BzrBranch

Provides capability for vim-airline to display the branch name when the file is part of a bzr branch instead.

Overview

vim-airline has the ability to show the branch name for files within a git or mercurial repository if vim-fugitive or vim-lawrencium is installed. For other repositories, they recommend using the vcscommand plugin and adding a special setting to .vimrc to enable such usage. When I tried it, it didn't work, spitting out several errors. I don't need full revision control support within vim; I just wanted airline to show the branch nick name. So, I wrote this.

Requirements

This plugin has been tested on Vim 7.4. It will probably work on others as well. It was tested against vim-airline git checkout as of 2014-11-08.

Installing

If you use Pathogen:

bzr branch http://linsam.homelinux.com/projs/bzrstatusline ~/.vim/bundle/bzrstatusline

Otherwise, branch or checkout the code and then copy the files into your ~/.vom directory.

Usage

After installing, add the following to your .vimrc:

autocmd VimEnter * call bzrstatusline#branch#install()

The next time you launch vim on a file within a bzr branch, the branch nickname will be displayed next to the branch symbol in the default statusline.

The display is done by appending the 'branchbzr' function to section_b, which is where the 'branch' plugin is located by default. If you do not want it in section_b (perhaps you customize a lot), call bzrstatusline#branch#init(1) instead of bzrstatusline#branch#install(), then add the 'branchbzr' function wherever you please.

Note that because this function is separate to the vim-airline branch extension, it is possible that both will activate if a location is both a bzr branch and a git or mercurial branch, even if not at the same level. For example, if my/path is a git repository, and my/path/whatever/subdir is a bzr branch, then this plugin will pick up the bzr nick, and vim-airline branch extension will pick up the git repository a few directories above, resulting in two branch displays. I don't know a reasonable way to deal with that quickly, and it doesn't affect me, so I'm unlikely to do anything about that.

Screen shot