I'm pretty new to vim and trying to do something that haven't found elsewhere yet.
I have to comment a line matching a pattern to be defined, e.g. the string 'foo', by adding the character '*' and all following lines which start with the character '+'. In the files I'm working on the sintax uses '+' as the first character of a line to mean that line is part of the preceding line, like:
this is a command line continuing through next lines and containing foo
+ this line continues the preciding one with other commands
+ this line continues the preciding one with other commands
this is a new command line
this is another command line
After the modification the text should become:
*this is a command line continuing through next lines and containing foo
*+ this line continues the preciding one with other commands
*+ this line continues the preciding one with other commands
this is a new command line
this is another command line
The number of lines a command is split on isn't always the same and it makes me unable to do it.
Is an if statement necessary?
Aucun commentaire:
Enregistrer un commentaire