I've always thought about digraph mode as a way to quickly insert unicode special or unusual chars into the buffer without copy-pasting things around or changing keyboard layout system-wide. So to insert an em-dash, for example, I just type <C-K>-M, to insert an ä, I type <C-K>a: and so on.

Today I stumbled upon another interesting thing you can do in digraph mode, namely inserting special key codes literally into the buffer. From the docs:

When {char1} is a special key, the code for that key is inserted in <> form.
For example, the string "<S-Space>" can be entered by typing <C-K><S-Space>.

I'm writing a post about Vim tips and tricks and this feature would help me a great deal to quickly enter literal commands. Unfortunately, it doesn't seem to work in my configuration. In insert mode, when I type <C-K><Tab> I would expect a <Tab> to show up on the screen, instead nothing happens.

Am I missing something here?

EDIT: I'm on OS X. My Vim build:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jul 10 2015 19:36:53)
MacOS X (unix) version
Included patches: 1-712
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         -gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: /usr/bin/clang   -L. -L/Users/haven/.sm/pkg/active/lib -fPIC -Bstatic -lz -fstack-protector -L/usr/local/lib -Wl,-headerpad_max_install_names -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -framework Python   -lruby-static -framework CoreFoundation -lobjc -L/Users/zool/.rvm/rubies/ruby-2.2.1/lib   
  • Perhaps <Tab> is not so special, after all ... (it's equivalent to <C-I>, so you actually insert <C-K><C-I>. <S-Tab> works btw.
    – VanLaser
    Commented Aug 7, 2015 at 10:46
  • I probably should have specified: nothing works in my config. Not <Tab> nor <S-Tab>, nor the example provided in the docs. I'm definitely missing something.
    – mrzool
    Commented Aug 7, 2015 at 10:52
  • Try ctrl-k up arrow, does that work? Perhaps add your OS, vim/gvim build details etc. to the post. And S is Shift (just to be sure).
    – VanLaser
    Commented Aug 7, 2015 at 11:00
  • I got it partially working by enabling the digraph option in my vimrc. Now the arrow keys show up properly, as does <S-Tab>. The example in the docs, <S-Space> still doesn't show up, nor do other common chords like <C-W> or <C-H>. Updating my question with more details.
    – mrzool
    Commented Aug 7, 2015 at 11:13

1 Answer 1


It will work only for (some of) the Vim 'special keys', literally - see :h ins-special-special. E.g. <C-K><Up>. Tab is not in that list. In addition, your terminal may not pass all key combos to Vim. For example, <S-Space> is there the same as <Space>, so it won't work (unlike in GVim). Long story short, your options seems limited, using this method.

  • 1
    I see, thank you for clearing things up for me. That's pretty poorly documented though. I've found mention of this feature in ins-special-keys, a section that lists all the chars that have a special meaning in insert mode, including <C-K> for digraphs. I wasn't expecting there was another section just a little further ahead named ins-special-special listing special special characters, and that those are the only ones you can have literally printed in digraph mode. A quick headsup and an hyperref linking the two sections in the docs would be a good thing.
    – mrzool
    Commented Aug 7, 2015 at 12:21
  • Indeed, it's almost like the 2nd special was added at a later time.
    – VanLaser
    Commented Aug 7, 2015 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.