What is the difference between \n and \r in Vim substitution patterns and replacements?
One of the most confusing asymmetries in Vim's substitution syntax: \n and \r mean different things depending on whether they appear in the pattern or the repla
category:
search
tags:
#search
#ex-commands
#editing
How do I toggle common Vim options like spell, wrap, and number with single keystrokes using vim-unimpaired?
The vim-unimpaired plugin adds a set of paired bracket mappings, including a powerful family of option toggles.
category:
plugins
tags:
#config
#plugins
#editing
How do I use a macro to wrap each word in quotes?
How it works This macro wraps the current word in double quotes and moves to the next word, making it easy to repeat across a line or file.
category:
macros
tags:
#macros
#editing
#normal-mode
#insert-mode
How do I sort only a visual selection using a fixed virtual column as the key?
When lines contain aligned columns, plain :sort often gives the wrong order because it compares from column 1.
category:
visual-mode
tags:
#visual-mode
#sorting
#text-processing
#command-line
How do I jump to the start or end of a C-style comment block?
Vim provides two motions for navigating C-style block comments (/ .
category:
navigation
tags:
#navigation
#motions
#comments
#normal-mode
How do I add blank lines above or below the current line using vim-unimpaired?
vim-unimpaired (by Tim Pope) provides paired bracket mappings for dozens of common operations.
category:
plugins
tags:
#editing
#normal-mode
How do I make % jump between HTML tags and block-level keywords like if/end?
The matchit plugin ships with Vim and Neovim but is not enabled by default.
category:
plugins
tags:
#navigation
#plugins
#text-objects
#editing
How do I match an optional sequence of characters at the end of a word in a Vim regex?
The \%[.
category:
search
tags:
#search
#regex
#normal-mode
How do I keep folds and viewport context when navigating jumps in Neovim?
:set jumpoptions=stack,view
By default, jump navigation can feel lossy in long files: you jump back, but folds, topline, and viewport context do not always match what you were looking at b
category:
config
tags:
#config
#navigation
#jumps
#workflow
How do I quickly change surrounding quotes, brackets, or tags in Vim?
The vim-surround plugin by Tim Pope lets you change any surrounding delimiter pair with a single cs command.
category:
plugins
tags:
#plugins
#surround
#editing
#text-objects
#normal-mode
How do I search for a second pattern relative to where the first one matched?
Vim's search offsets allow chaining two patterns together with a semicolon.
category:
search
tags:
#search
#navigation
#normal-mode
How do I add more steps to an existing macro without re-recording it from scratch?
When you record a macro into register q with qq.
category:
macros
tags:
#macros
#registers
#recording
#editing
How do I jump to the beginning of the next word?
The w command moves the cursor forward to the beginning of the next word.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I run commands without disturbing my marks?
Many Ex commands silently adjust or delete marks as a side effect of modifying buffer content.
category:
editing
tags:
#editing
#marks
#ex-commands
#scripting
How do I run a search-and-replace across all files in my argument list and only save changed buffers?
:argdo %s/\<old\>/new/ge | update
When you need to apply the same substitution across a curated set of files, :argdo is safer than a broad project-wide command.
category:
command-line
tags:
#command-line
#ex-commands
#search
#buffers
#formatting
How do I navigate quickfix entries, buffers, and conflicts with consistent bracket mappings?
The vim-unimpaired plugin (by Tim Pope) provides a consistent [x / ]x mnemonic for navigating any list-like structure in Vim.
category:
plugins
tags:
#navigation
#buffers
#macros
#ex-commands
How do I open or close folds one level at a time across the entire file?
The zr and zm commands let you incrementally adjust the global fold depth across the entire buffer — one level at a time.
category:
editing
tags:
#folding
#navigation
#normal-mode
How do I list all buffers including unlisted ones like help pages and terminal buffers?
:ls (or :buffers) shows Vim's buffer list, but it hides unlisted buffers — help files, directory listings (netrw), terminal buffers, and scratch buffers marke
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
How do I cycle through all lowercase marks in the current file sequentially?
The ]' command jumps to the start of the line containing the next lowercase mark in the file, while [' jumps to the previous one.
category:
navigation
tags:
#navigation
#marks
#normal-mode
How do I insert the current date or time into the buffer using Vim's built-in expression evaluation?
:put =strftime('%Y-%m-%d')
The :put = command inserts the result of a Vimscript expression directly into the buffer as a new line.
category:
editing
tags:
#editing
#ex-commands
#registers
#insert-mode