How do I prepend text to every line in a visual block selection?
I{text}<Esc>
When you need to add the same prefix to many adjacent lines, Visual Block insert is faster and safer than repeating macros or substitutions.
870 results for "it at"
I{text}<Esc>
When you need to add the same prefix to many adjacent lines, Visual Block insert is faster and safer than repeating macros or substitutions.
:g/pattern/m0
When working with large files, you sometimes need to reorganize content by pulling all lines matching a certain pattern to the top.
command-line #global #move #ex-commands #editing #command-line
:e!
:e! forces Vim to reload the current file from disk, discarding every unsaved change in the buffer.
buffers-windows #buffers-windows #editing #undo-redo #ex-commands
:set winwidth=999 winheight=999
Setting winwidth=999 and winheight=999 tells Vim to try to make the active window at least 999 columns wide and 999 rows tall whenever it gains focus.
{count}go
The go command moves the cursor to a specific byte offset from the start of the buffer.
vim-sleuth
The vim-sleuth plugin by Tim Pope automatically detects the indentation style (tabs vs spaces) and width used in a file and sets shiftwidth, expandtab, tabstop,
". / "% / ": / "# registers
Vim has four read-only special registers that automatically contain useful contextual information.
registers #registers #special-registers #workflow #productivity
<C-x><C-n>
triggers keyword completion that searches only the current buffer for matches, scanning forward from the cursor.
:set autochdir
The autochdir option tells Vim to automatically change the current working directory to the directory of the file in the active window whenever you switch buffe
:set spellfile={path}
By default, when you use zg to add a word to Vim's spell-check dictionary, it is saved in a file in your Vim data directory.
/\%>5l\%<10l pattern
Vim's \%>{lnum}l and \%5l — matches only at positions after line 5 (i.
<C-x><C-v>
The key sequence in insert mode triggers Vim command-line completion — the same completion engine used at the : command prompt.
:let @q = 'keystrokes'
You can assign a string directly to any register using :let, turning it into a macro instantly.
`0
Vim automatically saves your cursor position when you exit, storing it as the 0 mark in the viminfo file (or shada file in Neovim).
gw{motion}
The gw operator reformats text just like gq, but leaves the cursor exactly where it started.
l (in :%s///gc confirm prompt)
When running an interactive substitution with the c flag (e.
editing #search #editing #substitution #ex-commands #normal-mode
vipgq
The vipgq sequence reflowing a paragraph to fit within the width defined by textwidth (default 0, meaning no limit).
<C-w>P
The preview window is a special auxiliary split — usually at the top — opened by commands like :ptag, :pedit, and omni-completion to display reference infor
/\%>80v.
The pattern /\%>80v.
"ayy "byy "cyy
How it works Vim provides 26 named registers (a through z) that you can use as independent clipboards.