expand filename to full path ?

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

expand filename to full path ?

iler.ml

How do I use expand() to expand some filename, which is not %, to full
path ?
Filename is in some variable.
I tried to append :p to the argument of expand, but it doesn't work:

chdir $HOME
let fname=".vimrc"
echo expand(fname . ":p")  " we want /home/user/.vimrc

-> prints ".vimrc:p" ????
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: expand filename to full path ?

Michael Dunn-3

2008/7/16 Yakov <[hidden email]>:

>
> How do I use expand() to expand some filename, which is not %, to full
> path ?
> Filename is in some variable.
> I tried to append :p to the argument of expand, but it doesn't work:
>
> chdir $HOME
> let fname=".vimrc"
> echo expand(fname . ":p")  " we want /home/user/.vimrc
>
> -> prints ".vimrc:p" ????
>
Yakov, you need fnamemodify() rather than expand():

echo fnamemodify("~/.vimrc", ":p")

Cheers, Michael

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---