Index

vim key bindings

key syms

letters
[a-zA-Z]
arrow keys
<Up>
<Down>
<Left>
<Right>
other special keys
<BS>           Backspace
<Tab>          Tab
<CR>           Enter
<Enter>        Enter
<Return>       Enter
<Esc>          Escape
<Space>        Space
<Up>           Up arrow
<Down>         Down arrow
<Left>         Left arrow
<Right>        Right arrow
<F1> - <F12>   Function keys 1 to 12
<1,>#2..#9,#0 Function keys F1 to F9, F10
<Insert>       Insert
<Del>          Delete
<Home>         Home
<End>          End
<PageUp>       Page-Up
<PageDown>     Page-Down
<bar>          the '|' character, which otherwise needs to be escaped '\|'

composite keys

composite keys example
:nnoremap ;g :echo 'First command'<CR>
:nnoremap ;k :echo 'Second command'<CR>
:nnoremap ;= :echo 'Third command'<CR>

modifiers

control modifier
<C-[key]>
shift modifier
<S-[key]>
alt modifier (avoid alt as only modifier)
<A-[key]>
control & shift modifier
<C-S-[key]>
examples
nnoremap <S-F> :!date<CR>
nnoremap <S-Insert> :!date<CR>
nnoremap <S-F12> :!date<CR>
nnoremap <C-F> :!date<CR>
nnoremap <C-F> :!date<CR>
nnoremap <C-S-F> :!date<CR>
nnoremap <C-A-F> :!date<CR>
documentation
:help key-notation
https://vimhelp.org/intro.txt.html#key-codes

mapping keys

hello world example
map - :echo 'Current time is ' . strftime('%c')<CR>
map <F12> :echo 'Current time is ' . strftime('%c')<CR>
escape sequence for a bar '|' in a command
map <F8> :w <bar> !clear; ls<CR>
copy and paste example (like windows)
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <ESC>"+pa
Make shift-insert paste like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
list key mappings (overrides)
map  # normal, visual, select & operator pending
map! # insert & command-line
nmap # normal mode
imap # insert mode
vmap # visual & select
remove keymapping
unmap  [key]
unmap! [key]
nunmap [key]
iunmap [key]
vunmap [key]
unbound keys
;
\
<F1-F12>

https://vim.fandom.com/wiki/Unused_keys