Slideshare Down
slideshare.net1 pointsby atechie0 comments
" comentify/uncommentify a line or a visual block"
function! Komment()
if getline(".") =~ '^[ \t]*#'
let hls=@/
s/^\([ \t]*\)#\(.*\)$/\1\2
let @/=hls
else
let hls=@/
s/^\([ \t]*\)\(.*\)$/\1#\2
let @/=hls
endif
endfunction
:vnoremap // :call Komment()<CR>
:nnoremap // :call Komment()<CR>
If you want to use c style comment :
function! Komment()
if getline(".") =~ '^[ \t]*\/\*'
let hls=@/
s/^\(\s*\)\/\*\(.*\)\*\/\(\s*\)$/\1\2\3/
let @/=hls
else
let hls=@/
s/[ \t]*$//
s/^\(\s*\)\(.*\)\(\s*\)$/\1\/\* \2 \*\//
let @/=hls
endif
endfunction
:vnoremap <silent> // :call Komment()<CR>
:nnoremap <silent> // :call Komment()<CR>
edited formatting
http://www.ghacks.net/2013/03/14/the-ultimate-google-reader-...
http://reviews.cnet.com/8301-19512_7-57574201-233/google-rea...