Finding file name οf currently open file in vi on terminal
To see the filename in vi(m) press esc and then type
:set title
The filename appears in the top bar of the terminal window. You can also do
:buffers
to see the file(s) currently open - the information is displayed inside the terminal at the bottom. If you have multiple files open, you can tell which one you are in as %a
is shown beside the current file, for example
:buffers
1 %a= "unicorns" line 19
2 "rainbows" line 1
Press ENTER or type command to continue
I prefer Ctrl-G:
http://vimdoc.sourceforge.net/htmldoc/editing.html
CTRL-G or *CTRL-G* *:f* *:fi* *:file*
:f[ile] Prints the current file name (as typed, unless ":cd"
was used), the cursor position (unless the 'ruler'
option is set), and the file status (readonly,
modified, read errors, new file). See the 'shortmess'
option about how to make this message shorter.
{Vi does not include column number}
The filename of the currently edited file is in the %
register. You can view it with :reg %
.