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

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.

Tags: , , , , , , ,

19 Responses to “Vi(m) tip #2: Entering greek/math symbols using vim digraphs”

  1. Hey,

    thank you for that great grid! It really helped me since I also want to use plain text for some math stuff :-)

  2. ajx says:

    You’re very welcome. If you have any suggestions for common digraphs you are using that can add please leave them in a comment. Thanks!

  3. Vicki says:

    Thank you thank you, this was really helpful =).

  4. d.l says:

    Thanks ajx, you just saved my day. May i put this on my blog with a little bit modification and of course with your name (and permalink) as a credit?

  5. d.l says:

    Hi ajx, can you help me how to do a letters super/subscript in vi?

  6. ajx says:

    Sure you can put it on your blog. :-)

    Look here:

    It seems that unicode only really supports arabic numeral and a few letters. So right off the bat it will be hard to get a lot of subscripts.

    For numbers it’s always:
    Superscripts: K + [number key] + S
    K + [number key] + s

    It seems this formula also works to: +,-,(,),=, (and n but only for superscript)

  7. Ehtesh says:

    What about defining a set of iabbrevs for each of the letters?
    Something like:
    iabbrev \m μ
    iabbrev \s σ


    iabbrev `m μ
    iabbrev `s σ

    And if you wanted \sigma as an iabbrev, you could follow what this guy does to enable longer iabbrevs with backslashes:

    I mention this because I don’t think ‘ctrl+k s*’ is nearly as intuitive as ‘\sigma’.

    Of course, then you’d need to set it so it only works for ft=text (maybe using autocmd and augroup), so it wouldn’t get in the way when you type LaTeX.

  8. ajx says:

    Hi Ehtesh,
    This seems like a cool idea as long as you don’t mind having a vim setup that only works when using your personalized options.
    For me, I like to keep nearly everything on its default settings so that no matter which terminal I’m at it feels like home.

  9. AlmostThere says:

    Thanks for the page. However, when I tried to do this only some of the characters worked. For example, the Thorn, Eth and Logical Not symbols worked. However, none of the Greek, Math, and most of the other symbols did not work. I am using GVIM 7.3 on Windows XP SP3, if any of that info helps. If you have any ideas, I would greatly appreciate it.

  10. ajx says:

    What do you see when you enter:


    Can you scroll until you see the symbols you want? Perhaps you need to make sure the encoding is set to a high enough Unicode…

  11. AlmostThere says:

    After I posted my last message, I set my .vimrc file to set encoding=utf-8.
    After I did that I can see all the symbols posted here and type them exactly
    as you explained. However now that I did that which is great, I get conversion errors when I try to save my files. Thanks for your help.

  12. AlmostThere says:

    Ok. I tried this. I set my .vimrc file to
    set encoding=utf-8
    set fileencoding=utf-8
    This is working now. However, the files that I originally created are producing errors. Now, I can use the symbols and save the new files. However, the old files produce CONVERSION errors. So basically, I have to figure out how to modify the old files or cut, paste, and create new files.
    Thanks again for your help. I really appreciate it.

  13. Awesome! Do you know ∄? I can’t find it in :digraphs. (And it kind of bugs me that I can’t search :digraphs as easily as I coudl search gucharmap.

  14. I’ll just add these to your page (directly from :digraphs) … hopefully you don’t mind, just delete if you do.

    → 8594 -v ↓ 8595 ↔ 8596
    UD ↕ 8597 ⇒ 8658 == ⇔ 8660 FA ∀ 8704 dP ∂ 8706
    TE ∃ 8707 /0 ∅ 8709 DE ∆ 8710 NB ∇ 8711 (- ∈ 8712 -) ∋ 8715
    *P ∏ 8719 +Z ∑ 8721 -2 − 8722 -+ ∓ 8723 *- ∗ 8727 Ob ∘ 8728
    Sb ∙ 8729 RT √ 8730 0( ∝ 8733 00 ∞ 8734 -L ∟ 8735 -V ∠ 8736
    PP ∥ 8741 AN ∧ 8743 OR ∨ 8744 (U ∩ 8745 )U ∪ 8746 In ∫ 8747
    DI ∬ 8748 Io ∮ 8750 .: ∴ 8756 :. ∵ 8757 :R ∶ 8758 :: ∷ 8759
    ?1 ∼ 8764 CG ∾ 8766 ?- ≃ 8771 ?= ≅ 8773 ?2 ≈ 8776 =? ≌ 8780
    HI ≓ 8787 != ≠ 8800 =3 ≡ 8801 == ≥ 8805 ≫ 8811 ! ≯ 8815 (C ⊂ 8834 )C ⊃ 8835 (_ ⊆ 8838
    BB ¦ 166 SE § 167 Co © 169 -a ª 170 <> » 187 14 ¼ 188 12 ½ 189

  15. […] can’t seem to get digraphs working for me in GVIM. According to this site (and the VIM wiki) I should be able to enter the mu character µ by being in insert mode then […]

  16. pathemamike says:

    I use CTRL+k then => quite often.

    Every once in a while I need that symbol, but with an asterisk on top of it. Do you know if this is possible with unicode?

  17. ajx says:

    Hmmm. Not sure what symbol you mean exactly but you could try to find it with:

  18. bob says:

    I’ve looked through the digraphs list for the set of real numbers symbol, the set of integers, the set of natural numbers, etc… but can’t find them. How do you represent there in vim?

  19. ajx says:

    In my notes I would just use plain R, C, Z, N etc. You could use hex input for unicodes listed for the “DOUBLE-STRUCK” letters:

Leave a Reply