Closed loshjawrence closed 5 years ago
I was hoping this plugin supported something like
dic
/yic
/pic
but it appears it does not.
Try dgc, etc.
Note that commentary does only whole line commenting, so your second and third examples don't work.
'dgc' doesn't work for me. I tried vim-plug's :PlugClean and :PlugInstall but it still doesn't work, also checked my tagbar in my vimrc to make sure dgc isn't mapped to something else.
Edit
Oh. by whole line commenting you mean it does this style / int x = 0; / and I can only operate on lines that have that style.
It uses value of 'commentstring'
option, you can change it to
setlocal commentstring=//\ %s
and it will work on // comment
, but not on /* comment */
.
Yep, dgc
will delete comments created by gc
. Commentary does not - and likely will never - support arbitrary comment syntax.
Awesome thanks. This gets me what I need. Plug 'tpope/vim-commentary' autocmd FileType c,cpp,javascript,json setlocal commentstring=//\ %s
I was hoping this plugin supported something like
dic
/yic
/pic
but it appears it does not. If the cursor is in a contiguous set of single comments or a comment block it would be nice to supportc
as a text object for comments. I thinkdc
/yc
/pc
should only affect the line the cursor is on, otherwise for the inner motion versions do something like the cases below.Also, I think contiguous inline vs contiguous not-inline should be distinguished since I think most of the time this non-greedy approach is likely the intention of the user... and if the user wanted the greedy behavior they can just follow up with a
.
repeat.cic
could work butcc
wouldn't follow the convention since it's already a core operation.