Regex – How to add a string to the end of each line in Vim

matchregexreplacevim

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

I tried the code unsuccessfully

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

Best Answer

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