From 436fffdd6debb61d8459969f19941bd98c67741c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 24 Apr 2021 13:51:14 +0300 Subject: [PATCH] [nvim] add a comment textobject in continuation to 4d42627b83412dc0d837d90d8c6faf483e562c00 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. --- nvim/dotfiles/plugins-list.vim | 1 + nvim/plugin/editing.vim | 3 +++ 2 files changed, 4 insertions(+) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index d540517..c08d2bf 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -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 diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index d53d96a..59b18d3 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -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 gc TComment_gc nmap gcc TComment_gcc nmap gC TComment_gcb @@ -244,6 +245,8 @@ set commentstring=//%s nmap gCC m'o''TComment_gcb+ xnoremap gc :TCommentMaybeInline xnoremap gC :TCommentBlock + " Make an alias for the comment text object + omap gc ac " }}}