How do I append keystrokes to a macro without re-recording it?
:let @q .= 'j'
Re-recording a long macro just to add one extra keystroke is wasteful and error-prone.
870 results for "it at"
:let @q .= 'j'
Re-recording a long macro just to add one extra keystroke is wasteful and error-prone.
:colder
Vim maintains a history stack of up to 10 quickfix lists.
buffers-windows #buffers-windows #navigation #ex-commands #search
:[range]sort /regex/
The :[range]sort /regex/ command sorts lines while skipping the portion of each line that matches the regex.
:view {file}
:view opens a file with the readonly option set, preventing accidental writes.
vim.tbl_deep_extend('force', defaults, overrides)
vim.
:lua require'dap'.toggle_breakpoint()
The nvim-dap plugin implements the Debug Adapter Protocol in Neovim, providing a full debugging experience with breakpoints, step-through execution, variable in
:set iskeyword+=-
By default, Vim treats hyphens, dots, and many punctuation characters as word boundaries.
:cnoreabbrev {lhs} {rhs}
:cnoreabbrev defines a non-recursive command-line abbreviation — like noremap but for Ex commands.
]`
Most users jump to marks directly ('a, ` a `), but when a file has many lowercase marks, stepping through them in order is faster than remembering each name.
:'>,'<normal @q
Running a macro over a range usually goes top to bottom, but that can break when the macro inserts or deletes lines.
macros #macros #ex-commands #visual-mode #normal-mode #refactoring
:%s/\(prefix\)\@<=target/replacement/g
Vim's \@<= is a zero-width look-behind assertion.
[p
When you copy code from one indentation level and paste it at another, p preserves the original indentation, leaving your code misaligned.
:2match Todo /FIXME/
Vim provides three independent match slots — :match, :2match, and :3match — each of which highlights a pattern using a specified highlight group.
\d \w \s \a \l \u
How it works Vim provides shorthand character classes that save you from writing out full bracket expressions.
"#p
The # register holds the name of the alternate file — the file you were editing just before the current one.
:set makeprg=python3\ %
Setting makeprg to include % lets :make always execute the file you're currently editing.
:%retab!
The :retab command converts leading whitespace according to the current tabstop and expandtab settings, but it only touches indentation at the start of lines.
:set nrformats+=alpha
By default, and only increment and decrement numbers (decimal, hex, and octal depending on format).
:keepjumps normal! 500@q
Running a macro hundreds of times is efficient, but it can flood your jumplist and make normal navigation painful afterward.
:[range]join
The :[range]join Ex command lets you join lines by specifying an explicit line range — without having to navigate there or use visual selection.