7

A very simple question, is there some way to show constantly the current working directory at the bottom of the file opened by vim? Thanks.

Note this is a different question as here: How can I permanently display the path of the current file in Vim?

There we want to show the full path of the current file viewed, but what I am thinking is to show both, maybe two lines on the bottom of file: one for full path currently viewed; the other for the current working directory. These two could be different as we can open a file that's not in the current working directory.

Community
  • 1
  • 1
wiswit
  • 5,599
  • 7
  • 30
  • 32

1 Answers1

11

You can do it by adding these lines in your .vimrc

set laststatus=2
set statusline=%!getcwd()

The first setting is to configure statusline to be always visible, second one is to add a current working directory to statusline.

More on


Edit: This is an answer to OP's changed question:

It is not possible to have two-line statusline (at least to my knowledge). But it is possible to add e.g. some formatting. So

set laststatus=2
set statusline=%F
set statusline+=%=
set statusline+=%{getcwd()}

To further study I recommend to read help I mentioned before. Also this question might be of some interest.

Community
  • 1
  • 1
ryuichiro
  • 3,765
  • 1
  • 16
  • 21
  • A two-line statusline is possible if you're willing to recompile vim. The Patch is here: https://gist.github.com/h-east/3158492 & discussion of the patch with screenshots here https://github.com/vim-jp/issues/issues/225 – masukomi Dec 20 '19 at 14:57