Return to Snippet

Revision: 908
at August 21, 2006 00:21 by yuconner


Initial Code
#" lhs comments
map ,# :s/^/#/<CR>
map ,/ :s/^/\/\//<CR>
map ,> :s/^/> /<CR>
map ," :s/^/\"/<CR>
map ,% :s/^/%/<CR>
map ,! :s/^/!/<CR>
map ,; :s/^/;/<CR>
map ,- :s/^/--/<CR>
map ,c :s/^\/\/\\|^--\\|^> \\|^[#"%!;]//<CR>

#" wrapping comments
map ,* :s/^\(.*\)$/\/\* \1 \*\//<CR>
map ,( :s/^\(.*\)$/\(\* \1 \*\)/<CR>
map ,< :s/^\(.*\)$/<!-- \1 -->/<CR>
map ,d :s/^\([/(]\*\\|<!--\) \(.*\) \(\*[/)]\\|-->\)$/\2/<CR>

Initial URL
http://www.vim.org/tips/tip.php?tip_id=271

Initial Description
#Put into your .vimrc file
#The commands to comment a selection of text are as follows, begining with begining-of-line comments:

    ,#    shell, perl, etc
    ,/     c  
    ,>    email quote
    ,"     vim
    ,%    latex, prolog
    ,!      assembly?... add single !
    ,;      scheme
    ,-      don't remember this one... add --
    ,c     clears any of the previous comments

Here are the wrapping comments, each line wrapped individually:

    ,*      c
    ,(       Standard ML
    ,<      html
    ,d      clears any of the wrapping comments

Initial Title
Easy (un)commenting out of source code with vi editor

Initial Tags
linux

Initial Language
Other