Browse Source

create a function to handle multi line comment

Gharbi Mohamed 5 years ago
parent
commit
f3ba68b3cc
1 changed files with 2 additions and 1 deletions
  1. 2 1
      plug-config/vim-commentary.vim

+ 2 - 1
plug-config/vim-commentary.vim

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