On 28/12/09 01:27, Bob wrote:
Sorry I didnt see the prior 2 msgs until now
after I replied my last reply.
I tried ':verbose set fo' and I get:
formatoptions=croql
Last set from /usr/share/vim/vim72/ftplugin/c.vim
So Im wondering what this plugin is and/or where it
came from? Ive never messed around with vim other
than my ~/.vimrc file so I dont know why this file
exists.
That file is one of the "runtime files" distributed with Vim. The
directory /usr/share/vim/vim72/, which Vim knows (on your system) as
$VIMRUNTIME, is the top of the directory structure which contains a lot
of *.vim scripts to help Vim do what is expected of it, and also (in
$VIMRUNTIME/doc/*.txt) all the standard help which does Vim users
(newbies and old hands alike) so much good.
After editing the fo line in the above file (getting
rid of 'cr' options, it still shows up as:
formatoptions=coql
At least the 'r' is gone now. The file now reads:
" Set 'formatoptions' to break comment lines but not other lines,
" and insert the comment leader when hitting<CR> or using "o".
setlocal fo-=t fo+=oql
I couldnt find another instance in that file of 'fo' either.
You MUST NOT, ever, make *any* changes in *any* file in $VIMRUNTIME or
in any of its subdirectories *at any depth*, because:
- either you compile Vim yourself, and then you should periodically
upgrade your runtime files (even if there are no patches to the C
source) to keep them up-to-date;
- or you use the Vim package(s) distributed by your Linux distribution,
and then your distro's "Online update" (or whatever it is called) will
periodically update your runtime files for you whenever they need it.
In both cases, any of these updates may (and sooner or later one of them
is bound to) silently undo any changes you made in the runtime files.
Half way there at least and learned something new.
What should I try next to find where the 'c' is coming
from?
Thanks again!
If you worry that comment leaders are inserted while pasting, then you
should use ":set paste" (see :help 'paste') temporarily when pasting
(and ":set nopaste" when you're finished pasting and start typing
again), and it won't happen anymore IIUC. Or else, you could use gvim
instead of Console Vim, because gvim can tell the difference between
typing and pasting, and it will do the right thing even if 'paste' isn't
set.
The r in the 'formatoptions' for C sources is there so that when you're
hand-typing a 3-piece comment,
/*
* like this
* and that
hitting Enter at the end of the line will insert the leading asterisk
where it belongs at the start of the next line. If, instead of typing
text on the next line, you enter just a slash then hit Enter again, Vim
understands that you are at the end of the comment, and inserts the
comment trailer, like this:
*/
I find this very handy.
Best regards,
Tony.
--
Ronald Reagan -- America's favorite placebo
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php