Reputation: 13
There may or may not have been asked before, but I don't know enough about vim to be able to look. How can I add add single quotes (') 5 characters into the line and at the end of every line that begins with a (-)
An example from the file is
want quotes
here & here
v v
- essentials.help
- essentials.helpop
- essentials.list
- essentials.motd
- essentials.rules
- essentials.spawn
- groupmanager.notify.self
Upvotes: 1
Views: 73
Reputation: 992857
You could do something like:
:%s/^ -\(.*\)/ -'\1'/
Adjust the exact number of spaces you need as required.
This searches for the start of a line ^
, then four spaces, a dash, and then uses a capturing group to capture all the characters to the end of the line. Then it's replaced with four spaces, a dash, a single quote, \1
is the contents of the capturing group, then a final single quote.
The leading %
applies this command to all lines in the file.
Upvotes: 1