David - Musings of an SRE

Making emojis work with vim

As a developer who loves Vim’s efficiency and minimalist approach, I’ve often found myself in situations where I would use emojis to add some color and personality in either my blog posts, or when building outputs in my CLI tools.

Some emojis when they are displayed on vim, take up seemingly more character space that the others, causing vim to inteprete the line cursor a little differently.

This makes it really difficult to make any changes as your display and the actual cursor are not where they seem to be and causing visual effects like:

Screenshot of emoji glitching in vim (compared to the original post)


Thanks to Greg Hurrell’s video of the same topic (please send him love), the solution seemingly is just a simple:

set noemoji

in your .vimrc or in the text file you’re working on. This is because emoji is set to on by default in vim. (get link)

Once that’s added, you’ll no longer need to wrestle with having your actual cursor and display differing causing wrong text to be modified.


Bonus

If you’re like me, a slack user and often use shortcuts like :wave: or :+1: to type out emojis in chat, why not do the same in vim with the help of abbreviations.

In your .vimrc, you can just add the following:

ab :+1: 👍

Now when you type :+1: it will automatically convert into a 👍

With this, I hope you’ll be able to powerup your text editing on vim with emojis! 🚀🚀

Bonus-bonus