How do I check which language servers are attached to the current buffer and debug my LSP setup in Neovim?
The :LspInfo command, provided by the nvim-lspconfig plugin, opens a diagnostic floating window showing every active LSP client and its configuration for the cu
category:
plugins
tags:
#plugins
#lsp
#neovim
#debugging
#lspconfig
How do I pipe a range of lines through an external command and replace them with the output?
The ! operator filters the text covered by a motion through an external shell command, replacing the original lines with the command's stdout.
category:
editing
tags:
#editing
#ex-commands
#normal-mode
#formatting
How do I apply a recorded macro to every line in a visual selection?
Combining :normal with a visual range lets you replay a macro on each line of a selection individually — far more targeted than recursive macros or @@ repeati
category:
macros
tags:
#macros
#ex-commands
#normal-mode
#visual-mode
How do I search or substitute only within specific columns of text in Vim?
The \%Nc, \%>Nc, and \%20c — match only after column 20 (i.
category:
search
tags:
#search
#regex
#substitution
#normal-mode
How do I open an existing buffer in a new tab page in Vim?
How it works The :tab sb N command opens buffer number N in a brand new tab page.
category:
buffers-windows
tags:
#buffers
#tabs
#ex-commands
#navigation
How do I understand which register Vim uses for each operation?
Vim has 10 types of registers, each serving a specific purpose.
category:
registers
tags:
#registers
#reference
#clipboard
#workflow
How do I quickly resize the current window to exactly N lines tall in Vim?
The z{N} command sets the current window's height to exactly N lines and simultaneously positions the current line at the top of the window.
category:
buffers-windows
tags:
#buffers-windows
#windows
#navigation
How do I incrementally grow or shrink a split window by a specific number of lines or columns?
:resize adjusts the height of the current window by a relative or absolute amount.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
How do I move a line or range of lines to a different location in the file?
How it works The :m command (short for :move) moves one or more lines to after the specified address.
category:
editing
tags:
#editing
#ex-commands
#normal-mode
How do I create a Neovim namespace for grouping extmarks and virtual text to avoid conflicts with other plugins?
vim.api.nvim_create_namespace('my_plugin')
Neovim's extmark system (for highlights, virtual text, and diagnostics) uses namespaces to group related marks.
category:
plugins
tags:
#neovim
#lua
#plugins
#extmarks
#virtual-text
#api
How do I make my macros robust regardless of cursor position?
A common macro pitfall is assuming the cursor starts at a specific column.
category:
macros
tags:
#macros
#recording
#best-practices
#workflow
How do I add custom functions to Vim's statusline for dynamic information?
set statusline=%{MyCustomFunc()}
How it works Vim's statusline supports the %{expr} syntax which evaluates a Vimscript expression and displays the result.
category:
config
tags:
#editing
#formatting
How do I undo or redo all changes made within a specific time window in Vim?
:earlier {N}m and :later {N}m
Vim's :earlier and :later commands let you travel through your edit history by wall-clock time rather than by individual undo steps.
category:
command-line
tags:
#undo-redo
#ex-commands
#editing
How do I generate multiple lines of text using a Vimscript for loop from the command line?
:for i in range(1,5) | put ='item '.i | endfor
Vimscript's for loop is available directly from Vim's command line and can be used to generate repetitive or parameterized text without a macro or external scri
category:
command-line
tags:
#ex-commands
#macros
#editing
#normal-mode
How do I see a summary of all previous quickfix lists from my current session and navigate between them?
Every time you run :grep, :vimgrep, :make, or :cexpr, Vim creates a new quickfix list and pushes the previous one onto a history stack.
category:
buffers-windows
tags:
#buffers-windows
#quickfix
#navigation
#ex-commands
How do I scroll down half a page in Vim?
The (Ctrl+d) command scrolls the window down by half a screen, moving both the viewport and the cursor.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I run a recorded macro on every line in a range without using a count?
The :normal command executes normal-mode keystrokes on each line in a range — including macro playback.
category:
macros
tags:
#macros
#ex-commands
#normal-mode
#editing
How do I apply a normal mode command to every line in a range at once?
:normal (abbreviated :norm) executes a sequence of normal-mode keystrokes on each line of an address range.
category:
command-line
tags:
#ex-commands
#editing
#normal-mode
#macros
How do I use lambda functions in Vimscript to filter or transform lists?
Vim 8.
category:
config
tags:
#config
#ex-commands
How do I jump back and forth between my two most recent cursor positions?
Vim maintains a jumplist — a history of every "jump" you make (searches, marks, gg, G, %, etc.
category:
navigation
tags:
#navigation
#jumplist
#motions
#workflow