Vim Tip: Copy and paste into the editor ...
By bloggerkedar on Apr 26, 2009
Fact #1Copy and Paste is a damned implementation pattern in programming. But it is also one of the best ways to use code written (on the web, e.g.) as a starting point.
Fact #2Vim is one of the best text editors.
Now if we assume you vim most of the times you play with text files, you would be annoyed if copying text from somewhere on the web and pasting it into a vim buffer would mess up the alignment. For example, text that shows up like this on the web page:
class Product def initialize( code, name, desc, cost ) @code = code @name = name @desc = desc @cost = costshows up like this when "Ctrl+C, Ctrl+v"ed in your vim session:
class Product def initialize( code, name, desc, cost ) @code = code @name = name @desc = desc @cost = costWell, no more. Just do :set paste or in your .vimrc, set paste which puts vim in the so-called paste mode and you will see that sanity returns. I appreciate (Google, and) help from this vim-group entry.