Insert the filename in the file itself

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Insert the filename in the file itself

Eddy Petrișor
Hello,

Is there a way to insert the filename into the document itself? It
doesn't have to be automatic, but can be by hand.

I found bufname("%") but I don't know how to use that info and insert
it in the buffer. I tried a function which stores that in a variable,
but how do I insert it in the buffer itself?

--
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein
Reply | Threaded
Open this post in threaded view
|

Re: Insert the filename in the file itself

Zbigniew Kowalski
If you don't want to play with variables,
and you're on some *nix enviroment,
you can use:
:r !ls %

regards
zbikow

Dnia 6-04-2006 o godz. 14:34 Eddy Petrişor napisał(a):

> Hello,
>
> Is there a way to insert the filename into the document itself? It
> doesn't have to be automatic, but can be by hand.
>
> I found bufname("%") but I don't know how to use that info and insert
> it in the buffer. I tried a function which stores that in a variable,
> but how do I insert it in the buffer itself?
>
> --
> Regards,
> EddyP
> =============================================
> "Imagination is more important than knowledge" A.Einstein
>
Zbigniew Kowalski
http://zbikow1.webpark.pl/


Reply | Threaded
Open this post in threaded view
|

Re: Insert the filename in the file itself

Jürgen Krämer
In reply to this post by Eddy Petrișor

Hello,

Eddy Petrisor wrote:
>
> Is there a way to insert the filename into the document itself? It
> doesn't have to be automatic, but can be by hand.
>
> I found bufname("%") but I don't know how to use that info and insert
> it in the buffer. I tried a function which stores that in a variable,
> but how do I insert it in the buffer itself?

while you are in insert mode enter  "<ctrl-r>%"  (without the quotes).

Regards,
Jürgen

--
Jürgen Krämer                              Softwareentwicklung
HABEL GmbH & Co. KG                        mailto:[hidden email]
Hinteres Öschle 2                          Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-Weilheim                    Fax: +49 / 74 61 / 93 53 - 99
Reply | Threaded
Open this post in threaded view
|

Re: Insert the filename in the file itself

Eddy Petrișor
On 4/6/06, Jürgen Krämer <[hidden email]> wrote:
> > I found bufname("%") but I don't know how to use that info and insert
> while you are in insert mode enter  "<ctrl-r>%"  (without the quotes).

Cool, nice. Now I can imap this :-)

--
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein