tcomment_vim icon indicating copy to clipboard operation
tcomment_vim copied to clipboard

Question about `gcgn`

Open vito-c opened this issue 9 years ago • 3 comments

One of the new features in vim is gn

I was wondering if there is a way to force tcomment to use a line comment on the next motion. Maybe this is possible to setup via a new mapping gC

What are your thoughts?

vito-c avatar Mar 05 '16 18:03 vito-c

I was wondering if there is a way to force tcomment to use a line comment on the next motion. Maybe this is possible to setup via a new mapping |gC|

What about vgngc?

tomtom avatar Mar 06 '16 20:03 tomtom

// cursor starts here _
val a:String = "one two three"
val b:Int = 3
val c:String = "four five"
val d:String = "six"

let's say I want to comment all of the String definitions except val d and that I have already searched for "String" so to jump to the next string I can just gcgn but the problem is that gn puts you in visual mode and selects the text. So in this case it takes it gives me val a:/* String */ = "one two three" I could just do ngcc but the advantage of gn is that I can repeat it with the . command.

I guess I'm counting keystrokes too much since ngccn n. n. is a score of 9 and gCgn$ .$ .$ I had to put the $ in so that it would take me past the current search. If the $ was part of the gC command it would worth it because it would bring the score down to 6 and just . repeat the comment line on search :D

vito-c avatar Mar 06 '16 22:03 vito-c

Since this seems to be a special case, I'd hesitate to include a new map in tcomment -- IMHO there already are too many maps defined by tcomment.

I don't quite understand why you use gn and not n as in ngccn. There are some plugins around like repeat (please see issue #114 or #115) that can be used to make this work with ..

tomtom avatar Mar 07 '16 18:03 tomtom