Wednesday, July 11, 2012

How to view the file path of currently opened file in Vim?

File name is stored in the register %. To retrieve it, in vi command mode type:
:echo @%
Above will display the relative path from the present working directory.  To get the absolute path type:
:echo expand('%:p')

No comments: