How do I set up filetype-specific documentation lookup for the K key in Vim?
:autocmd FileType python setlocal keywordprg=pydoc3
The K command looks up the word under the cursor using the program defined by keywordprg (default: man).
Search Vim Tricks
Searching...:autocmd FileType python setlocal keywordprg=pydoc3
The K command looks up the word under the cursor using the program defined by keywordprg (default: man).
<C-x><C-t>
Vim's insert-mode completion includes a thesaurus mode triggered by .
:set wildcharm=<C-z>
The wildchar option (default ) triggers wildcard completion interactively on the command line.
:set synmaxcol=200
The synmaxcol option tells Vim the maximum column up to which it will apply syntax highlighting on each line.
:norm! {command}
:normal {command} runs a sequence of Normal mode keystrokes from the command line (or a range of lines with :%normal), but it applies your custom key mappings.
command-line #ex-commands #macros #normal-mode #command-line
1z=
The z= command opens an interactive numbered menu of spelling corrections for the word under the cursor, requiring you to type a number and press Enter.
:tabmove +1
:tabmove normally takes an absolute position (:tabmove 0 moves the tab to the far left), but it also accepts relative offsets using + and -.
]c and [c
When files are open in Vim's built-in diff mode — whether via vimdiff, :diffsplit, or :diffthis — the ]c and [c motions let you jump precisely between chang
:set winbar=%f
Neovim 0.
:set cursorbind
:set cursorbind (or :setlocal cursorbind) locks the cursor's column position so it moves in sync across all windows that have cursorbind enabled.
:g/^$/,/./-j
The command :g/^$/,/.
g<
Pressing g or q to dismiss it again Example Tips :messages also shows recent messages (and those accumulate across the session), while g< only shows the last pa
<C-x><C-e> and <C-x><C-y>
While in insert mode, scrolls the window up one line and scrolls it down one line — all without leaving insert mode.
zg
When Vim's spell checker flags a technical term, proper noun, or project-specific identifier as misspelled, you can permanently silence it with zg ("mark as goo
:set wildmode=list:longest,full
Vim's default Tab completion in the command-line cycles through matches one at a time, making it hard to see all available options at once.
:set softtabstop=4
When expandtab is enabled, Vim inserts spaces instead of a real tab character, but without softtabstop, Backspace only deletes one space at a time — not a ful
zR and zM
When working with a heavily folded file, manually opening or closing each fold is tedious.
<C-x><C-u>
Vim's invokes a user-defined completion function, letting you plug any completion logic you want into the standard insert-mode completion popup.
:call matchadd('ErrorMsg', 'TODO')
matchadd() lets you highlight arbitrary patterns using any highlight group — without touching the search register or search highlighting.
<C-x><C-i>
Vim's completion mode searches for keyword matches not just in the current buffer, but also in all files reachable via include directives (e.