How do I run a macro only on lines that match a specific pattern?
The :g (global) command combined with :normal @a lets you execute a recorded macro only on lines matching a pattern.
category:
macros
tags:
#macros
#ex-commands
#global-command
#editing
#automation
How do I edit a recorded macro?
Since macros are stored in registers, you can paste the register content into the buffer, edit it, and yank it back.
category:
registers
tags:
#registers
#macros
#editing
What are the useful flags for the substitute command?
The substitute command supports several flags that modify its behavior.
category:
command-line
tags:
#command-line
#search
#ex-commands
How do I save a recorded macro permanently so it persists across Vim sessions?
let @a = 'macro_contents'
Recorded macros are stored in registers, which are lost when you quit Vim (unless viminfo saves them).
category:
macros
tags:
#macros
#config
#registers
#vimrc
#productivity
How do I fuzzy search inside file contents across a project in Vim?
The fzf.
category:
plugins
tags:
#plugins
#fzf
#ripgrep
#search
#workflow
#quickfix
How do I control automatic text wrapping and comment formatting in Vim?
The formatoptions setting controls how Vim automatically formats text as you type — including comment continuation, auto-wrapping, and paragraph formatting.
category:
config
tags:
#config
#formatting
#comments
#text-wrapping
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 quickly repeat the last macro I executed?
How it works After running a macro with @a (or any other register), you can repeat that same macro by pressing @@.
category:
macros
tags:
#macros
#normal-mode
How do I run a one-off macro without recording by executing keystrokes from an expression register?
Recorded macros are powerful, but sometimes you need a quick ephemeral sequence and do not want to occupy a register.
category:
macros
tags:
#macros
#registers
#normal-mode
#automation
How do I record a macro that uppercases a word and advances so I can replay it across words?
Macros are most powerful when they encode both the edit and the movement to the next target.
category:
macros
tags:
#macros
#editing
#motions
#normal-mode
How do I create a recursive macro that runs until it encounters an error?
A recursive macro calls itself at the end of its recording, causing it to repeat until a motion or search fails.
category:
macros
tags:
#macros
#recursive
#automation
#repeat
How do I rerun a previous search pattern from history directly on the / prompt?
/\V<C-r>=histget('/', -2)<CR>
If you often alternate between two complex search patterns, opening q/ each time is slow.
category:
search
tags:
#search
#command-line
#history
#regex
#productivity
How do I list only search-pattern history entries in Vim?
Power users tend to run long, composable searches during refactors, but the default / and ? history navigation can be noisy when command history and search hist
category:
command-line
tags:
#command-line
#search
#history
#regex
How do I open Vim help pages in a new tab instead of a split?
By default, :help opens in a horizontal split, which can feel cramped.
category:
buffers-windows
tags:
#buffers
#windows
#tabs
How do I view my complete Vim command and search history?
:history displays a numbered list of your recently entered Ex commands, giving you a full audit of what you have run in the current session (and across sessions
category:
command-line
tags:
#ex-commands
#command-line
#search
How do I delete from the cursor to the end of a word?
The de command deletes from the cursor position to the end of the current word.
category:
editing
tags:
#editing
#delete
#motions
#normal-mode
How do I redisplay the output from the last Ex command that already scrolled away?
Pressing g or q to dismiss it again Example Tips :messages also shows recent messages (and those accumulate across the session), while g< only shows the last pa
category:
command-line
tags:
#command-line
#ex-commands
#output
How do I quickly evaluate and print a Lua expression in Neovim without calling print()?
In Neovim, prefixing a Lua expression with = on the :lua command line evaluates it and pretty-prints the result using vim.
category:
command-line
tags:
#command-line
#ex-commands
How do I close a preview window from any other window without having to jump to it first?
Pressing z closes the preview window from any window in the current tab page.
category:
buffers-windows
tags:
#windows
#buffers
#navigation
#normal-mode
How do I use a macro to wrap each word in quotes?
How it works This macro wraps the current word in double quotes and moves to the next word, making it easy to repeat across a line or file.
category:
macros
tags:
#macros
#editing
#normal-mode
#insert-mode