Created
February 26, 2014 07:44
-
-
Save sooop/9225308 to your computer and use it in GitHub Desktop.
This file contains 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
"pycomment | |
"comment selected line | |
function! PyComment#com() | |
let b:l1 = line("'<") | |
let b:l2 = line("'>") | |
let b:cmd_ = ":" . b:l1 . "," . b:l2 . "s/^/#/g" | |
exec b:cmd_ | |
endfunction | |
function! PyComment#uncom() | |
let b:l1 = line("'<") | |
let b:l2 = line("'>") | |
let b:cmd_ = ":". b:l1 . "," . b:l2 . "s/\\v^([\\t\\s]*)#+/\\1/" | |
exec b:cmd_ | |
endfunction | |
augroup python comment | |
autocmd! | |
autocmd FileType *.py vnoremap <c-/> <esc>:call PyComment#com()<enter> | | |
\ vnoremap <c-,> <esc>:call PyComment#uncom()<enter> | |
augroup end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment