Comment all lines in a text file

editorsnanovivim

In a text file I need to comment out all lines by adding a ";" as first character of each line. What is a good way to do this? I thought of Vim's visual block mode, but I couldn't find a "select all" option and marking several hundred lines manually also isn't great 😉 Any idea? I have nano, vi and vim at hand, I would prefer one of those for this task.

Best Answer

In Vim: gg0<ctrl-v>GI;<Esc>

Related Question