diff options
author | Christian Chiarulli <[email protected]> | 2020-07-14 22:26:05 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-14 22:26:05 -0400 |
commit | 337e7b55c8807e505ee9273467092d38bbe75a51 (patch) | |
tree | 21a5f81dcac94db41f3a3c966225132d44f97a18 | |
parent | b178b332dd191d606ea50762563434edc2f8ea54 (diff) | |
parent | 51d9b8841d45992d7d0e66d51844f50ac428541a (diff) |
Merge pull request #37 from ghmhd/@ghmhd/feature/add-multiline-comment-support
Add multi line comment
-rw-r--r-- | init.vim | 3 | ||||
-rw-r--r-- | keys/which-key.vim | 2 | ||||
-rw-r--r-- | plug-config/vim-commentary.vim | 10 |
3 files changed, 13 insertions, 2 deletions
@@ -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\ */} |