vim-airline/autoload/airline
d10n 39c61288e8 Fix git hunk status disappearance on CursorHold
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'
2017-07-01 11:57:08 -04:00
..
extensions Fix git hunk status disappearance on CursorHold 2017-07-01 11:57:08 -04:00
themes Permit appending content to a theme 2017-03-12 18:16:26 -04:00
builder.vim correctly check w:airline_skip_empty_sections var 2017-04-11 22:10:43 +02:00
debug.vim Add 'scriptencoding utf-8' to all scripts 2016-09-24 08:16:30 +08:00
extensions.vim Update the ALE extension so it loads better and uses the new count format 2017-06-25 19:49:18 +01:00
highlighter.vim Revert "highlight: skip processing the same hi group twice" 2017-06-27 14:44:49 +02:00
init.vim syntastic: distinguis errors and warnings 2017-06-20 22:26:22 +02:00
msdos.vim Add 'scriptencoding utf-8' to all scripts 2016-09-24 08:16:30 +08:00
parts.vim shorten filetype only when winwidth is < 90 2017-05-02 22:06:36 +02:00
section.vim Add 'scriptencoding utf-8' to all scripts 2016-09-24 08:16:30 +08:00
themes.vim Add 'scriptencoding utf-8' to all scripts 2016-09-24 08:16:30 +08:00
util.vim tabline: Cache title as tablocal variable 2017-06-27 14:40:31 +02:00