zefei / vim-wintabs

Modern buffer manager for Vim
MIT License
325 stars 25 forks source link

Allow overriding buf_label specifically #51

Open tmandry opened 5 years ago

tmandry commented 5 years ago

I wanted to change the format of buffer labels beyond the format string you've defined, but this required duplicating a chunk of code in my vimrc to get back the highlighting behavior. (It was also a bit confusing, since at first I copied vim-wintabs code, only to realize I needed to copy vim-wintabs-powerline code.)

Can you add a hook for customizing only buf_label?

If you're curious, the label I want is not only the file, but its parent directory name (one level only, so each buffer label has exactly one /).

Love the plugin, it's quickly becoming one of my favorites!

zefei commented 5 years ago

Hi, sorry for the late reply. Let me check if there's a good way to add a hook for buf_label. The function wintabs#renderers#bufname is interestingly one of the most expensive function in the plugin and is cached with its dependencies (bufnr, and flags like readonly); so providing hooks may be non-trivial. Anyways, if a hook isn't possible, I'll write a new buffer_name_format substitution.