59

I am using vim and I need a way to always be able to see the file that I am working on without having to do ^G.
I see the file name when I start vim but when I start to work and use various functions it gets lost.
Also I have seen other people have some kind of "addons" in the lower part of the vim console that seem like they are "button"/"tabs" (I am not sure how to describe them) that show various info constantly including the file name.
Any idea what are these plugins? Or how can I achieve what I want?

2

5 Answers 5

62

You can add this to your .vimrcfile, or temporarily while in vim.

  • vimrc - set laststatus=2
  • in vim - :set laststatus=2

To get the full path you can add this command, again to either your .vimrc or while in vim.

  • vimrc - set statusline+=%F
  • in vim - :set statusline+=%F

Examples

normal mode

                        ss #1

command line mode

                        ss #2

For more info than you care to read through there's additional info on both of these available in vim.

:help laststatus :help statusline 

References

3
  • Weird name (no mnemonic I think). This does not seem to show the full path. Would showing the full path be an option? Commented Jan 29, 2014 at 22:54
  • @Jim - see updates Commented Jan 29, 2014 at 23:07
  • @Jim it's just as ls command set ls=2 Commented Jan 30, 2014 at 8:09
14

I find that adding the currently opened file name on the window title bar using

: set title 

in the .vimrc looks like less obnoxious then always having the status bar taking up a full line at the bottom.

7

The tabs you are probably referring to is not a plugin, but a built-in. Try

:tabnew 

It should open a new tab and you should see the menu bar, showing the name of the files in the different tabs. To always show this menu-bar, use

:set showtabline=2 

Although this makes only sense when you really want to work with tabs (I can recommend it). Otherwise I'd suggest to set the name in the statusbar as outlined by others.

4
  • No.Not tabs for sure.I know about tabs. Commented Jan 30, 2014 at 6:13
  • 1
    Thanks for the downvote. Tabs show the name of the file, that's what you want, no? You called them tabs yourself... Commented Jan 30, 2014 at 11:10
  • 2
    @Jim what's wrong with tabs? Commented Jul 20, 2016 at 3:14
  • 2
    This is exactly what I was looking for. Commented Jan 2, 2021 at 6:52
4

Also check out vim-airline. Note that you still have to use "set laststatus=2" show the status line.

enter image description here

1
  • wow, will try it after finish this task!. Commented Aug 3, 2021 at 15:18
1

Try this for full path:

:set statusline =%4*\ %<%F%* 

More info: http://got-ravings.blogspot.com/2008/08/vim-pr0n-making-statuslines-that-own.html

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.