Display name of the current file in vim?
ctrl+g will do it.
Also, I like to have:
set statusline="%f%m%r%h%w [%Y] [0x%02.2B]%< %F%=%4v,%4l %3p%% of %L"
Which produces:
foo.c [C] [0x23]<code/foo.c 1, 1 2% of 50
Also, as someone mentioned (but now deleted) %
will be replaced with the current filename. For example:
:!echo "current file: %" current file: foo.c Press ENTER or type command to continue
:f
(:file
) will do same as <C-G>
. :f!
will give a untruncated version, if applicable.
set the status line. more info with :help statusline
These commands can go in your .vimrc file, or you can enter them as commands while in vim by typing ':' in command mode.
First, set last status to 2 using the following:
set laststatus=2
Then set status line to %f for short file name.
set statusline=%f
For the full path to the file, use %F.