Let vim tab title - name of the current directory

Given that vim tabs are not intended to be used the same way tabs are used in TextMate, Sublime, etc. I plan to start using them, as suggested here , where each tab can be a different project or folder.

For example, I am currently working on a Rails application that splits into different projects that interact with each other, and I also sometimes look at the source of another source to see how it works, etc. Then I could try to work in such a way that each open tab matches a different project, using the fact that each tab can be linked to a different working directory.

Therefore, I would appreciate any advice on how to use vim correctly, and if that makes sense. In particular, I'm looking for a way to configure vim so that the tab title displays the name of the current directory for this tab, and not the name of the currently active buffer on this tab.

+4
source share
1 answer

This works for gvim, but you should be able to easily work with the vim terminal:

Everything in your .vimrc:

function! GuiTabLabel() return substitute( expand( '%:p' ), '.\+\/\(.\+\)\/.\+', '\1', '' ) endfunction set guitablabel=%{GuiTabLabel()} 

Not very pretty, the path separator is hard-coded, and I think the resulting tab labels are odd, but I think this is at least the starting point.

+3
source

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


All Articles