vimrelative-path

Getting relative paths in Vim


Say I am running Vim and pwd returns

/home/rafid/myproject

And say I am currently editing the file

/home/rafid/myproject/website/editpage.php

Is there any command that returns this for me?

website/editpage.php

That is, the path of the file relative to the current folder.


Solution

  • This works for me :

    :echo expand("%")