sponsor Vim development Vim logo Vim Book Ad

F6_Comment : Auto commenting that accepts Visual range

 script karma  Rating 14/9, Downloaded by 1277  Comments, bugs, improvements  Vim wiki

created by
David Maclay
 
script type
utility
 
description
Description:
I don't know for sure that something like this does not already exist in Vim, but if it does, I can't find it.

I recall Cream having this kind of functionallity mapped to <F6>,
so to maintain consistency I've kept the convention.

This uses the current value of &cms / &commentstring to comment and uncomment code.
It works for ranges selected in Visual mode, or for the current line in all modes.
NB. Comment strings may not include '@' or '+'
(I don't know of any languages that use these characters for comments).

Help:
Use <F6> to comment, and <S-F6> to uncomment
 
install details
Just put it in your plugin directory.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
F6_Comment.vim 1.2 2007-12-03 7.0 David Maclay This version puts the first comment on a line after any leading whitespace.
F6_Comment.vim 1.1 2007-10-07 7.0 David Maclay Set the vim file format to "unix"
F6_Comment.vim 1.0 2007-10-03 7.0 David Maclay Initial upload
ip used for rating: 3.14.6.194

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github