Monday, February 18, 2013

Re: which file is being edited?

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)

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: