|

Inserting Unicode Characters in Vim

July 7, 2017 1 min read

Inserting Unicode Characters in Vim

Imagine you are writing a basic to-do list in Vim:

- Write a failing test
- Make the test pass 
- Refactor

When you finish the first task, you want to add a check mark next to it:

✓ Write a failing test
- Make the test pass
- Refactor

To do this in vim, you can use the following command: i Ctrl+v u2713.

Let us break that down:

  • i go into INSERT mode
  • Ctrl+v go into ins-special-keys mode
  • u2713 insert the Unicode character CHECK MARK (U+2713)

You might be wondering: “What if I do not know the code for the character I want to insert?” That is where the handy unicode.vim plugin comes in.

Once you install unicode.vim, you can run the :SearchUnicode command. In the previous case, you would run :SearchUnicode check mark, and the following window would pop up:

You will see a list of all matching Unicode characters with their corresponding codes, so you can use them with ins-special-keys.

SHARE:

arrow_upward