如何在 Vim 中获取当前文件到 pwd 的相对路径

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

假设我的 cwd 是 /home/rgrinberg/project,我正在浏览一些文件 /home/rgrinberg/project/x/y/z.py,我想获得 x/y.

普通模式:

:echo expand('%:h')

Please use vim wiki for further research