Vim 9.1 · the grammar, the registers and the ex language · 2537 entries

Written for someone who has used three editors and wants the model, not a key list. Vim is a small language for describing edits — operators, counts, motions and text objects — and the payoff is that twelve verbs and forty nouns give you several hundred edits nobody taught you. The guide is about where the state actually lives: why undo is a tree and g- reaches branches u cannot, why "0p pastes what you yanked after you deleted something else, why buffers, windows, tab pages and the argument list are four independent axes, what :g and :normal compose into, and why \v at the front of a pattern makes Vim regex ordinary. It installs Vim on macOS, Windows with PowerShell and Omarchy, and it ends on the traps that only bite people who are already fluent. Cards 1–21 are the guide; the rest is a filterable index of 2537 entries pulled straight out of the runtime documentation — 599 ex commands, 436 options, 591 built-in functions and 119 autocommand events. Press / to jump to the filter box; hover a clipped row for the whole entry.

Dots: plain command cursor movement — usable as a motion changes text — undoable, repeatable with . Vim9 script only obsolete / vi compatibility
Sources: the Vim 9.1 runtime documentation as shipped on this machine (/usr/share/vim/vim91/doc — index.txt, quickref.txt, builtin.txt, autocmd.txt), read by a script rather than retyped. Behaviour claims were checked against VIM 9.1 patches 1-1752, the build Apple ships at /usr/bin/vim on macOS 26. Hover a clipped row for the whole entry.

The Working Guide

Vim as a language for describing edits — the grammar, where the state lives, and which defaults are archaeology

What Vim Actually Is

a grammar, not a keymap

Vim is not an editor with a lot of shortcuts. It is a small language for describing edits, whose verbs are operators, whose nouns are motions and text objects, and whose statements are then repeatable and composable. Learning the key list is the slow path; learning the grammar is the fast one, because a grammar of twelve operators and forty motions gives you several hundred edits you were never taught.

[count] operator [count] motionthe whole language, in one line — 2d3w deletes six wordsoperator + text objectci", dap, ya( — an object is a region the parser finds for youoperator doubleddd, yy, >> — apply to the whole line.replay the last change, with its count — the reason edits are worth composing

Four pieces of state, and everything else is a view onto them

StateWhat it isWhere it shows
bufferthe in-memory text of a file, plus its undo tree and local options:ls, :b
windowa viewport onto a buffer, with its own cursor, folds and window-local optionsCTRL-W, :sp
tab pagea layout of windows — not a file tab, whatever every other editor taught you:tabnew, gt
argument listthe files named on the command line, iterated with :next / :argdo:args

A buffer can be open in no window (hidden), in one, or in five. That decoupling is why :bufdo and :argdo exist and why "close the tab" is the wrong mental model.

The lineage, because the defaults are dated by it

ed (1969) → ex (1976)the line editor; every : command is still literally exvi (1976)a visual mode bolted onto ex — the modal grammar arrivesVim (1991)Vi IMproved: multiple undo, windows, folding, scriptingVim 8 (2016)jobs, channels, timers, native packages, async everythingVim 9 (2022)Vim9script: a compiled, typed, ~10× faster script languageVim 9.1 (2024–)classes, 'wildmenu' completion work, smoothscroll; the current line
Vim and Neovim are not the same editor any more. Neovim forked in 2014 and now has a Lua runtime, a built-in LSP client, tree-sitter highlighting and a different plugin ecosystem. The grammar, the ex commands, most options and nearly all of this page apply to both. Vimscript written for Vim runs in Neovim; Lua and vim.lsp do not run in Vim. Where it matters here, the sheet says which.

Installing Vim

macOS · Windows · Omarchy

Vim is almost certainly already there. What is already there is often old, or built without the features you want — so the install question is really "which build, and does it have +clipboard?"

macOS

The system copy is /usr/bin/vim, currently Vim 9.1 with patches 1–1752, built with +clipboard, +terminal and +vim9script but without +python3, +clientserver or +sodium. Good enough for most work; replace it if you want a GUI or Python plugins.

# what you already have vim --version | head -1 # newer: +python3, +clientserver brew install vim # GUI build; ships mvim brew install --cask macvim # brew lands in /opt/homebrew/bin -- # it must precede /usr/bin on PATH
Windows — PowerShell

Vim ships a real Windows build with a GUI (gvim) and a console binary. Git for Windows also bundles a minimal Vim — check which one where.exe finds first.

winget install --id vim.vim --exact # or: scoop install vim (bucket 'main') # or: choco install vim -y # which copies are on PATH? where.exe vim gvim vim --version | Select-Object -First 1 # config lives in your profile, not /etc $HOME\_vimrc # the vimrc $HOME\vimfiles\ # = ~/.vim $HOME\vimfiles\pack\me\start\ # packages echo $HOME # C:\Users\you
Omarchy / Arch

Omarchy is Arch underneath, so this is pacman. Omarchy ships Neovim as its default editor; installing Vim alongside it is fine, they share nothing but a name.

# console build sudo pacman -S vim # GUI build -- this is the one with +clipboard sudo pacman -S gvim # vim-runtime comes in with either # Wayland: console vim on Arch has no # +clipboard. Without it, pipe instead: # :w !wl-copy :r !wl-paste sudo pacman -S wl-clipboard
Check the feature list before you debug a plugin. vim --version prints every feature as +name or -name; from inside, :echo has("clipboard"). A plugin that "does nothing" is usually a missing +python3, +job or +clipboard, not a broken plugin.

Where the files live

macOS / LinuxWindows
vimrc~/.vimrc or ~/.vim/vimrc~\_vimrc or ~\vimfiles\vimrc
runtime dir~/.vim/~\vimfiles\
packages~/.vim/pack/*/start/~\vimfiles\pack\*\start\
system runtime/usr/share/vim/vim91/C:\Program Files\Vim\vim91\
state~/.viminfo~\_viminfo

:echo $MYVIMRC settles which file is actually being read, and :echo &runtimepath settles where it looks for everything else.

The Grammar

operator × count × motion

An edit is [count] {operator} [count] {motion}. The two counts multiply. The operator waits in operator-pending mode until a motion or text object completes it, which is why d alone appears to hang — it is a partially applied function.

Operators

OpDoesOpDoes
ddeletegu / gUlowercase / uppercase
cchange (delete + insert)g~swap case
yyankgq / gwformat to 'textwidth'; gw keeps the cursor
> / <indent / dedent one 'shiftwidth'g?rot13, because 1991
=reindent via 'equalprg' / 'indentexpr'zfcreate a fold
!filter through an external commandg@call 'operatorfunc' — how plugins add operators

Text objects — the half most people never learn

i = inner (the contents), a = around (contents plus delimiters or trailing space). They work from anywhere inside the object, so you never position the cursor first.

ciwchange inner word — cursor anywhere in itci" ci( ci{ ci[ citinside quotes, parens, braces, brackets, an HTML/XML tagdapdelete a paragraph and its trailing blank lineyi{yank a block body without the bracesvasselect a sentence, whitespace includeddatdelete a whole tag, open to close

Forcing the mode of an operator

dvjforce charwise: delete from the cursor to the same column one line downdVjforce linewise: both lines entirelyd<C-v>jforce blockwise

Worked examples

KeysReads as
d2}delete forward two paragraphs
y/END<CR>yank from here up to the next "END" — a search is a motion
c3awchange three words including their spaces
>i{indent the body of the block the cursor is in
!ip sortsort the paragraph under the cursor through sort(1)
gqiprewrap the paragraph to 'textwidth'
ct,change up to the next comma — t stops before, f lands on
. repeats the last change, not the last keystroke. That is the whole argument for composing edits rather than holding a key down: ciwfoo<Esc> then n. n. is a hand-driven search-and-replace with a diff you can see.

Motions and Jumps

and the inclusive/exclusive rule

A motion used alone moves the cursor; used after an operator it defines a region. Whether the character under the destination is included is a property of the motion, and it is the single most common source of off-by-one surprise.

ClassMotionsRegion
charwise exclusiveh l w W b B ge 0 ^ $ (no), ) ( } {, /pat, ?patup to but not including the end
charwise inclusivee E f F t T $ % and `m when charwiseincludes the end character
linewisej k G gg H M L + - _ 'm :{n}whole lines only
dw vs dedw deletes the word and the space after it; de stops at the last letterd$ vs Didentical — D is just d$d/foodeletes up to foo; d/foo/e deletes through it

Two exceptions worth knowing

  • exclusive-linewise: if an exclusive motion ends on the first column, the end moves to the end of the previous line, and if the start was at or before the first non-blank the whole thing becomes linewise. This is why d} on a paragraph does what you want instead of leaving a stray blank line.
  • a count on % is not "do it n times" — 50% goes to 50% of the file.

Within the line

f{char} / F{char}to the next / previous occurrence, cursor on itt{char} / T{char}till: stops one short — the one you want with an operator; / ,repeat the last f/F/t/T forwards / backwards0 ^ g_ $column 1, first non-blank, last non-blank, end of lineg0 g^ g$ gj gkthe same, but on the screen line when text is wrapped

Between places

gg / G / {n}G / :{n}top, bottom, line nH M Ltop / middle / bottom of the visible windowCTRL-O / CTRL-Iback / forward through the jump list — :jumpsg; / g,back / forward through the change list — :changesCTRL-^to the alternate file; the fastest two-file toggle there is* / #search for the word under the cursor, forwards / backwardsg* / g#same, without the \< \> word boundaries% to the matching bracket — extended to language keywords by matchit, shipped in $VIMRUNTIME/pack/dist[m ]m [[ ]] [{ ]}method, section and block boundaries
Only "jumps" go on the jump list. h j k l and w b do not; searches, G, { }, %, marks, :N and tag jumps do. That is why CTRL-O reliably takes you back where you were looking, not where you last nudged the cursor.

Registers

ten of them matter

Every yank and delete writes to more than one place. Understanding which is the difference between "my paste got clobbered" being a mystery and being a keystroke.

y{motion}writes "" and "0d{motion} (multi-line)writes "" and shifts the ring "1"9d{motion} (within a line)writes "" and "-, and does not touch the ring"xywrites "" and "x; the yank register "0 is skipped

The consequence, and the fix

yiw " yank a word -> "" and "0 diw " delete the target -> "" (and "-) p " pastes the DELETED text, not the yanked one "0p " pastes the yank. This is the whole trick. "_diw " delete into the black hole; "" survives " visual-paste replaces the selection, and swaps into "" viwp

Registers worth having in muscle memory

RegHoldsRegHolds
"0the last yank, immune to deletes"%current file name
"-the last small (sub-line) delete"#alternate file name
"_black hole; write-only".last inserted text
"+system clipboard":last command line
"*X11 primary selection"/last search pattern — writable

Uses that are not obvious

" clear search highlight without :nohlsearch :let @/ = '' :let @a = @a . @b " concatenate registers " clear register a (record nothing into it) qaq "Ayy " APPEND this line to register a " (insert mode) insert register a literally CTRL-R a " (cmdline) insert the word under the cursor CTRL-R CTRL-W " expression register: insert today's date CTRL-R =strftime('%F')<CR> " yank the whole buffer to the clipboard :%y+
"+ is not always the clipboard. It needs +clipboard. On Wayland a console Vim usually lacks it; use :w !wl-copy and :r !wl-paste, or install gvim. Apple’s /usr/bin/vim 9.1 does have it — getreg('+') really does return the pasteboard, checked on this machine.

Undo Is a Tree

and nobody tells you

Vim does not keep an undo stack. It keeps a tree: undo three changes, type something new, and the three you undid are still there on a sibling branch. u and CTRL-R walk the current branch; g- and g+ walk all states in chronological order, which is the only pair that can reach a branch you have left.

u / CTRL-Rundo / redo along the current branchg- / g+older / newer text state, across branches — the escape hatch:undolistthe leaves, with sequence numbers and timestamps:undo {n}jump to state n directly:earlier 10m / :later 1htime travel; also 10s, 5f (file writes):earlier 1fback to the text as it was at the previous write — a diff-free "what did I change"Uundo all recent changes on one line; itself undoable

Persistent undo — the one line everybody should have

set undofile " the trailing // encodes the full path set undodir=~/.vim/undo// call mkdir(expand('~/.vim/undo'), 'p')

With that, closing and reopening a file keeps the whole tree: you can undo past the point where you quit Vim last week. The // makes the state file name include the full path, so src/main.c and test/main.c do not collide.

Undo blocks

One u undoes one change, and a whole insert session is normally one change. Break it up so that undo has useful granularity:

" make CTRL-U (kill line) undoable on its own inoremap <C-U> <C-G>u<C-U> " one undo block per line typed inoremap <CR> <C-G>u<CR> " default 1000; 0 means one level, -1 none set undolevels=1000
:earlier 1f is the underrated one. "Show me the file as it was when I last saved" needs no git, no plugin and no scratch buffer, and :later 1f puts it back.

Buffers, Windows, Tabs, Args

four axes, not one

Other editors give you one list. Vim gives you four, and they are orthogonal. The confusion is nearly always someone treating tab pages as file tabs.

:ls / :buffersevery loaded buffer; the flags are the interesting part:b {n|name}switch — partial names work, <Tab> completes:bn :bp :bf :bl :bdnext, previous, first, last, deleteCTRL-^ / :b#the alternate buffer — toggle two files with one key:bufdo {cmd}run cmd in every buffer; add | update to save the changed ones
:ls flagMeans:ls flagMeans
%the current bufferaactive — loaded and displayed
#the alternate bufferhhidden — loaded, no window
+modified= -read-only / 'modifiable' off
uunlisted (help, terminal)xread errors
set hidden is not optional in practice. Without it Vim refuses to leave a modified buffer, so :bn, :argdo and every "jump to definition" plugin fail with E37. With it, buffers stay loaded and unsaved — which means :q can lose work. Pair it with :wa in your muscle memory, or set 'confirm'.

Windows

:sp / :vs [file]split horizontally / verticallyCTRL-W s v c o qsplit, vsplit, close, only, quitCTRL-W h j k lmove focus; CTRL-W w cyclesCTRL-W H J K Lmove the window to the far left/bottom/top/right — re-lays out the screenCTRL-W = _ |equalise, maximise height, maximise widthCTRL-W + - < >resize by one; prefix a countCTRL-W T / CTRL-W xmove this window to its own tab / exchange two windows

Tab pages and the argument list

:tabnew :tabc :tabonew, close, close othersgt / gT / {n}gtnext / previous / go to tab n:tabdo {cmd}run cmd in every tab:args *.c / :argadd / :argdeleteset and edit the argument list:argdo %s/foo/bar/ge | updateproject-wide substitute; e stops "not found" aborting the loop:next :prev :first :lastwalk the argument list

The right mental model: buffers are the files you have open, windows are how many you can see at once, and tabs are saved window layouts. Use :b for files and reach for tabs only when you actually want a second layout.

Ex Commands and Ranges

the other half of the editor

Everything after : is ex, a line editor from 1976 that never went away. Its shape is :[range] cmd [args] [flags], and once the range syntax is in your fingers a lot of edits stop needing motions at all.

Range atoms — they compose

:5,10dlines 5 to 10:.,$yhere to end of file:%s/a/b/g% is 1,$:'a,'bdbetween marks a and b:.,+5>this line and the next five, indented:/BEGIN/,/END/dfrom the next BEGIN to the next END:g/TODO/normal A # doneappend to every TODO line:'<,'>!column -tfilter the visual selection through a shell command

The two that pay for the whole page

:global and :normal compose into a scripting language you already know. :g runs in two passes — it marks every matching line first, then executes — so a command that deletes lines cannot invalidate its own iteration.

:g/^\s*$/d " delete every blank line " delete every line that is NOT an error :v/error/d " copy every TODO to the end of the file :g/TODO/t$ " reverse the file (move every line to the top) :g/^/m0 " comment out every line, using normal-mode keys :%norm! I// <Esc> :g/{/,/}/> " indent every brace block " arbitrary composition via :execute :g/pat/exe "norm! ddP"
Use :normal! with the bang in scripts. Without it your mappings apply, so a plugin that remaps I silently changes what your command does. The same bang rule holds for :g/…/norm!.

Command-line editing

CTRL-R CTRL-W / CTRL-R CTRL-Ainsert the word / WORD under the cursorCTRL-R %insert the current file name<Up> / <Down>history filtered by what you have typed so far — not a plain history walkq: / q/ / q?open the command / search history as an editable bufferCTRL-Fsame, from a command line already in progressCTRL-D / <Tab>list completions / complete; see 'wildmode':<C-R><C-R>"insert the unnamed register verbatim

Filename modifiers, which appear everywhere

%current file%:hits directory (head)%:tits basename (tail)%:rwithout extension (root)%:ethe extension%:pfull path%:.relative to the working directory%:~relative to home%:Sshell-escaped — always use it before !

Patterns

why Vim regex feels wrong

Vim’s regex predates PCRE and escapes the opposite set of characters. In the default 'magic' level . * [ are special but + ? ( ) { | are not — they need backslashes. The fix is one atom.

" the same pattern, four ways \v(foo|bar)+\s*= " very magic -- read this one \m\(foo\|bar\)\+\s*= " magic (the default) \M\(foo\|bar\)\+\s*= " nomagic " very nomagic: only \ is special -- the literal escape \V...

Start every non-trivial pattern with \v and Vim regex becomes ordinary. Start a literal search with \V and you never escape a dot again.

What Vim has that PCRE does not

AtomMeans
\zs \zeset where the match starts / ends — variable-width lookaround, and far more readable
\%Vonly inside the visual selection — the only sane way to substitute in a block
\%23l \%>10lonly on line 23 / after line 10; also c for column, v for virtual column
\ka "keyword" character, as defined by 'iskeyword' for this filetype
\%(...\)non-capturing group ((...) with \v is capturing)
\{-}the non-greedy *; there is no *?
\&"branch and": both alternatives must match at this position

Substitute, with the flags that matter

:%s/\vold/new/g " every line, every occurrence " empty pattern = reuse the last SEARCH -- eyeball first :%s//new/g " n = count matches, change nothing :%s/\vfoo//gn " \u upcases the next character of the replacement :%s/\v(\w+)/\u\1/g " \= : the replacement is an expression :%s/\v\d+/\=submatch(0)*2/g :'<,'>s/\%Vfoo/bar/g " only inside the block selection " repeat the last :s WITH its flags (plain & drops them) :&&
& and ~ are special in the replacement. & inserts the whole match and ~ inserts the previous replacement, so :s/x/A&B/ does not produce A&B. Escape them, or set 'nomagic' for that command.

Search behaviour worth setting

" lowercase = insensitive; any capital = sensitive set ignorecase smartcase " live preview; highlight all matches set incsearch hlsearch " :s acts globally without /g (careful: inverts /g) set gdefault " clear the highlight nnoremap <silent> <C-l> :nohlsearch<CR><C-l>

'smartcase' only applies to typed patterns, not to * or # — those always respect 'ignorecase' alone.

Insert Mode

completion without a plugin

Insert mode has its own command set, reached through CTRL-X. Vim has had structured completion since long before language servers, and it still works with no plugin, no daemon and no network.

KeyCompletes from
CTRL-N / CTRL-Pkeywords, per 'complete' — this buffer, other buffers, tags, includes
CTRL-X CTRL-Ffile names, relative to the working directory
CTRL-X CTRL-Lwhole lines from open buffers
CTRL-X CTRL-K / CTRL-T'dictionary' / 'thesaurus'
CTRL-X CTRL-I / CTRL-Dincluded files / macro definitions, via 'path'
CTRL-X CTRL-]tags — ctags, and it is fast
CTRL-X CTRL-Oomni-completion — 'omnifunc', set by the filetype plugin
CTRL-X CTRL-U'completefunc' — where a plugin hooks in
CTRL-X CTRL-VVim command line, inside a vimrc
CTRL-X CTRL-Sspelling suggestions

Once the popup is open, CTRL-N/CTRL-P cycle and CTRL-E cancels back to what you typed. set completeopt=menuone,noinsert,noselect makes it behave the way a modern editor does.

Everything else in insert mode

CTRL-R {reg}insert a register; CTRL-R CTRL-R inserts it literallyCTRL-O {cmd}one normal-mode command, then back to insertCTRL-W / CTRL-Udelete the word / line before the cursorCTRL-T / CTRL-Dindent / dedent this line one 'shiftwidth'CTRL-V {code}literal character: CTRL-V u00e9, CTRL-V 065, CTRL-V <Tab>CTRL-K {a}{b}digraph: CTRL-K e' = é, CTRL-K -> = →. :digraphs lists themCTRL-A / CTRL-@insert the previously inserted text / that and stop insertingCTRL-E / CTRL-Ycopy the character below / above the cursorCTRL-G ubreak the undo sequence here — see the undo cardCTRL-\ CTRL-O {cmd}like CTRL-O but the cursor cannot move past the end

Abbreviations

iabbrev teh the iabbrev <expr> dts strftime('%F') " expands on any non-keyword char; CTRL-V stops it iabbrev adn and
Blockwise insert is the feature people leave for a multiple-cursor plugin. CTRL-V, select the lines, I (or A), type, <Esc> — the text lands on every line. $ before A appends at each line’s own end, ragged lengths and all. c in blockwise mode does the same for replacement.

Quickfix and Location Lists

the compiler loop

The quickfix list is Vim’s error list: a global stack of file/line/message triples produced by anything that emits compiler-shaped output. The location list is the identical thing, but per window. This is how Vim does "problems panel" and "search results", and it predates both by decades.

:make [args]run 'makeprg', parse via 'errorformat', jump to the first error:cw / :copen / :ccloseopen the window if there are errors / always / close:cn :cp :cfirst :clastwalk the list; :cc {n} jumps to entry n:cnf / :cpfnext / previous file in the list:colder / :cnewerVim keeps the last ten lists — step back through them:cdo {cmd} / :cfdo {cmd}run cmd on every entry / on every file in the list:cexpr / :cgetexpr / :caddexprbuild a list from an expression or from system() output:cfile / :cgetfileread a list from a file of compiler output

Every :c… command has an :l… twin for the location list: :lmake, :lopen, :lnext, :ldo, :lgrep.

Grep without leaving Vim

set grepprg=rg\ --vimgrep\ --smart-case set grepformat=%f:%l:%c:%m :grep -w 'pattern' -- src/ " ripgrep -> quickfix " Vim's own; j = don't jump, g = every match :vimgrep /\vpat/gj **/*.py " confirm-substitute across every hit :cdo s/old/new/gc | update
:cdo plus :vimgrep is project-wide search and replace with a diff you can step through, no plugin involved. :cfdo %s/…/…/ge | update is the faster form when the change is per-file rather than per-match.

Compiler plugins

" sets makeprg + errorformat from $VIMRUNTIME/compiler/ :compiler gcc :compiler pytest :set makeprg=cargo\ build " ^= prepends a rule :set errorformat^=%f:%l:%c:\ %t%*[^:]:\ %m

'errorformat' is scanf-like, tried in order, and is the reason arbitrary tools drop into the loop. :h errorformat is worth twenty minutes once.

Folding

six methods, one that works

Folds are a display property of a window, not of the text, which is why two windows on one buffer can fold differently and why folds vanish when you close a window unless you save a view.

'foldmethod'Folds onVerdict
manualwhatever you mark with zfthe default; folds die with the window
indentindentation depthcheap and surprisingly good for Python and YAML
syntaxregions the syntax file marks foldablecorrect, and the classic cause of slow scrolling in large files
expr'foldexpr', evaluated per linethe flexible one; also the easiest to make slow
markerliteral {{{ / }}} in the textthe only method that survives everything, at the cost of noise
diffunchanged regions in diff modeset automatically by vimdiff
za / zAtoggle one fold / recursivelyzo zc zO zCopen, close, and their recursive formszR / zMopen every fold / close every foldzr / zmreduce / increase 'foldlevel' by onezj / zkto the start of the next / end of the previous foldzvopen just enough to see the cursor linezf{motion} / zd / zEcreate a fold / delete one / delete allzitoggle folding off and on entirely — the "get out of my way" key
set foldmethod=indent " start with everything open, not everything closed set foldlevelstart=99 set foldnestmax=3 " persist manual folds for a file: autocmd BufWinLeave *.c mkview autocmd BufWinEnter *.c silent! loadview
foldmethod=syntax or expr on a large file is the most common cause of "Vim got slow". Both re-evaluate on every change. Diagnose with :set foldmethod=manual and see if the lag goes; :syntime on then :syntime report attributes it properly.

Macros

a register full of keystrokes

A macro is not a special object. qa records your keystrokes into register a as plain text, and @a feeds that text back to the input parser. Everything follows from that: you can yank a macro, paste it into the buffer, edit it, and yank it back.

qa " record into a " ... whatever the edit is, ending positioned for the next 0f,ci"new<Esc>j q " stop @a " run it once 5@a " run it five more times @@ " repeat the last @ " run it on EVERY line -- no count guessing :%normal @a

Editing a macro you got slightly wrong

" paste register a into the buffer as text "ap " ... fix the keystrokes, then ... 0"ay$ " yank the corrected line back into a dd " remove the scratch line

Rules that make macros reliable

  • Start from a known column. Begin the macro with 0 or ^; a macro that starts "wherever the cursor happens to be" fails on the third line.
  • End positioned for the next iteration — usually j. Then 99@a just works.
  • Let it fail. A macro stops when a command errors, so a f, that finds nothing terminates the loop cleanly. This is a feature: it is the loop condition.
  • Prefer :%normal @a to a count when the edit is per-line — no counting, and lines that do not match are skipped.
  • Use qA to append to an existing macro rather than re-recording it.
. beats a macro when the change is one edit. Macros are for multi-step edits that must be applied in bulk; the dot command with n is for repeating a single change with your eyes open. Recording a macro to do the work of ciw…<Esc> plus n. is the beginner move.

Options

scope is the whole story

Every option is global, buffer-local, window-local, or global-with-a-local-copy. Getting this wrong is why a setting "does not stick" when you open a second file.

CommandWrites
:set opt=xthe global value, and the local value of the current buffer/window
:setlocal opt=xonly this buffer or window
:setglobal opt=xonly the global default, used by buffers opened later
:set opt<reset the local value to the global one
:set opt& / :set all&reset to Vim’s built-in default
:verbose set opt?the value and the file and line that last set it

:verbose set is the debugger for configuration. Any "why is this on?" question ends there.

:set opt?show the value:set opt!toggle a boolean:set opt+=x / -=x / ^=xappend / remove / prepend to a comma list&opt / &l:opt / &g:optthe value as an expression: echo &tabstop:optionsan interactive, categorised browser of every option

The ones that actually change behaviour

" buffers survive being left; see the buffers card set hidden set backspace=indent,eol,start set ignorecase smartcase incsearch hlsearch set expandtab shiftwidth=4 softtabstop=4 tabstop=8 set autoindent set wildmenu wildmode=longest:full,full set scrolloff=3 sidescrolloff=5 " drives CursorHold and swap writes (default 4000) set updatetime=300 " mapping vs terminal-escape timeouts set timeoutlen=500 ttimeoutlen=10 set undofile undodir=~/.vim/undo// set splitbelow splitright " so CTRL-A on 007 gives 008, not 010 set nrformats-=octal set listchars=tab:>-,trail:· list
tabstop is not indentation. 'tabstop' is how wide an existing tab character is drawn (leave it at 8, it is what everyone else’s tools assume), 'shiftwidth' is how far >> moves, and 'softtabstop' is what <Tab> inserts. 'expandtab' decides whether that is spaces. Setting only tabstop=4 makes your file look right and everyone else’s look wrong.

Modelines

/* vim: set ts=4 sw=4 et: */ -- first or last 5 lines

Handy, and a historic attack surface — Vim has had modeline CVEs. Only a safe subset of options is honoured, but if you open untrusted files, set nomodeline and move on.

Mappings

and why always nore

:map is recursive: the result of a mapping is re-scanned for further mappings. That is occasionally what you want and usually a way to hang the editor. Use the nore forms unless you are deliberately invoking another mapping.

PrefixModes it covers
:map :noremap :unmapnormal, visual, select and operator-pending — four at once, which is rarely what you meant
:n…normal
:v…visual and select
:x…visual only — the one you almost always want
:s…select only (typing replaces the selection)
:i…insert
:c…command line
:o…operator-pending — how you add a motion
:t…terminal-job
:l…the "lang-arg" subset: insert, command line and Lang-Arg

Each prefix takes all three suffixes: :nmap / :nnoremap / :nunmap, and so on. :mapclear and its per-mode twins remove the lot.

Arguments, in <> before the left-hand side

<buffer>this buffer only — what an ftplugin should always use<silent>do not echo the command being run<expr>the right-hand side is an expression whose result is the keys<nowait>fire immediately, do not wait for a longer mapping<unique>fail rather than clobber an existing mapping<script>only remap using mappings defined in this script
" set BEFORE any <leader> mapping let mapleader = ' ' nnoremap <leader>w :write<CR> nnoremap <silent> <leader>n :nohlsearch<CR> inoremap jk <Esc> " keep the selection after indenting xnoremap < <gv " count-aware wrapped-line movement nnoremap <expr> j v:count ? 'j' : 'gj' " leave terminal mode with Esc tnoremap <Esc> <C-\><C-n> nnoremap <buffer> <CR> :call Run()<CR> " ftplugin-scoped

Debugging

:mapevery mapping; :nmap <leader> filters:verbose nmap <C-p>which file and line defined it — the answer to "which plugin stole my key"CTRL-V {key}on the command line, insert the literal key code a terminal sends:h key-notationthe canonical spelling of every key name
Terminal Vim cannot see most modified keys. CTRL-I is <Tab>, CTRL-[ is <Esc>, CTRL-M is <CR>, and <C-S> is usually swallowed by terminal flow control (stty -ixon fixes that one). Mapping <Tab> also remaps CTRL-I — and with it your jump-forward key. In a GUI, or a terminal supporting the Kitty keyboard protocol, they are distinguishable.
<Plug> mappings exist so plugins do not fight over keys. A plugin defines <Plug>SomeAction, which is unreachable from the keyboard, and you map to it: nmap <leader>s <Plug>SomeAction — and note that this one must be nmap, not nnoremap.

Autocommands

events, groups, and the reload trap

An autocommand runs an ex command when an event fires on a file matching a pattern. Everything filetype-specific in Vim is built out of them.

augroup my_config " CLEAR the group first -- see below autocmd! autocmd FileType python setlocal sw=4 sts=4 et autocmd BufWritePre *.go call Format() autocmd BufReadPost * if line("'\"") > 1 \ && line("'\"") <= line("$") " restore last cursor position \ | exe "normal! g`\"" | endif autocmd VimResized * wincmd = autocmd BufWritePost $MYVIMRC source $MYVIMRC augroup END
Without augroup + autocmd!, sourcing your vimrc twice registers every autocommand twice, and the third time three times. Symptoms: a formatter that runs repeatedly, a sluggish save, "why is this happening twice". :autocmd with no arguments lists them all, so you can see the duplicates.

The events that carry the weight

EventFires
BufReadPost / BufWritePre / BufWritePostafter load, before write, after write
BufNewFileediting a file that does not exist — skeleton templates
FileTypeafter 'filetype' is set — the right place for per-language settings
BufEnter / BufLeave / WinEnterfocus moves between buffers and windows
InsertEnter / InsertLeavemode changes — relative-number toggling lives here
TextChanged / TextChangedIthe buffer changed, in normal / insert mode
CursorHold / CursorHoldI'updatetime' ms with no typing — the idle hook
VimEnter / VimLeavePreafter startup / before exit
QuickFixCmdPostafter :make or :grep — auto-open the quickfix window
TerminalWinOpena :terminal window appeared
++oncedelete the autocommand after it fires once++nestedallow this command to trigger further autocommands (they are suppressed by default):doautocmd FileTypefire an event by hand — useful after changing an ftplugin:noautocmd {cmd}run cmd with all autocommands suppressed — the fast path for bulk edits:autocmd! my_group BufWritePreremove specific autocommands
Prefer an ftplugin file to a FileType autocommand when the settings are per-language: drop them in ~/.vim/after/ftplugin/python.vim and they load automatically, in the right order, after the distributed one. Use setlocal there, never set.

The Runtime Path

how Vim finds anything

'runtimepath' is an ordered list of directories. For most kinds of file Vim sources every match in order; for a few (colour schemes, autoload) it takes the first. Understanding the order is understanding why your override does or does not win.

:echo &runtimepath ~/.vim, /usr/share/vim/vimfiles, /usr/share/vim/vim91, /usr/share/vim/vimfiles/after, ~/.vim/after

Yours first, the distribution’s in the middle, and after/ directories last — which is the whole point: ~/.vim/after/ftplugin/python.vim is sourced after the shipped Python ftplugin, so it can undo it.

DirectoryLoaded
plugin/*.vimonce at startup, always
autoload/foo.vimlazily, the first time foo#Bar() is called — the lazy-loading mechanism
ftplugin/{ft}.vimon FileType; use setlocal and <buffer> maps
indent/{ft}.vimon FileType, sets 'indentexpr'
syntax/{ft}.vimon FileType when :syntax on
ftdetect/*.vimat startup; where a plugin claims new file extensions
colors/*.vimon :colorscheme name — first match wins
compiler/*.vimon :compiler name
doc/*.txtafter :helptags generates the tags file
pack/*/start/*added to 'runtimepath' at startup — native packages
pack/*/opt/*only on :packadd name
:scriptnamesevery file sourced, in order — the load-order debugger:runtime! plugin/**/*.vimsource matching files from every rtp entry:filetype on / plugin on / indent onenable detection, ftplugins, indent files:syntax on / :syntax enableon overrides your colours, enable keeps them:set filetype?what Vim thinks this file is:verbose set indentexpr?and which file decided that
Vim 8 packages need no plugin manager at all. git clone a plugin into ~/.vim/pack/anything/start/ and it loads; into pack/anything/opt/ and :packadd loads it on demand. The plugins sheet covers what a manager buys you on top of that.

Vim9script

the second language

Vim 9 shipped a new script language alongside the old one. It is compiled to instructions instead of re-parsed per line, is statically typed, and runs roughly an order of magnitude faster on tight loops. Legacy Vimscript still works everywhere; the two are selected per file.

" must be the FIRST line of the file vim9script " var, not let. Types are inferred or declared var count: number = 0 const MAX = 100 " the binding is fixed, the list is not final list = [1, 2, 3] " def, not function. Compiled. def Total(xs: list<number>): number var t = 0 for x in xs t += x endfor return t enddef # export/import instead of g: pollution export def Public() enddef

What changes, and it is a lot

LegacyVim9
let x = 1var x = 1let is an error
function F()endfunctiondef F()enddef, compiled and type-checked
" starts a comment# starts a comment (" is a string)
line continuation with a leading \continuation is implicit inside brackets
a:arg, a:000plain parameter names; ...rest: list<any>
call F(x)F(x) — bare calls are legal
truthy strings and numbersconditions must be boolean-ish; 0/1, true/false
g: everywherescript-local by default; export/import for the rest

Classes, new in 9.1

vim9script class Point var x: number var y: number def new(this.x, this.y) enddef def Len(): float return sqrt(this.x * this.x + this.y * this.y) enddef endclass var p = Point.new(3, 4) echo p.Len() # 5.0
:vim9cmd {cmd}run one command with Vim9 semantics from a legacy script:legacy {cmd}the reverse:disassemble Fthe compiled instructions — how you confirm something is actually compiled:defcompilecompile now rather than on first call, so type errors surface at load
Vim9script does not run in Neovim. Neovim declined the fork and uses Lua for the same job. A plugin written in Vim9script is Vim-only; one written in legacy Vimscript runs in both. This is the single biggest source of "plugin does not work in my editor".

Terminal, Jobs and Diff

Vim 8 caught up

Vim 8 added real asynchrony: jobs, channels, timers and an embedded terminal emulator. Everything a modern plugin does in the background — linters, language servers, test runners — rests on these.

The terminal

:terminal [cmd]open a terminal buffer running cmd, or your shell:term ++close ++rows=15 makeclose on exit, sized, running one command:term ++curwin / ++hiddenin this window / with no window at allCTRL-W N (or CTRL-\ CTRL-N)terminal-job → terminal-normal: the buffer becomes scrollable and yankablei / aback into terminal-job modeCTRL-W "{reg}paste a register into the running program:term ++shell 'ls | wc -l'run through the shell rather than exec directly

A terminal buffer has two modes. In terminal-job mode keys go to the program; in terminal-normal mode you are in ordinary Vim on the scrollback, which is how you copy build output into your source. tnoremap <Esc> <C-\><C-n> is the usual convenience — at the cost of Esc inside the program.

Jobs and channels

let job = job_start(['rg', '--json', 'pat'], \ {'out_cb': function('OnLine'), \ 'exit_cb': function('OnExit')}) call job_status(job) | call job_stop(job) let t = timer_start(1000, {-> execute('checktime')}, \ {'repeat': -1})

Diff mode

vim -d a b / vimdiff a bopen two (up to eight) files diffed:diffthis / :diffoff[!]add this window to the diff / leave it:diffsplit {file}split and diff against another file]c / [cnext / previous changedo / dpdiff obtain / diff put — pull or push one hunk:diffupdaterecompute after edits:set diffopt+=iwhite,algorithm:patienceignore whitespace; a better diff algorithm:w !diff % -diff the buffer against the file on disk without a plugin

Sessions and views

" windows, tabs, buffers, cwd :mksession! ~/.vim/sessions/proj.vim vim -S ~/.vim/sessions/proj.vim " do NOT save options; they go stale set sessionoptions-=options " one window's folds and local options :mkview / :loadview

A vimrc That Earns Its Keep

nothing decorative

Vim ships defaults.vim, which is loaded only when you have no vimrc. The moment you create one, you lose those defaults — so the first line of a hand-written vimrc should usually be to get them back.

" ---- baseline ------------------------------------------ unlet! skip_defaults_vim " incsearch, ruler, backspace, syntax, ... source $VIMRUNTIME/defaults.vim " implied by having a vimrc; explicit is fine set nocompatible filetype plugin indent on syntax enable " ---- behaviour ----------------------------------------- " let buffers survive being left set hidden " ask instead of failing on unsaved changes set confirm " reload files changed outside Vim set autoread set updatetime=300 " mapping timeout vs escape-sequence timeout set timeoutlen=500 ttimeoutlen=10 set mouse=a " yank straight to the system clipboard set clipboard=unnamed " ---- searching ----------------------------------------- set ignorecase smartcase hlsearch incsearch " ---- indentation (ftplugins may override) ----------- set expandtab sw=4 softtabstop=4 tabstop=8 autoindent " ---- interface ----------------------------------------- set number relativenumber signcolumn=yes set scrolloff=3 sidescrolloff=5 nowrap set laststatus=2 showcmd set wildmenu wildmode=longest:full,full wildignorecase set splitbelow splitright set list listchars=tab:»\ ,trail:·,nbsp:␣ " ---- files --------------------------------------------- set undofile undodir=~/.vim/undo// set directory=~/.vim/swap// backupdir=~/.vim/backup// silent! call mkdir(expand('~/.vim/undo'), 'p') " ---- mappings ------------------------------------------ let mapleader = ' ' nnoremap <silent> <leader>n :nohlsearch<CR> nnoremap <leader>b :ls<CR>:b<Space> nnoremap <leader>f :find * xnoremap < <gv xnoremap > >gv " ---- fuzzy-ish file finding with no plugin at all ------ " :find fuzzily under the working directory set path+=** set wildignore+=**/node_modules/**,**/.git/**,*.o,*.pyc
set path+=** and :find is a genuinely usable file finder with zero plugins: :find *ontrol*<Tab> completes across the whole tree. It gets slow on very large repositories, which is the honest argument for fzf — but try it first.
set clipboard=unnamed is a real trade. Every delete now overwrites your system clipboard. Many people prefer explicit "+y and "+p, or clipboard=unnamedplus on Linux where the two selections differ.

Traps

the ones that bite fluent users
Recursive mappings. nmap j gj then nmap gj j hangs Vim. Always nnoremap, except for <Plug>.
:q with 'hidden' set can lose work — other buffers may still be modified and Vim will not always stop you. :qa does check; set confirm turns the refusal into a prompt.
The swap-file dialog on a real crash. "Recover" reads the swap, but you must then :w under a new name and diff against the original — the recovered buffer is not automatically written, and deleting the .swp before checking throws away the recovery.
'paste' is a footgun and, in 2026, nearly always unnecessary. It disables mappings, abbreviations and 'textwidth' until you unset it, and people forget. Vim 8.2+ handles bracketed paste automatically in a terminal that supports it — check with :set t_BE? before reaching for :set paste.
Line endings. 'fileformat' is detected per file from 'fileformats'. A file showing ^M at every line end was read as unix but is dos: :e ++ff=dos re-reads it correctly. Do not :%s/\r//g — that edits the content to hide a metadata problem.
CTRL-S freezes a terminal Vim. That is the tty’s flow control, not Vim. CTRL-Q unfreezes it; stty -ixon in your shell rc stops it happening.
'autochdir' quietly breaks relative paths in :find, :grep, quickfix entries and %:.. If you want per-project roots, use :lcd in an autocommand instead.
Blockwise y then p is not a rectangle paste everywhere. Pasting a blockwise register inserts it as a block at the cursor column — but P versus p and a cursor past end-of-line change the result. Use $ in blockwise visual to get ragged-right behaviour deliberately.
Escape latency. If leaving insert mode feels sticky, it is 'ttimeoutlen': Vim is waiting to see whether your <Esc> is the start of an arrow-key escape sequence. Set ttimeoutlen=10; keep 'timeoutlen' (mapping timeout) comfortable at 500–1000.
Slow scrolling is nearly always syntax or folds. Diagnose with :syntime on → scroll → :syntime report. Common fixes: set synmaxcol=200, set nocursorline, set foldmethod=manual, set regexpengine=1 for pathological syntax files.
Modelines are executable content from a file you did not write. Vim restricts what they may set and has still had CVEs there. set nomodeline if you open other people’s repositories, and never enable 'modelineexpr'.
When something is inexplicable, bisect. vim --clean reproduces it or it does not; then :scriptnames for load order and :verbose set opt? / :verbose map {key} for the culprit. Three commands settle nearly every configuration bug.

Command, Option & Function Index

Every normal, insert, visual, command-line and ex command, every option, every built-in function and every autocommand event, taken straight from the Vim 9.1 runtime documentation — type in the filter box, or press /

Normal Mode

203

Every normal-mode command, from index.txt

CTRL-Aadd N to number at/after cursor
CTRL-Bscroll N screens Backwards
CTRL-Cinterrupt current (search) command
CTRL-Dscroll Down N lines (default: half a screen)
CTRL-Escroll N lines upwards (N lines Extra)
CTRL-Fscroll N screens Forward
CTRL-Gdisplay current file name and position
<BS>same as "h"
CTRL-Hsame as "h"
<Tab>go to N newer entry in jump list
CTRL-Isame as <Tab>
<NL>same as "j"
<S-NL>same as CTRL-F
CTRL-Jsame as "j" CTRL-K not used
CTRL-Lredraw screen
<CR>cursor to the first CHAR N lines lower
<S-CR>same as CTRL-F
CTRL-Msame as <CR>
CTRL-Nsame as "j"
CTRL-Ogo to N older entry in jump list
CTRL-Psame as "k" CTRL-Q not used, or used for terminal control flow
CTRL-Rredo changes which were undone with 'u' CTRL-S not used, or used for terminal control flow
CTRL-Tjump to N older Tag in tag list
CTRL-Uscroll N lines Upwards (default: half a screen)
CTRL-Vstart blockwise Visual mode
CTRL-W {char}window commands, see |CTRL-W|
CTRL-Xsubtract N from number at/after cursor
CTRL-Yscroll N lines downwards
CTRL-Zsuspend program (or start new shell) CTRL-[ <Esc> not used
CTRL-\ CTRL-Ngo to Normal mode (no-op)
CTRL-\ CTRL-Ggo to mode specified with 'insertmode' CTRL-\ a - z reserved for extensions CTRL-\ others not used
CTRL-]:ta to ident under cursor
CTRL-^edit Nth alternate file (equivalent to ":e #N") CTRL-_ not used
<Space>same as "l" 2 filter Nmove text through the {filter} command
!!{filter}filter N lines through the {filter} command
"{register}use {register} for next delete, yank or put ({.%#:} only work with put)
#search backward for the Nth occurrence of the ident under the cursor
$cursor to the end of Nth next line
%find the next (curly/square) bracket on this line and go to its match, or go to matching comment bracket, or go to matching preprocessor directive.
{count}%go to N percentage in the file
&repeat last :s
'{a-zA-Z0-9}cursor to the first CHAR on the line with mark {a-zA-Z0-9}
''cursor to the first CHAR of the line where the cursor was before the latest jump.
'(cursor to the first CHAR on the line of the start of the current sentence
')cursor to the first CHAR on the line of the end of the current sentence
'<cursor to the first CHAR of the line where highlighted area starts/started in the current buffer.
'>cursor to the first CHAR of the line where highlighted area ends/ended in the current buffer.
'[cursor to the first CHAR on the line of the start of last operated text or start of put text
']cursor to the first CHAR on the line of the end of last operated text or end of put text
'{cursor to the first CHAR on the line of the start of the current paragraph
'}cursor to the first CHAR on the line of the end of the current paragraph
(cursor N sentences backward
)cursor N sentences forward
*search forward for the Nth occurrence of the ident under the cursor
+same as <CR>
<S-+>same as CTRL-F
,repeat latest f, t, F or T in opposite direction N times
-cursor to the first CHAR N lines higher
<S-->same as CTRL-B
.repeat last change with count replaced with N
/{pattern}<CR>search forward for the Nth occurrence of {pattern}
/<CR>search forward for {pattern} of last search
0cursor to the first char of the line
1prepend to command to give a count
2"
3"
4"
5"
6"
7"
8"
9"
:start entering an Ex command
{count}:start entering an Ex command with range from current line to N-1 lines down
;repeat latest f, t, F or T N times
<{motion}shift Nmove lines one 'shiftwidth' leftwards
<<shift N lines one 'shiftwidth' leftwards
={motion}filter Nmove lines through "indent"
==filter N lines through "indent"
>{motion}shift Nmove lines one 'shiftwidth' rightwards
>>shift N lines one 'shiftwidth' rightwards
?{pattern}<CR>search backward for the Nth previous occurrence of {pattern}
?<CR>search backward for {pattern} of last search
@{a-z}execute the contents of register {a-z} N times
@:repeat the previous ":" command N times
@@repeat the previous @{a-z} N times
Aappend text after the end of the line N times
Bcursor N WORDS backward
["x]Cchange from the cursor position to the end of the line, and N-1 more lines [into register x]; synonym for "c$"
["x]Ddelete the characters under the cursor until the end of the line and N-1 more lines [into register x]; synonym for "d$"
Ecursor forward to the end of WORD N
F{char}cursor to the Nth occurrence of {char} to the left
Gcursor to line N, default last line
Hcursor to line N from top of screen
Iinsert text before the first CHAR on the line N times
JJoin N lines; default is 2
Klookup Keyword under the cursor with 'keywordprg'
Lcursor to line N from bottom of screen
Mcursor to middle line of screen
Nrepeat the latest '/' or '?' N times in opposite direction
Obegin a new line above the cursor and insert text, repeat N times
["x]Pput the text [from register x] before the cursor N times
Qswitch to "Ex" mode
Renter replace mode: overtype existing characters, repeat the entered text N-1 times
["x]Sdelete N lines [into register x] and start insert; synonym for "cc".
T{char}cursor till after Nth occurrence of {char} to the left
Uundo all latest changes on one line
Vstart linewise Visual mode
Wcursor N WORDS forward
["x]Xdelete N characters before the cursor [into register x]
["x]Yyank N lines [into register x]; synonym for "yy"
ZZwrite if buffer changed and close window
ZQclose window without writing
[{char}square bracket command (see |[| below) \ not used
]{char}square bracket command (see |]| below)
^cursor to the first CHAR of the line
_cursor to the first CHAR N - 1 lines lower
`{a-zA-Z0-9}cursor to the mark {a-zA-Z0-9}
`(cursor to the start of the current sentence
`)cursor to the end of the current sentence
`<cursor to the start of the highlighted area
`>cursor to the end of the highlighted area
`[cursor to the start of last operated text or start of putted text
`]cursor to the end of last operated text or end of putted text
``cursor to the position before latest jump
`{cursor to the start of the current paragraph
`}cursor to the end of the current paragraph
aappend text after the cursor N times
bcursor N words backward
["x]c{motion}delete Nmove text [into register x] and start insert
["x]ccdelete N lines [into register x] and start insert
["x]d{motion}delete Nmove text [into register x]
["x]dddelete N lines [into register x]
dosame as ":diffget"
dpsame as ":diffput"
ecursor forward to the end of word N
f{char}cursor to Nth occurrence of {char} to the right
g{char}extended commands, see |g| below
hcursor N chars to the left
iinsert text before the cursor N times
jcursor N lines downward
kcursor N lines upward
lcursor N chars to the right
m{A-Za-z}set mark {A-Za-z} at cursor position
nrepeat the latest '/' or '?' N times
obegin a new line below the cursor and insert text, repeat N times
["x]pput the text [from register x] after the cursor N times
q{0-9a-zA-Z"}record typed characters into named register {0-9a-zA-Z"} (uppercase to append)
q(while recording) stops recording
q:edit : command-line in command-line window
q/edit / command-line in command-line window
q?edit ? command-line in command-line window
r{char}replace N chars with {char}
["x]s(substitute) delete N characters [into register x] and start insert
t{char}cursor till before Nth occurrence of {char} to the right
uundo changes
vstart characterwise Visual mode
wcursor N words forward
["x]xdelete N characters under and after the cursor [into register x]
["x]y{motion}yank Nmove text [into register x]
["x]yyyank N lines [into register x]
z{char}commands starting with 'z', see |z| below
{cursor N paragraphs backward
|cursor to column N
}cursor N paragraphs forward
~'tildeop' off: switch case of N characters under cursor and move the cursor N characters to the right
~{motion}'tildeop' on: switch case of Nmove text
<C-End>same as "G"
<C-Home>same as "gg"
<C-Left>same as "b"
<C-LeftMouse>":ta" to the keyword at the mouse click
<C-Right>same as "w"
<C-Tab>same as "g<Tab>"
["x]<Del>same as "x"
{count}<Del>remove the last digit from {count}
<Down>same as "j"
<End>same as "$"
<F1>same as <Help>
<Help>open a help window
<Home>same as "0"
<Insert>same as "i"
<Left>same as "h"
<LeftMouse>move cursor to the mouse click position
<MiddleMouse>same as "gP" at the mouse click position
<PageDown>same as CTRL-F
<PageUp>same as CTRL-B
<Right>same as "l"
<RightMouse>start Visual mode, move cursor to the mouse click position
<S-Down>same as CTRL-F
<S-Left>same as "b"
<S-LeftMouse>same as "*" at the mouse click position
<S-Right>same as "w"
<S-Up>same as CTRL-B
<Undo>same as "u"
<Up>same as "k"
<ScrollWheelDown>move window three lines down
<S-ScrollWheelDown>move window one page down
<ScrollWheelUp>move window three lines up
<S-ScrollWheelUp>move window one page up
<ScrollWheelLeft>move window six columns left
<S-ScrollWheelLeft>move window one page left
<ScrollWheelRight>move window six columns right
<S-ScrollWheelRight>move window one page right

Text Objects & Operators

39

Text objects — after an operator or in visual mode

a"double quoted string
a'single quoted string
a(same as ab
a)same as ab
a<"a <>" from '<' to the matching '>'
a>same as a<
aB"a Block" from "[{" to "]}" (with brackets)
aW"a WORD" (with white space)
a["a []" from '[' to the matching ']'
a]same as a[
a`string in backticks
ab"a block" from "[(" to "])" (with braces)
ap"a paragraph" (with white space)
as"a sentence" (with white space)
at"a tag block" (with white space)
aw"a word" (with white space)
a{same as aB
a}same as aB
i"double quoted string without the quotes
i'single quoted string without the quotes
i(same as ib
i)same as ib
i<"inner <>" from '<' to the matching '>'
i>same as i<
iB"inner Block" from "[{" and "]}"
iW"inner WORD"
i["inner []" from '[' to the matching ']'
i]same as i[
i`string in backticks without the backticks
ib"inner block" from "[(" to "])"
ip"inner paragraph"
is"inner sentence"
it"inner tag block"
iw"inner word"
i{same as iB
i}same as iB

Operator-pending forcing

vforce operator to work characterwise
Vforce operator to work linewise
CTRL-Vforce operator to work blockwise

Insert Mode

87

Insert and replace mode

CTRL-@insert previously inserted text and stop insert
CTRL-Ainsert previously inserted text CTRL-B not used |i_CTRL-B-gone|
CTRL-Cquit insert mode, without checking for abbreviation, unless 'insertmode' set.
CTRL-Ddelete one shiftwidth of indent in the current line
CTRL-Einsert the character which is below the cursor CTRL-F not used (but by default it's in 'cinkeys' to re-indent the current line)
CTRL-G CTRL-Jline down, to column where inserting started
CTRL-G jline down, to column where inserting started
CTRL-G <Down>line down, to column where inserting started
CTRL-G CTRL-Kline up, to column where inserting started
CTRL-G kline up, to column where inserting started
CTRL-G <Up>line up, to column where inserting started
CTRL-G ustart new undoable edit
CTRL-G Udon't break undo with next cursor movement
<BS>delete character before the cursor enter digraph (only when 'digraph' option set)
CTRL-Hsame as <BS>
<Tab>insert a <Tab> character
CTRL-Isame as <Tab>
<NL>same as <CR>
CTRL-Jsame as <CR> enter digraph
CTRL-Lwhen 'insertmode' set: Leave Insert mode
<CR>begin new line
CTRL-Msame as <CR>
CTRL-Nfind next match for keyword in front of the cursor
CTRL-Oexecute a single command and return to insert mode
CTRL-Pfind previous match for keyword in front of the cursor
CTRL-Qsame as CTRL-V, unless used for terminal control flow like CTRL-Q unless |modifyOtherKeys| is active insert the contents of a register insert the contents of a register literally insert the contents of a register literally and don't auto-indent insert the contents of a register literally and fix indent. CTRL-S not used or used for terminal control flow
CTRL-Tinsert one shiftwidth of indent in current line
CTRL-Udelete all entered characters in the current line
CTRL-V {char}insert next non-digit literally like CTRL-V unless |modifyOtherKeys| is active byte.
CTRL-Wdelete word before the cursor
CTRL-X {mode}enter CTRL-X sub mode, see |i_CTRL-X_index|
CTRL-Yinsert the character which is above the cursor
CTRL-Zwhen 'insertmode' set: suspend Vim
<Esc>end insert mode (unless 'insertmode' set)
CTRL-[same as <Esc> CTRL-\ a - z reserved for extensions CTRL-\ others not used
CTRL-]trigger abbreviation
CTRL-^toggle use of |:lmap| mappings
CTRL-_When 'allowrevins' set: change language (Hebrew, Farsi) {only when compiled with the |+rightleft| feature} <Space> to '~' not used, except '0' and '^' followed by CTRL-D
0 CTRL-Ddelete all indent in the current line
^ CTRL-Ddelete all indent in the current line, restore it in the next line
<Del>delete character under the cursor Meta characters (0x80 to 0xff, 128 to 255) not used
<Left>cursor one character left
<S-Left>cursor one word left
<C-Left>cursor one word left
<Right>cursor one character right
<S-Right>cursor one word right
<C-Right>cursor one word right
<Up>cursor one line up
<S-Up>same as <PageUp>
<Down>cursor one line down
<S-Down>same as <PageDown>
<Home>cursor to start of line
<C-Home>cursor to start of file
<End>cursor past end of line
<C-End>cursor past end of file
<PageUp>one screenful backward
<PageDown>one screenful forward
<F1>same as <Help>
<Help>stop insert mode and display help window
<Insert>toggle Insert/Replace mode
<LeftMouse>cursor at mouse click
<ScrollWheelDown>move window three lines down
<S-ScrollWheelDown>move window one page down
<ScrollWheelUp>move window three lines up
<S-ScrollWheelUp>move window one page up
<ScrollWheelLeft>move window six columns left
<S-ScrollWheelLeft>move window one page left
<ScrollWheelRight>move window six columns right
commands in CTRL-X submode*i_CTRL-X_index*
CTRL-X CTRL-Dcomplete defined identifiers
CTRL-X CTRL-Escroll up
CTRL-X CTRL-Fcomplete file names
CTRL-X CTRL-Icomplete identifiers
CTRL-X CTRL-Kcomplete identifiers from dictionary
CTRL-X CTRL-Lcomplete whole lines
CTRL-X CTRL-Nnext completion
CTRL-X CTRL-Oomni completion
CTRL-X CTRL-Pprevious completion
CTRL-X CTRL-Rcomplete contents from registers
CTRL-X CTRL-Sspelling suggestions
CTRL-X CTRL-Tcomplete identifiers from thesaurus
CTRL-X CTRL-Yscroll down
CTRL-X CTRL-Ucomplete with 'completefunc'
CTRL-X CTRL-Vcomplete like in : command line
CTRL-X CTRL-Zstop completion, keeping the text as-is
CTRL-X CTRL-]complete tags
CTRL-X sspelling suggestions CTRL-L insert one character from the current match <CR> insert currently selected match <BS> delete one character and redo search CTRL-H same as <BS> <Up> select the previous match <Down> select the next match <PageUp> select a match several entries back <PageDown> select a match several entries forward other stop completion and insert the typed character

Visual & Select Mode

81

Where visual differs from normal

CTRL-Aadd N to number in highlighted text
CTRL-Cstop Visual mode
CTRL-Gtoggle between Visual mode and Select mode
<BS>Select mode: delete highlighted area
CTRL-Hsame as <BS>
CTRL-Oswitch from Select to Visual mode for one command
CTRL-Vmake Visual mode blockwise or stop Visual mode
CTRL-Xsubtract N from number in highlighted text
<Esc>stop Visual mode
CTRL-]jump to highlighted tag
!{filter}filter the highlighted lines through the external command {filter}
:start a command-line with the highlighted lines as a range
<shift the highlighted lines one 'shiftwidth' left
=filter the highlighted lines through the external program given with the 'equalprg' option
>shift the highlighted lines one 'shiftwidth' right
Ablock mode: append same text in all lines, after the highlighted area
Cdelete the highlighted lines and start insert
Ddelete the highlighted lines
Iblock mode: insert same text in all lines, before the highlighted area
Jjoin the highlighted lines
Krun 'keywordprg' on the highlighted area
Omove horizontally to other corner of area
Preplace highlighted area with register contents; registers are unchanged Q does not start Ex mode
Rdelete the highlighted lines and start insert
Sdelete the highlighted lines and start insert
Umake highlighted area uppercase
Vmake Visual mode linewise or stop Visual mode
Xdelete the highlighted lines
Yyank the highlighted lines
a"extend highlighted area with a double quoted string
a'extend highlighted area with a single quoted string
a(same as ab
a)same as ab
a<extend highlighted area with a <> block
a>same as a<
aBextend highlighted area with a {} block
aWextend highlighted area with "a WORD"
a[extend highlighted area with a [] block
a]same as a[
a`extend highlighted area with a backtick quoted string
abextend highlighted area with a () block
apextend highlighted area with a paragraph
asextend highlighted area with a sentence
atextend highlighted area with a tag block
awextend highlighted area with "a word"
a{same as aB
a}same as aB
cdelete highlighted area and start insert
ddelete highlighted area
g CTRL-Aadd N to number in highlighted text
g CTRL-Xsubtract N from number in highlighted text
gJjoin the highlighted lines without inserting spaces
gqformat the highlighted lines
gvexchange current and previous highlighted area
i"extend highlighted area with a double quoted string (without quotes)
i'extend highlighted area with a single quoted string (without quotes)
i(same as ib
i)same as ib
i<extend highlighted area with inner <> block
i>same as i<
iBextend highlighted area with inner {} block
iWextend highlighted area with "inner WORD"
i[extend highlighted area with inner [] block
i]same as i[
i`extend highlighted area with a backtick quoted string (without the backticks)
ibextend highlighted area with inner () block
ipextend highlighted area with inner paragraph
isextend highlighted area with inner sentence
itextend highlighted area with inner tag block
iwextend highlighted area with "inner word"
i{same as iB
i}same as iB
omove cursor to other corner of area
preplace highlighted area with register contents; deleted text in unnamed register
rreplace highlighted area with a character
sdelete highlighted area and start insert
umake highlighted area lowercase
vmake Visual mode characterwise or stop Visual mode
xdelete the highlighted area
yyank the highlighted area
~swap case for the highlighted area

Window Commands

74

CTRL-W — splits, sizes and movement

CTRL-W CTRL-Bsame as "CTRL-W b"
CTRL-W CTRL-Cno-op
CTRL-W CTRL-Dsame as "CTRL-W d"
CTRL-W CTRL-Fsame as "CTRL-W f" CTRL-W CTRL-G same as "CTRL-W g .."
CTRL-W CTRL-Hsame as "CTRL-W h"
CTRL-W CTRL-Isame as "CTRL-W i"
CTRL-W CTRL-Jsame as "CTRL-W j"
CTRL-W CTRL-Ksame as "CTRL-W k"
CTRL-W CTRL-Lsame as "CTRL-W l"
CTRL-W CTRL-Nsame as "CTRL-W n"
CTRL-W CTRL-Osame as "CTRL-W o"
CTRL-W CTRL-Psame as "CTRL-W p"
CTRL-W CTRL-Qsame as "CTRL-W q"
CTRL-W CTRL-Rsame as "CTRL-W r"
CTRL-W CTRL-Ssame as "CTRL-W s"
CTRL-W CTRL-Tsame as "CTRL-W t"
CTRL-W CTRL-Vsame as "CTRL-W v"
CTRL-W CTRL-Wsame as "CTRL-W w"
CTRL-W CTRL-Xsame as "CTRL-W x"
CTRL-W CTRL-Zsame as "CTRL-W z"
CTRL-W CTRL-]same as "CTRL-W ]"
CTRL-W CTRL-^same as "CTRL-W ^"
CTRL-W CTRL-_same as "CTRL-W _"
CTRL-W +increase current window height N lines
CTRL-W -decrease current window height N lines
CTRL-W :same as |:|, edit a command line
CTRL-W <decrease current window width N columns
CTRL-W =make all windows the same height & width
CTRL-W >increase current window width N columns
CTRL-W Hmove current window to the far left
CTRL-W Jmove current window to the very bottom
CTRL-W Kmove current window to the very top
CTRL-W Lmove current window to the far right
CTRL-W Pgo to preview window
CTRL-W Rrotate windows upwards N times
CTRL-W Ssame as "CTRL-W s"
CTRL-W Tmove current window to a new tab page
CTRL-W Wgo to N previous window (wrap around)
CTRL-W ]split window and jump to tag under cursor
CTRL-W ^split current window and edit alternate file N
CTRL-W _set current window height to N (default: very high)
CTRL-W bgo to bottom window
CTRL-W cclose current window (like |:close|)
CTRL-W dsplit window and jump to definition under the cursor
CTRL-W fsplit window and edit file name under the cursor
CTRL-W Fsplit window and edit file name under the cursor and jump to the line number following the file name. cursor
CTRL-W g ]split window and do |:tselect| for tag under cursor
CTRL-W g }do a |:ptjump| to the tag under the cursor
CTRL-W g fedit file name under the cursor in a new tab page
CTRL-W g Fedit file name under the cursor in a new tab page and jump to the line number following the file name.
CTRL-W g tsame as `gt`: go to next tab page
CTRL-W g Tsame as `gT`: go to previous tab page
CTRL-W g <Tab>same as |g<Tab>|: go to last accessed tab page.
CTRL-W hgo to Nth left window (stop at first window)
CTRL-W isplit window and jump to declaration of identifier under the cursor
CTRL-W jgo N windows down (stop at last window)
CTRL-W kgo N windows up (stop at first window)
CTRL-W lgo to Nth right window (stop at last window)
CTRL-W nopen new window, N lines high
CTRL-W oclose all but current window (like |:only|)
CTRL-W pgo to previous (last accessed) window
CTRL-W qquit current window (like |:quit|)
CTRL-W rrotate windows downwards N times
CTRL-W ssplit current window in two parts, new window N lines high
CTRL-W tgo to top window
CTRL-W vsplit current window vertically, new window N columns wide
CTRL-W wgo to N next window (wrap around)
CTRL-W xexchange current window with window N (default: next window)
CTRL-W zclose preview window
CTRL-W |set window width to N columns
CTRL-W }show tag under cursor in preview window
CTRL-W <Down>same as "CTRL-W j"
CTRL-W <Up>same as "CTRL-W k"
CTRL-W <Left>same as "CTRL-W h"

Bracket Commands

44

[ and ] — unmatched pairs, includes, diffs, spelling

[ CTRL-Djump to first #define found in current and included files matching the word under the cursor, start searching at beginning of current file
[ CTRL-Ijump to first line in current and included files that contains the word under the cursor, start searching at beginning of current file
[#cursor to N previous unmatched #if, #else or #ifdef
['cursor to previous lowercase mark, on first non-blank
[(cursor N times back to unmatched '('
[*same as "[/"
[`cursor to previous lowercase mark
[/cursor to N previous start of a C comment
[Dlist all defines found in current and included files matching the word under the cursor, start searching at beginning of current file
[Ilist all lines found in current and included files that contain the word under the cursor, start searching at beginning of current file
[Psame as "[p"
[[cursor N sections backward
[]cursor N SECTIONS backward
[ccursor N times backwards to start of change
[dshow first #define found in current and included files matching the word under the cursor, start searching at beginning of current file
[fsame as "gf"
[ishow first line found in current and included files that contains the word under the cursor, start searching at beginning of current file
[mcursor N times back to start of member function
[plike "P", but adjust indent to current line
[smove to the previous misspelled word
[zmove to start of open fold
[{cursor N times back to unmatched '{'
] CTRL-Djump to first #define found in current and included files matching the word under the cursor, start searching at cursor position
] CTRL-Ijump to first line in current and included files that contains the word under the cursor, start searching at cursor position
]#cursor to N next unmatched #endif or #else
]'cursor to next lowercase mark, on first non-blank
])cursor N times forward to unmatched ')'
]*same as "]/"
]`cursor to next lowercase mark
]/cursor to N next end of a C comment
]Dlist all #defines found in current and included files matching the word under the cursor, start searching at cursor position
]Ilist all lines found in current and included files that contain the word under the cursor, start searching at cursor position
]Psame as "[p"
][cursor N SECTIONS forward
]]cursor N sections forward
]ccursor N times forward to start of change
]dshow first #define found in current and included files matching the word under the cursor, start searching at cursor position
]fsame as "gf"
]ishow first line found in current and included files that contains the word under the cursor, start searching at cursor position
]mcursor N times forward to end of member function
]plike "p", but adjust indent to current line
]smove to next misspelled word
]zmove to end of open fold
]}cursor N times forward to unmatched '}'

g Commands

66

The second normal-mode namespace

g CTRL-Aonly when compiled with MEM_PROFILE defined: dump a memory profile
g CTRL-Gshow information about current cursor position
g CTRL-Hstart Select block mode
g CTRL-]|:tjump| to the tag under the cursor
g#like "#", but without using "\<" and "\>"
g$when 'wrap' off go to rightmost character of the current line that is on the screen; when 'wrap' on go to the rightmost character of the current screen line
g&repeat last ":s" on all lines
g'{mark}like |'| but without changing the jumplist
g`{mark}like |`| but without changing the jumplist
g*like "*", but without using "\<" and "\>"
g+go to newer text state N times
g,go to N newer position in change list
g-go to older text state N times
g0when 'wrap' off go to leftmost character of the current line that is on the screen; when 'wrap' on go to the leftmost character of the current screen line
g8print hex value of bytes used in UTF-8 character under the cursor
g;go to N older position in change list
g<display previous command output
g?Rot13 encoding operator
g??Rot13 encode current line
g?g?Rot13 encode current line
gDgo to definition of word under the cursor in current file
gEgo backwards to the end of the previous WORD
gHstart Select line mode
gIlike "I", but always start in column 1
gJjoin lines without inserting space
gN1,2 find the previous match with the last used search pattern and Visually select it
["x]gPput the text [from register x] before the cursor N times, leave the cursor after it
gQswitch to "Ex" mode with Vim editing
gRenter Virtual Replace mode
gTgo to the previous tab page
gU{motion}make Nmove text uppercase
gVdon't reselect the previous Visual area when executing a mapping or menu in Select mode
g]:tselect on the tag under the cursor
g^when 'wrap' off go to leftmost non-white character of the current line that is on the screen; when 'wrap' on go to the leftmost non-white character of the current screen line
g_cursor to the last CHAR N - 1 lines lower
gaprint ascii value of character under the cursor
gdgo to definition of word under the cursor in current function
gego backwards to the end of the previous word
gfstart editing the file whose name is under the cursor
gFstart editing the file whose name is under the cursor and jump to the line number following the filename.
ggcursor to line N, default first line
ghstart Select mode
gilike "i", but first move to the |'^| mark
gjlike "j", but when 'wrap' on go N screen lines down
gklike "k", but when 'wrap' on go N screen lines up
gmgo to character at middle of the screenline
gMgo to character at middle of the text line
gn1,2 find the next match with the last used search pattern and Visually select it
gocursor to byte N in the buffer
["x]gpput the text [from register x] after the cursor N times, leave the cursor after it
gq{motion}format Nmove text
gr{char}virtual replace N chars with {char}
gsgo to sleep for N seconds (default 1)
gtgo to the next tab page
gu{motion}make Nmove text lowercase
gvreselect the previous Visual area
gw{motion}format Nmove text and keep cursor
g@{motion}call 'operatorfunc'
g~{motion}swap case for Nmove text
g<Down>same as "gj"
g<End>same as "g$"
g<Home>same as "g0"
g<LeftMouse>same as <C-LeftMouse> g<MiddleMouse> same as <C-MiddleMouse>
g<RightMouse>same as <C-RightMouse>
g<Tab>go to the last accessed tab page.
g<Up>same as "gk"

z Commands

52

Scrolling, folding and spelling

z<CR>redraw, cursor line to top of window, cursor on first non-blank
z{height}<CR>redraw, make window {height} lines high
z+cursor on line N (default line below window), otherwise like "z<CR>"
z-redraw, cursor line at bottom of window, cursor on first non-blank
z.redraw, cursor line to center of window, cursor on first non-blank
z=give spelling suggestions
zAopen a closed fold or close an open fold recursively
zCclose folds recursively
zDdelete folds recursively
zEeliminate all folds
zFcreate a fold for N lines
zGtemporarily mark word as correctly spelled
zHwhen 'wrap' off scroll half a screenwidth to the right
zLwhen 'wrap' off scroll half a screenwidth to the left
zMset 'foldlevel' to zero
zNset 'foldenable'
zOopen folds recursively
zRset 'foldlevel' to the deepest fold
zWtemporarily mark word as incorrectly spelled
zXre-apply 'foldlevel'
z^cursor on line N (default line above window), otherwise like "z-"
zaopen a closed fold, close an open fold
zbredraw, cursor line at bottom of window
zcclose a fold
zddelete a fold
zewhen 'wrap' off scroll horizontally to position the cursor at the end (right side) of the screen
zf{motion}create a fold for Nmove text
zgpermanently mark word as correctly spelled
zhwhen 'wrap' off scroll screen N characters to the right
zitoggle 'foldenable'
zjmove to the start of the next fold
zkmove to the end of the previous fold
zlwhen 'wrap' off scroll screen N characters to the left
zmsubtract one from 'foldlevel'
znreset 'foldenable'
zoopen fold
zppaste in block-mode without trailing spaces
zPpaste in block-mode without trailing spaces
zradd one to 'foldlevel'
zswhen 'wrap' off scroll horizontally to position the cursor at the start (left side) of the screen
ztredraw, cursor line at top of window
zuwundo |zw|
zugundo |zg|
zuWundo |zW|
zuGundo |zG|
zvopen enough folds to view the cursor line
zwpermanently mark word as incorrectly spelled
zxre-apply 'foldlevel' and do "zv"
zyyank without trailing spaces
zzredraw, cursor line at center of window
z<Left>same as "zh"
z<Right>same as "zl"

Command Line & Terminal

53

Command-line editing

CTRL-Ado completion on the pattern in front of the cursor and insert all matches
CTRL-Bcursor to begin of command-line
CTRL-Csame as <Esc>
CTRL-Dlist completions that match the pattern in front of the cursor
CTRL-Ecursor to end of command-line
'cedit'CTRL-F default value for 'cedit': opens the command-line window; otherwise not used
CTRL-Gnext match when 'incsearch' is active
<BS>delete the character in front of the cursor enter digraph when 'digraph' is on
CTRL-Hsame as <BS>
<Tab>if 'wildchar' is <Tab>: Do completion on the pattern in front of the cursor
<S-Tab>same as CTRL-P
'wildchar'Do completion on the pattern in front of the cursor (default: <Tab>)
CTRL-Isame as <Tab>
<NL>same as <CR>
CTRL-Jsame as <CR> enter digraph
CTRL-Ldo completion on the pattern in front of the cursor and insert the longest common part
<CR>execute entered command
CTRL-Msame as <CR>
CTRL-Nafter using 'wildchar' with multiple matches: go to next match, otherwise: recall older command-line from history. CTRL-O not used
CTRL-Pafter using 'wildchar' with multiple matches: go to previous match, otherwise: recall older command-line from history.
CTRL-Qsame as CTRL-V, unless it's used for terminal control flow insert the contents of a register or object under the cursor as if typed insert the contents of a register or object under the cursor literally CTRL-S not used, or used for terminal control flow
CTRL-Tprevious match when 'incsearch' is active
CTRL-Uremove all characters
CTRL-Vinsert next non-digit literally, insert three digit decimal number as a single byte.
CTRL-Wdelete the word in front of the cursor CTRL-X not used (reserved for completion) CTRL-Y copy (yank) modeless selection CTRL-Z not used (reserved for suspend)
<Esc>abandon command-line without executing it
CTRL-[same as <Esc> abandon command-line CTRL-\ a - d reserved for extensions {expr} CTRL-\ f - z reserved for extensions CTRL-\ others not used
CTRL-]trigger abbreviation
CTRL-^toggle use of |:lmap| mappings
CTRL-_when 'allowrevins' set: change language (Hebrew, Farsi)
<Del>delete the character under the cursor
<Left>cursor left
<S-Left>cursor one word left
<C-Left>cursor one word left
<Right>cursor right
<S-Right>cursor one word right
<C-Right>cursor one word right
<Up>recall previous command-line from history that matches pattern in front of the cursor
<S-Up>recall previous command-line from history
<Down>recall next command-line from history that matches pattern in front of the cursor
<S-Down>recall next command-line from history
<Home>cursor to start of command-line
<End>cursor to end of command-line
<PageDown>same as <S-Down>
<PageUp>same as <S-Up>
<Insert>toggle insert/overstrike mode
<LeftMouse>cursor at mouse click <Up> move up to parent / select the previous match <Down> move down to submenu / select the next match <Left> select the previous match / move up to parent <Right> select the next match / move down to submenu <CR> move into submenu when doing menu completion CTRL-E stop completion and go back to original text CTRL-Y accept selected match and stop completion other stop completion and insert the typed character <PageUp> select a match several entries back <PageDown> select a match several entries forward

Terminal-Job mode

CTRL-W Nswitch to Terminal-Normal mode
CTRL-W :enter an Ex command
CTRL-W .type CTRL-W in the terminal CTRL-W CTRL-\ send a CTRL-\ to the job in the terminal paste register in the terminal
CTRL-W gtgo to next tabpage, same as `gt`
CTRL-W gTgo to previous tabpage, same as `gT`
You found it, Arthur!*holy-grail* *:smile*

Registers, Marks & Ranges

49

Registers

"a"znamed registers; you fill them
"A"Zappend to the matching lowercase register
""the unnamed register — last delete or yank
"0the yank register — last y only
"1"9delete ring; "1 is the newest multi-line delete
"-small delete register: deletes of less than one line
"_the black hole — write only
"+the system clipboard (CLIPBOARD selection)
"*the X11 primary selection (middle-click); same as "+ on Windows/macOS
"%name of the current file
"#name of the alternate file
".the last inserted text
":the last command line
"/the last search pattern
"=the expression register
:reg[isters] [x]show register contents
let @a = "text"set a register from script
q{reg}qrecord keystrokes into a register
@{reg} / @@replay a register / replay the last replayed
:@aexecute register a as ex commands

Marks and jumps

m{a-zA-Z}set a mark; lowercase = file-local, uppercase = global
`a / 'ato mark a, exact position / first non-blank of its line
`` / ''to the position before the last jump
`.to the position of the last change
`^to where insert mode was last left
`[ / `]start / end of the last changed or yanked text
`< / `>start / end of the last visual selection
`"position when the file was last exited
:markslist all marks
:delm[arks] a b / :delm!delete marks / all lowercase marks
CTRL-O / CTRL-Iolder / newer position in the jump list

Ex ranges and the two commands worth memorising

{n}line n; 0 means "before the first line"
.the current line
$the last line of the file
%the whole file — shorthand for 1,$
*the last visual selection — same as '<,'>
'xthe line of mark x
/pat/ / ?pat?next / previous line matching pat
\/ / \?next / previous line matching the last search pattern
+n / -nn lines after / before the preceding address
;separator that moves the cursor to the first address first
:{range}norm[al] {keys}run normal-mode keys on every line in the range
:g/pat/{cmd}run cmd on every line matching pat
:v/pat/{cmd} / :g!run cmd on every line NOT matching pat
:g/pat/d _delete matching lines into the black hole
:{range}t {addr}copy the range to after addr (:co[py])
:{range}m {addr}move the range to after addr
:{range}!cmdfilter the range through an external command
:r !cmd / :w !cmdread command output in / write range to a command

Patterns & Substitute

22

Vim regex, offsets and :s

\vvery magic — almost PCRE: ( ) + ? { } | are special
\m / \M / \Vmagic (default) / nomagic / very nomagic
\< / \>start / end of word
\zs / \zeset start / end of the match
\@= \@! \@<= \@<!lookahead / negative / lookbehind / negative
\%Vinside the visual selection
\%d123 \%x7f \%u20acmatch a character by decimal, hex or Unicode value
\%23l \%23c \%23vonly on line 23 / column 23 / virtual column 23
\{n,m} \{-}count; \{-} is the non-greedy *
\(...\) / \1capture group / backreference
\%(...\)non-capturing group
\i \k \f \p \s \d \x \o \w \h \a \l \ucharacter classes; uppercase negates
[[:alpha:]]POSIX character classes inside []
\c / \Cforce case-insensitive / case-sensitive for the whole pattern
/pat/e /pat/s+2 /pat/;/pat2/search offsets and chained searches
:s/pat/rep/[flags]substitute in the range
& ~ \0 \1\9in the replacement: whole match, previous replacement, groups
\u \l \U \L \Ecase-fold the rest of the replacement
\=exprthe replacement is a Vim expression
g c i I n e:s flags — all matches, confirm, ignore case, match case, count only, no error
:%s//rep/gempty pattern reuses the last search
:&& / g&repeat the last :s with its flags / on the whole file

Ex Commands

599

Every ":" command, sorted on the non-optional part of its name

:nothing
:{range}go to last line in {range}
:!filter lines or execute an external command
:!!repeat last ":!" command
:#same as ":number"
:&repeat last ":substitute"
:*use the last Visual area, like :'<,'>
:<shift lines one 'shiftwidth' left
:=print the last line number
:>shift lines one 'shiftwidth' right
:@execute contents of a register
:@@repeat the previous ":@"
:2mat[ch]define a second match to highlight
:3mat[ch]define a third match to highlight
:N[ext]go to previous file in the argument list
:P[rint]print lines
:Xask for encryption key
:a[ppend]append text
:ab[breviate]enter abbreviation
:abc[lear]remove all abbreviations
:abo[veleft]make split window appear left or above
:abstractdeclare a Vim9 abstract class
:al[l]open a window for each file in the argument list
:am[enu]enter new menu item for all modes
:an[oremenu]enter a new menu for all modes that will not be remapped
:ar[gs]print the argument list
:arga[dd]add items to the argument list
:argded[upe]remove duplicates from the argument list
:argd[elete]delete items from the argument list
:arge[dit]add item to the argument list and edit it
:argdodo a command on all items in the argument list
:argg[lobal]define the global argument list
:argl[ocal]define a local argument list
:argu[ment]go to specific file in the argument list
:as[cii]print ascii value of character under the cursor
:au[tocmd]enter or show autocommands
:aug[roup]select the autocommand group to use
:aun[menu]remove menu for all modes
:b[uffer]go to specific buffer in the buffer list
:bN[ext]go to previous buffer in the buffer list
:ba[ll]open a window for each buffer in the buffer list
:bad[d]add buffer to the buffer list
:baltlike ":badd" but also set the alternate file
:bd[elete]remove a buffer from the buffer list
:be[have]set mouse and selection behavior
:bel[owright]make split window appear right or below
:bf[irst]go to first buffer in the buffer list
:bl[ast]go to last buffer in the buffer list
:bm[odified]go to next buffer in the buffer list that has been modified
:bn[ext]go to next buffer in the buffer list
:bo[tright]make split window appear at bottom or far right
:bp[revious]go to previous buffer in the buffer list
:br[ewind]go to first buffer in the buffer list
:brea[k]break out of while loop
:breaka[dd]add a debugger breakpoint
:breakd[el]delete a debugger breakpoint
:breakl[ist]list debugger breakpoints
:bro[wse]use file selection dialog
:bufd[o]execute command in each listed buffer
:bufferslist all files in the buffer list
:bun[load]unload a specific buffer
:bw[ipeout]really delete a buffer
:c[hange]replace a line or series of lines
:cN[ext]go to previous error
:cNf[ile]go to last error in previous file
:ca[bbrev]like ":abbreviate" but for Command-line mode
:cabc[lear]clear all abbreviations for Command-line mode
:cabo[ve]go to error above current line
:cad[dbuffer]add errors from buffer
:cadde[xpr]add errors from expr
:caddf[ile]add error message to current quickfix list
:caf[ter]go to error after current cursor
:cal[l]call a function
:cat[ch]part of a :try command
:cbe[fore]go to error before current cursor
:cbel[ow]go to error below current line
:cbo[ttom]scroll to the bottom of the quickfix window
:cb[uffer]parse error messages and jump to first error
:ccgo to specific error
:ccl[ose]close quickfix window
:cdchange directory
:cdoexecute command in each valid error list entry
:cfd[o]execute command in each file in error list
:ce[nter]format lines at the center
:cex[pr]read errors from expr and jump to first
:cf[ile]read file with error messages and jump to first
:cfir[st]go to the specified error, default first one
:cgetb[uffer]get errors from buffer
:cgete[xpr]get errors from expr
:cg[etfile]read file with error messages
:changesprint the change list
:chd[ir]change directory
:che[ckpath]list included files
:checkt[ime]check timestamp of loaded buffers
:chi[story]list the error lists
:classstart of a class declaration
:cla[st]go to the specified error, default last one
:cle[arjumps]clear the jump list
:clip[reset]reset 'clipmethod'
:cl[ist]list all errors
:clo[se]close current window
:cm[ap]like ":map" but for Command-line mode
:cmapc[lear]clear all mappings for Command-line mode
:cme[nu]add menu for Command-line mode
:cn[ext]go to next error
:cnew[er]go to newer error list
:cnf[ile]go to first error in next file
:cno[remap]like ":noremap" but for Command-line mode
:cnorea[bbrev]like ":noreabbrev" but for Command-line mode
:cnoreme[nu]like ":noremenu" but for Command-line mode
:co[py]copy lines
:col[der]go to older error list
:colo[rscheme]load a specific color scheme
:com[mand]create user-defined command
:comc[lear]clear all user-defined commands
:comp[iler]do settings for a specific compiler
:con[tinue]go back to :while
:conf[irm]prompt user when confirmation required
:cons[t]create a variable as a constant
:cope[n]open quickfix window
:cp[revious]go to previous error
:cpf[ile]go to last error in previous file
:cq[uit]quit Vim with an error code
:cr[ewind]go to the specified error, default first one
:cs[cope]execute cscope command
:cst[ag]use cscope to jump to a tag
:cu[nmap]like ":unmap" but for Command-line mode
:cuna[bbrev]like ":unabbrev" but for Command-line mode
:cunme[nu]remove menu for Command-line mode
:cw[indow]open or close quickfix window
:d[elete]delete lines
:deb[ug]run a command in debugging mode
:debugg[reedy]read debug mode commands from normal input
:defdefine a Vim9 user function
:defc[ompile]compile Vim9 user functions in current script
:defe[r]call function when current function is done
:delc[ommand]delete user-defined command
:delf[unction]delete a user function
:delm[arks]delete marks
:dif[fupdate]update 'diff' buffers
:diffg[et]remove differences in current buffer
:diffo[ff]switch off diff mode
:diffp[atch]apply a patch and show differences
:diffpu[t]remove differences in other buffer
:diffs[plit]show differences with another file
:difft[his]make current window a diff window
:dig[raphs]show or enter digraphs
:di[splay]display registers
:disa[ssemble]disassemble Vim9 user function
:dj[ump]jump to #define
:dlshort for |:delete| with the 'l' flag
:dli[st]list #defines
:do[autocmd]apply autocommands to current buffer
:doautoa[ll]apply autocommands for all loaded buffers
:d[elete]pshort for |:delete| with the 'p' flag
:dr[op]jump to window editing file or edit file in current window
:ds[earch]list one #define
:dsp[lit]split window and jump to #define
:e[dit]edit a file
:ea[rlier]go to older change, undo
:ec[ho]echoes the result of expressions
:echoc[onsole]like :echomsg but write to stdout
:echoe[rr]like :echo, show like an error and use history
:echoh[l]set highlighting for echo commands
:echom[sg]same as :echo, put message in history
:echonsame as :echo, but without <EOL>
:echow[indow]same as :echomsg, but use a popup window
:el[se]part of an :if command
:elsei[f]part of an :if command
:em[enu]execute a menu by name
:endclassend of a class declaration
:enddefend of a user function started with :def
:endenumend of an enum declaration
:en[dif]end previous :if
:endinterfaceend of an interface declaration
:endfo[r]end previous :for
:endf[unction]end of a user function started with :function
:endt[ry]end previous :try
:endw[hile]end previous :while
:ene[w]edit a new, unnamed buffer
:enumstart of an enum declaration
:ev[al]evaluate an expression and discard the result
:exsame as ":edit"
:exe[cute]execute result of expressions
:exi[t]same as ":xit"
:exp[ort]Vim9: export an item from a script
:exu[sage]overview of Ex commands
:f[ile]show or set the current file name
:fileslist all files in the buffer list
:filet[ype]switch file type detection on/off
:filt[er]filter output of following command
:fin[d]find file in 'path' and edit it
:finaldeclare an immutable variable in Vim9
:fina[lly]part of a :try command
:fini[sh]quit sourcing a Vim script
:fir[st]go to the first file in the argument list
:fix[del]set key code of <Del>
:fo[ld]create a fold
:foldc[lose]close folds
:foldd[oopen]execute command on lines not in a closed fold
:folddoc[losed]execute command on lines in a closed fold
:foldo[pen]open folds
:forfor loop
:fu[nction]define a user function
:g[lobal]execute commands for matching lines
:go[to]go to byte in the buffer
:gr[ep]run 'grepprg' and jump to first match
:grepa[dd]like :grep, but append to current list
:gu[i]start the GUI
:gv[im]start the GUI
:ha[rdcopy]send text to the printer
:h[elp]open a help window
:helpc[lose]close one help window
:helpf[ind]dialog to open a help window
:helpg[rep]like ":grep" but searches help files
:helpt[ags]generate help tags for a directory
:hi[ghlight]specify highlighting methods
:hid[e]hide current buffer for a command
:his[tory]print a history list
:hor[izontal]following window command work horizontally
:i[nsert]insert text
:ia[bbrev]like ":abbrev" but for Insert mode
:iabc[lear]like ":abclear" but for Insert mode
:ifexecute commands when condition met
:ij[ump]jump to definition of identifier
:il[ist]list lines where identifier matches
:im[ap]like ":map" but for Insert mode
:imapc[lear]like ":mapclear" but for Insert mode
:ime[nu]add menu for Insert mode
:imp[ort]Vim9: import an item from another script
:ino[remap]like ":noremap" but for Insert mode
:inorea[bbrev]like ":noreabbrev" but for Insert mode
:inoreme[nu]like ":noremenu" but for Insert mode
:int[ro]print the introductory message
:interfacestart of an interface declaration
:ip[ut]like |:put|, but adjust the indent to the current line
:is[earch]list one line where identifier matches
:isp[lit]split window and jump to definition of identifier
:iu[nmap]like ":unmap" but for Insert mode
:iuna[bbrev]like ":unabbrev" but for Insert mode
:iunme[nu]remove menu for Insert mode
:j[oin]join lines
:ju[mps]print the jump list
:kset a mark
:keepa[lt]following command keeps the alternate file
:kee[pmarks]following command keeps marks where they are
:keepj[umps]following command keeps jumplist and marks
:keepp[atterns]following command keeps search pattern history
:lN[ext]go to previous entry in location list
:lNf[ile]go to last entry in previous file
:l[ist]print lines
:lab[ove]go to location above current line
:lad[dexpr]add locations from expr
:laddb[uffer]add locations from buffer
:laddf[ile]add locations to current location list
:laf[ter]go to location after current cursor
:la[st]go to the last file in the argument list
:lan[guage]set the language (locale)
:lat[er]go to newer change, redo
:lbe[fore]go to location before current cursor
:lbel[ow]go to location below current line
:lbo[ttom]scroll to the bottom of the location window
:lb[uffer]parse locations and jump to first location
:lc[d]change directory locally
:lch[dir]change directory locally
:lcl[ose]close location window
:lcs[cope]like ":cscope" but uses location list
:ld[o]execute command in valid location list entries
:lfd[o]execute command in each file in location list
:le[ft]left align lines
:lefta[bove]make split window appear left or above
:leg[acy]make following command use legacy script syntax
:letassign a value to a variable or option
:lex[pr]read locations from expr and jump to first
:lf[ile]read file with locations and jump to first
:lfir[st]go to the specified location, default first one
:lgetb[uffer]get locations from buffer
:lgete[xpr]get locations from expr
:lg[etfile]read file with locations
:lgr[ep]run 'grepprg' and jump to first match
:lgrepa[dd]like :grep, but append to current list
:lh[elpgrep]like ":helpgrep" but uses location list
:lhi[story]list the location lists
:llgo to specific location
:lla[st]go to the specified location, default last one
:lli[st]list all locations
:lmak[e]execute external command 'makeprg' and parse error messages
:lm[ap]like ":map!" but includes Lang-Arg mode
:lmapc[lear]like ":mapclear!" but includes Lang-Arg mode
:lne[xt]go to next location
:lnew[er]go to newer location list
:lnf[ile]go to first location in next file
:ln[oremap]like ":noremap!" but includes Lang-Arg mode
:loadk[eymap]load the following keymaps until EOF
:lo[adview]load view for current window from a file
:loc[kmarks]following command keeps marks where they are
:lockv[ar]lock variables
:lol[der]go to older location list
:lop[en]open location window
:lp[revious]go to previous location
:lpf[ile]go to last location in previous file
:lr[ewind]go to the specified location, default first one
:lslist all buffers
:lt[ag]jump to tag and add matching tags to the location list
:lu[nmap]like ":unmap!" but includes Lang-Arg mode
:luaexecute |Lua| command
:luad[o]execute Lua command for each line
:luaf[ile]execute |Lua| script file
:lv[imgrep]search for pattern in files
:lvimgrepa[dd]like :vimgrep, but append to current list
:lw[indow]open or close location window
:m[ove]move lines
:ma[rk]set a mark
:mak[e]execute external command 'makeprg' and parse error messages
:mapshow or enter a mapping
:mapc[lear]clear all mappings for Normal and Visual mode
:markslist all marks
:mat[ch]define a match to highlight
:me[nu]enter a new menu item
:mes[sages]view previously displayed messages
:mk[exrc]write current mappings and settings to a file
:mks[ession]write session info to a file
:mksp[ell]produce .spl spell file
:mkv[imrc]write current mappings and settings to a file
:mkvie[w]write view of current window to a file
:mod[e]show or change the screen mode
:mz[scheme]execute MzScheme command
:mzf[ile]execute MzScheme script file
:nbc[lose]close the current Netbeans session
:nb[key]pass a key to Netbeans
:nbs[tart]start a new Netbeans session
:n[ext]go to next file in the argument list
:newcreate a new empty window
:nm[ap]like ":map" but for Normal mode
:nmapc[lear]clear all mappings for Normal mode
:nme[nu]add menu for Normal mode
:nn[oremap]like ":noremap" but for Normal mode
:nnoreme[nu]like ":noremenu" but for Normal mode
:noa[utocmd]following commands don't trigger autocommands
:no[remap]enter a mapping that will not be remapped
:noh[lsearch]suspend 'hlsearch' highlighting
:norea[bbrev]enter an abbreviation that will not be remapped
:noreme[nu]enter a menu that will not be remapped
:norm[al]execute Normal mode commands
:nos[wapfile]following commands don't create a swap file
:nu[mber]print lines with line number
:nun[map]like ":unmap" but for Normal mode
:nunme[nu]remove menu for Normal mode
:ol[dfiles]list files that have marks in the viminfo file
:o[pen]start open mode (not implemented)
:om[ap]like ":map" but for Operator-pending mode
:omapc[lear]remove all mappings for Operator-pending mode
:ome[nu]add menu for Operator-pending mode
:on[ly]close all windows except the current one
:ono[remap]like ":noremap" but for Operator-pending mode
:onoreme[nu]like ":noremenu" but for Operator-pending mode
:opt[ions]open the options-window
:ou[nmap]like ":unmap" but for Operator-pending mode
:ounme[nu]remove menu for Operator-pending mode
:ow[nsyntax]set new local syntax highlight for this window
:pa[ckadd]add a plugin from 'packpath'
:packl[oadall]load all packages under 'packpath'
:pb[uffer]edit buffer in the preview window
:pc[lose]close preview window
:ped[it]edit file in the preview window
:pe[rl]execute Perl command
:p[rint]print lines
:profd[el]stop profiling a function or script
:prof[ile]profiling functions and scripts
:pro[mptfind]open GUI dialog for searching
:promptr[epl]open GUI dialog for search/replace
:perld[o]execute Perl command for each line
:po[p]jump to older entry in tag stack
:popu[p]popup a menu by name
:pp[op]":pop" in preview window
:pre[serve]write all text to swap file
:prev[ious]go to previous file in argument list
:ps[earch]like ":ijump" but shows match in preview window
:pt[ag]show tag in preview window
:ptN[ext]|:tNext| in preview window
:ptf[irst]|:trewind| in preview window
:ptj[ump]|:tjump| and show tag in preview window
:ptl[ast]|:tlast| in preview window
:ptn[ext]|:tnext| in preview window
:ptp[revious]|:tprevious| in preview window
:ptr[ewind]|:trewind| in preview window
:pts[elect]|:tselect| and show tag in preview window
:publicprefix for a class or object member
:pu[t]insert contents of register in the text
:pw[d]print current directory
:py3execute Python 3 command
:python3same as :py3
:py3d[o]execute Python 3 command for each line
:py3f[ile]execute Python 3 script file
:py[thon]execute Python command
:pyd[o]execute Python command for each line
:pyf[ile]execute Python script file
:pyxexecute |python_x| command
:pythonxsame as :pyx
:pyxd[o]execute |python_x| command for each line
:pyxf[ile]execute |python_x| script file
:q[uit]quit current window (when one window quit Vim)
:quita[ll]quit Vim
:qa[ll]quit Vim
:r[ead]read file into the text
:rec[over]recover a file from a swap file
:red[o]redo one undone change
:redi[r]redirect messages to a file or register
:redr[aw]force a redraw of the display
:redraws[tatus]force a redraw of the status line(s)
:reg[isters]display the contents of registers
:res[ize]change current window height
:ret[ab]change tab size
:retu[rn]return from a user function
:rew[ind]go to the first file in the argument list
:ri[ght]right align text
:rightb[elow]make split window appear right or below
:rub[y]execute Ruby command
:rubyd[o]execute Ruby command for each line
:rubyf[ile]execute Ruby script file
:rund[o]read undo information from a file
:ru[ntime]source vim scripts in 'runtimepath'
:rv[iminfo]read from viminfo file
:s[ubstitute]find and replace text
:sN[ext]split window and go to previous file in argument list
:san[dbox]execute a command in the sandbox
:sa[rgument]split window and go to specific file in argument list
:sal[l]open a window for each file in argument list
:sav[eas]save file under another name.
:sb[uffer]split window and go to specific file in the buffer list
:sbN[ext]split window and go to previous file in the buffer list
:sba[ll]open a window for each file in the buffer list
:sbf[irst]split window and go to first file in the buffer list
:sbl[ast]split window and go to last file in buffer list
:sbm[odified]split window and go to modified file in the buffer list
:sbn[ext]split window and go to next file in the buffer list
:sbp[revious]split window and go to previous file in the buffer list
:sbr[ewind]split window and go to first file in the buffer list
:scr[iptnames]list names of all sourced Vim scripts
:scs[cope]split window and execute cscope command
:se[t]show or set options
:setf[iletype]set 'filetype', unless it was set already
:setg[lobal]show global values of options
:setl[ocal]show or set options locally
:sf[ind]split current window and edit file in 'path'
:sfir[st]split window and go to first file in the argument list
:sh[ell]escape to a shell
:sim[alt]Win32 GUI: simulate Windows ALT key
:sig[n]manipulate signs
:sil[ent]run a command silently
:sl[eep]do nothing for a few seconds
:sl[eep]!do nothing for a few seconds, without the cursor visible
:sla[st]split window and go to last file in the argument list
:sm[agic]:substitute with 'magic'
:smaplike ":map" but for Select mode
:smapc[lear]remove all mappings for Select mode
:sme[nu]add menu for Select mode
:smi[le]make the user happy
:sn[ext]split window and go to next file in the argument list
:sno[magic]:substitute with 'nomagic'
:snor[emap]like ":noremap" but for Select mode
:snoreme[nu]like ":noremenu" but for Select mode
:sor[t]sort lines
:so[urce]read Vim or Ex commands from a file
:spelld[ump]split window and fill with all correct words
:spe[llgood]add good word for spelling
:spelli[nfo]show info about loaded spell files
:spellra[re]add rare word for spelling
:spellr[epall]replace all bad words like last |z=|
:spellu[ndo]remove good or bad word
:spellw[rong]add spelling mistake
:sp[lit]split current window
:spr[evious]split window and go to previous file in the argument list
:sre[wind]split window and go to first file in the argument list
:st[op]suspend the editor or escape to a shell
:sta[g]split window and jump to a tag
:star[tinsert]start Insert mode
:startr[eplace]start Replace mode
:staticprefix for a class member or function
:stopi[nsert]stop Insert mode
:stj[ump]do ":tjump" and split window
:sts[elect]do ":tselect" and split window
:sun[hide]same as ":unhide"
:sunm[ap]like ":unmap" but for Select mode
:sunme[nu]remove menu for Select mode
:sus[pend]same as ":stop"
:sv[iew]split window and edit file read-only
:sw[apname]show the name of the current swap file
:sy[ntax]syntax highlighting
:synti[me]measure syntax highlighting speed
:sync[bind]sync scroll binding
:tsame as ":copy"
:tN[ext]jump to previous matching tag
:tabN[ext]go to previous tab page
:tabc[lose]close current tab page
:tabd[o]execute command in each tab page
:tabe[dit]edit a file in a new tab page
:tabf[ind]find file in 'path', edit it in a new tab page
:tabfir[st]go to first tab page
:tabl[ast]go to last tab page
:tabm[ove]move tab page to other position
:tabnewedit a file in a new tab page
:tabn[ext]go to next tab page
:tabo[nly]close all tab pages except the current one
:tabp[revious]go to previous tab page
:tabr[ewind]go to first tab page
:tabslist the tab pages and what they contain
:tabcreate new tab when opening new window
:ta[g]jump to tag
:tagsshow the contents of the tag stack
:tc[d]change directory for tab page
:tch[dir]change directory for tab page
:tclexecute Tcl command
:tcld[o]execute Tcl command for each line
:tclf[ile]execute Tcl script file
:te[aroff]tear-off a menu
:ter[minal]open a terminal window
:tf[irst]jump to first matching tag
:th[row]throw an exception
:thisprefix for an object member during initialization (e.g. on |new()|)
:tj[ump]like ":tselect", but jump directly when there is only one match
:tl[ast]jump to last matching tag
:tlm[enu]add menu for Terminal-Job mode
:tln[oremenu]like ":noremenu" but for Terminal-Job mode
:tlu[nmenu]remove menu for Terminal-Job mode
:tmapc[lear]remove all mappings for Terminal-Job mode
:tma[p]like ":map" but for Terminal-Job mode
:tm[enu]define menu tooltip
:tn[ext]jump to next matching tag
:tno[remap]like ":noremap" but for Terminal-Job mode
:to[pleft]make split window appear at top or far left
:tp[revious]jump to previous matching tag
:tr[ewind]jump to first matching tag
:tryexecute commands, abort on error or exception
:ts[elect]list matching tags and select one
:tunma[p]like ":unmap" but for Terminal-Job mode
:tu[nmenu]remove menu tooltip
:typecreate a type alias
:u[ndo]undo last change(s)
:undoj[oin]join next change with previous undo block
:undol[ist]list leafs of the undo tree
:una[bbreviate]remove abbreviation
:unh[ide]open a window for each loaded file in the buffer list
:uni[q]uniq lines
:unl[et]delete variable
:unlo[ckvar]unlock variables
:unm[ap]remove mapping
:unme[nu]remove menu
:uns[ilent]run a command not silently
:up[date]write buffer if modified
:v[global]execute commands for not matching lines
:varvariable declaration in Vim9
:ve[rsion]print version number and other info
:verb[ose]execute command with 'verbose' set
:vert[ical]make following command split vertically
:vim9[cmd]make following command use Vim9 script syntax
:vim9s[cript]indicates Vim9 script file
:vim[grep]search for pattern in files
:vimgrepa[dd]like :vimgrep, but append to current list
:vi[sual]same as ":edit", but turns off "Ex" mode
:viu[sage]overview of Normal mode commands
:vie[w]edit a file read-only
:vm[ap]like ":map" but for Visual+Select mode
:vmapc[lear]remove all mappings for Visual+Select mode
:vme[nu]add menu for Visual+Select mode
:vne[w]create a new empty window, vertically split
:vn[oremap]like ":noremap" but for Visual+Select mode
:vnoreme[nu]like ":noremenu" but for Visual+Select mode
:vs[plit]split current window vertically
:vu[nmap]like ":unmap" but for Visual+Select mode
:vunme[nu]remove menu for Visual+Select mode
:wind[o]execute command in each window
:w[rite]write to a file
:wN[ext]write to a file and go to previous file in argument list
:wa[ll]write all (changed) buffers
:wh[ile]execute loop for as long as condition met
:wi[nsize]get or set window size (obsolete)
:winc[md]execute a Window (CTRL-W) command
:winp[os]get or set window position
:wl[restore]restore the Wayland compositor connection
:wn[ext]write to a file and go to next file in argument list
:wp[revious]write to a file and go to previous file in argument list
:wqwrite to a file and quit window or Vim
:wqa[ll]write all changed buffers and quit Vim
:wu[ndo]write undo information to a file
:wv[iminfo]write to viminfo file
:x[it]write if buffer changed and close window
:xa[ll]same as ":wqall"
:xmapc[lear]remove all mappings for Visual mode
:xm[ap]like ":map" but for Visual mode
:xme[nu]add menu for Visual mode
:xr[estore]restores the X server connection
:xn[oremap]like ":noremap" but for Visual mode
:xnoreme[nu]like ":noremenu" but for Visual mode
:xu[nmap]like ":unmap" but for Visual mode
:xunme[nu]remove menu for Visual mode
:y[ank]yank lines into a register
:zprint some lines
:~repeat last ":substitute" vim:tw=78:ts=8:noet:ft=help:norl:

Options

436

Every option and its abbreviation

'aleph' 'al'ASCII code of the letter Aleph (Hebrew)
'allowrevins' 'ari'allow CTRL-_ in Insert and Command-line mode
'altkeymap' 'akm'obsolete option for Farsi
'ambiwidth' 'ambw'what to do with Unicode chars of ambiguous width
'antialias' 'anti'Mac OS X: use smooth, antialiased fonts
'arabic' 'arab'for Arabic as a default second language
'arabicshape' 'arshape'do shaping for Arabic characters
'autochdir' 'acd'change directory to the file in the current window
'autocomplete' 'ac'enable automatic completion in insert mode
'autocompletedelay' 'acl'delay in msec before menu appears after typing
'autocompletetimeout' 'act'initial decay timeout for autocompletion algorithm
'autoindent' 'ai'take indent for new line from previous line
'autoread' 'ar'autom. read file when changed outside of Vim
'autoshelldir' 'asd'change directory to the shell's current directory
'autowrite' 'aw'automatically write file if changed
'autowriteall' 'awa'as 'autowrite', but works with more commands
'background' 'bg'"dark" or "light", used for highlight colors
'backspace' 'bs'how backspace works at start of line
'backup' 'bk'keep backup file after overwriting a file
'backupcopy' 'bkc'make backup as a copy, don't rename the file
'backupdir' 'bdir'list of directories for the backup file
'backupext' 'bex'extension used for the backup file
'backupskip' 'bsk'no backup for files that match these patterns
'balloondelay' 'bdlay'delay in mS before a balloon may pop up
'ballooneval' 'beval'switch on balloon evaluation in the GUI
'balloonevalterm' 'bevalterm'switch on balloon evaluation in the terminal
'balloonexpr' 'bexpr'expression to show in balloon
'belloff' 'bo'do not ring the bell for these reasons
'binary' 'bin'read/write/edit file in binary mode
'bioskey' 'biosk'MS-DOS: use bios calls for input characters
'bomb'prepend a Byte Order Mark to the file
'breakat' 'brk'characters that may cause a line break
'breakindent' 'bri'wrapped line repeats indent
'breakindentopt' 'briopt'settings for 'breakindent'
'browsedir' 'bsdir'which directory to start browsing in
'bufhidden' 'bh'what to do when buffer is no longer in window
'buflisted' 'bl'whether the buffer shows up in the buffer list
'buftype' 'bt'special type of buffer
'casemap' 'cmp'specifies how case of letters is changed
'cdhome' 'cdh'change directory to the home directory by ":cd"
'cdpath' 'cd'list of directories searched with ":cd"
'cedit'key used to open the command-line window
'charconvert' 'ccv'expression for character encoding conversion
'chistory' 'chi'maximum number of quickfix lists in history
'cindent' 'cin'do C program indenting
'cinkeys' 'cink'keys that trigger indent when 'cindent' is set
'cinoptions' 'cino'how to do indenting when 'cindent' is set
'cinscopedecls' 'cinsd'words that are recognized by 'cino-g'
'cinwords' 'cinw'words where 'si' and 'cin' add an indent
'clipboard' 'cb'use the clipboard as the unnamed register
'clipmethod' 'cpm'specify order of what clipboard methods to use
'cmdheight' 'ch'number of lines to use for the command-line
'cmdwinheight' 'cwh'height of the command-line window
'colorcolumn' 'cc'columns to highlight
'columns' 'co'number of columns in the display
'comments' 'com'patterns that can start a comment line
'commentstring' 'cms'template for comments; used for fold marker
'compatible' 'cp'behave Vi-compatible as much as possible
'complete' 'cpt'specify how Insert mode completion works
'completefunc' 'cfu'function to be used for Insert mode completion
'completeopt' 'cot'options for Insert mode completion
'completepopup' 'cpp'options for the Insert mode completion info popup
'completeslash' 'csl'like 'shellslash' for completion
'completetimeout' 'cto'initial decay timeout for CTRL-N and CTRL-P
'concealcursor' 'cocu'whether concealable text is hidden in cursor line
'conceallevel' 'cole'whether concealable text is shown or hidden
'confirm' 'cf'ask what to do about unsaved/read-only files
'conskey' 'consk'get keys directly from console (MS-DOS only)
'copyindent' 'ci'make 'autoindent' use existing indent structure
'cpoptions' 'cpo'flags for Vi-compatible behavior
'cryptmethod' 'cm'type of encryption to use for file writing
'cscopepathcomp' 'cspc'how many components of the path to show
'cscopeprg' 'csprg'command to execute cscope
'cscopequickfix' 'csqf'use quickfix window for cscope results
'cscoperelative' 'csre'Use cscope.out path basename as prefix
'cscopetag' 'cst'use cscope for tag commands
'cscopetagorder' 'csto'determines ":cstag" search order
'cscopeverbose' 'csverb'give messages when adding a cscope database
'cursorbind' 'crb'move cursor in window as it moves in other windows
'cursorcolumn' 'cuc'highlight the screen column of the cursor
'cursorline' 'cul'highlight the screen line of the cursor
'cursorlineopt' 'culopt'settings for 'cursorline'
'debug'set to "msg" to see all error messages
'define' 'def'pattern to be used to find a macro definition
'delcombine' 'deco'delete combining characters on their own
'dictionary' 'dict'list of file names used for keyword completion
'diff'use diff mode for the current window
'diffanchors' 'dia'list of {address} to force anchoring of a diff
'diffexpr' 'dex'expression used to obtain a diff file
'diffopt' 'dip'options for using diff mode
'digraph' 'dg'enable the entering of digraphs in Insert mode
'directory' 'dir'list of directory names for the swap file
'display' 'dy'list of flags for how to display text
'eadirection' 'ead'in which direction 'equalalways' works
'edcompatible' 'ed'toggle flags of ":substitute" command
'emoji' 'emo'emoji characters are considered full width
'encoding' 'enc'encoding used internally
'endoffile' 'eof'write CTRL-Z at end of the file
'endofline' 'eol'write <EOL> for last line in file
'equalalways' 'ea'windows are automatically made the same size
'equalprg' 'ep'external program to use for "=" command
'errorbells' 'eb'ring the bell for error messages
'errorfile' 'ef'name of the errorfile for the QuickFix mode
'errorformat' 'efm'description of the lines in the error file
'esckeys' 'ek'recognize function keys in Insert mode
'eventignore' 'ei'autocommand events that are ignored
'eventignorewin' 'eiw'autocommand events that are ignored in a window
'expandtab' 'et'use spaces when <Tab> is inserted
'exrc' 'ex'read .vimrc and .exrc in the current directory
'fileencoding' 'fenc'file encoding for multibyte text
'fileencodings' 'fencs'automatically detected character encodings
'fileformat' 'ff'file format used for file I/O
'fileformats' 'ffs'automatically detected values for 'fileformat'
'fileignorecase' 'fic'ignore case when using file names
'filetype' 'ft'type of file, used for autocommands
'fillchars' 'fcs'characters to use for displaying special items
'findfunc' 'ffu'function to be called for the |:find| command
'fixendofline' 'fixeol'make sure last line in file has <EOL>
'fkmap' 'fk'obsolete option for Farsi
'foldclose' 'fcl'close a fold when the cursor leaves it
'foldcolumn' 'fdc'width of the column used to indicate folds
'foldenable' 'fen'set to display all folds open
'foldexpr' 'fde'expression used when 'foldmethod' is "expr"
'foldignore' 'fdi'ignore lines when 'foldmethod' is "indent"
'foldlevel' 'fdl'close folds with a level higher than this
'foldlevelstart' 'fdls''foldlevel' when starting to edit a file
'foldmarker' 'fmr'markers used when 'foldmethod' is "marker"
'foldmethod' 'fdm'folding type
'foldminlines' 'fml'minimum number of lines for a fold to be closed
'foldnestmax' 'fdn'maximum fold depth
'foldopen' 'fdo'for which commands a fold will be opened
'foldtext' 'fdt'expression used to display for a closed fold
'formatexpr' 'fex'expression used with "gq" command
'formatlistpat' 'flp'pattern used to recognize a list header
'formatoptions' 'fo'how automatic formatting is to be done
'formatprg' 'fp'name of external program used with "gq" command
'fsync' 'fs'whether to invoke fsync() after file write
'gdefault' 'gd'the ":substitute" flag 'g' is default on
'grepformat' 'gfm'format of 'grepprg' output
'grepprg' 'gp'program to use for ":grep"
'guicursor' 'gcr'GUI: settings for cursor shape and blinking
'guifont' 'gfn'GUI: Name(s) of font(s) to be used
'guifontset' 'gfs'GUI: Names of multibyte fonts to be used
'guifontwide' 'gfw'list of font names for double-wide characters
'guiheadroom' 'ghr'GUI: pixels room for window decorations
'guiligatures' 'gli'GTK GUI: ASCII characters that can form shapes
'guioptions' 'go'GUI: Which components and options are used
'guipty'GUI: try to use a pseudo-tty for ":!" commands
'guitablabel' 'gtl'GUI: custom label for a tab page
'guitabtooltip' 'gtt'GUI: custom tooltip for a tab page
'helpfile' 'hf'full path name of the main help file
'helpheight' 'hh'minimum height of a new help window
'helplang' 'hlg'preferred help languages
'hidden' 'hid'don't unload buffer when it is |abandon|ed
'highlight' 'hl'sets highlighting mode for various occasions
'history' 'hi'number of command-lines that are remembered
'hkmap' 'hk'Hebrew keyboard mapping
'hkmapp' 'hkp'phonetic Hebrew keyboard mapping
'hlsearch' 'hls'highlight matches with last search pattern
'icon'let Vim set the text of the window icon
'iconstring'string to use for the Vim icon text
'ignorecase' 'ic'ignore case in search patterns
'imactivatefunc' 'imaf'function to enable/disable the X input method
'imactivatekey' 'imak'key that activates the X input method
'imcmdline' 'imc'use IM when starting to edit a command line
'imdisable' 'imd'do not use the IM in any mode
'iminsert' 'imi'use :lmap or IM in Insert mode
'imsearch' 'ims'use :lmap or IM when typing a search pattern
'imstatusfunc' 'imsf'function to obtain X input method status
'imstyle' 'imst'specifies the input style of the input method
'include' 'inc'pattern to be used to find an include file
'includeexpr' 'inex'expression used to process an include line
'incsearch' 'is'highlight match while typing search pattern
'indentexpr' 'inde'expression used to obtain the indent of a line
'indentkeys' 'indk'keys that trigger indenting with 'indentexpr'
'infercase' 'inf'adjust case of match for keyword completion
'insertmode' 'im'start the edit of a file in Insert mode
'isfname' 'isf'characters included in file names and pathnames
'isident' 'isi'characters included in identifiers
'iskeyword' 'isk'characters included in keywords
'isprint' 'isp'printable characters
'joinspaces' 'js'two spaces after a period with a join command
'jumpoptions' 'jop'specifies how jumping is done
'key'encryption key
'keymap' 'kmp'name of a keyboard mapping
'keymodel' 'km'enable starting/stopping selection with keys
'keyprotocol' 'kpc'what keyboard protocol to use for what terminal
'keywordprg' 'kp'program to use for the "K" command
'langmap' 'lmap'alphabetic characters for other language mode
'langmenu' 'lm'language to be used for the menus
'langnoremap' 'lnr'do not apply 'langmap' to mapped characters
'langremap' 'lrm'do apply 'langmap' to mapped characters
'laststatus' 'ls'tells when last window has status lines
'lazyredraw' 'lz'don't redraw while executing macros
'lhistory' 'lhi'maximum number of location lists in history
'linebreak' 'lbr'wrap long lines at a blank
'lines'number of lines in the display
'linespace' 'lsp'number of pixel lines to use between characters
'lisp'automatic indenting for Lisp
'lispoptions' 'lop'changes how Lisp indenting is done
'lispwords' 'lw'words that change how lisp indenting works
'list'show <Tab> and <EOL>
'listchars' 'lcs'characters for displaying in list mode
'loadplugins' 'lpl'load plugin scripts when starting up
'luadll'name of the Lua dynamic library
'macatsui'Mac GUI: use ATSUI text drawing
'magic'changes special characters in search patterns
'makeef' 'mef'name of the errorfile for ":make"
'makeencoding' 'menc'encoding of external make/grep commands
'makeprg' 'mp'program to use for the ":make" command
'matchpairs' 'mps'pairs of characters that "%" can match
'matchtime' 'mat'tenths of a second to show matching paren
'maxcombine' 'mco'maximum nr of combining characters displayed
'maxfuncdepth' 'mfd'maximum recursive depth for user functions
'maxmapdepth' 'mmd'maximum recursive depth for mapping
'maxmem' 'mm'maximum memory (in Kbyte) used for one buffer
'maxmempattern' 'mmp'maximum memory (in Kbyte) used for pattern search
'maxmemtot' 'mmt'maximum memory (in Kbyte) used for all buffers
'menuitems' 'mis'maximum number of items in a menu
'mkspellmem' 'msm'memory used before |:mkspell| compresses the tree
'modeline' 'ml'recognize modelines at start or end of file
'modelineexpr' 'mle'allow setting expression options from a modeline
'modelines' 'mls'number of lines checked for modelines
'modifiable' 'ma'changes to the text are not possible
'modified' 'mod'buffer has been modified
'more'pause listings when the whole screen is filled
'mouse'enable the use of mouse clicks
'mousefocus' 'mousef'keyboard focus follows the mouse
'mousehide' 'mh'hide mouse pointer while typing
'mousemodel' 'mousem'changes meaning of mouse buttons
'mousemoveevent' 'mousemev'report mouse moves with <MouseMove>
'mouseshape' 'mouses'shape of the mouse pointer in different modes
'mousetime' 'mouset'max time between mouse double-click
'mzquantum' 'mzq'the interval between polls for MzScheme threads
'mzschemedll'name of the MzScheme dynamic library
'mzschemegcdll'name of the MzScheme dynamic library for GC
'nrformats' 'nf'number formats recognized for CTRL-A command
'number' 'nu'print the line number in front of each line
'numberwidth' 'nuw'number of columns used for the line number
'omnifunc' 'ofu'function for filetype-specific completion
'opendevice' 'odev'allow reading/writing devices on MS-Windows
'operatorfunc' 'opfunc'function to be called for |g@| operator
'osfiletype' 'oft'no longer supported
'packpath' 'pp'list of directories used for packages
'paragraphs' 'para'nroff macros that separate paragraphs
'paste'allow pasting text
'pastetoggle' 'pt'key code that causes 'paste' to toggle
'patchexpr' 'pex'expression used to patch a file
'patchmode' 'pm'keep the oldest version of a file
'path' 'pa'list of directories searched with "gf" et.al.
'perldll'name of the Perl dynamic library
'preserveindent' 'pi'preserve the indent structure when reindenting
'previewheight' 'pvh'height of the preview window
'previewpopup' 'pvp'use popup window for preview
'previewwindow' 'pvw'identifies the preview window
'printdevice' 'pdev'name of the printer to be used for :hardcopy
'printencoding' 'penc'encoding to be used for printing
'printexpr' 'pexpr'expression used to print PostScript for :hardcopy
'printfont' 'pfn'name of the font to be used for :hardcopy
'printheader' 'pheader'format of the header used for :hardcopy
'printmbcharset' 'pmbcs'CJK character set to be used for :hardcopy
'printmbfont' 'pmbfn'font names to be used for CJK output of :hardcopy
'printoptions' 'popt'controls the format of :hardcopy output
'prompt' 'prompt'enable prompt in Ex mode
'pumheight' 'ph'maximum height of the popup menu
'pumwidth' 'pw'minimum width of the popup menu
'pythondll'name of the Python 2 dynamic library
'pythonhome'name of the Python 2 home directory
'pythonthreedll'name of the Python 3 dynamic library
'pythonthreehome'name of the Python 3 home directory
'pyxversion' 'pyx'Python version used for pyx* commands
'quickfixtextfunc' 'qftf'function for the text in the quickfix window
'quoteescape' 'qe'escape characters used in a string
'readonly' 'ro'disallow writing the buffer
'redrawtime' 'rdt'timeout for 'hlsearch' and |:match| highlighting
'regexpengine' 're'default regexp engine to use
'relativenumber' 'rnu'show relative line number in front of each line
'remap'allow mappings to work recursively
'renderoptions' 'rop'options for text rendering on Windows
'report'threshold for reporting nr. of lines changed
'restorescreen' 'rs'Win32: restore screen when exiting
'revins' 'ri'inserting characters will work backwards
'rightleft' 'rl'window is right-to-left oriented
'rightleftcmd' 'rlc'commands for which editing works right-to-left
'rubydll'name of the Ruby dynamic library
'ruler' 'ru'show cursor line and column in the status line
'rulerformat' 'ruf'custom format for the ruler
'runtimepath' 'rtp'list of directories used for runtime files
'scroll' 'scr'lines to scroll with CTRL-U and CTRL-D
'scrollbind' 'scb'scroll in window as other windows scroll
'scrollfocus' 'scf'scroll wheel applies to window under pointer
'scrolljump' 'sj'minimum number of lines to scroll
'scrolloff' 'so'minimum nr. of lines above and below cursor
'scrollopt' 'sbo'how 'scrollbind' should behave
'sections' 'sect'nroff macros that separate sections
'secure'secure mode for reading .vimrc in current dir
'selection' 'sel'what type of selection to use
'selectmode' 'slm'when to use Select mode instead of Visual mode
'sessionoptions' 'ssop'options for |:mksession|
'shell' 'sh'name of shell to use for external commands
'shellcmdflag' 'shcf'flag to shell to execute one command
'shellpipe' 'sp'string to put output of ":make" in error file
'shellquote' 'shq'quote character(s) for around shell command
'shellredir' 'srr'string to put output of filter in a temp file
'shellslash' 'ssl'use forward slash for shell file names
'shelltemp' 'stmp'whether to use a temp file for shell commands
'shelltype' 'st'Amiga: influences how to use a shell
'shellxescape' 'sxe'characters to escape when 'shellxquote' is (
'shellxquote' 'sxq'like 'shellquote', but include redirection
'shiftround' 'sr'round indent to multiple of shiftwidth
'shiftwidth' 'sw'number of spaces to use for (auto)indent step
'shortmess' 'shm'list of flags, reduce length of messages
'shortname' 'sn'Filenames assumed to be 8.3 chars
'showbreak' 'sbr'string to use at the start of wrapped lines
'showcmd' 'sc'show (partial) command somewhere
'showcmdloc' 'sloc'where to show (partial) command
'showfulltag' 'sft'show full tag pattern when completing tag
'showmatch' 'sm'briefly jump to matching bracket if insert one
'showmode' 'smd'message on status line to show current mode
'showtabline' 'stal'tells when the tab pages line is displayed
'sidescroll' 'ss'minimum number of columns to scroll horizontal
'sidescrolloff' 'siso'min. nr. of columns to left and right of cursor
'signcolumn' 'scl'when to display the sign column
'smartcase' 'scs'no ignore case when pattern has uppercase
'smartindent' 'si'smart autoindenting for C programs
'smarttab' 'sta'<Tab> in leading whitespace indents by 'shiftwidth'
'smoothscroll' 'sms'scroll by screen lines when 'wrap' is set
'softtabstop' 'sts'number of columns between two soft tab stops
'spell'enable spell checking
'spellcapcheck' 'spc'pattern to locate end of a sentence
'spellfile' 'spf'files where |zg| and |zw| store words
'spelllang' 'spl'language(s) to do spell checking for
'spelloptions' 'spo'options for spell checking
'spellsuggest' 'sps'method(s) used to suggest spelling corrections
'splitbelow' 'sb'new window from split is below the current one
'splitkeep' 'spk'determines scroll behavior for split windows
'splitright' 'spr'new window is put right of the current one
'startofline' 'sol'commands move cursor to first non-blank in line
'statusline' 'stl'custom format for the status line
'suffixes' 'su'suffixes that are ignored with multiple match
'suffixesadd' 'sua'suffixes added when searching for a file
'swapfile' 'swf'whether to use a swapfile for a buffer
'swapsync' 'sws'how to sync the swap file
'switchbuf' 'swb'sets behavior when switching to another buffer
'synmaxcol' 'smc'maximum column to find syntax items
'syntax' 'syn'syntax to be loaded for current buffer
'tabclose' 'tcl'which tab page to focus when closing a tab
'tabline' 'tal'custom format for the console tab pages line
'tabpagemax' 'tpm'maximum number of tab pages for |-p| and "tab all"
'tabstop' 'ts'number of columns between two tab stops
'tagbsearch' 'tbs'use binary searching in tags files
'tagcase' 'tc'how to handle case when searching in tags files
'tagfunc' 'tfu'function to get list of tag matches
'taglength' 'tl'number of significant characters for a tag
'tagrelative' 'tr'file names in tag file are relative
'tags' 'tag'list of file names used by the tag command
'tagstack' 'tgst'push tags onto the tag stack
'tcldll'name of the Tcl dynamic library
'term'name of the terminal
'termbidi' 'tbidi'terminal takes care of bi-directionality
'termencoding' 'tenc'character encoding used by the terminal
'termguicolors' 'tgc'use GUI colors for the terminal
'termwinkey' 'twk'key that precedes a Vim command in a terminal
'termwinscroll' 'twsl'max number of scrollback lines in a terminal window
'termwinsize' 'tws'size of a terminal window
'termwintype' 'twt'MS-Windows: type of pty to use for terminal window
'terse'shorten some messages
'textauto' 'ta'obsolete, use 'fileformats'
'textmode' 'tx'obsolete, use 'fileformat'
'textwidth' 'tw'maximum width of text that is being inserted
'thesaurus' 'tsr'list of thesaurus files for keyword completion
'thesaurusfunc' 'tsrfu'function to be used for thesaurus completion
'tildeop' 'top'tilde command "~" behaves like an operator
'timeout' 'to'time out on mappings and key codes
'timeoutlen' 'tm'time out time in milliseconds
'title'let Vim set the title of the window
'titlelen'percentage of 'columns' used for window title
'titleold'old title, restored when exiting
'titlestring'string to use for the Vim window title
'toolbar' 'tb'GUI: which items to show in the toolbar
'toolbariconsize' 'tbis'size of the toolbar icons (for GTK 2 only)
'ttimeout'time out on mappings
'ttimeoutlen' 'ttm'time out time for key codes in milliseconds
'ttybuiltin' 'tbi'use built-in termcap before external termcap
'ttyfast' 'tf'indicates a fast terminal connection
'ttymouse' 'ttym'type of mouse codes generated
'ttyscroll' 'tsl'maximum number of lines for a scroll
'ttytype' 'tty'alias for 'term'
'undodir' 'udir'where to store undo files
'undofile' 'udf'save undo information in a file
'undolevels' 'ul'maximum number of changes that can be undone
'undoreload' 'ur'max nr of lines to save for undo on a buffer reload
'updatecount' 'uc'after this many characters flush swap file
'updatetime' 'ut'after this many milliseconds flush swap file
'varsofttabstop' 'vsts'a list of number of columns between soft tab stops
'vartabstop' 'vts'a list of number of columns between tab stops
'verbose' 'vbs'give informative messages
'verbosefile' 'vfile'file to write messages in
'viewdir' 'vdir'directory where to store files with :mkview
'viewoptions' 'vop'specifies what to save for :mkview
'viminfo' 'vi'use .viminfo file upon startup and exiting
'viminfofile' 'vif'file name used for the viminfo file
'virtualedit' 've'when to use virtual editing
'visualbell' 'vb'use visual bell instead of beeping
'warn'warn for shell command when buffer was changed
'weirdinvert' 'wiv'for terminals that have weird inversion method
'whichwrap' 'ww'allow specified keys to cross line boundaries
'wildchar' 'wc'command-line character for wildcard expansion
'wildcharm' 'wcm'like 'wildchar' but also works when mapped
'wildignore' 'wig'files matching these patterns are not completed
'wildignorecase' 'wic'ignore case when completing file names
'wildmenu' 'wmnu'use menu for command line completion
'wildmode' 'wim'mode for 'wildchar' command-line expansion
'wildoptions' 'wop'specifies how command line completion is done
'winaltkeys' 'wak'when the windows system handles ALT keys
'wincolor' 'wcr'window-local highlighting
'window' 'wi'nr of lines to scroll for CTRL-F and CTRL-B
'winfixbuf' 'wfb'keep window focused on a single buffer
'winfixheight' 'wfh'keep window height when opening/closing windows
'winfixwidth' 'wfw'keep window width when opening/closing windows
'winheight' 'wh'minimum number of lines for the current window
'winminheight' 'wmh'minimum number of lines for any window
'winminwidth' 'wmw'minimal number of columns for any window
'winptydll'name of the winpty dynamic library
'winwidth' 'wiw'minimal number of columns for current window
'wlseat' 'wse'the Wayland seat to use
'wlsteal' 'wst'allow focus stealing functionality for Wayland
'wltimeoutlen' 'wtm'timeout to use when polling in Wayland
'wrap'long lines wrap and continue on the next line
'wrapmargin' 'wm'chars from the right where wrapping starts
'wrapscan' 'ws'searches wrap around the end of the file
'write'writing to a file is allowed
'writeany' 'wa'write to file with no need for "!" override
'writebackup' 'wb'make a backup before overwriting a file
'writedelay' 'wd'delay this many msec for each char (for debug)
'xtermcodes'request terminal codes from an xterm

Built-in Functions

591

Every function in builtin.txt, with its return type

abs({expr})Float or Number · absolute value of {expr}
acos({expr})Float · arc cosine of {expr}
add({object}, {item})List/Blob · append {item} to {object}
and({expr}, {expr})Number · bitwise AND
append({lnum}, {text})Number · append {text} below line {lnum}
appendbufline({buf}, {lnum}, {text})Number · append {text} below line {lnum} in buffer {buf}
argc([{winid}])Number · number of files in the argument list
argidx()Number · current index in the argument list
arglistid([{winnr} [, {tabnr}]])Number · argument list id
argv({nr} [, {winid}])String · {nr} entry of the argument list
argv([-1, {winid}])List · the argument list
asin({expr})Float · arc sine of {expr}
assert_beeps({cmd})Number · assert {cmd} causes a beep
assert_equal({exp}, {act} [, {msg}])Number · assert {exp} is equal to {act}
assert_equalfile({fname-one}, {fname-two} [, {msg}])Number · assert file contents are equal
assert_exception({error} [, {msg}])Number · assert {error} is in v:exception
assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])Number · assert {cmd} fails
assert_false({actual} [, {msg}])Number · assert {actual} is false
assert_inrange({lower}, {upper}, {actual} [, {msg}])Number · assert {actual} is inside the range
assert_match({pat}, {text} [, {msg}])Number · assert {pat} matches {text}
assert_nobeep({cmd})Number · assert {cmd} does not cause a beep
assert_notequal({exp}, {act} [, {msg}])Number · assert {exp} is not equal {act}
assert_notmatch({pat}, {text} [, {msg}])Number · assert {pat} not matches {text}
assert_report({msg})Number · report a test failure
assert_true({actual} [, {msg}])Number · assert {actual} is true
atan({expr})Float · arc tangent of {expr}
atan2({expr1}, {expr2})Float · arc tangent of {expr1} / {expr2}
autocmd_add({acmds})Bool · add a list of autocmds and groups
autocmd_delete({acmds})Bool · delete a list of autocmds and groups
autocmd_get([{opts}])List · return a list of autocmds
balloon_gettext()String · current text in the balloon
balloon_show({expr})none · show {expr} inside the balloon
balloon_split({msg})List · split {msg} as used for a balloon
base64_decode({string})Blob · base64 decode {string} characters
base64_encode({blob})String · base64 encode the bytes in {blob}
bindtextdomain({package}, {path})Bool · bind text domain to specified path
blob2list({blob})List · convert {blob} into a list of numbers
blob2str({blob} [, {options}])List · convert {blob} into a list of strings
browse({save}, {title}, {initdir}, {default})String · put up a file requester
browsedir({title}, {initdir})String · put up a directory requester
bufadd({name})Number · add a buffer to the buffer list
bufexists({buf})Number · |TRUE| if buffer {buf} exists
buflisted({buf})Number · |TRUE| if buffer {buf} is listed
bufload({buf})Number · load buffer {buf} if not loaded yet
bufloaded({buf})Number · |TRUE| if buffer {buf} is loaded
bufname([{buf}])String · Name of the buffer {buf}
bufnr([{buf} [, {create}]])Number · Number of the buffer {buf}
bufwinid({buf})Number · window ID of buffer {buf}
bufwinnr({buf})Number · window number of buffer {buf}
byte2line({byte})Number · line number at byte count {byte}
byteidx({expr}, {nr} [, {utf16}])Number · byte index of {nr}'th char in {expr}
byteidxcomp({expr}, {nr} [, {utf16}])Number · byte index of {nr}'th char in {expr}
call({func}, {arglist} [, {dict}])any · call {func} with arguments {arglist}
ceil({expr})Float · round {expr} up
ch_canread({handle})Number · check if there is something to read
ch_close({handle})none · close {handle}
ch_close_in({handle})none · close in part of {handle}
ch_evalexpr({handle}, {expr} [, {options}])any · evaluate {expr} on JSON {handle}
ch_evalraw({handle}, {string} [, {options}])any · evaluate {string} on raw {handle}
ch_getbufnr({handle}, {what})Number · get buffer number for {handle}/{what}
ch_getjob({channel})Job · get the Job of {channel}
ch_info({handle})String · info about channel {handle}
ch_log({msg} [, {handle}])none · write {msg} in the channel log file
ch_logfile({fname} [, {mode}])none · start logging channel activity
ch_open({address} [, {options}])Channel · open a channel to {address}
ch_read({handle} [, {options}])String · read from {handle}
ch_readblob({handle} [, {options}])Blob · read Blob from {handle}
ch_readraw({handle} [, {options}])String · read raw from {handle}
ch_sendexpr({handle}, {expr} [, {options}])any · send {expr} over JSON {handle}
ch_sendraw({handle}, {expr} [, {options}])any · send {expr} over raw {handle}
ch_setoptions({handle}, {options})none · set options for {handle}
ch_status({handle} [, {options}])String · status of channel {handle}
changenr()Number · current change number
char2nr({expr} [, {utf8}])Number · ASCII/UTF-8 value of first char in {expr}
charclass({string})Number · character class of {string}
charcol({expr} [, {winid}])Number · column number of cursor or mark
charidx({string}, {idx} [, {countcc} [, {utf16}]])Number · char index of byte {idx} in {string}
chdir({dir})String · change current working directory
cindent({lnum})Number · C indent for line {lnum}
clearmatches([{win}])none · clear all matches
cmdcomplete_info()Dict · get current cmdline completion information
col({expr} [, {winid}])Number · column byte index of cursor or mark
complete({startcol}, {matches})none · set Insert mode completion
complete_add({expr})Number · add completion match
complete_check()Number · check for key typed during completion
complete_info([{what}])Dict · get current completion information
complete_match([{lnum}, {col}])List · get completion column and trigger text
confirm({msg} [, {choices} [, {default} [, {type}]]])Number · number of choice picked by user
copy({expr})any · make a shallow copy of {expr}
cos({expr})Float · cosine of {expr}
cosh({expr})Float · hyperbolic cosine of {expr}
count({comp}, {expr} [, {ic} [, {start}]])Number · count how many {expr} are in {comp}
cscope_connection([{num}, {dbpath} [, {prepend}]])Number · checks existence of cscope connection
cursor({lnum}, {col} [, {off}])Number · move cursor to {lnum}, {col}, {off}
cursor({list})Number · move cursor to position in {list}
debugbreak({pid})Number · interrupt process being debugged
deepcopy({expr} [, {noref}])any · make a full copy of {expr}
delete({fname} [, {flags}])Number · delete the file or directory {fname}
deletebufline({buf}, {first} [, {last}])Number · delete lines from buffer {buf}
did_filetype()Number · |TRUE| if FileType autocmd event used
diff({fromlist}, {tolist} [, {options}])List · diff two Lists of strings
diff_filler({lnum})Number · diff filler lines about {lnum}
diff_hlID({lnum}, {col})Number · diff highlighting at {lnum}/{col}
digraph_get({chars})String · get the |digraph| of {chars}
digraph_getlist([{listall}])List · get all |digraph|s
digraph_set({chars}, {digraph})Bool · register |digraph|
digraph_setlist({digraphlist})Bool · register multiple |digraph|s
echoraw({expr})none · output {expr} as-is
empty({expr})Number · |TRUE| if {expr} is empty
environ()Dict · return environment variables
err_teapot([{expr}])none · give E418, or E503 if {expr} is |TRUE|
escape({string}, {chars})String · escape {chars} in {string} with '\'
eval({string})any · evaluate {string} into its value
eventhandler()Number · |TRUE| if inside an event handler
executable({expr})Number · 1 if executable {expr} exists
execute({command})String · execute {command} and get the output
exepath({expr})String · full path of the command {expr}
exists({expr})Number · |TRUE| if {expr} exists
exists_compiled({expr})Number · |TRUE| if {expr} exists at compile time
exp({expr})Float · exponential of {expr}
expand({expr} [, {nosuf} [, {list}]])any · expand special keywords in {expr}
expandcmd({string} [, {options}])String · expand {string} like with `:edit`
extend({expr1}, {expr2} [, {expr3}])List/Dict insert items of {expr2} into {expr1} ·
extendnew({expr1}, {expr2} [, {expr3}])List/Dict like |extend()| but creates a new · List or Dictionary
feedkeys({string} [, {mode}])Number · add key sequence to typeahead buffer
filecopy({from}, {to})Number · |TRUE| if copying file {from} to {to} worked
filereadable({file})Number · |TRUE| if {file} is a readable file
filewritable({file})Number · |TRUE| if {file} is a writable file
filter({expr1}, {expr2})List/Dict/Blob/String · remove items from {expr1} where {expr2} is 0
finddir({name} [, {path} [, {count}]])? ·
findfile({name} [, {path} [, {count}]])String/List find dir/file {name} in {path} ·
flatten({list} [, {maxdepth}])List · flatten {list} up to {maxdepth} levels
flattennew({list} [, {maxdepth}])List · flatten a copy of {list}
float2nr({expr})Number · convert Float {expr} to a Number
floor({expr})Float · round {expr} down
fmod({expr1}, {expr2})Float · remainder of {expr1} / {expr2}
fnameescape({fname})String · escape special characters in {fname}
fnamemodify({fname}, {mods})String · modify file name
foldclosed({lnum})Number · first line of fold at {lnum} if closed
foldclosedend({lnum})Number · last line of fold at {lnum} if closed
foldlevel({lnum})Number · fold level at {lnum}
foldtext()String · line displayed for closed fold
foldtextresult({lnum})String · text for closed fold at {lnum}
foreach({expr1}, {expr2})List/Tuple/Dict/Blob/String · for each item in {expr1} call {expr2}
foreground()Number · bring the Vim window to the foreground
fullcommand({name} [, {vim9}])String · get full command from {name}
funcref({name} [, {arglist}] [, {dict}])Funcref · reference to function {name}
function({name} [, {arglist}] [, {dict}])Funcref · named reference to function {name}
garbagecollect([{atexit}])none · free memory, breaking cyclic references
get({list}, {idx} [, {def}])any · get item {idx} from {list} or {def}
get({dict}, {key} [, {def}])any · get item {key} from {dict} or {def}
get({func}, {what})any · get property of funcref/partial {func}
getbufinfo([{buf}])List · information about buffers
getbufline({buf}, {lnum} [, {end}])List · lines {lnum} to {end} of buffer {buf}
getbufoneline({buf}, {lnum})String · line {lnum} of buffer {buf}
getbufvar({buf}, {varname} [, {def}])any · variable {varname} in buffer {buf}
getcellpixels()List · get character cell pixel size
getcellwidths()List · get character cell width overrides
getchangelist([{buf}])List · list of change list items
getchar([{expr} [, {opts}]])Number or String · get one character from the user
getcharmod()Number · modifiers for the last typed character
getcharpos({expr})List · position of cursor, mark, etc.
getcharsearch()Dict · last character search
getcharstr([{expr} [, {opts}]])String · get one character from the user
getcmdcomplpat()String · return the completion pattern of the current command-line completion
getcmdcompltype()String · return the type of the current command-line completion
getcmdline()String · return the current command-line input
getcmdpos()Number · return cursor position in command-line
getcmdprompt()String · return the current command-line prompt
getcmdscreenpos()Number · return cursor screen position in command-line
getcmdtype()String · return current command-line type
getcmdwintype()String · return current command-line window type
getcompletion({pat}, {type} [, {filtered}])List · list of cmdline completion matches
getcompletiontype({pat})String · return the type of the command-line completion using {pat}
getcurpos([{winnr}])List · position of the cursor
getcursorcharpos([{winnr}])List · character position of the cursor
getcwd([{winnr} [, {tabnr}]])String · get the current working directory
getenv({name})String · return environment variable
getfontname([{name}])String · name of font being used
getfperm({fname})String · file permissions of file {fname}
getfsize({fname})Number · size in bytes of file {fname}
getftime({fname})Number · last modification time of file
getftype({fname})String · description of type of file {fname}
getimstatus()Number · |TRUE| if the IME status is active
getjumplist([{winnr} [, {tabnr}]])List · list of jump list items
getline({lnum})String · line {lnum} of current buffer
getline({lnum}, {end})List · lines {lnum} to {end} of current buffer
getloclist({nr})List · list of location list items
getloclist({nr}, {what})Dict · get specific location list properties
getmarklist([{buf}])List · list of global/local marks
getmatches([{win}])List · list of current matches
getmousepos()Dict · last known mouse position
getmouseshape()String · current mouse shape name
getpid()Number · process ID of Vim
getpos({expr})List · position of cursor, mark, etc.
getqflist()List · list of quickfix items
getqflist({what})Dict · get specific quickfix list properties
getreg([{regname} [, 1 [, {list}]]])String or List · contents of a register
getreginfo([{regname}])Dict · information about a register
getregion({pos1}, {pos2} [, {opts}])List · get the text from {pos1} to {pos2}
getregionpos({pos1}, {pos2} [, {opts}])List · get a list of positions for a region
getregtype([{regname}])String · type of a register
getscriptinfo([{opts}])List · list of sourced scripts
getstacktrace()List · get current stack trace of Vim scripts
gettabinfo([{expr}])List · list of tab pages
gettabvar({nr}, {varname} [, {def}])any · variable {varname} in tab {nr} or {def}
gettabwinvar({tabnr}, {winnr}, {name} [, {def}])any · {name} in {winnr} in tab page {tabnr}
gettagstack([{nr}])Dict · get the tag stack of window {nr}
gettext({text} [, {package}])String · lookup translation of {text}
getwininfo([{winid}])List · list of info about each window
getwinpos([{timeout}])List · X and Y coord in pixels of Vim window
getwinposx()Number · X coord in pixels of the Vim window
getwinposy()Number · Y coord in pixels of the Vim window
getwinvar({nr}, {varname} [, {def}])any · variable {varname} in window {nr}
glob({expr} [, {nosuf} [, {list} [, {alllinks}]]])any · expand file wildcards in {expr}
glob2regpat({expr})String · convert a glob pat into a search pat
globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]])String · do glob({expr}) for all dirs in {path}
has({feature} [, {check}])Number · |TRUE| if feature {feature} supported
has_key({dict}, {key})Number · |TRUE| if {dict} has entry {key}
haslocaldir([{winnr} [, {tabnr}]])Number · |TRUE| if the window executed |:lcd| or |:tcd|
hasmapto({what} [, {mode} [, {abbr}]])Number · |TRUE| if mapping to {what} exists
histadd({history}, {item})Number · add an item to a history
histdel({history} [, {item}])Number · remove an item from a history
histget({history} [, {index}])String · get the item {index} from a history
histnr({history})Number · highest index of a history
hlID({name})Number · syntax ID of highlight group {name}
hlexists({name})Number · |TRUE| if highlight group {name} exists
hlget([{name} [, {resolve}]])List · get highlight group attributes
hlset({list})Number · set highlight group attributes
hostname()String · name of the machine Vim is running on
iconv({expr}, {from}, {to})String · convert encoding of {expr}
id({item})String · get unique identity string of item
indent({lnum})Number · indent of line {lnum}
index({object}, {expr} [, {start} [, {ic}]])Number · index in {object} where {expr} appears
indexof({object}, {expr} [, {opts}]])Number · index in {object} where {expr} is true
input({prompt} [, {text} [, {completion}]])String · get input from the user
inputdialog({prompt} [, {text} [, {cancelreturn}]])String · like input() but in a GUI dialog
inputlist({textlist})Number · let the user pick from a choice list
inputrestore()Number · restore typeahead
inputsave()Number · save and clear typeahead
inputsecret({prompt} [, {text}])String · like input() but hiding the text
insert({object}, {item} [, {idx}])List · insert {item} in {object} [before {idx}]
instanceof({object}, {class})Number · |TRUE| if {object} is an instance of {class}
interrupt()none · interrupt script execution
invert({expr})Number · bitwise invert
isabsolutepath({path})Number · |TRUE| if {path} is an absolute path
isdirectory({directory})Number · |TRUE| if {directory} is a directory
isinf({expr})Number · determine if {expr} is infinity value (positive or negative)
islocked({expr})Number · |TRUE| if {expr} is locked
isnan({expr})Number · |TRUE| if {expr} is NaN
items({expr})List · key/index-value pairs in {expr}
job_getchannel({job})Channel · get the channel handle for {job}
job_info([{job}])Dict · get information about {job}
job_setoptions({job}, {options})none · set options for {job}
job_start({command} [, {options}])Job · start a job
job_status({job})String · get the status of {job}
job_stop({job} [, {how}])Number · stop {job}
join({expr} [, {sep}])String · join items in {expr} into one String
js_decode({string})any · decode JS style JSON
js_encode({expr})String · encode JS style JSON
json_decode({string})any · decode JSON
json_encode({expr})String · encode JSON
keys({dict})List · keys in {dict}
keytrans({string})String · translate internal keycodes to a form that can be used by |:map|
len({expr})Number · the length of {expr}
libcall({lib}, {func}, {arg})String · call {func} in library {lib} with {arg}
libcallnr({lib}, {func}, {arg})Number · idem, but return a Number
line({expr} [, {winid}])Number · line nr of cursor, last line or mark
line2byte({lnum})Number · byte count of line {lnum}
lispindent({lnum})Number · Lisp indent for line {lnum}
list2blob({list})Blob · turn {list} of numbers into a Blob
list2str({list} [, {utf8}])String · turn {list} of numbers into a String
list2tuple({list})Tuple · turn {list} of items into a tuple
listener_add({callback} [, {buf}])Number · add a callback to listen to changes
listener_flush([{buf}])none · invoke listener callbacks
listener_remove({id})none · remove a listener callback
localtime()Number · current time
log({expr})Float · natural logarithm (base e) of {expr}
log10({expr})Float · logarithm of Float {expr} to base 10
luaeval({expr} [, {expr}])any · evaluate |Lua| expression
map({expr1}, {expr2})List/Dict/Blob/String · change each item in {expr1} to {expr2}
maparg({name} [, {mode} [, {abbr} [, {dict}]]])String or Dict · rhs of mapping {name} in mode {mode}
mapcheck({name} [, {mode} [, {abbr}]])String · check for mappings matching {name}
maplist([{abbr}])List · list of all mappings, a dict for each
mapnew({expr1}, {expr2})List/Dict/Blob/String · like |map()| but creates a new List or Dictionary
mapset({mode}, {abbr}, {dict})none · restore mapping from |maparg()| result
match({expr}, {pat} [, {start} [, {count}]])Number · position where {pat} matches in {expr}
matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])Number · highlight {pattern} with {group}
matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])Number · highlight positions with {group}
matcharg({nr})List · arguments of |:match|
matchbufline({buf}, {pat}, {lnum}, {end}, [, {dict})List · all the {pat} matches in buffer {buf}
matchdelete({id} [, {win}])Number · delete match identified by {id}
matchend({expr}, {pat} [, {start} [, {count}]])Number · position where {pat} ends in {expr}
matchfuzzy({list}, {str} [, {dict}])List · fuzzy match {str} in {list}
matchfuzzypos({list}, {str} [, {dict}])List · fuzzy match {str} in {list}
matchlist({expr}, {pat} [, {start} [, {count}]])List · match and submatches of {pat} in {expr}
matchstr({expr}, {pat} [, {start} [, {count}]])String · {count}'th match of {pat} in {expr}
matchstrlist({list}, {pat} [, {dict})List · all the {pat} matches in {list}
matchstrpos({expr}, {pat} [, {start} [, {count}]])List · {count}'th match of {pat} in {expr}
max({expr})Number · maximum value of items in {expr}
menu_info({name} [, {mode}])Dict · get menu item information
min({expr})Number · minimum value of items in {expr}
mkdir({name} [, {flags} [, {prot}]])Number · create directory {name}
mode([{expr}])String · current editing mode
mzeval({expr})any · evaluate |MzScheme| expression
nextnonblank({lnum})Number · line nr of non-blank line >= {lnum}
ngettext({single}, {plural}, {number}[, {domain}])String · translate text based on {number}
nr2char({expr} [, {utf8}])String · single char with ASCII/UTF-8 value {expr}
or({expr}, {expr})Number · bitwise OR
pathshorten({expr} [, {len}])String · shorten directory names in a path
perleval({expr})any · evaluate |Perl| expression
popup_atcursor({what}, {options})Number create popup window near the cursor ·
popup_beval({what}, {options})Number · create popup window for 'ballooneval'
popup_clear()none · close all popup windows
popup_close({id} [, {result}])none · close popup window {id}
popup_create({what}, {options})Number · create a popup window
popup_dialog({what}, {options})Number · create a popup window used as a dialog
popup_filter_menu({id}, {key})Number · filter for a menu popup window
popup_filter_yesno({id}, {key})Number · filter for a dialog popup window
popup_findecho()Number · get window ID of popup for `:echowin`
popup_findinfo()Number · get window ID of info popup window
popup_findpreview()Number · get window ID of preview popup window
popup_getoptions({id})Dict · get options of popup window {id}
popup_getpos({id})Dict · get position of popup window {id}
popup_hide({id})none · hide popup menu {id}
popup_list()List · get a list of window IDs of all popups
popup_locate({row}, {col})Number · get window ID of popup at position
popup_menu({what}, {options})Number · create a popup window used as a menu
popup_move({id}, {options})none · set position of popup window {id}
popup_notification({what}, {options})Number · create a notification popup window
popup_setbuf({id}, {buf})Bool · set the buffer for the popup window {id}
popup_setoptions({id}, {options})none · set options for popup window {id}
popup_settext({id}, {text})none · set the text of popup window {id}
popup_show({id})none · unhide popup window {id}
pow({x}, {y})Float · {x} to the power of {y}
prevnonblank({lnum})Number · line nr of non-blank line <= {lnum}
printf({fmt}, {expr1}...)String · format text
prompt_getprompt({buf})String · get prompt text
prompt_setcallback({buf}, {expr})none · set prompt callback function
prompt_setinterrupt({buf}, {text})none · set prompt interrupt function
prompt_setprompt({buf}, {text})none · set prompt text
prop_add({lnum}, {col}, {props})none · add one text property
prop_add_list({props}, [[{lnum}, {col}, {end-lnum}, {end-col}], ...])none · add multiple text properties
prop_clear({lnum} [, {lnum-end} [, {props}]])none · remove all text properties
prop_find({props} [, {direction}])Dict · search for a text property
prop_list({lnum} [, {props}])List · text properties in {lnum}
prop_remove({props} [, {lnum} [, {lnum-end}]])Number · remove a text property
prop_type_add({name}, {props})none · define a new property type
prop_type_change({name}, {props})none · change an existing property type
prop_type_delete({name} [, {props}])none · delete a property type
prop_type_get({name} [, {props}])Dict · get property type values
prop_type_list([{props}])List · get list of property types
pum_getpos()Dict · position and size of pum if visible
pumvisible()Number · whether popup menu is visible
py3eval({expr} [, {locals}])any · evaluate |python3| expression
pyeval({expr} [, {locals}])any · evaluate |Python| expression
pyxeval({expr} [, {locals}])any · evaluate |python_x| expression
rand([{expr}])Number · get pseudo-random number
range({expr} [, {max} [, {stride}]])List · items from {expr} to {max}
readblob({fname} [, {offset} [, {size}]])Blob · read a |Blob| from {fname}
readdir({dir} [, {expr} [, {dict}]])List · file names in {dir} selected by {expr}
readdirex({dir} [, {expr} [, {dict}]])List · file info in {dir} selected by {expr}
readfile({fname} [, {type} [, {max}]])List · get list of lines from file {fname}
reduce({object}, {func} [, {initial}])any · reduce {object} using {func}
reg_executing()String · get the executing register name
reg_recording()String · get the recording register name
reltime([{start} [, {end}]])List · get time value
reltimefloat({time})Float · turn the time value into a Float
reltimestr({time})String · turn time value into a String
remote_expr({server}, {string} [, {idvar} [, {timeout}]])String · send expression
remote_foreground({server})Number · bring Vim server to the foreground
remote_peek({serverid} [, {retvar}])Number · check for reply string
remote_read({serverid} [, {timeout}])String · read reply string
remote_send({server}, {string} [, {idvar}])String · send key sequence
remote_startserver({name})none · become server {name}
remove({list}, {idx} [, {end}])any/List · remove items {idx}-{end} from {list}
remove({blob}, {idx} [, {end}])Number/Blob · remove bytes {idx}-{end} from {blob}
remove({dict}, {key})any · remove entry {key} from {dict}
rename({from}, {to})Number · rename (move) file from {from} to {to}
repeat({expr}, {count})List/Tuple/Blob/String · repeat {expr} {count} times
resolve({filename})String · get filename a shortcut points to
reverse({obj})List/Tuple/Blob/String · reverse {obj}
round({expr})Float · round off {expr}
rubyeval({expr})any · evaluate |Ruby| expression
screenattr({row}, {col})Number · attribute at screen position
screenchar({row}, {col})Number · character at screen position
screenchars({row}, {col})List · List of characters at screen position
screencol()Number · current cursor column
screenpos({winid}, {lnum}, {col})Dict · screen row and col of a text character
screenrow()Number · current cursor row
screenstring({row}, {col})String · characters at screen position
search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])Number · search for {pattern}
searchcount([{options}])Dict · get or update search stats
searchdecl({name} [, {global} [, {thisblock}]])Number · search for variable declaration
searchpair({start}, {middle}, {end} [, {flags} [, {skip} [...]]])Number · search for other end of start/end pair
searchpairpos({start}, {middle}, {end} [, {flags} [, {skip} [...]]])List · search for other end of start/end pair
searchpos({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])List · search for {pattern}
server2client({clientid}, {string})Number · send reply string
serverlist()String · get a list of available servers
setbufline({buf}, {lnum}, {text})Number · set line {lnum} to {text} in buffer {buf}
setbufvar({buf}, {varname}, {val})none · set {varname} in buffer {buf} to {val}
setcellwidths({list})none · set character cell width overrides
setcharpos({expr}, {list})Number · set the {expr} position to {list}
setcharsearch({dict})Dict · set character search from {dict}
setcmdline({str} [, {pos}])Number · set command-line
setcmdpos({pos})Number · set cursor position in command-line
setcursorcharpos({list})Number · move cursor to position in {list}
setenv({name}, {val})none · set environment variable
setfperm({fname}, {mode})Number · set {fname} file permissions to {mode}
setline({lnum}, {line})Number · set line {lnum} to {line}
setloclist({nr}, {list} [, {action}])Number · modify location list using {list}
setloclist({nr}, {list}, {action}, {what})Number · modify specific location list props
setmatches({list} [, {win}])Number · restore a list of matches
setpos({expr}, {list})Number · set the {expr} position to {list}
setqflist({list} [, {action}])Number · modify quickfix list using {list}
setqflist({list}, {action}, {what})Number · modify specific quickfix list props
setreg({n}, {v} [, {opt}])Number · set register to value and type
settabvar({nr}, {varname}, {val})none · set {varname} in tab page {nr} to {val}
settabwinvar({tabnr}, {winnr}, {varname}, {val})none · set {varname} in window {winnr} in tab page {tabnr} to {val}
settagstack({nr}, {dict} [, {action}])Number · modify tag stack using {dict}
setwinvar({nr}, {varname}, {val})none · set {varname} in window {nr} to {val}
sha256({string})String · SHA256 checksum of {string}
shellescape({string} [, {special}])String · escape {string} for use as shell command argument
shiftwidth([{col}])Number · effective value of 'shiftwidth'
sign_define({name} [, {dict}])Number · define or update a sign
sign_define({list})List · define or update a list of signs
sign_getdefined([{name}])List · get a list of defined signs
sign_getplaced([{buf} [, {dict}]])List · get a list of placed signs
sign_jump({id}, {group}, {buf})Number · jump to a sign
sign_place({id}, {group}, {name}, {buf} [, {dict}])Number · place a sign
sign_placelist({list})List · place a list of signs
sign_undefine([{name}])Number · undefine a sign
sign_undefine({list})List · undefine a list of signs
sign_unplace({group} [, {dict}])Number · unplace a sign
sign_unplacelist({list})List · unplace a list of signs
simplify({filename})String · simplify filename as much as possible
sin({expr})Float · sine of {expr}
sinh({expr})Float · hyperbolic sine of {expr}
slice({expr}, {start} [, {end}])String, List or Blob · slice of a String, List or Blob
sort({list} [, {how} [, {dict}]])List · sort {list}, compare with {how}
sound_clear()none · stop playing all sounds
sound_playevent({name} [, {callback}])Number · play an event sound
sound_playfile({path} [, {callback}])Number · play sound file {path}
sound_stop({id})none · stop playing sound {id}
soundfold({word})String · sound-fold {word}
spellbadword()String · badly spelled word at cursor
spellsuggest({word} [, {max} [, {capital}]])List · spelling suggestions
split({expr} [, {pat} [, {keepempty}]])List · make |List| from {pat} separated {expr}
sqrt({expr})Float · square root of {expr}
srand([{expr}])List · get seed for |rand()|
state([{what}])String · current state of Vim
str2blob({list} [, {options}])Blob · convert list of strings into a Blob
str2float({expr} [, {quoted}])Float · convert String to Float
str2list({expr} [, {utf8}])List · convert each character of {expr} to ASCII/UTF-8 value
str2nr({expr} [, {base} [, {quoted}]])Number · convert String to Number
strcharlen({expr})Number · character length of the String {expr}
strcharpart({str}, {start} [, {len} [, {skipcc}]])String · {len} characters of {str} at character {start}
strchars({expr} [, {skipcc}])Number · character count of the String {expr}
strdisplaywidth({expr} [, {col}])Number display length of the String {expr} ·
strftime({format} [, {time}])String · format time with a specified format
strgetchar({str}, {index})Number · get char {index} from {str}
stridx({haystack}, {needle} [, {start}])Number · index of {needle} in {haystack}
string({expr})String · String representation of {expr} value
strlen({expr})Number · length of the String {expr}
strpart({str}, {start} [, {len} [, {chars}]])String · {len} bytes/chars of {str} at byte {start}
strptime({format}, {timestring})Number · Convert {timestring} to unix timestamp
strridx({haystack}, {needle} [, {start}])Number · last index of {needle} in {haystack}
strtrans({expr})String · translate string to make it printable
strutf16len({string} [, {countcc}])Number · number of UTF-16 code units in {string}
strwidth({expr})Number · display cell length of the String {expr}
submatch({nr} [, {list}])String or List · specific match in ":s" or substitute()
substitute({expr}, {pat}, {sub}, {flags})String · all {pat} in {expr} replaced with {sub}
swapfilelist()List · swap files found in 'directory'
swapinfo({fname})Dict · information about swap file {fname}
swapname({buf})String · swap file of buffer {buf}
synID({lnum}, {col}, {trans})Number · syntax ID at {lnum} and {col}
synIDattr({synID}, {what} [, {mode}])String · attribute {what} of syntax ID {synID}
synIDtrans({synID})Number · translated syntax ID of {synID}
synconcealed({lnum}, {col})List · info about concealing
synstack({lnum}, {col})List · stack of syntax IDs at {lnum} and {col}
system({expr} [, {input}])String · output of shell command/filter {expr}
systemlist({expr} [, {input}])List · output of shell command/filter {expr}
tabpagebuflist([{arg}])List · list of buffer numbers in tab page
tabpagenr([{arg}])Number · number of current or last tab page
tabpagewinnr({tabarg} [, {arg}])Number · number of current window in tab page
tagfiles()List · tags files used
taglist({expr} [, {filename}])List · list of tags matching {expr}
tan({expr})Float · tangent of {expr}
tanh({expr})Float · hyperbolic tangent of {expr}
tempname()String · name for a temporary file
term_dumpdiff({filename}, {filename} [, {options}])Number · display difference between two dumps
term_dumpload({filename} [, {options}])Number · displaying a screen dump
term_dumpwrite({buf}, {filename} [, {options}])none · dump terminal window contents
term_getaltscreen({buf})Number · get the alternate screen flag
term_getansicolors({buf})List · get ANSI palette in GUI color mode
term_getattr({attr}, {what})Number · get the value of attribute {what}
term_getcursor({buf})List · get the cursor position of a terminal
term_getjob({buf})Job · get the job associated with a terminal
term_getline({buf}, {row})String · get a line of text from a terminal
term_getscrolled({buf})Number · get the scroll count of a terminal
term_getsize({buf})List · get the size of a terminal
term_getstatus({buf})String · get the status of a terminal
term_gettitle({buf})String · get the title of a terminal
term_gettty({buf}, [{input}])String · get the tty name of a terminal
term_list()List · get the list of terminal buffers
term_scrape({buf}, {row})List · get row of a terminal screen
term_sendkeys({buf}, {keys})none · send keystrokes to a terminal
term_setansicolors({buf}, {colors})none · set ANSI palette in GUI color mode
term_setapi({buf}, {expr})none · set |terminal-api| function name prefix
term_setkill({buf}, {how})none · set signal to stop job in terminal
term_setrestore({buf}, {command})none · set command to restore terminal
term_setsize({buf}, {rows}, {cols})none · set the size of a terminal
term_start({cmd} [, {options}])Number · open a terminal window and run a job
term_wait({buf} [, {time}])Number · wait for screen to be updated
terminalprops()Dict · properties of the terminal
test_alloc_fail({id}, {countdown}, {repeat})none · make memory allocation fail
test_autochdir()none · enable 'autochdir' during startup
test_feedinput({string})none · add key sequence to input buffer
test_garbagecollect_now()none · free memory right now for testing
test_garbagecollect_soon()none · free memory soon for testing
test_getvalue({string})any · get value of an internal variable
test_gui_event({event}, {args})bool · generate a GUI event for testing
test_ignore_error({expr})none · ignore a specific error
test_mswin_event({event}, {args})bool · generate MS-Windows event for testing
test_null_blob()Blob · null value for testing
test_null_channel()Channel · null value for testing
test_null_dict()Dict · null value for testing
test_null_function()Funcref · null value for testing
test_null_job()Job · null value for testing
test_null_list()List · null value for testing
test_null_partial()Funcref · null value for testing
test_null_string()String · null value for testing
test_null_tuple()Tuple · null value for testing
test_option_not_set({name})none · reset flag indicating option was set
test_override({expr}, {val})none · test with Vim internal overrides
test_refcount({expr})Number · get the reference count of {expr}
test_setmouse({row}, {col})none · set the mouse position for testing
test_settime({expr})none · set current time for testing
test_srand_seed([{seed}])none · set seed for testing srand()
test_unknown()any · unknown value for testing
test_void()any · void value for testing
timer_info([{id}])List · information about timers
timer_pause({id}, {pause})none · pause or unpause a timer
timer_start({time}, {callback} [, {options}])Number · create a timer
timer_stop({timer})none · stop a timer
timer_stopall()none · stop all timers
tolower({expr})String · the String {expr} switched to lowercase
toupper({expr})String · the String {expr} switched to uppercase
tr({src}, {fromstr}, {tostr})String · translate chars of {src} in {fromstr} to chars in {tostr}
trim({text} [, {mask} [, {dir}]])String · trim characters in {mask} from {text}
trunc({expr})Float · truncate Float {expr}
tuple2list({tuple})List · turn {tuple} of items into a list
type({expr})Number · type of value {expr}
typename({expr})String · representation of the type of {expr}
undofile({name})String · undo file name for {name}
undotree([{buf}])List · undo file tree for buffer {buf}
uniq({list} [, {func} [, {dict}]])List · remove adjacent duplicates from a list
uri_decode({string})String · URI-decode a string
uri_encode({string})String · URI-encode a string
utf16idx({string}, {idx} [, {countcc} [, {charidx}]])Number · UTF-16 index of byte {idx} in {string}
values({dict})List · values in {dict}
virtcol({expr} [, {list} [, {winid}])Number or List · screen column of cursor or mark
virtcol2col({winid}, {lnum}, {col})Number · byte index of a character on screen
visualmode([{expr}])String · last visual mode used
wildmenumode()Number · whether 'wildmenu' mode is active
wildtrigger()Number · start wildcard expansion
win_execute({id}, {command} [, {silent}])String · execute {command} in window {id}
win_findbuf({bufnr})List · find windows containing {bufnr}
win_getid([{win} [, {tab}]])Number · get window ID for {win} in {tab}
win_gettype([{nr}])String · type of window {nr}
win_gotoid({expr})Number · go to window with ID {expr}
win_id2tabwin({expr})List · get tab and window nr from window ID
win_id2win({expr})Number · get window nr from window ID
win_move_separator({nr})Number · move window vertical separator
win_move_statusline({nr})Number · move window status line
win_screenpos({nr})List · get screen position of window {nr}
win_splitmove({nr}, {target} [, {options}])Number · move window {nr} to split of {target}
winbufnr({nr})Number · buffer number of window {nr}
wincol()Number · window column of the cursor
windowsversion()String · MS-Windows OS version
winheight({nr})Number · height of window {nr}
winlayout([{tabnr}])List · layout of windows in tab {tabnr}
winline()Number · window line of the cursor
winnr([{expr}])Number · number of current window
winrestcmd()String · returns command to restore window sizes
winrestview({dict})none · restore view of current window
winsaveview()Dict · save view of current window
winwidth({nr})Number · width of window {nr}
wordcount()Dict · get byte/char/word statistics
writefile({object}, {fname} [, {flags}])Number · write |Blob| or |List| of lines to file
xor({expr}, {expr})Number · bitwise XOR

Autocommand Events

119

Every event :autocmd can hook

BufDeleteBefore deleting a buffer from the buffer list.
BufEnterAfter entering a buffer. Useful for setting
BufFilePostAfter changing the name of the current buffer
BufFilePreBefore changing the name of the current buffer
BufHiddenJust before a buffer becomes hidden. That is,
BufLeaveBefore leaving to another buffer. Also when
BufNewJust after creating a new buffer. Also used
BufNewFileWhen starting to edit a file that doesn't
BufReadCmdBefore starting to edit a new buffer. Should
BufReadPreWhen starting to edit a new buffer, before
BufUnloadBefore unloading a buffer. This is when the
BufWinEnterAfter a buffer is displayed in a window. This
BufWinLeaveBefore a buffer is removed from a window.
BufWipeoutBefore completely deleting a buffer. The
BufWriteCmdBefore writing the whole buffer to a file.
BufWritePostAfter writing the whole buffer to a file
CmdUndefinedWhen a user command is used but it isn't
CmdlineChangedAfter a change was made to the text in the
CmdlineEnterAfter moving the cursor to the command line,
CmdlineLeaveBefore leaving the command line; including
CmdlineLeavePreJust before leaving the command line, and
CmdwinEnterAfter entering the command-line window.
CmdwinLeaveBefore leaving the command-line window.
ColorSchemeAfter loading a color scheme. |:colorscheme|
ColorSchemePreBefore loading a color scheme. |:colorscheme|
CompleteChanged*CompleteChanged*
CompleteDonePreAfter Insert mode completion is done. Either
CompleteDoneAfter Insert mode completion is done. Either
CursorHoldWhen the user doesn't press a key for the time
CursorHoldIJust like CursorHold, but in Insert mode.
CursorMovedAfter the cursor was moved in Normal or Visual
CursorMovedCAfter the cursor was moved in the command
CursorMovedIAfter the cursor was moved in Insert mode.
DiffUpdatedAfter diffs have been updated. Depending on
DirChangedPreThe working directory is going to be changed,
DirChangedThe working directory has changed in response
EncodingChangedFires off after the 'encoding' option has been
ExitPreWhen using `:quit`, `:wq` in a way it makes
FileAppendCmdBefore appending to a file. Should do the
FileAppendPostAfter appending to a file.
FileAppendPreBefore appending to a file. Use the '[ and ']
FileChangedROBefore making the first change to a read-only
FileChangedShellWhen Vim notices that the modification time of
FileChangedShellPostAfter handling a file that was changed outside
FileEncodingObsolete. It still works and is equivalent
FileReadCmdBefore reading a file with a ":read" command.
FileReadPostAfter reading a file with a ":read" command.
FileReadPreBefore reading a file with a ":read" command.
FileTypeWhen the 'filetype' option has been set. The
FileWriteCmdBefore writing to a file, when not writing the
FileWritePostAfter writing to a file, when not writing the
FileWritePreBefore writing to a file, when not writing the
FilterReadPostAfter reading a file from a filter command.
FilterReadPreBefore reading a file from a filter command.
FilterWritePostAfter writing a file for a filter command or
FilterWritePreBefore writing a file for a filter command or
FocusGainedWhen Vim got input focus. Only for the GUI
FocusLostWhen Vim lost input focus. Only for the GUI
FuncUndefinedWhen a user function is used but it isn't
GUIEnterAfter starting the GUI successfully, and after
GUIFailedAfter starting the GUI failed. Vim may
InsertChangeWhen typing <Insert> while in Insert or
InsertCharPreWhen a character is typed in Insert mode,
InsertEnterJust before starting Insert mode. Also for
InsertLeavePreJust before leaving Insert mode. Also when
InsertLeaveJust after leaving Insert mode. Also when
KeyInputPreJust before a key is processed after mappings
MenuPopupJust before showing the popup menu (under the
ModeChangedAfter changing the mode. The pattern is
OptionSetAfter setting an option. The pattern is
QuickFixCmdPreBefore a quickfix command is run (|:make|,
QuickFixCmdPostLike QuickFixCmdPre, but after a quickfix
QuitPreWhen using `:quit`, `:wq` or `:qall`, before
RemoteReplyWhen a reply from a Vim that functions as
SafeStateWhen nothing is pending, going to wait for the
SafeStateAgainLike SafeState but after processing any
SessionLoadPostAfter loading the session file created using
SessionWritePostAfter writing a session file by calling
ShellCmdPostAfter executing a shell command with |:!cmd|,
ShellFilterPostAfter executing a shell command with
SourcePreBefore sourcing a Vim script. |:source|
SourcePostAfter sourcing a Vim script. |:source|
SourceCmdWhen sourcing a Vim script. |:source|
SpellFileMissingWhen trying to load a spell checking file and
StdinReadPostAfter reading from the stdin into the buffer,
StdinReadPreBefore reading from stdin into the buffer.
SwapExistsDetected an existing swap file when starting
SyntaxWhen the 'syntax' option has been set. The
TabClosedAfter closing a tab page.
TabClosedPreBefore closing a tab page. The window layout
TabEnterJust after entering a tab page. |tab-page|
TabLeaveJust before leaving a tab page. |tab-page|
TabNewWhen a tab page was created. |tab-page|
TermChangedAfter the value of 'term' has changed. Useful
TerminalOpenJust after a terminal buffer was created, with
TerminalWinOpenJust after a terminal buffer was created, with
TermResponseAfter the response to |t_RV| is received from
TermResponseAllAfter the response to |t_RV|, |t_RC|, |t_RS|,
TextChangedAfter a change was made to the text in the
TextChangedIAfter a change was made to the text in the
TextChangedPAfter a change was made to the text in the
TextChangedTAfter a change was made to the text in the
TextYankPostAfter text has been yanked or deleted in the
UserNever executed automatically. To be used for
SigUSR1After the SIGUSR1 signal has been detected.
UserGettingBoredWhen the user presses the same key 42 times.
VimEnterAfter doing all the startup stuff, including
VimLeaveBefore exiting Vim, just after writing the
VimLeavePreBefore exiting Vim, just before writing the
VimResizedAfter the Vim window was resized, thus 'lines'
VimResumeWhen the Vim instance is resumed after being
VimSuspendWhen the Vim instance is suspended. Only when
WinClosedWhen closing a window, just before it is
WinEnterAfter entering another window. Not done for
WinLeaveBefore leaving a window. If the window to be
WinNewPreBefore creating a new window. Triggered
WinNewWhen a new window was created. Not done for
WinScrolledAfter any window in the current tab page
WinResizedAfter a window in the current tab page changed

Starting Vim

22

Command-line arguments, files and paths

vim {file}...open files as the argument list
vim +{n} {file}open at line n; + alone means the last line
vim +/{pat} {file}open at the first match of pat
vim -c {cmd} / -S {file}run an ex command / source a script after loading
vim -u {vimrc}use this vimrc instead of the usual ones
vim --cleanno vimrc, no plugins, no viminfo, defaults on
vim --nopluginread the vimrc but skip plugin loading
vim -R / viewread-only mode
vim -d f1 f2 / vimdiffdiff mode
vim -o {n} / -O / -popen files in horizontal splits / vertical splits / tabs
vim -bbinary mode
vim -xedit an encrypted file
vim -es / -Essilent ex / silent improved-ex mode — scripting
vim --startuptime {file}log startup timings
vim --versionversion, patches and the feature list
vim --remote-send / --servernamedrive a running Vim from another process
$MYVIMRCpath of the vimrc that was actually read
~/.vimrcuser vimrc on macOS and Linux
~\_vimrcuser vimrc on Windows
~/.vim/ · ~\vimfiles\the user runtime directory
:versionthe same information from inside Vim
:h {subject}the help — the only reference that is always right