Couldn't figure this out. Just need to enter 1 emoji into a string and couldn't figure it out. Unicode is not working. Tried diagraph but didn't work either. Is there some trick to this in Vim? thx!
In any app with text editing capability, including Xcode, you can click on the Edit menu, then Emoji & Symbols. You'll see a panel with emoji. Choose any of them and they will appear in your code. Another way is to use the hotkey ⌃⌘Space (ctrl + cmd + space).
You do not need to install a plugin for this. All you need to do is enter the unicode value of the emoji. You can do that in insert mode with <C-v>
. From :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)
For example, if you want to enter this smiley-face, which has a unicode value of U+1F60A
, you could simply type:
<C-v>U1F60A<esc>
or if you don't want to hit <esc>
,
<C-v>U0001F60A
Just so you know, there's a good chance that it will not render properly in vim, depending on your font. If you are using gvim, you can change :se guifont=*
, or in regular vim, changing your consoles font to make it render (assuming you pick a font that can render this particular emoji)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With