mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[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:
parent
660316fb14
commit
436fffdd6d
2 changed files with 4 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
||||||
Plug 'tpope/vim-repeat'
|
Plug 'tpope/vim-repeat'
|
||||||
" if g:vim_ide
|
" if g:vim_ide
|
||||||
Plug 'tomtom/tcomment_vim'
|
Plug 'tomtom/tcomment_vim'
|
||||||
|
Plug 'glts/vim-textobj-comment'
|
||||||
" else
|
" else
|
||||||
" Plug 'tpope/vim-commentary'
|
" Plug 'tpope/vim-commentary'
|
||||||
" endif
|
" endif
|
||||||
|
|
|
@ -236,6 +236,7 @@ set commentstring=//%s
|
||||||
" Remove the mappings that I won't use
|
" Remove the mappings that I won't use
|
||||||
let g:tcomment_maps = 0
|
let g:tcomment_maps = 0
|
||||||
|
|
||||||
|
" Closely replicate the behavior of tpope/vim-commentary
|
||||||
nmap <silent> gc <Plug>TComment_gc
|
nmap <silent> gc <Plug>TComment_gc
|
||||||
nmap <silent> gcc <Plug>TComment_gcc
|
nmap <silent> gcc <Plug>TComment_gcc
|
||||||
nmap <silent> gC <Plug>TComment_gcb
|
nmap <silent> gC <Plug>TComment_gcb
|
||||||
|
@ -244,6 +245,8 @@ set commentstring=//%s
|
||||||
nmap <silent> gCC m'o<Esc>''<Plug>TComment_gcb+
|
nmap <silent> gCC m'o<Esc>''<Plug>TComment_gcb+
|
||||||
xnoremap <silent> gc :TCommentMaybeInline<CR>
|
xnoremap <silent> gc :TCommentMaybeInline<CR>
|
||||||
xnoremap <silent> gC :TCommentBlock<CR>
|
xnoremap <silent> gC :TCommentBlock<CR>
|
||||||
|
" Make an alias for the comment text object
|
||||||
|
omap <silent> gc ac
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue