How do I highlight the entire column under the cursor to help with aligning data?
:set cursorcolumn (or the short form set cuc) highlights the entire vertical column where the cursor sits, painting a visible strip from top to bottom of the wi
category:
config
tags:
#config
#navigation
#editing
#normal-mode
How do I write vimrc configuration that works in both Vim and Neovim by detecting which one is running?
The has() function tests whether a feature or capability is available, returning 1 (true) or 0 (false).
category:
config
tags:
#config
#vimscript
#compatibility
How do I execute Ctrl-W window commands from a Vimscript mapping or function without using :normal?
:wincmd is the Ex command equivalent of any keystroke.
category:
buffers-windows
tags:
#buffers-windows
#windows
#ex-commands
How do I delete all lines matching my last search pattern without retyping it?
:g//d uses an empty pattern in the global command, which instructs Vim to reuse the last search pattern.
category:
search
tags:
#search
#ex-commands
#global-command
#editing
How do I execute a motion or command without adding an entry to the jump list?
The :keepjumps modifier lets you run any movement or command without recording a new entry in the jump list.
category:
navigation
tags:
#navigation
#ex-commands
#jump-list
#normal-mode
#vimscript
How do I sort a range of lines by piping them through an external sort command using the ! operator?
The ! operator in Vim filters a motion's text through an external shell command, replacing it with the output.
category:
editing
tags:
#editing
#motions
#ex-commands
How do I copy a character from the line above or below while in insert mode?
When typing in insert mode, you can pull individual characters from adjacent lines without leaving insert mode.
category:
editing
tags:
#insert-mode
#editing
#completion
How do I define or modify a macro without recording keystrokes?
Instead of recording a macro with q, you can assign any string directly to a named register using :let @{register} = 'keys'.
category:
macros
tags:
#macros
#registers
#ex-commands
#normal-mode
How do I filter a visual selection through an external shell command?
How it works Vim can pipe selected text through any external shell command, replacing the selection with the command's output.
category:
visual-mode
tags:
#visual-mode
#ex-commands
#editing
#formatting
How do I create a dynamic abbreviation that inserts live content like the current date?
:iabbrev <expr> {trigger} {expression}
The flag on :iabbrev turns the right-hand side into a Vimscript expression that is evaluated at expansion time rather than stored as a literal string.
category:
config
tags:
#config
#insert-mode
#abbreviations
#ex-commands
How do I trigger language-aware autocompletion in Vim?
The keystroke triggers omni completion, Vim's built-in language-aware completion system.
category:
editing
tags:
#insert-mode
#completion
#programming
#filetype
How do I highlight a pattern without executing a search or moving the cursor?
Assigning a string directly to the search register @/ with :let causes Vim to highlight all matches (if hlsearch is enabled) without performing a search or movi
category:
registers
tags:
#registers
#search
#normal-mode
#ex-commands
How do I set up a local leader key for file-type-specific mappings that don't conflict with global mappings?
:let maplocalleader = ','
Vim provides two separate leader keys: (global) and (local to the current buffer).
category:
config
tags:
#config
#normal-mode
#ex-commands
How do I reopen the current file and force Vim to interpret it with a specific line ending format?
The ++ff modifier forces Vim to re-read the current file from disk using a specific fileformat — unix (LF), dos (CRLF), or mac (CR).
category:
editing
tags:
#ex-commands
#editing
#buffers
How do I populate the quickfix list from any shell command?
:cexpr system('grep -rn pattern .')
While :make and :grep populate the quickfix list, they are limited to their configured programs.
category:
command-line
tags:
#command-line
#ex-commands
#quickfix
#shell
How do I complete words using a thesaurus for synonym suggestions in Vim insert mode?
Vim's insert-mode completion includes a thesaurus mode triggered by .
category:
editing
tags:
#editing
#completion
#insert-mode
#writing
How do I visually select multiple paragraphs or text objects at once using a count prefix?
In Vim, text objects accept a count prefix in visual mode, letting you select multiple consecutive text objects in one keystroke.
category:
visual-mode
tags:
#visual-mode
#text-objects
#motions
#editing
How do I write a non-greedy (lazy) quantifier in Vim's search regex?
In Vim's regex engine, \{-} is the non-greedy (lazy) quantifier — it matches as few characters as possible, unlike .
category:
search
tags:
#search
#regex
#patterns
#substitution
How do I open another file without saving the current modified buffer first?
Normally, trying to :edit another file from a modified buffer triggers a warning and blocks the switch unless you save or force the command.
category:
buffers-windows
tags:
#buffers
#windows
#workflow
#command-line
#editing
How do I insert the output of a shell command directly into my buffer?
:put =system('cmd') lets you insert the output of any shell command as new lines in your buffer without leaving Vim.
category:
command-line
tags:
#ex-commands
#shell
#registers
#editing