How do I scroll the view horizontally by half a screen width in Vim?
zH and zL scroll the viewport horizontally by half a screen width, letting you navigate wide content efficiently when wrap is disabled.
category:
navigation
tags:
#navigation
#scrolling
#horizontal
#nowrap
#motions
How do I delete all blank and whitespace-only lines from a file in Vim?
The global command :g/^\s$/d removes every line that is empty or contains only whitespace — a common cleanup task when tidying up code, configuration files, o
category:
command-line
tags:
#editing
#ex-commands
#search
#command-line
How do I perform a non-greedy (minimal) match in Vim search?
How it works In most regex engines, ? or +? make quantifiers non-greedy (matching as little as possible).
category:
search
tags:
#search
#normal-mode
#ex-commands
How do I quickly evaluate and print a Lua expression in Neovim without calling print()?
In Neovim, prefixing a Lua expression with = on the :lua command line evaluates it and pretty-prints the result using vim.
category:
command-line
tags:
#command-line
#ex-commands
How do I paste a register's content in Insert mode without Vim adjusting the indentation?
The standard {reg} pastes register contents in Insert mode, but Vim may auto-indent multi-line text to match the current indentation level — sometimes manglin
category:
registers
tags:
#registers
#insert-mode
#editing
How do I run a macro or command on every entry in the location list?
:ldo runs an Ex command on each entry in the location list — the buffer-local cousin of the quickfix list.
category:
macros
tags:
#macros
#ex-commands
#editing
How do I override ignorecase or smartcase for a single search without changing my settings?
Vim's \c and \C flags let you force a search to be case-insensitive or case-sensitive on a per-search basis, regardless of your ignorecase and smartcase setting
category:
search
tags:
#search
#normal-mode
#ex-commands
How do I open quickfix at the bottom with a fixed height and keep cursor focus in my editing window?
:botright copen 8 | wincmd p
Quickfix is powerful, but opening it can disrupt window layout and yank focus away from your current editing context.
category:
buffers-windows
tags:
#buffers
#windows
#quickfix
#command-line
How do I make buffer-jump commands reuse an existing tab before opening a new one?
:set switchbuf=usetab,newtab
When you jump to buffers from quickfix, tags, or command-line completions, Vim's default window selection can feel unpredictable.
category:
buffers-windows
tags:
#buffers
#windows
#tabs
#quickfix
#navigation
How do I jump to a literal search target without adding jump-list noise?
:keepjumps normal! /\Vtarget\<CR>
Repeated navigational searches can pollute the jump list, especially when you are doing targeted inspections before returning to your main edit location.
category:
navigation
tags:
#navigation
#search
#jumplist
#normal-mode
#workflow
How do I refer to the matched text in a Vim substitution replacement?
In a Vim substitution, & in the replacement string expands to the entire matched text.
category:
search
tags:
#search
#ex-commands
#editing
How do I run a Vim command in sandbox mode to prevent side effects?
Vim's sandbox mode restricts what a command can do, preventing it from executing shell commands, writing files, or modifying certain settings.
category:
command-line
tags:
#command-line
#security
#sandbox
#safety
How do I programmatically remove or unmap a keybinding in Neovim Lua without knowing its original definition?
vim.
category:
config
tags:
#config
#neovim
#mappings
#lsp
#normal-mode
How do I run a substitute command on every file in the quickfix list at once?
:cfdo %s/old/new/ge | update
When you grep across your project and want to perform a search-and-replace on every file that matched, :cfdo is the most efficient approach.
category:
command-line
tags:
#quickfix
#substitute
#search
#ex-commands
#editing
How do I insert a blank line above or below the current line without entering insert mode?
Using :put ='' with an empty expression lets you insert blank lines in normal mode without ever entering insert mode.
category:
editing
tags:
#editing
#normal-mode
#ex-commands
#expression-register
#blank-line
How do I jump to a specific column number on the current line?
The command (pipe character) moves the cursor to a specific column number on the current line.
category:
navigation
tags:
#navigation
#motions
#columns
#normal-mode
How do I select a word under the cursor in visual mode?
How it works The command viw selects the word under the cursor in visual mode.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#navigation
How do I jump to a definition-style pattern match using Vim's define search?
:djump searches for matches using Vim's definition search rules and jumps to the selected hit.
category:
navigation
tags:
#navigation
#search
#definitions
#command-line
How do I convert between tabs and spaces in a visual selection?
The :retab! command converts between tabs and spaces based on your expandtab setting.
category:
visual-mode
tags:
#visual-mode
#indentation
#tabs
#whitespace
How do I change the case of matched text in a substitute?
Vim provides case-conversion atoms in substitute replacements: \u uppercases the next character, \l lowercases it, \U uppercases until \e, and \L lowercases unt
category:
search
tags:
#search
#editing
#ex-commands