[nvim] add a comment textobject in continuation to 4d42627b83

You may be wondering why I have exchanged a single simple plugin for two
arguably more complex ones. Well, vim-commentary couldn't put comments
on blank lines, so there. And also tcomment.vim was mentioned in the
README of the former plugin.
This commit is contained in:
Dmytro Meleshko 2021-04-24 13:51:14 +03:00
parent 660316fb14
commit 436fffdd6d
2 changed files with 4 additions and 0 deletions

View File

@ -14,6 +14,7 @@
Plug 'tpope/vim-repeat'
" if g:vim_ide
Plug 'tomtom/tcomment_vim'
Plug 'glts/vim-textobj-comment'
" else
" Plug 'tpope/vim-commentary'
" endif

View File

@ -236,6 +236,7 @@ set commentstring=//%s
" Remove the mappings that I won't use
let g:tcomment_maps = 0
" Closely replicate the behavior of tpope/vim-commentary
nmap <silent> gc <Plug>TComment_gc
nmap <silent> gcc <Plug>TComment_gcc
nmap <silent> gC <Plug>TComment_gcb
@ -244,6 +245,8 @@ set commentstring=//%s
nmap <silent> gCC m'o<Esc>''<Plug>TComment_gcb+
xnoremap <silent> gc :TCommentMaybeInline<CR>
xnoremap <silent> gC :TCommentBlock<CR>
" Make an alias for the comment text object
omap <silent> gc ac
" }}}