which file is being edited?

15 views
Skip to first unread message

shawn wilson

unread,
Feb 18, 2013, 3:51:02 AM2/18/13
to vim...@googlegroups.com
How do I get the full path of the file I'm editing?

Christian Brabandt

unread,
Feb 18, 2013, 4:01:26 AM2/18/13
to vim...@googlegroups.com
Hi shawn!

On Mo, 18 Feb 2013, shawn wilson wrote:

> How do I get the full path of the file I'm editing?

1<Ctrl-G>

regards,
Christian
--
Charade

Das Erste, das ist immer,
Und wenn auch die Welt vergeht;
Das Zweite ist man und bleibt man,
Wenn man zu lesen versteht.

-- Heinrich Heine

stosss

unread,
Feb 18, 2013, 4:11:56 AM2/18/13
to vim...@googlegroups.com
On Mon, Feb 18, 2013 at 3:51 AM, shawn wilson <ag4v...@gmail.com> wrote:
> How do I get the full path of the file I'm editing?
>

:Explore

will show you where you are and let you pick another file in the directory.

Jürgen Krämer

unread,
Feb 18, 2013, 4:23:54 AM2/18/13
to vim...@googlegroups.com

Hi,

shawn wilson wrote:
> How do I get the full path of the file I'm editing?

register % contains the name of the current file. You can pass '%' as an
argument to the expand() function:

:echo expand('%')

or

:let filename = expand('%')

This might give you the file name with a path relative to the current
directory. If you always want an absolute path you can append ':p' to
the register name:

:echo expand('%:p')

Regards,
J�rgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

shawn wilson

unread,
Feb 20, 2013, 11:02:12 PM2/20/13
to vim...@googlegroups.com
I forgot about C-G - thanks

On Mon, Feb 18, 2013 at 4:23 AM, Jürgen Krämer <jott...@googlemail.com> wrote:
>
> :echo expand('%:p')

This is what I'm looking for. Now to associate it with an F key or
leader.... decisions
Reply all
Reply to author
Forward
0 new messages