In Vim, I have the following text:
key => value1
key => value2
key => value1111
key => value12
key => value1122222
I would like to add "," at the end of each line. The previous text will become the following:
key => value1,
key => value2,
key => value1111,
key => value12,
key => value1122222,
Does anyone know how to do this? Is it possible to use visual block mode to accomplish this?
Best Answer
This will do it to every line in the file:
If you want to do a subset of lines instead of the whole file, you can specify them in place of the
%
.One way is to do a visual select and then type the
:
. It will fill in:'<,'>
for you, then you type the rest of it (Notice you only need to adds/$/,/
)