On 2011-09-09, Peng Yu wrote:
> On Sep 9, 11:16 pm, Gary Johnson <[email protected]> wrote:
> > On 2011-09-09, Peng Yu wrote:
> >
> > > Hi,
> >
> > > Suppose that I am pasting some c++ code in vim (with some comment
> > > starting with //). The lines after the comments are also automatically
> > > commented, which is very annoy. Is there a way to disable this?
> >
> > There are a number of ways to disable this, but I think a better
> > approach would be to fix the problem with pasting.  There are
> > essentially two ways to paste in Vim:  inserting the characters as
> > if you typed them and inserting the text as it was formatted when
> > copied.  You seem to be doing the former when you want to be doing
> > the latter.
> >
> > How exactly are you pasting this C++ code?  Are you using gvim or
> > vim in a terminal?  Windows or Unix?
> 
> I use Commmand+C on Mac to paste (in GUI version). Is it helpful in
> determining what the solution is?

Unfortunately, I know little about Macs.  If Vim sees the Command+C
and executes some paste operation, then the problem can probably be
fixed in Vim so that pasting "just works".  If, on the other hand,
Command+C is seen only by the Mac OS and all Vim sees is the text
characters in its input stream, then you may have to resort to some
other, less attractive solution, such as changing your
'formatoptions' as Taylor suggested, or toggling the 'paste' option
before and after the pasting operation.  Toggling 'paste' involves
extra keystrokes, but is a reliable solution.  See

    :help 'paste'

One way to determine whether Vim sees the Command+C would be to
enter insert mode, type CTRL-V, then type Command+C and see what
appears.  If it's the contents of the Mac's copy-paste buffer, then
Vim doesn't see that key combination and you may be stuck with
toggling 'paste'.

Bear in mind, though, that I don't know Macs well enough to be
giving reliable advice.

Regards,
Gary

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to