Using digraphs in VIM
Many of us want to write not just text, but text which is graphically pleasant. When we use WYSIWYG type of writing software (or word processors) like Microsoft Word, LibreOffice, we have to look for special symbols in the special tables and insert symbols with the mouse, or we have to learn how to insert those symbols via Unicode codes.
VIM allows you insert most of the such symbols (in VIM they are called «digraphs») using key bindings which are easy to remember.
To insert digraph in the insert mode type Ctrl + K and key combination of the digraph. E.g. to insert ✓ press Ctr+K OK.
You can find most used digraphs here.
But I will show few extra which I found useful.
Digrapsh | Symbol | Key combination |
---|---|---|
Non-breaking space | Ctrl+K Space Space | |
Euro currency | € | Ctrl+K Eu or Ctrl+K =e |
En dash | – | Ctrl+K -N |
Em dash | — | Ctrl+K -M |
Quotation marks Guillemet | « » | Ctrl+K << and Ctrl+K >> |
Paragraph sign | § | Ctrl+K SE |
Number symbol | № | Ctrl+K N0 |
Copyright | © | Ctrl+K Co |
Registered trade mark | ® | Ctrl+K Rg |
Grad Celsius | ℃ | Ctrl+K oC |
Grad | ° | Ctrl+K ~o |
Greek µ letter1 | µ | Ctrl+K My |
Approximately equal | ≈ | Ctrl+K ?2 or Ctrl+K 2? |
Not equal | ≠ | Ctrl+K != |
Left single line arrow | ← | Ctrl+K <- or Ctrl+K -< |
Right single line arrow | → | Ctrl+K >- or Ctrl+K -> |
Double single line arrow | ↔ | Ctrl+K <> |
Left dual line arrow | ⇐ | Ctrl+K <= |
Right dual line arrow | ⇒ | Ctrl+K => |
Double dual line arrow | ⇔ | Ctrl+K == |
Less or equal than | ≤ | Ctrl+K =< |
More or equal than | ≥ | Ctrl+K >= |
Is much less than | ≪ | Ctrl+K <* |
More or equal than | ≫ | Ctrl+K >* |
Plus minus | ± | Ctrl+K +- |
If you are making text for publishing, e.g. in PDF format, it is good to know difference between «hyphen», «en dash» and «em dash». They have different length. Hyphen is the shortest line of three, “en dash” has length of “n” letter and “em dash” has length of “m” letter.
Sign | Symbol |
---|---|
Hyphen | - |
En dash | – |
Em dash | — |
Guillemet style of quotation marks is used in many languages such as Russian, French, Spanish, etc. But also in English text Guillemet marks sometimes look nicer than standard single or double quites. Guillemet quotation marks allow to emphasize text stronger, than that standard English double quotes, and also allow to avoid using of the bold font for emphasis.
For example:
I want to emphasize word “neutral” in the text and I can do it in many ways. I can do it with standard double quotes like this - “neutral”, but when text paragraph is too large, then this word is lost for the eye. Or I can use bold text and then neutral becomes dominating too much. But with Guillemet quotation marks we now have third option and «neutral» is visible, but also does not stand out too much from the rest text.
To see the full table of digraphs just type following command in VIM:
:digraphs
Summary
VIM digraphs extend your ability to write text with symbols matching the content which is easier to read and understand.
In most cases source text (I use Markdown) can be converted to any other format for presentation (PDF, DOCX, etc.) without much problems. But sometimes when printing to PDF, fonts cannot show all digraphs and then those digraphs have to be removed or other fonts shall be used for publishing. I can recommend to use this XITS Math font to print text rich with mathematical signs.
-
It is useful when one writes about e.g. some measurements. Then µs is “microseconds”, µg is “microgram”. ↩︎