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')
Ref:
http://vim.wikia.com/wiki/Get_the_name_of_the_current_file

No comments: