From ee03e6e4a4abc48c156f2952206d10fb8f6f7879 Mon Sep 17 00:00:00 2001 From: Thomas Manning Date: Mon, 30 Dec 2019 19:14:18 +0000 Subject: [PATCH 1/2] Fix string concatenation for ic textobject mapping Currently the mapping for the `ic` (inline comment) mapping has no space in between the `omap` and `g:tcomment_textobject_inlinecomment` parts meaning that the whole expression would look like: `exec 'omapic TComment_ic'` rather than `exec 'omap ic TComment_ic'`. --- plugin/tcomment.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/tcomment.vim b/plugin/tcomment.vim index 4cc8d72..6d246ae 100644 --- a/plugin/tcomment.vim +++ b/plugin/tcomment.vim @@ -274,8 +274,8 @@ if g:tcomment_maps exec 'xmap '. g:tcomment_mapleader_comment_anyway .' TComment_Comment' endif if g:tcomment_textobject_inlinecomment != '' - exec 'vmap' g:tcomment_textobject_inlinecomment ' TComment_ic' - exec 'omap' g:tcomment_textobject_inlinecomment ' TComment_ic' + exec 'vmap '. g:tcomment_textobject_inlinecomment .' TComment_ic' + exec 'omap '. g:tcomment_textobject_inlinecomment .' TComment_ic' endif endif From 5af53f4d5edf2133ed79a0f845987f5179c64e6c Mon Sep 17 00:00:00 2001 From: Thomas Manning Date: Mon, 30 Dec 2019 19:52:01 +0000 Subject: [PATCH 2/2] Add docs for the ic text object This addresses https://github.com/tomtom/tcomment_vim/issues/255 and https://github.com/tomtom/tcomment_vim/issues/188. It also partially addresses https://github.com/tomtom/tcomment_vim/issues/237 (by making it clear that the functionality exists, even if it doesn't quite do what's being asked for there). --- doc/tags | 1 + doc/tcomment.txt | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/doc/tags b/doc/tags index 06e16f0..d8eaf19 100644 --- a/doc/tags +++ b/doc/tags @@ -56,4 +56,5 @@ tcomment-debug tcomment.txt /*tcomment-debug* tcomment-maps tcomment.txt /*tcomment-maps* tcomment-new-filetype tcomment.txt /*tcomment-new-filetype* tcomment-operator tcomment.txt /*tcomment-operator* +tcomment-textobject tcomment.txt /*tcomment-textobject* tcomment.txt tcomment.txt /*tcomment.txt* diff --git a/doc/tcomment.txt b/doc/tcomment.txt index a7cc627..fb49294 100644 --- a/doc/tcomment.txt +++ b/doc/tcomment.txt @@ -121,6 +121,14 @@ A secondary set of key maps is defined for normal and insert mode (see also __ :: :TComment _i :: :TCommentInline + *tcomment-textobject* + +A text object is also added for selecting an inner-comment: + + {operator}ic :: Operate on the inner comment. The mapping can be changed + using the `g:tcomment_textobject_inlinecomment` variable + or disabled by setting it to the empty string, `''`. + ----------------------------------------------------------------------- @@ -256,6 +264,10 @@ g:tcomment_mapleader_uncomment_anyway (default: 'g<') g:tcomment_mapleader_comment_anyway (default: 'g>') See |tcomment-operator|. + *g:tcomment_textobject_inlinecomment* +g:tcomment_textobject_inlinecomment (default: 'ic') + See |tcomment-textobject|. + *:TComment* :[range]TComment[!] ?ARGS... If there is a visual selection that begins and ends in the same line,