How to write a macro that saves the current file and advances to the next file in the argument list in Vim?
:wn
:wn (short for :wnext) writes the current buffer to disk and immediately advances to the next file in the argument list.
2277 results for "@a"
:wn
:wn (short for :wnext) writes the current buffer to disk and immediately advances to the next file in the argument list.
qa f,ldt,F(p q
This macro swaps two comma-separated arguments inside parentheses by cutting the second argument and placing it before the first.
ciw + new text + Esc, then n.
The ciw command followed by new text, combined with and .
qaciw"<C-r>""<Esc>wq
This macro wraps the current word in double quotes by changing the word, inserting quotes around the original content, and moving to the next word.
:for i in range(1,5) | put ='item '.i | endfor
Vimscript's for loop is available directly from Vim's command line and can be used to generate repetitive or parameterized text without a macro or external scri
<C-r><C-r>{reg}
When you insert a register with {reg} in insert mode, Vim processes the content as if you had typed it — this means autoindent, autoformat, and insert-mode ma
:chistory
Every time you run :grep, :vimgrep, :make, or :cexpr, Vim creates a new quickfix list and pushes the previous one onto a history stack.
buffers-windows #buffers-windows #quickfix #navigation #ex-commands
<C-v>u{hex}
In insert mode, pressing followed by u and a 4-digit hexadecimal codepoint inserts the corresponding Unicode character directly into the buffer.
zfap
Combining the fold-creation operator zf with the ap (around paragraph) text object gives you a quick way to collapse any paragraph into a single fold line.
set foldlevelstart=N
When Vim opens a file with folds enabled, it uses the foldlevelstart option to decide how many fold levels to open automatically.
gra
Since Neovim 0.
\_.
In Vim's regular expressions, .
:argdo %s/old/new/g | update
The :argdo command runs an Ex command on every file in the argument list (the files you opened Vim with, or added via :argadd).
\@!
In Vim's regex engine, \@! is the negative lookahead assertion.
:set laststatus=3
Neovim 0.
\(pattern\)\@=
Vim's regex engine supports zero-width positive lookahead via the \@= operator.
/\(\<\w\+\>\)\_s\+\1\>
When writing or editing text, repeated words like "the the" or "is is" are a common typo that spell checkers often miss.
:cfdo %s/\<GetUser\>/FetchUser/ge | update
When quickfix has many matches per file, :cdo can execute your command repeatedly in the same buffer.
command-line #command-line #quickfix #refactoring #ex-commands #search
# vim: set ts=4 sw=4 et:
Vim's modeline feature lets you embed editor settings directly into a file.
:set iskeyword+={char}
iskeyword defines which characters are considered word characters in Vim.