I am trying to use visual block mode to append a ,
to the end of root_dir
, where []
is the cursor.
lspconfig.html.setup{
root_dir = root_di[r]
}
lspconfig.cssls.setup{
root_dir = root_dir
}
I tried to enter visual block mode, go down until I am on another root_dir
and append comma.
<c-v> 3j A ,
But then it will become this:
lspconfig.html.setup{
root_dir = root_dir,
} ,
lspconfig.cssls.setup,{
root_dir = root_dir,
}
Is it possible to achieve what I want with visual block mode? I know I can use search and replace but I want to know if there is some other alternatives.
A
orI
from Visual Block to affect only a few of the lines... You should use a macro or similar to make these edits if you have too many to do manually. For example, to add a comma to every line with aroot_dir
I'd use:g/root_dir/norm A,
which will do the job.:s
with a pattern matching$
(end of the line) to add the comma there also an option.:g/root_dir/norm A
is really smart. Thanks