My issue
I am new to Neovim/Vim, and I am using the Neovim from Scratch config as a starting point. It works well for me for the most part. I have a peculiar encoding issue affecting emoji that prevents emoji from rendering properly from the moment I yank them in Neovim.
Instead of seeing a line like this: "I have a 🎂 (cake) emoji and a 🍏 (apple) emoji"
I see a line that looks like this: "I have a üéÇ (cake) emoji and a üçè (apple) emoji"
My question: How do I resolve this emoji rendering issue? Alternatively, where should I look next to troubleshoot this issue?
Steps to reproduce
- I have text in Neovim that includes an emoji character;
- My test used this line that I created in TextEdit in plain text mode: "I have a 🎂 (cake) emoji and a 🍏 (apple) emoji";
- I copied that from TextEdit using the
CMD c
command, and pasted it into Neovim usingCMD v
, and it rendered correctly; - I then copy the text from Neovim using
y
in Normal mode, and paste it into TextEdit, and I see "I have a üéÇ (cake) emoji and a üçè (apple) emoji"; - I did the same test from the command line in iTerm (I've tried the same thing in the Kitty terminal emulator with the same result) where I copied the same time in iTerm2 to TextEdit, and the line pastes correctly;
- I noticed that if I copy the line from TextEdit using
CMD c
and then paste into Neovim usingp
in Normal mode, I see the incorrectly rendered text.
Here is a video demonstrating the issue: https://cln.sh/VPzgydIs5CDYj4cPcXkl
An interesting observation is that if I have the same file open in Neovim and VS Code and update on either side, the other app accurately displays the content with the emoji. This issue only seems to manifest when I use the Vim y
and p
commands.
My system
- My encoding in Neovim and iTerm2 is set to UTF-8.
- I am using macOS 12.1 and Neovim 6.1 (the issue was present in Neovim 6.0 too).
- I am using the Nerd Font modified version of JetBrains Mono
- As I mentioned above, I am also using the Neovim from Scratch config for Neovim as I'm a newbie, and this gives me a great foundation to use Neovim.
I'd appreciate any help or pointers here. I could abandon the use of the emoji entirely, although I tend to use them in my daily flow so I'd prefer to be able to keep using them.
yy
'd it out, and pasted it into TextEdit, all without trouble. One other place to start: How to debug my vimrcCMD v
. I then usedSHIFT v
(soV
) to select the line, and thenyy
to yank it. When I pasted it into TextEdit, I had the same issue. Interestingly when I paste usingp
in Neovim, the result replaces the emoji with??
..nvimrc
and the other config files in~/.config/nvim/
.clipboard = "unnamed"
in myoptions.lua
file, here. I have the same issue if I useunnamedplus
. I just ran:echo has('clipboard')
and received a1
return.