How do I move all lines matching a pattern to the end of the file in Vim?
The :g (global) command combined with :m (move) lets you collect all lines matching a pattern and relocate them to a specific position in the file.
category:
command-line
tags:
#ex-commands
#editing
#global
#search
#formatting
How do I do a case-preserving search and replace across different naming conventions?
:%Subvert/old{,s}/new{,s}/g
Tim Pope's vim-abolish plugin provides the :Subvert command (aliased as :S), which performs substitutions that automatically preserve case variants and handle p
category:
plugins
tags:
#plugins
#substitution
#editing
#ex-commands
#search
How do I copy or transfer text between Vim registers?
Vim's :let @{reg} syntax lets you read from one register and write to another.
category:
registers
tags:
#registers
#ex-commands
#editing
#command-line
How do I filter the output of an Ex command to show only matching lines?
:filter /pattern/ command
The :filter command restricts the output of another Ex command to only lines matching a given pattern.
category:
command-line
tags:
#ex-commands
#command-line
#search
#buffers
How do I move the cursor to the other end of a Visual selection in Vim?
When you make a Visual selection in Vim, the cursor sits at one end while the other end is anchored.
category:
visual-mode
tags:
#visual-mode
#editing
#navigation
#motions
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 cycle through previously deleted text using numbered registers?
"1p then u then . to cycle
Vim stores your last 9 deletions in numbered registers "1 through "9.
category:
registers
tags:
#registers
#editing
#undo-redo
#delete
#paste
How do I preview a tag definition in a preview window using :ptag?
The :ptag command opens a tag definition in a small preview window at the top of the screen, letting you read the definition without losing your place in the cu
category:
buffers-windows
tags:
#buffers
#windows
#tags
#preview
#navigation
How do I automatically equalize window sizes when the terminal is resized?
:autocmd WinResized * wincmd =
When you resize your terminal window, Vim's split layout can become unbalanced.
category:
buffers-windows
tags:
#buffers-windows
#autocmd
#resize
#layout
How do I prevent a split window from being resized by Vim?
When you have a specific window you want to keep at a fixed size — like a terminal, log viewer, or reference file — winfixheight and winfixwidth prevent Vim
category:
buffers-windows
tags:
#buffers-windows
#windows
#resize
#layout
How do I create a floating window in Neovim?
:lua vim.api.nvim_open_win(0, true, {relative='editor', width=80, height=20, row=5, col=10})
Neovim's floating windows hover above the main layout, creating popup-like UI elements.
category:
buffers-windows
tags:
#buffers-windows
#floating
#neovim
#api
How do I preview quickfix entries without leaving the quickfix window?
The preview window shows file contents temporarily without switching your editing context.
category:
buffers-windows
tags:
#buffers-windows
#quickfix
#preview
#navigation
How do I rotate or swap window positions in Vim?
Vim provides commands to rotate windows within a row or column, and to swap the current window with another.
category:
buffers-windows
tags:
#buffers-windows
#windows
#rotate
#layout
How do I progressively expand or contract a visual selection by text objects?
In visual mode, repeating text object motions progressively expands the selection.
category:
visual-mode
tags:
#visual-mode
#text-objects
#selection
#motions
How do I indent lines multiple times without reselecting in visual mode?
Normally, pressing > in visual mode indents the selection but exits visual mode, requiring you to press gv to reselect.
category:
visual-mode
tags:
#visual-mode
#indentation
#mapping
#editing
How do I yank a visual selection to a specific named register?
Using named registers with visual mode lets you store multiple independent snippets simultaneously.
category:
visual-mode
tags:
#visual-mode
#registers
#yank
#clipboard
How do I see a live preview of substitutions as I type in Neovim?
Neovim's inccommand option provides real-time visual feedback as you type substitution commands.
category:
visual-mode
tags:
#visual-mode
#substitute
#neovim
#preview
How do I replace a visual block selection with digraph or special characters?
Visual block mode combined with the replace command and digraph input lets you replace a column of characters with special Unicode characters.
category:
visual-mode
tags:
#visual-mode
#digraph
#unicode
#block-mode
How do I transform text in a visual selection using awk or sed?
:'<,'>!awk '{print toupper($0)}'
Vim can pipe any visual selection through external Unix commands and replace the selection with the output.
category:
visual-mode
tags:
#visual-mode
#external-command
#awk
#text-transformation
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