How do I insert a timestamp computed by Vimscript directly from Normal mode?
"=strftime('%Y-%m-%d %H:%M')<CR>p
The expression register lets you evaluate Vimscript on demand and paste the result immediately.
category:
registers
tags:
#registers
#expression-register
#automation
#timestamps
How do I get a detailed word, character, and byte count in Vim?
While shows basic file info (filename, line count, position), g provides a much more detailed statistical breakdown of your file or visual selection.
category:
navigation
tags:
#navigation
#normal-mode
#visual-mode
How do I save a recorded macro permanently so it survives Vim restarts?
Macros recorded with q{register} are stored in registers and lost when Vim exits.
category:
macros
tags:
#macros
#registers
#config
How do I comment out an entire paragraph or code block with a single motion using vim-commentary?
The vim-commentary plugin exposes gc as a comment operator, which means it composes with any Vim motion or text object.
category:
plugins
tags:
#plugins
#editing
#commenting
#text-objects
#normal-mode
How do I detect whether a macro is currently being recorded or executed in Vimscript?
reg_recording() and reg_executing()
Vim exposes two built-in functions for querying the current macro state: regrecording() and regexecuting().
category:
macros
tags:
#macros
#registers
#normal-mode
How do I run a command on every file in the quickfix list?
:cdo s/old/new/g | update
The :cdo command executes a given command on every entry in the quickfix list.
category:
command-line
tags:
#command-line
#quickfix
#batch-editing
#search
#multi-file
How do I find out which file or plugin last set a particular Vim option?
:verbose set {option}? shows the current value of an option and reports exactly which file set it last — the full path and line number.
category:
command-line
tags:
#command-line
#config
#ex-commands
How do I view only command-history entries matching a pattern in Vim?
:filter /{pattern}/ history cmd
When command history gets crowded, scanning :history cmd manually is slow.
category:
command-line
tags:
#command-line
#history
#search
#workflow
How do I run a substitution over every quickfix hit and save only changed files?
:cdo s/foo/bar/ge | update
When quickfix already contains exactly the lines you want to touch, :cdo is the safest way to batch-edit with tight scope.
category:
command-line
tags:
#command-line
#quickfix
#substitution
#refactoring
How do I override case sensitivity for a single search pattern without changing my settings?
Vim lets you embed \c or \C directly inside a search pattern to control case sensitivity for that search only, regardless of your 'ignorecase' and 'smartcase' s
category:
search
tags:
#search
#regex
#case
#normal-mode
What is the difference between cw and ciw when changing a word?
The cw and ciw commands both change a word, but they behave differently depending on cursor position.
category:
editing
tags:
#editing
#text-objects
#motions
#normal-mode
#productivity
How do I toggle the case of a character in Vim?
The ~ command toggles the case of the character under the cursor — uppercase becomes lowercase and vice versa — then advances the cursor one position to the
category:
editing
tags:
#editing
#normal-mode
#formatting
How do I find out which script or plugin defined a specific mapping or setting?
:verbose map <key> or :verbose set option?
The :verbose prefix shows where a mapping, setting, command, or function was defined — which file and line number.
category:
command-line
tags:
#command-line
#debugging
#config
#mappings
#workflow
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 load project-specific Vim settings automatically when opening files in a directory?
Vim's exrc option tells Vim to look for a .
category:
config
tags:
#config
#vimrc
#project
#ex-commands
How do I prevent accidental edits to a buffer by making it completely read-only?
:set nomodifiable locks a buffer so that no changes can be made at all — not even temporary ones.
category:
buffers-windows
tags:
#buffers
#editing
#normal-mode
#ex-commands
How do I open a file in Vim without triggering any autocmds for faster loading?
When you have heavy autocmds registered for BufRead, BufEnter, or FileType events — such as LSP clients, formatters, or syntax processors — opening a large
category:
command-line
tags:
#command-line
#ex-commands
#buffers-windows
#config
How do I keep a utility split from resizing when other windows open or close?
:setlocal winfixheight winfixwidth
If you use a dedicated utility pane (logs, quick notes, REPL output), Vim's default equalization behavior can keep resizing it whenever other splits change.
category:
buffers-windows
tags:
#buffers
#windows
#config
#ex-commands
How do I align text around a delimiter character using vim-lion?
vim-lion (by Tom McDonald) adds gl and gL as alignment operators.
category:
plugins
tags:
#plugins
#editing
#formatting
How do I uppercase or lowercase matched text directly in a substitute command?
Vim's substitute replacement string supports special case-transform atoms that change the case of matched text without requiring a second pass or an external to
category:
editing
tags:
#editing
#search
#ex-commands
#formatting