How do I paste text from outside Vim without messing up indentation?
:set paste
The :set paste command enables paste mode, which temporarily disables auto-indentation, smart tabs, and other insert-mode features that can mangle text pasted f
162 results for "paste"
:set paste
The :set paste command enables paste mode, which temporarily disables auto-indentation, smart tabs, and other insert-mode features that can mangle text pasted f
"=expression<CR>p
The expression register ("=) lets you evaluate any Vimscript expression and paste the result directly into your buffer from normal mode.
registers #registers #editing #normal-mode #productivity #math
5"ap
Prefix the paste command with a count.
"aP
Use "aP (uppercase P) to paste the contents of register a before the cursor position, as opposed to "ap which pastes after.
". / "% / ": / "# registers
Vim has four read-only special registers that automatically contain useful contextual information.
registers #registers #special-registers #workflow #productivity
"a]p
Use ]p after specifying a register to paste with adjusted indentation.
qa"bpq
While recording macro a, paste from register b with "bp.
:call setreg('a', @a, 'v') then "ap
Use setreg() to change register a to characterwise mode (v), then paste.
"_dP or use "0p
When pasting over a selection, the replaced text overwrites the unnamed register.
P (in visual mode)
When you paste over a visual selection using p (lowercase), Vim replaces the selection with your register contents — but the replaced text overwrites your unn
<C-v>jjxp
Visual block mode lets you select, cut, and paste rectangular columns of text.
[p
When you copy code from one indentation level and paste it at another, p preserves the original indentation, leaving your code misaligned.
<C-r><C-o>{register}
The standard {reg} pastes register contents in Insert mode, but Vim may auto-indent multi-line text to match the current indentation level — sometimes manglin
<C-v>jj"ay then "ap
How it works Vim registers remember not just the text content but also the type of selection that was used to yank it: characterwise, linewise, or blockwise.
:{line}put {register}
How it works The :put Ex command pastes the contents of a register after a specified line.
"ayy ... "ap
Named registers let you store multiple pieces of text independently.
"ap
In visual mode, "ap replaces the selected text with the contents of register a.
/<C-r>a
While in the search prompt (/), press a to insert the contents of register a.
p
The p command pastes (puts) the contents of the default register after the cursor.
:put a
The :put a command pastes register a on a new line below the cursor.