Tim Pope has just released a new plugin called Flagship (GitHub: tpope/vim-flagship, License: Vim). It makes customising the status line and tab line much easier, and other plugins can extend it as well. For example, if you've got fugitive.vim installed, then you should see the current Git branch in the status line.

This script isn't quite the same as the airline breed of plugins that use super fancy glyphs to make the status line look like a GUI. But it does integrate well with 'statusline' and makes the tab line saner.

The extension API is great for adding flags, but what if you want to change the core content? For the status line, Vim already provides a perfectly adequate 'statusline' option, and Flagship will use it in constructing its own. Customizing your status line is exactly the same with and without Flagship.

Unfortunately, dealing with the tab line is much more problematic:

The usual technique (see :help setting-tabline) involves creating a function that cycles through each tab and assembles a giant format string. Furthermore, while you can use the same status line "%" items, they're expanded in the context of the active window only, rendering most of them worthless for any tab but the current.

Tim calls this an abomination, and instead provides the g:tablabel option, which you can set to customise the format of a tab:

let g:tablabel =
  \ "%N%{flagship#tabmodified()} %{flagship#tabcwds('shorten',',')}"

I've been testing out Flagship and I really like it so far. It has great documentation and is easy to install. I refuse to change fonts for any script, so this is exactly what I was looking for!

blog comments powered by Disqus