Add the following to your vimrc. It will add two menu items under the "Edit" menu in gVim. The function calls can be mapped to keystrokes if desired. "Menu items for Commenting and Un-Commenting code amenu 20.435 &Edit.-SEP4- : amenu Edit.Comment `:let ll=line("."):call Comment(fl, ll) amenu Edit.UnComment `:let ll=line("."):call UnComment(fl, ll) "Function for commenting a block of Visually selected text function Comment(fl, ll) let i=a:fl let comment="//" while i<=a:ll let cl=getline(i) let cl2=comment.cl call setline(i, cl2) let i=i+1 endwhile endfunction "Function for Un-Commenting a block of Visually selected text function UnComment(fl, ll) let i=a:fl let comment="//" while i<=a:ll let cl=getline(i) let cl2=substitute(cl, "//", "", "") call s
Attributes | Values |
---|
rdfs:label
| - Comment/UnComment visually selected text
|
rdfs:comment
| - Add the following to your vimrc. It will add two menu items under the "Edit" menu in gVim. The function calls can be mapped to keystrokes if desired. "Menu items for Commenting and Un-Commenting code amenu 20.435 &Edit.-SEP4- : amenu Edit.Comment `<:let fl=line(".")`>:let ll=line("."):call Comment(fl, ll) amenu Edit.UnComment `<:let fl=line(".")`>:let ll=line("."):call UnComment(fl, ll) "Function for commenting a block of Visually selected text function Comment(fl, ll) let i=a:fl let comment="//" while i<=a:ll let cl=getline(i) let cl2=comment.cl call setline(i, cl2) let i=i+1 endwhile endfunction "Function for Un-Commenting a block of Visually selected text function UnComment(fl, ll) let i=a:fl let comment="//" while i<=a:ll let cl=getline(i) let cl2=substitute(cl, "//", "", "") call s
|
Version
| |
dbkwik:vim/property/wikiPageUsesTemplate
| |
Previous
| |
Category
| |
Author
| |
Complexity
| |
Created
| |
ID
| |
NEXT
| |
Rating
| |
abstract
| - Add the following to your vimrc. It will add two menu items under the "Edit" menu in gVim. The function calls can be mapped to keystrokes if desired. "Menu items for Commenting and Un-Commenting code amenu 20.435 &Edit.-SEP4- : amenu Edit.Comment `<:let fl=line(".")`>:let ll=line("."):call Comment(fl, ll) amenu Edit.UnComment `<:let fl=line(".")`>:let ll=line("."):call UnComment(fl, ll) "Function for commenting a block of Visually selected text function Comment(fl, ll) let i=a:fl let comment="//" while i<=a:ll let cl=getline(i) let cl2=comment.cl call setline(i, cl2) let i=i+1 endwhile endfunction "Function for Un-Commenting a block of Visually selected text function UnComment(fl, ll) let i=a:fl let comment="//" while i<=a:ll let cl=getline(i) let cl2=substitute(cl, "//", "", "") call setline(i, cl2) let i=i+1 endwhile endfunction
|