How can I add a string to the end of each line in Vim?

Léo Léopold Hertz 준영 picture Léo Léopold Hertz 준영 · Feb 27, 2009 · Viewed 284.4k times · Source

I want to add * to the end of each line in Vim.

I tried the code unsuccessfully

:%s/\n/*\n/g

Answer

Cyber Oliveira picture Cyber Oliveira · Mar 1, 2009

Even shorter than the :search command:

:%norm A*

This is what it means:

 %       = for every line
 norm    = type the following commands
 A*      = append '*' to the end of current line