How do I paste the contents of a register literally in command-line mode without interpreting special characters?
In command-line mode, {reg} inserts a register's contents — but it processes certain sequences, potentially misinterpreting backslashes, pipe characters, or e
category:
registers
tags:
#registers
#command-line
#search
#editing
How do I move to the first non-blank character of a line?
The ^ command moves the cursor to the first non-blank character of the current line.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I use \zs to set the start of a search match so only part of the pattern is highlighted or operated on?
Vim's \zs atom marks the start of the match within a longer pattern.
category:
search
tags:
#search
#regex
#patterns
#normal-mode
How do I look up which two-character code produces a special character when using Vim's digraph system?
:digraphs (abbreviated :dig) displays a full reference table of every digraph registered in Vim.
category:
command-line
tags:
#editing
#special-characters
#insert-mode
#command-line
How do I paste my last Ex command into the command line or a buffer?
Vim stores your last executed Ex command in the read-only : register.
category:
registers
tags:
#registers
#ex-commands
#command-line
How do I make the focused window automatically expand to a minimum size while keeping other windows visible?
:set winwidth=85 winheight=20
Setting winwidth and winheight tells Vim the minimum column width and line height the current focused window must have.
category:
buffers-windows
tags:
#windows
#buffers
#config
#navigation
How do I sort lines by the text that matches a regex pattern rather than the text after it?
The :sort r /pattern/ command sorts lines using the matched portion of the regex as the sort key.
category:
command-line
tags:
#ex-commands
#search
#editing
#normal-mode
How do I run a :g or :s command without overwriting my current search pattern?
Whenever Vim runs a command that involves searching — :g, :s, :v, or even moving the cursor with / — it overwrites the last search register (@/).
category:
search
tags:
#search
#ex-commands
#macros
How do I use zero-width lookbehind assertions in Vim search patterns to match text only when preceded (or not preceded) by a pattern?
Vim's \@<= and \@<! atoms let you write zero-width lookbehind assertions — they check what comes before the match position without consuming characters.
category:
search
tags:
#search
#regex
#patterns
#advanced
How do I open the alternate file in a new split window without typing its name?
Press (Ctrl+W followed by Ctrl+6) to open the alternate file in a horizontal split.
category:
buffers-windows
tags:
#buffers-windows
#navigation
#buffers
How do I view the git history for the current file as a navigable quickfix list using vim-fugitive?
Running :Gclog in vim-fugitive loads the git log for the current file into the quickfix list.
category:
plugins
tags:
#plugins
#git
#buffers
#quickfix
How do I safely run Neovim API calls from inside a fast callback or loop without causing errors?
vim.
category:
config
tags:
#ex-commands
#vimscript
#config
#completion
How do I select, delete, or change a complete sentence using Vim's sentence text objects?
Vim defines sentence text objects — as (around sentence) and is (inner sentence) — that allow any operator to act on an entire sentence in one motion.
category:
editing
tags:
#text-objects
#editing
#normal-mode
#sentences
How do I run a substitute command without overwriting my current search pattern?
:keeppattern %s/old/new/g
When you run a :s or :%s substitute command, Vim updates the search register (@/) with the substitution pattern.
category:
command-line
tags:
#ex-commands
#search
#editing
#registers
#substitute
How do I selectively accept LOCAL or REMOTE changes in a three-way git merge using Vim?
When Vim is configured as a git mergetool, it opens a three-way split with the LOCAL (your branch), REMOTE (their branch), and MERGED (the output file) buffers.
category:
buffers-windows
tags:
#buffers-windows
#diff
#editing
#command-line
How do I match a pattern but only highlight or capture part of it using \zs and \ze?
How it works Vim's \zs (set start) and \ze (set end) atoms let you define which portion of a pattern counts as the actual match, even though the full pattern is
category:
search
tags:
#search
#ex-commands
#normal-mode
How do I search for text that appears after or before a specific pattern without including the pattern in the match?
Vim supports zero-width assertions (lookahead and lookbehind) in its regex engine.
category:
search
tags:
#search
#regex
#advanced-search
#lookahead
#lookbehind
How do I append more commands to an existing macro without re-recording it from scratch?
Recording a macro with an uppercase register letter appends to the existing macro in the corresponding lowercase register instead of overwriting it.
category:
macros
tags:
#macros
#registers
#recording
#normal-mode
How do I jump to any visible text on screen with a two-character search using flash.nvim in Neovim?
flash.
category:
plugins
tags:
#navigation
#motions
#plugins
#search
How do I execute a recorded macro once in each currently open window?
When you split a file into multiple windows or keep several related buffers visible, repeating the same small cleanup in each one can be tedious.
category:
macros
tags:
#macros
#windows
#normal-mode
#ex-commands
#automation