Stop vim replicating comments on a new line

July 4, 2011

I use vim for programming on Mac OSX. The version of vim has problem sharing clipboard with the mac so I don’t seem to be able to yank to the system clipboard or paste from the system clipboard.

I can paste using the usual cmd+v in insert mode but this types the contents of the system clipboard into VIM. what this means is that when I paste a line of comment in followed by lines of code, the code is commented out as VIM helpfully continues comments on the next line.

To stop vim doing this before a paste from the system clipboard, first issue the VIM command:

:set fo=cqt

To set Vim back into its previous new line continue commenting state use

:set fo=crqt


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: