rgrinberg
rgrinberg

Reputation: 9878

How to get relative path of current file to pwd in Vim

Let's say that my cwd is /home/rgrinberg/project and I'm browsing some file /home/rgrinberg/project/x/y/z.py and I'd like to get x/y.

Upvotes: 0

Views: 787

Answers (1)

lared
lared

Reputation: 1994

In normal mode:

:echo expand('%:h')

Please use vim wiki for further research

Upvotes: 3

Related Questions