Posts Tagged ‘unicode’

Searching for digraphs by name in vim

Sunday, January 5th, 2014

I love using vim’s digraphs to insert unicode symbols into my text documents. I’ve memorized a lot of the more frequent ones that I type but I often end up looking up new ones or ones I’ve forgotten. I used to use:


to display a giant table of all of the digraphs. There sorted by unicode so they’re in a roughly coherent order, but there’s a lot to look at, and it’s just the raw symbols.

Recently I found a much better way. By typing

:help digraphs

you can pull up the digraphs help page which contains a more thorough list of all digraphs including English unicode symbol names. For example I can hit /ditt to find the line:

〃      +"      3003    12291   DITTO MARK

the name “🍌” can’t be used

Saturday, March 9th, 2013

the name 🍌 can't be used

Vi(m) tip #6: save a file with digraphs as utf-8 plain text

Tuesday, December 22nd, 2009

I took all of my algorithms notes this semester in vim using digraphs for math symbols. Today I wanted to cat all the files and print the results. However, I had overlooked that when vim inserts a digraph it’s subtly displaying a UTF-8 character in your terminal but not necessarily saving your file with this encoding. To be sure issue the following commands from command mode in vim:

:set enc=utf-8

When I want to view or print my notes, I insert them into a &ltpre&gt tag in an html document, using my converter script to take care of escaping wakkas and being sure to declare utf-8 charset in the content-type meta attribute:

    <meta http-equiv='Content-type' content='text/html;charset=UTF-8' >
        Paste escaped UTF-8 plain text here

My UTF-8 notes as a HTML page viewable in browser.


Vi(m) tip #2: Entering greek/math symbols using vim digraphs

Wednesday, October 14th, 2009

Lately I have been taking computer science/math class notes using vim. Since typing LaTeX is too cumbersome and not readily intuitive (you have to typeset it). I just use plain text. This is fine until I need to quickly type strange letters/symbols. I can do this in vim using digraphs. To see a list of available digraphs, in normal mode type:


To enter a digraph in insert mode simply hit <ctrl>+k then the two symbols to create the digraph. So to make the greek capital phi, Φ, you’d hit (in insert mode)


Below is a table of useful math and computer science digraphs.

symbol description symbol unicode (decimal) vim digraph (first type <ctrl>k)
plus minus ± 177 +-
squared (superscript 2) ² 178 2S
coproduct (big, tall Pi) 8719 *P
summation (big, tall Sigma) 8721 +Z
bullet operator (dot product) 8729 Sb
(square) root 8730 RT
infinity 8734 00
Greek Letters
Gamma Γ 915 G*
Delta Δ 916 D*
Theta Θ 920 H*
Pi Π 928 P*
Sigma Σ 931 S*
Phi Φ 934 F*
Psi Ψ 936 Q*
Omega Ω 937 W*
alpha α 945 a*
beta β 946 b*
gamma γ 947 g*
delta δ 948 d*
epsilon ε 949 e*
eta η 951 y*
theta θ 952 h*
kappa κ 954 k*
lambda λ 955 l*
mu μ 956 m*
pi π 960 p*
rho ρ 961 r*
sigma σ 963 s*
sigma (alternative) ς 962 *s
tau τ 964 t*
phi* φ 966 f*
psi* ψ 968 q*
omega* ω 969 w*
dagger (sword) 8224 /-
double dagger (double sword) 8225 /=
left arrow* 8592 <-
up arrow 8593 -!
right arrow 8594 ->
down arrow 8595 -v
for all (for any) 8704 FA
partial differential (curled little d) 8706 dP
there exists (backwards capital E) 8707 TE
logical and 8743 AN
logical or 8744 OR
therefore (triangle of dots) 8756 .:
because (upside-down triangle of dots) 8757 :.
Null set, empty set, var nothing, capital O slash 8709 /0
Null set, empty set, var nothing, capital O slash Ø 216 O/
element of 8712 (-
contains as member 8715 -)
set intersect 8745 (U
set union 8746 U)
subset of (contained in) 8834 (C
superset of (contains) 8835 )C
subset of or equal to 8838 (_
superset of or equal to 8839 )_
concatenation, centered dot 8728 Ob
integral S 8747 In
double integral S 8748 DI
line integral S with circle 8750 Io
Delta 8710 DE
Nabla 8711 NB
Equalities, inequalities, et al.
tilde operator (centered tilde, proportional) 8764 ?1
approximately equal to 8773 ?=
almost equal to 8776 ?2
not equal to 8800 !=
less than or equal to 8804 =<
greater than or equal to 8805 >=

* I avoid these because they are double-width characters. In the document they are technically only one character put displayed they take up two character positions resulting in overlap in vim.

Note: Greek letters are usually their Latin alphabet “equivalent” then star, with capitals taking capital (uppercase) Latin letters, likewise for lowercase. I included some (what I use most) here.

Note:“Superscript” and “subscript” numbers are all [digit]S for Superscript and [digit]s for subscript.

Note: If you don’t find the character you want above, or by typing :digraphs and paging through supported digraphs, you can input a unicode character by its value in hex. Do this by typing <ctrl>v in insert mode then:

u[4-hex-digit value]

U[8-hex-digit value]

Leading zeros may be omitted.

Note: On some machines <ctrl>v means paste, in that case use <ctrl>q


Update: I found a useful list of unicodes for math symbols.