Unicode with With echo
echo $’\xae’ = “®”
Digraphs in VIM
Vim has a special shorthand for entering characters with diacritical marks. If you need some familiar variant of a Latin alphabet character you’ll be able to input it with the digraph system.
Digraph input is started in insert or command mode (but not normal mode) by pressing Ctrl-k, then two printable characters in succession.
The first is often the “base” form of the letter, and the second denotes the appropriate embellishment.
Some basic examples:
Ctrl-k c ,
-> çCtrl-k e '
-> éCtrl-k o ^
-> ôCtrl-k a !
-> àCtrl-k u :
-> üCtrl-k = e
-> €
Also type within Vim: :digraphs
–> get a complete list of digraphs.
Unicode characters
In VIM, for characters not covered in the digraph set, you can also enter unicode characters by referring to their code page number.
In insert or command mode (but not normal mode) this is done by Ctrl-v
then u
followed by the hexadecimal number.
Some examples:
Ctrl-v u 2018
-> ‘, a LEFT SINGLE QUOTATION MARKCtrl-v u 2019
-> ’, a RIGHT SINGLE QUOTATION MARKCtrl-v u 2014
-> —, an EM DASHCtrl-v u 00a9
-> ©, a COPYRIGHT SIGN
Handy when writing HTML documents, as an alternative to using HTML entities like — or ©. The full list is available on Unicode website.
Comments