Vim Digraphs and Ligatures

Programming Symbols in Unicode



Type :digraphs and you can see a list of defined digraphs.

Pre-defined Digraphs

E.g. to enter the copyright symbol, in insert mode, type Control-K, and then Co (capital C and lower case o).

Digraphs in Vim/Neovim

For Visual Studio Code user, if you install vscodevim or vscode-neovim extension you can also use the digraph feature.

Digraphs in Visual Studio Code

Similarly for Emacs, if you installed emacs-evil then digraph feature is available to you.

Digraphs in Emacs

Code Fonts using Digraphs and Conceal

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 allow us to define colors, compilers, key mappings and many others. In this case I can also define my own syntax file. Type:h mysyntaxfile-add and it tells you how to create custom syntax file in after/syntax folder from runtimepath.

Combining this with the conceal feature now I can use Vimscript to display programming symbols in Unicode characters.

Below is an example for Rust. I create a file called rust.vim in the after/syntax folder.

rust.vim (adapted from rektrex/vim-conceal-rust)

And now if I open a Rust file, I can see the Unicode characters are displayed based on the syntax file I defined.

Unicode Code Fonts in Rust

Using this method you can easily apply it to any languages. Here is another example for Python.

python.vim (adapted from ehamberg/vim-cute-python)
Unicode Code Fonts in Python

Do also check out the following articles

Programmer and occasional blogger.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store