How do I get syntax highlighting and indentation for every language in Vim without configuring each one?
The vim-polyglot plugin is a curated collection of language packs for Vim that provides syntax highlighting, indentation, filetype detection, and compiler suppo
category:
plugins
tags:
#plugins
#polyglot
#syntax
#languages
#filetype
How do I set a different statusline for a specific buffer or window?
:setlocal statusline=%f\ %m\ %y\ [%l/%L]
The :setlocal statusline command lets you override the global statusline for a specific window.
category:
config
tags:
#config
#statusline
#ex-commands
#buffers
How do I open a file by name without knowing its full path?
The :find command searches for a file by name across all directories listed in Vim's path option, so you can open files without typing full paths.
category:
navigation
tags:
#navigation
#ex-commands
#buffers
#editing
How do I increment or decrement a number under the cursor?
Pressing increments and decrements the number under or after the cursor.
category:
editing
tags:
#editing
#numbers
#normal-mode
#increment
How do I match a pattern only when it is preceded or followed by another pattern using Vim regex?
Vim's regex engine supports zero-width lookahead and lookbehind assertions using the \@ atom.
category:
search
tags:
#search
#regex
#normal-mode
#ex-commands
How do I access and manipulate the last search pattern as a register?
Vim stores the last search pattern in the special / register.
category:
registers
tags:
#registers
#search
#command-line
How do I search for a pattern only on a specific line number or at a specific column position?
Vim's \%l and \%c pattern atoms anchor a search to a particular line number or column, enabling surgical searches and substitutions that standard regex cannot e
category:
search
tags:
#search
#regex
#ex-commands
How do I force a case-sensitive or case-insensitive search for just one pattern without changing my settings?
Vim's \C and \c atoms let you override ignorecase and smartcase on a per-pattern basis.
category:
search
tags:
#search
#normal-mode
#ex-commands
How do I quickly convert between snake_case, camelCase, and other naming conventions in Vim?
Tim Pope's vim-abolish plugin provides cr (coerce) commands that instantly convert the word under the cursor between common naming conventions.
category:
plugins
tags:
#editing
#plugins
#formatting
#normal-mode
How do I convert the entire current line to lowercase or uppercase in one command?
Vim's case operators gu (lowercase) and gU (uppercase) follow the same doubling convention as dd and yy: repeating the operator letter applies it to the whole c
category:
editing
tags:
#editing
#normal-mode
How do I run an Ex command without changing the current search pattern?
Many Ex commands silently overwrite the search register (@/), which changes your hlsearch highlighting and n/N behavior.
category:
command-line
tags:
#ex-commands
#search
#command-line
How do I debug a macro by stepping through it command by command?
:let g:debug_macro=1 | normal @a
When a macro doesn't work as expected, debugging it step by step is essential.
category:
macros
tags:
#macros
#debugging
#troubleshooting
#registers
How do I look up documentation for the keyword under the cursor?
Pressing K in normal mode runs a lookup program on the word under the cursor.
category:
navigation
tags:
#navigation
#help
#documentation
#normal-mode
#keywordprg
How do I count how many times a pattern appears in a file without making any changes?
The n flag on the substitute command makes it report the match count without actually performing any replacement.
category:
search
tags:
#search
#ex-commands
#editing
How do I programmatically set the contents of a register from the command line?
The :let @{reg} = expr command lets you assign any string or expression directly into a named register without entering insert mode or performing a yank.
category:
registers
tags:
#registers
#ex-commands
#macros
#normal-mode
How do I turn a visual selection of lines into a numbered list?
:s/^/\=line('.') - line("'<") + 1 . '. '/
When you need to quickly number a set of lines — such as TODO items, steps, or bullet points — you can use a visual selection combined with a substitution e
category:
visual-mode
tags:
#visual-mode
#editing
#ex-commands
#formatting
#substitute
How do I open a file and jump directly to a specific line or pattern?
The :edit command accepts a +{cmd} prefix that executes an Ex command immediately after the file is loaded.
category:
command-line
tags:
#buffers
#ex-commands
#navigation
#command-line
How do I search case-insensitively in Vim without changing global settings?
How it works By default, Vim searches are case-sensitive: /Hello will not match hello or HELLO.
category:
search
tags:
#search
#normal-mode
#ex-commands
How do I increment or decrement hexadecimal and binary numbers with Ctrl-A and Ctrl-X?
By default, Vim's and only increment and decrement decimal numbers.
category:
config
tags:
#editing
#config
#normal-mode
How do I re-insert the text I typed in the previous insert session?
While in insert mode, pressing re-inserts the exact text you typed during your previous insert session.
category:
editing
tags:
#insert-mode
#editing
#registers