Tim Chase wrote:
:put %
That seems to insert the filename in random place. What if I
want to place it e.g. in the beginning of each line?
It inserts it on the line below where the cursor currently is. You can
specify a target (as in
:30put %
which will put it below line #30)
If you want it at the beginning of each line, you can use my
aforementioned suggestion of
:%s/^/\=expand('%').': '
(which also adds a colon and a space for visualization purposes, but
is totally omittable if you want)
-tim
:%s/^/\=expand('%')
works great!
Thank you all