Matthias Pitzl wrote:
Hello all!
I don't really know how to do this but im sure that there's a solution.
I have some file and i need to insert a number before each line and a
separator. The number is the line number. Is there any way in vim to do
this easily?
Thank's for your help!
Greetings,
Matthias
:1,$s/^/\=line(".") . " | "/
(untested)
see
:help sub-replace-expression
The idea is to "substitute" (:s) the start-of-line (^) by the given
expression (where line(".") is the current line number) on all lines
(from 1 to $ = last line).
Best regards,
Tony.