想不通这个。只需要在字符串中输入 1 个表情符号,无法弄清楚。 Unicode 不起作用。尝试diagraph,但也没有奏效。在 Vim 中有一些技巧吗?谢谢!
最佳答案
您不需要为此安装插件。您需要做的就是输入表情符号的 unicode 值。您可以使用 <C-v>
在插入模式下执行此操作.来自 :h i_ctrl-v_digit
:
*i_CTRL-V_digit*
With CTRL-V the decimal, octal or hexadecimal value of a character can be
entered directly. This way you can enter any character, except a line break
(<NL>, value 10). There are five ways to enter the character value:
first char mode max nr of chars max value ~
(none) decimal 3 255
o or O octal 3 377 (255)
x or X hexadecimal 2 ff (255)
u hexadecimal 4 ffff (65535)
U hexadecimal 8 7fffffff (2147483647)
例如,如果您想输入 this smiley-face ,其 unicode 值为
U+1F60A
,你可以简单地输入:<C-v>U1F60A<esc>
或者如果您不想点击
<esc>
,<C-v>U0001F60A
正如您所知,根据您的字体,它很有可能无法在 vim 中正确呈现。如果你使用 gvim,你可以更改
:se guifont=*
,或在常规 vim 中,更改控制台字体以使其呈现(假设您选择可以呈现此特定表情符号的字体)
关于vim - 如何在 Vim 中将表情符号输入到字符串中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40262567/