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?
Well, the canonical way to do this on *nix boxes is just
cat -n file.in > file.out
which can be used in vim with
:%!cat -n
If you don't have access to cat or want to do it purely within
vim, you can do
:%s/^/\=line(".")." "
where the space in quotes is whatever sort of delimiter you want
(tab, colon, any string you like)
Since it's performing an expression evaluation there, you can
even shift your numbering if you like
:%s/^/\=(42+line("."))." "
or go by multiples
:%s/^/\=(2*line("."))." "
HTH,
-tim