10
I don’t want to remove the entire line of code in VIM, what I want is to work with the comment codes. I have 3 purpose cases:
Comments with which open and close (usually multiple lines):
/* doSomething(); */
Comments with 2 characters in the line of code (one per line):
// doSomething();
And comments with only 1 character at the beginning (one per line):
# doSomething();
I would like to know an agile way to add and remove these types of comments in VIM, so that it applies only to selective lines of code and not to the entire file.
didn’t know, so +1 for learning! :)
– Rodrigo Rigotti
+1 I really liked the answer, I’ll give a little more time to see if someone comes up with a multi-line pro solution too, otherwise I will take for granted your solution, because it already solves 90% of my cases :)
– Gabriel Gartz
Yeah, vertical selection helps to comment blocks with line comments. When it’s just a line, you tbm can use
I
, that enters insertion mode with the cursor at the beginning of the current line. I used these methods for some time, but today I prefer tcomment.– elias