summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.vim3
-rw-r--r--keys/which-key.vim2
-rw-r--r--plug-config/vim-commentary.vim10
3 files changed, 13 insertions, 2 deletions
diff --git a/init.vim b/init.vim
index c6456734..8205e455 100644
--- a/init.vim
+++ b/init.vim
@@ -24,7 +24,8 @@ else
source $HOME/.config/nvim/themes/airline.vim
source $HOME/.config/nvim/plug-config/rnvimr.vim
source $HOME/.config/nvim/plug-config/fzf.vim
- source $HOME/.config/nvim/plug-config/nerd-commenter.vim
+ "source $HOME/.config/nvim/plug-config/nerd-commenter.vim switching to vim-commentary
+ source $HOME/.config/nvim/plug-config/vim-commentary.vim
source $HOME/.config/nvim/plug-config/rainbow.vim
source $HOME/.config/nvim/plug-config/codi.vim
source $HOME/.config/nvim/plug-config/quickscope.vim
diff --git a/keys/which-key.vim b/keys/which-key.vim
index 661882c1..cc0c41a2 100644
--- a/keys/which-key.vim
+++ b/keys/which-key.vim
@@ -25,7 +25,7 @@ autocmd FileType which_key set laststatus=0 noshowmode noruler
" Single mappings
-let g:which_key_map['/'] = [ ':Commentary' , 'comment' ]
+let g:which_key_map['/'] = [ ':call Comment()' , 'comment' ]
let g:which_key_map['.'] = [ ':e $MYVIMRC' , 'open init' ]
let g:which_key_map[';'] = [ ':Commands' , 'commands' ]
let g:which_key_map['='] = [ '<C-W>=' , 'balance windows' ]
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\ */}