How do I programmatically load text or a macro into a named register from the command line?
:let @a="text"
:let @{register}=".
272 results for ":q"
:let @a="text"
:let @{register}=".
:reg a b c
The :reg (alias :registers) command accepts a string of register names as its argument.
:argdo normal @a
The :argdo command applies any Ex command to every file in the argument list.
:cnext and :cprev
The quickfix list holds a set of file positions, typically from compiler errors, grep results, or other tools.
cs{from}{to}
The cs command from the vim-surround plugin lets you swap one type of surrounding delimiter for another in a single motion.
[b and ]b
The vim-unimpaired plugin by Tim Pope adds symmetric [ and ] bracket mappings for navigating common Vim lists.
plugins #navigation #buffers #quickfix #plugins #normal-mode
qaI// <Esc>jq
This macro adds a // comment prefix to the beginning of the current line and moves down.
:'<,'>norm .
The :'norm .
visual-mode #visual-mode #editing #normal-mode #repeat #dot-operator
reg_recording() and reg_executing()
Vim exposes two built-in functions for querying the current macro state: regrecording() and regexecuting().
<C-n> to select (vim-visual-multi)
vim-visual-multi provides VS Code-style multiple cursor support for Vim.
<C-f> from : prompt
Pressing while on the : command line opens the command-line window, where you can edit your command using full Vim editing capabilities.
:nnoremap ]b :bnext<CR>
Mapping ]b and [b to :bnext and :bprev creates an intuitive bracket-style navigation for buffers, matching the convention used by unimpaired.
buffers-windows #buffers-windows #navigation #mapping #buffers
<C-f> (from command-line mode)
When you are partway through typing a long or complex Ex command on the : prompt, you can press to open the command-line window.
qa{motions}@aq
A recursive macro is one that calls itself at the end of its own recording.
:wviminfo / :rviminfo
Vim can persist register contents (including macros) across sessions using viminfo (Vim) or shada (Neovim).
:cq
The :cq command quits Vim and returns a non-zero exit code to the calling process.
:set foldmethod=marker
Setting foldmethod=marker lets you define fold boundaries using special comment markers — {{{ to start a fold and }}} to end it.
:<C-f>
Long Ex commands are easy to mistype when you edit inline on a single command line.
qaq
How it works To clear a macro register, you simply start recording into that register and immediately stop.
let @a = 'sequence'
How it works Macros recorded with q are stored in registers, but they are lost when you close Vim (unless you have the viminfo or shada file preserving them).