summaryrefslogtreecommitdiff
path: root/plug-config/vim-commentary.vim
diff options
context:
space:
mode:
Diffstat (limited to 'plug-config/vim-commentary.vim')
-rw-r--r--plug-config/vim-commentary.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/plug-config/vim-commentary.vim b/plug-config/vim-commentary.vim
new file mode 100644
index 00000000..f672715d
--- /dev/null
+++ b/plug-config/vim-commentary.vim
@@ -0,0 +1,10 @@
+" this function check whether vim is in normal mode or not and comment appropriately
+function! Comment()
+ if (mode() == "n" )
+ execute "Commentary"
+ else
+ execute "'<,'>Commentary"
+ endif
+ endfunction
+vnoremap <silent> <space>/ :call Comment()
+autocmd filetype javascript.jsx setlocal commentstring={/*\ %s\ */}