Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vmap <F12> <ESC>`<:let fl=line(".")<CR>`>:let ll=line(".")<CR>:call ToggleComment(fl,ll)<CR>
- function! ToggleComment(fl, ll)
- let i=a:fl
- let comment="//"
- while i<=a:ll
- let cl=getline(i)
- if matchstr(cl, "^\s*//\s*.*")==""
- let cl2=comment.cl
- else
- let cl2=substitute(cl, "//", "", "")
- endif
- call setline(i, cl2)
- let i=i+1
- endwhile
- endfunction
Add Comment
Please, Sign In to add comment