Overview
In my previous article Ligature Fonts for Terminal, VS Code, Neovim and Emacs, I showed you how to configure fonts with ligatures. In this article, I will show you how to configure Vim/Neovim to use Unicode characters to display programming symbols.
Digraphs
In Vim/Neovim, digraphs are used to enter characters that normally cannot be entered by an ordinary keyboard. These are mostly printable non-ASCII characters. The digraphs are easier to remember than the decimal number that can be entered with CTRL-V
.
Type :digraphs
and you can see a list of defined digraphs.
E.g. to enter the copyright symbol, in insert mode, type Control-K
, and then Co
(capital C and lower case o).
For Visual Studio Code users, if you install vscodevim or vscode-neovim extension you can also use the digraph feature.
Similarly for Emacs, if you installed emacs-evil then the digraph feature is available to you.
Code Fonts using Digraphs and Conceal
Vim/Neovim associates each file you opened to a particular syntax. E.g. open up a Python file, and type :set syntax?
and you can see syntax=Python
. (Note: make sure you have syntax enable
in your .vimrc
or init.vim
)
Do a :verbose set ft?
and you can see the file type and location of filetype.vim which tells you the list of supported file types.
Vim is extremely flexible and allows us to define colors, compilers, key mappings, and many others. In this case, I can also define my own syntax file. Type:h
…