How do I capture shell command output directly into a Vim register?
:let @a = system('cmd')
You can populate any Vim register with the output of an external shell command using :let @{register} = system('{command}').
2125 results for "i" a""
:let @a = system('cmd')
You can populate any Vim register with the output of an external shell command using :let @{register} = system('{command}').
:sp +/{pattern} {file}
The +{cmd} syntax lets you run an Ex command immediately after a file is opened.
Create plugin/myplugin.vim
A basic Vim plugin is just a .
getreginfo('a')
getreginfo('{reg}') (Vim 8.
/\%>20l\%<40lTODO
Vim's search engine can constrain matches by line number, which is useful when you want to scan a known section without touching the rest of the buffer.
:g/pattern/m 0
The :global command combined with :move lets you restructure a file by relocating all lines that match a pattern.
:g/pattern/normal @q
The :global command combined with :normal lets you execute a recorded macro on every line that matches a given pattern.
macros #macros #command-line #ex-commands #global #batch-editing
:'a,'bs/old/new/g
Named marks can serve as range endpoints for any Ex command, including :substitute.
:t {line-number}
The :t (copy/transfer) command duplicates the current line and places it after the specified line number.
<C-f> (command-line mode)
Pressing while in the command-line (:, /, or ? prompt) opens the command-line window with your partially-typed command already loaded and ready for full Vim edi
command-line #command-line #ex-commands #editing #navigation
:call setreg("a", substitute(getreg("a"), "old", "new", "g"))
The getreg() and setreg() functions let you read and write register contents as plain strings, making it possible to surgically edit a macro without re-recordin
:tab {cmd}
Most commands that open a new window (:help, :split, :new, :terminal) open a horizontal split by default.
:let @a = @/
Vim stores the last search pattern in the special / register (@/).
{N}@q
Prefix a macro invocation with a count to execute it up to N times in a single command.
<C-r><C-r>a
In insert mode, a pastes register a but processes the text as if typed, which can trigger abbreviations and mappings.
:v/pattern/command
:v (short for :vglobal) is the inverse of :g.
zug
When spell checking is active, pressing zg over a word adds it to your personal word list so Vim stops flagging it.
{Visual}<C-a>
In Visual mode, pressing increments every number within the selection by 1 (or by a given [count]).
qa/pattern<CR>dd@aq
By starting a macro with a search command, the macro becomes conditional — it jumps to the next match before acting, and terminates when no more matches are f
\%(...\)
Vim's standard grouping syntax \(.