I know I can apply changes to multiple lines by selecting the lines in visual mode (I use ctrl-v
) and defining the set of actions and the mode to start in (e.g. norma A,
will add a comma at the end of all selected lines).
I was wondering how can I go back to normal mode after using something like A
(which goes to insert mode). I'm not familiar with the terminology enough to google it properly.
I want to add a comma at the end of each line and then join all lines together. I assumed something like the following (not correct, obviously) should do it:
ctrl-v
, G
, :
, normal A, normal J
RET
But obviously this appends , normal J
to each line.
I know there are plenty of other ways to do it (regular expressions, macros ...) so I don't need alternatives, that's not my question.
vG:norm! A,^]I+
(where^]
is the escape character as explained by @Nobe4).