The paste
option is useful so that vim doesn't indent every pasted line by inserting a tab character (or spaces) in front of them which messes the formatting.
I've noticed two side effects that are a little annoying and are the reason why I don't put set paste
inside my ~/.vimrc
.
First, it disables auto-indentation when you're in insert mode even if you type your text normally (no pasting) because vim seems to not make the difference between pasted text and typed text.
Second, at one time I had mapped the jk
sequence as escape (I don't have it anymore), and the mapping doesn't work when paste
is set.
When I want to copy some text from another program inside vim in a terminal, in insert mode, I usually have the choice between <C-S-v>
, <C-r>*
or <C-r>+
.
There's a vim plugin called vim-bracketed-paste that allows a recent terminal to tell vim that the text is being pasted from an external program. It solves the problem of extra indentation when pasting with <C-S-v>
but not with <C-r>*
or <C-r>+
.
Note you can also paste while in normal mode with "+p
or "*p
.
The first one allows you to paste what's inside the system clipboard, the second one what's selected in an external program.
:h paste
. Basically a lot of stuff gets disabled, so no, you don't want that.