How to show persistent working directory in vim

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

Please note that this is another question, like here: How can I permanently display the path to the current file in Vim?

Here we want to show the full path to the current file being viewed, but I think it should show both, possibly two lines at the bottom of the file: one for the full path being viewed; another for the current working directory. The two may be different, because we can open a file that is not in the current working directory.

+5
source share
1 answer

You can do this by adding these lines to your .vimrc

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

The first parameter is to configure the status line, which will always be visible, the second is to add the current working directory to the status line.

Read more about


Edit: this is the answer to the question that the OP changed:

It is impossible to have a two-line status line (at least as far as I know). But you can add, for example, some formatting. So

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

For further study, I recommend reading the help that I mentioned earlier. Also, this question may be of some interest.

+7
source

Source: https://habr.com/ru/post/1233321/


All Articles