When you want to paste in Vim, you want vim to not use indenting, because that messes up your code. I used to use :insert, but on some machines, it would still indent. I discovered the :set paste command, which works quite well.
-
Categories
-
Tags/Keywords
Apache bash blog blog.bigsmoke.us CLI CSS Debian DNS Firefox Gentoo Google HTML HTTP iptables Linux MediaWiki mod_rewrite MySQL network PHP plugin postfix RAID Ruby samba Screen shell Sicirec smb SSH ssl Subversion svn T61 thunderbird Ubuntu van der Molen VIM Windows WordPress WWW X xen XTerm zimbra -
Recent Posts
-
Recent Comments

3 Comments ( Add comment / trackback )
I often use the following if :insert doesn’t give me the desired result:
I learned that trick from Kim Hendrikse a long time ago. It also works in ol’ vi.
While researching another post, I actually just used :set paste for the first time and was amazed by how well it works. I recommend anyone to try it. I especially like how every subsequent time that you change to insert mode, it will have this (clearly) enabled until it’s explicitly disabled again.
However, in that same post that I was working on, I also introduce the following solution, which uses the excellent XSel tool to do the same, with more flexibility and power (I think). Here’s an example with xsel that pastes the contents of PRIMARY:
Or, if you prefer the CLIPBOARD:
That’s how easy it is.
Hmm, my vim only has insert mode enabled once. If you go to command mode and then back to insert, it’s no longer paste mode. And that’s the way I prefer it.