PDA

View Full Version : vim creating comment lines



fauzie
September 11th, 2008, 06:00 PM
I have a problem with vim, every time I put a comment line like

// This is a comment

And press Enter

Vim automatically put // on the next line
So it looks like this:

// This is a comment
//

This behavior is quite annoying for me as I have to delete those lines before continuing. I would like to know how to disable it.

It occurs on any language by the way ...

Thanks

SteelDragon
September 11th, 2008, 08:49 PM
I don't know how to disable it (because I like it), but rather than backspacing or leaving insert mode to delete it, you can just press ctrl+u to get rid of it and then go on with your typing..

Good luck.

ilrudie
September 11th, 2008, 09:00 PM
Thats odd. My vim does not do that. I can see how that would be annoying though.

fauzie
September 12th, 2008, 02:53 AM
ilrudie, could you post your ~/.vimrc ??

Thanks

Ctrl-u works ... I think I can live with it ...

dwhitney67
September 12th, 2008, 02:58 AM
ilrudie, could you post your ~/.vimrc ??

Thanks

Ctrl-u works ... I think I can live with it ...
Better to live with this... (insert into your ~/.vimrc file):

au FileType * setlocal comments=

ilrudie
September 12th, 2008, 01:03 PM
my .vimrc is short and sweet:

syn on

fauzie
September 12th, 2008, 06:57 PM
Ahhh, the code works!!! Thanks a lot dwhitney67!!!