Vim Commands

Some useful commands can be found here.

CommandDescription
:g/{pattern}/{cmd}apply cmd on each search match; default command is print
:g/{pattern}search for pattern in current file
!!filter current line
!{motion}normal mode mapping to feed into a filter command
au TextChanged * updateautosave file when text changed
<C-k>-Ninsert en-dash using vim digraphs
:[range]ce[nter] [width]center the current line to the given width (or width of terminal)
g?g?encode whole line with rot13
g&run last substiution command on whole file
gqsplit up long lines to multiple lines
<C-x><C-n>autocompletion for current buffer
<C-x><C-i>autocompletion for included file keywords
<C-x><C-]>autocompletion for tags
<C-x><C-k>autocompletion for dictionary
<C-x><C-l>autocompletion for whole lines
<C-x><C-f>autocompletion for filenames
<C-x><C-o>omni-autocompletion; filetype-plugin required
<C-x><C-s> or <C-x>ssearch backwards and correct misspelling in line
C-eCancel completion list
C-yAccept completion list
:e #edit alternate file
:function fzf#runshow function definition
:command FZFshow command definition
:'<,'>norm .repeat last operation on each selected line
ZQquit without saving
:xwrite and quit file
:set spell!check grammar
:set spellang=en_usset spell language (supports regional language)
:setlocal spellfile+=~/myjargon.utf-8.addadd another good word list
z=show grammar corrections 1z= will use first suggestions
zgadd word to good word list, 2zg will add word to the second good word list
zwadd word to misspelled word list, 2zw will add word to the second misspelled word list
:mksession file.vmSave vim layout to file.vim. Open with vim -S file.vim
/HAY\zsGOAL/zeHAYOnly select thing between \zs\ze in a regular expression
C-a / C-xincrement / decrement first number found on current lin
{ }go to next paragraph
( oder )go to next sentence
*/#search forward/backword for word under cursor (also works in
g\;/g\,cycle through :changes
autocmd CursorHold * updateautosave file when inactive
:windo difftvim diff all opened windows
:b[substring]search file name in buffer containing substring and edit it
Ctrl-[n/]pautomcomplete
gicontinue at last insert position
Ctrl-tpop tag stack
gtswitch to other tab
Ctrl-[Y/E]move screen up / down
[count][e/E]go to end of word/WORD right
gfgo to tag cursor is on
=make indent the same (gg=G indents entire file
:set suffixesadd+=.txtallows gf (go to file) on filenames without suffix
[count]+ / [count]- down/up to first non-blank char of line
g_go to last non blank char
q:open command line window (or go to ex-mode with : then press C
m{a-zA-Z}set bookmarks
`{mark}visit bookmark
Ctrl-]jump to definition of tag
gUi'go Uppercase inside ’
Ctrl-^Toggle to previous file
C-v / C-k in insert modepaste decimal, hexadecimal and digraphs (:h digraph-table)
\.jump to last change
gdgo to local declaration
:findfind file in ‘path’
[H/L/M]move cursor to High/Middle/Low of screen
Ctrl-[I/O]go to next/previous jump
Ctrl-[F/B]Page forward / backwards
@:repeat last Ex command
&find next matching ),], or } / Repeat last :substitute comman
Ctrl-rpress in insert mode and then presser name of register to
OSC52clipboard copy
10%go 10% down in file
[zt/zz/zb]scroll window that cursor is in top/middle/bottom
:set path+=**add files recursively to path
[count]]mgo to beginning of next method
Ctrl-[D/U]Scroll Half a Page Down / Up
C-o in insert modeswitch to normal mode for 1 command and then g
^go to first non blank char
gj/gkmove down/up on wrapped line