Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Last active October 28, 2022 01:11
Show Gist options
  • Save peteristhegreat/8a6cb3db8b964602d748 to your computer and use it in GitHub Desktop.
Save peteristhegreat/8a6cb3db8b964602d748 to your computer and use it in GitHub Desktop.
Unicode commands vim

This isn't a file per se, but it is some secret vim-fu that lets you insert unicode and show it, and null characters:

First off in Vim if you see ^@ it is a NULL character. To type it, get into INSERT MODE and then press Ctrl-v, Ctrl-2.

Tada!

For entering in an html escaped unicode character, like the ones listed here:

http://www.amp-what.com/unicode/search/checkbox

Click the U in a circle on the right, and it shows for a checkbox: U+2610

So to type this in vim: go into INSERT MODE, then type Ctrl-v,u2610

Tada! Vim sometimes gets confused by Utf-8 at least when I was testing it. Sometimes it would chop the rest of the line visually after inserting the unicode character (the next time you load the file).

To switch the encoding on the file, there is this:

http://stackoverflow.com/questions/778069/how-can-i-change-a-files-encoding-with-vim

:write ++enc=utf-8 russian.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment