create a function to handle multi line comment

This commit is contained in:
Gharbi Mohamed 2020-07-15 03:03:47 +01:00
parent bd30daefea
commit f3ba68b3cc

View file

@ -1,3 +1,4 @@
" this function check whether vim is in normal mode or not and comment appropriately
function! Comment()
if (mode() == "n" )
execute "Commentary"
@ -5,5 +6,5 @@ function! Comment()
execute "'<,'>Commentary"
endif
endfunction
vnoremap <silent> <space>/ :call Comment()
vnoremap <silent> <space>/ :call Comment()
autocmd filetype javascript.jsx setlocal commentstring={/*\ %s\ */}