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
zimbra Windows shell Ubuntu plugin RAID smb RuG Linux Subversion ssl samba CLI WWW WordPress Gentoo XTerm blog.bigsmoke.us X HTML VIM Firefox Ruby mod_rewrite van der Molen xen HTTP Screen nutrition SSH svn metabolism DNS Family PHP CSS T61 Javascript MediaWiki Debian WLB07051 bash MySQL postfix Apache -
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.