vimCU : comment/uncomment functionalities for every language
| script karma
Downloaded by 1220
Comments, bugs, improvements
script versions (upload new version)
|vimCU is a set of ViM functions that you can use to customize your ViM editor to comment/uncomment source code of every language you like.
Comment key binding defaults to ",#" while uncomment key binding to ",3" (mnemonic: same key as comment, but without shift). In command mode the current line will be commented/uncommented, in visual mode all selected lines will.
In order to support commenting in the language of your choice you've to define how comments are handled in that language defining the following local variables:
- variable "b:CommentType". A string formed using "s" and/or "m" chars; "s" means that your language supports single line comment like, e.g., bash script, perl or similar, that are comments formed adding something at the beginning and at the end of a line; "m" means that your language supports multi line comment like, e.g. ANSI C, OCaml, or similar, that are comments that extends from a character set to another character set; "ms" or "sm" mean that your language supports both kinds of comments like, e.g., C++.
- variables: "b:beginOfCommentSingle", "b:endOfCommentSingle". Strings that are used to begin and end a single line comment. These strings are added at the begin and at the end of the line you want to commend.
- variables: "b:beginOfCommentMulti", "b:endOfCommentMulti". Strings that are used to begin and end a multi line comment. These strings are added before and after the line(s) you are commenting on a line by themeselves.
For example, in order to support C++, just add to your ~/.vim/ftplugin/cpp.vim the following lines:
let b:CommentType = "ms"
let b:beginOfCommentSingle = "// "
let b:endOfCommentSingle = ""
let b:beginOfCommentMulti = "/*"
let b:endOfCommentMulti = "*/"
|Just copy vimCU.vim somewhere (e.g. ~/.vim/vimCU.vim) and source it from your ~/.vimrc, e.g.:
... and of course define the above variables for your favorite language! :-)
Click on the package to download.
ip used for rating: 18.104.22.168