Currently this is a hack, to get terminal mode from Vim.
However there is no better solution yet, since the API is not stable
here. Until then, just use the hack with
index(term_list(), bufnr('')) > -1
Previously the user was expected to set 'laststatus' himself to 2 if he
wanted to have airline be shown by default.
However it doesn't make much sense to have airline installed but not
display the statusline. Therefore, set the 'laststatus' to 2, if it
isn't set to it already.
When using vim-gitgutter and fugitive:
The hunks extension and the branch extension work as expected when the
file is first loaded; both parts are added to the statusline.
Once the cursor is moved and stopped for &updatetime ms:
1. The branch extension clears b:airline_head on CursorHold
2. Somehow (?) airline#statusline gets called on CursorHold
3. The hunks extension returns '' when b:airline_head is empty, causing
the hunks to be removed from the statusline.
It doesn't make sense to clear airline_head just because the cursor
moved, and the commit message adding the line doesn't say why:
13297cee03
Commit 174b7e1962 relies on airline_head
being set.
Debug detail:
Executing CursorHold Auto commands for "*"
autocommand unlet! b:airline_head
[...]
continuing in CursorHold Auto commands for "*"
calling function airline#statusline(1)
[...]
line 1: return exists('*airline#extensions#branch#head') && empty(get(b:, 'airline_head', ''))
function airline#extensions#hunks#get_hunks[13]..<SNR>32_get_hunks[14]..<SNR>32_get_hunks_gitgutter[1]..<SNR>32_is_branch_empty returning #1
function airline#extensions#hunks#get_hunks[13]..<SNR>32_get_hunks[14]..<SNR>32_get_hunks_gitgutter returning ''
function airline#extensions#hunks#get_hunks[13]..<SNR>32_get_hunks returning ''
function airline#extensions#hunks#get_hunks returning ''
:au CursorHold
--- Auto-Commands ---
gitgutter CursorHold
* call gitgutter#process_buffer(bufnr(''), 1)
CursorHold
* unlet! b:airline_head
airline_whitespace CursorHold
* call <sid>ws_refresh()
------------------------
Sample vimrc:
set nocompatible
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | q | doautocmd WinEnter
endif
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif
call plug#begin('~/.vim/bundle/')
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
call plug#end()
set laststatus=2
set updatetime=250
let g:airline_theme = 'dark'
Commmit a10d321809 introduced a small typo
spelling a previously set variable `trailing_fmt` as `trailing_fm`. This
causes Vim to report `trailing_fm` as an undefined variable. In this
change, the variable is properly referenced as `trailing_fmt`.
calling settabvar() while evaluating the 'tabline' setting apparently
causes flicker on Windows. Fall back to using `:let t:var` to store the
content in the current tabpage.
This is not as good as using `settabvar()` since we cannot store the
title for other tabs, but at least it should prevent the flicker and at
the same time at least cache the title for the current tabpage.
do not call airline#extensions#branch#head() but instead use the cached
variable b:airline_head.
Note: it looks like GitGutterGetHunkSummary() could need some cacheing
The comparison in airline#highlighter#exec() was there to prevent to
call out to too many :hi calls by making sure that the newly to be
defined highlighting group will be actually different from the current
existing one.
However, that did not work, as the returned old highlight
group did never match the newly to be created one, since it
intentionally left the cterm attributes out for the gui and the gui
attributes for the terminal.
Therefore, fix the comparasion and make it compare the actual values
that we have.
This should make vim-airline a bit faster (hopefully!)
Currently, vim-airline will check untracked status for files e.g. living
in .git. So when editing .git/config it will show as being untracked.
While technically, this is correct I prefer not to see this for those
files. So skip the check for those files.
if airline is initialized too early and some :hi commands are run,
this will force a redraw in Vim which will result in the intro screen
being cleared.
Currently, this does not work for gvim, not sure why.
closes#1476 (well only partly, until i have discovered, why for gvim it
doesn't work).
previously we only checked, that the group exists, however
if loading a new color scheme, this might lead to the group becoming
cleared. That means it still exists, but the highlighting group would
not show anything. Therefore, also check that the group is not cleared.
closes#1483
previous commit 2e3055541e broke the unit tests, since it renamed
the syntastic section. Fix that and also test correctly the other
sections, that have been added (and which have not been tested until
now).
Currently the syntastic results are simply dumped into the error
section, however syntastic does internally distinguish between error and
warning sections.
Therefore change the syntastic extension to dump errors into the error
section and warnings into the warning section.
closes#1480
If a file is edited inside a git repository, which lies within a git
repository, the branch extensions shows 'gitmaster | hgdefault'
To make it more obvious, that we are looking into both repositories
here, use 'git:master | hg:default'
closes#1482
vim-airline does use a different section (path/file) depending on
whether 'acd' is set. Later in the bufferline extesion however, it
unconditionally overwrites the 'file' section, regardless of whether
this section is actually used.
Therefore the bufferline section needs to check this option as well.
fixes#1487
This should not happen, however being a bit more error tolerant
shouldn't hurt, so let's just fall back to 'normal' for the
g:netrw_sort_direction in case it is not defined (which should be the
default anyhow).
fixes#1492