Created
April 18, 2011 13:50
-
-
Save mix3/925377 to your computer and use it in GitHub Desktop.
commentout.vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" lhs comments | |
vmap ,# :s/^/#/<CR>:nohlsearch<CR> | |
vmap ,/ :s/^/\/\//<CR>:nohlsearch<CR> | |
vmap ,> :s/^/> /<CR>:nohlsearch<CR> | |
vmap ," :s/^/\"/<CR>:nohlsearch<CR> | |
vmap ,% :s/^/%/<CR>:nohlsearch<CR> | |
vmap ,! :s/^/!/<CR>:nohlsearch<CR> | |
vmap ,; :s/^/;/<CR>:nohlsearch<CR> | |
vmap ,- :s/^/--/<CR>:nohlsearch<CR> | |
vmap ,c :s/^\/\/\\|^--\\|^> \\|^[#"%!;]//<CR>:nohlsearch<CR> | |
" wrapping comments | |
vmap ,* :s/^\(.*\)$/\/\* \1 \*\//<CR>:nohlsearch<CR> | |
vmap ,( :s/^\(.*\)$/\(\* \1 \*\)/<CR>:nohlsearch<CR> | |
vmap ,< :s/^\(.*\)$/<!-- \1 -->/<CR>:nohlsearch<CR> | |
vmap ,d :s/^\([/(]\*\\|<!--\) \(.*\) \(\*[/)]\\|-->\)$/\2/<CR>:nohlsearch<CR> | |
" block comments | |
vmap ,b v`<I<CR><esc>k0i/*<ESC>`>j0i*/<CR><esc><ESC> | |
vmap ,h v`<I<CR><esc>k0i<!--<ESC>`>j0i--><CR><esc><ESC> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment