How can I have a permanent status line showing the name of the current file?

vim
30,878

Solution 1

From the manual, you're really just wanting:

set laststatus=2
set statusline=%f "tail of the filename

As an aside: if you're wanting a status line with a ton more information be sure to check out this link. It'll give you something a bit more fancier like so:-

alt text

Solution 2

You can use Ctrl+g to print the current file name along with the cursor position and the file status.

To permanently show the current filename (and much more) in the statusline, you can use the vim-airline plugin. By default, the statusline will look similar to this:

enter image description here

Share:
30,878
anon
Author by

anon

Updated on November 06, 2020

Comments

  • anon
    anon over 3 years

    I keep on forgetting which file I'm editing.

    In Vim 7.x, how can I have a permanent status bar at the bottom (like what is displayed when I press Ctrl+G) showing the current file name I'm editing?

  • johnsyweb
    johnsyweb about 13 years
    @anon: Add these lines to your .vimrc (or _vimrc on Windows).
  • bub
    bub over 7 years
    This works after setting it in .vimrc file. Can someone please tell me how I can force this to be displayed on the top?