Created
April 29, 2010 21:13
-
-
Save ricardochimal/384258 to your computer and use it in GitHub Desktop.
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
" comment an entire visual block at once | |
" highlight the area however you want (V, CTRL+V) then | |
" ,c will comment the block | |
" ,u will uncomment the block | |
let b:comment_leader = '# ' | |
au FileType haskell,vhdl,ada let b:comment_leader = '-- ' | |
au FileType vim let b:comment_leader = '" ' | |
au FileType c,cpp,java,php,js let b:comment_leader = '// ' | |
au FileType sh,make,perl,ruby,python let b:comment_leader = '# ' | |
au FileType tex let b:comment_leader = '% ' | |
noremap <silent> ,c :<C-B>sil <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:noh<CR> | |
noremap <silent> ,u :<C-B>sil <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:noh<CR> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment