diff options
author | Marvin Borner | 2020-03-16 23:33:42 +0100 |
---|---|---|
committer | Marvin Borner | 2020-03-16 23:33:42 +0100 |
commit | 0e9ddbb0bf0cd34500155ea4b03de2e2a38d8ab2 (patch) | |
tree | 719da1c7fe5dabb872fe9ff1582c39b55ccd488e /.config/nvim/plugged/vim-airline/autoload/airline/extensions/denite.vim | |
parent | e5d38956336ab1be954bdbd12808c5f98f8bd925 (diff) |
Well I'm using Arch again
Diffstat (limited to '.config/nvim/plugged/vim-airline/autoload/airline/extensions/denite.vim')
-rw-r--r-- | .config/nvim/plugged/vim-airline/autoload/airline/extensions/denite.vim | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/.config/nvim/plugged/vim-airline/autoload/airline/extensions/denite.vim b/.config/nvim/plugged/vim-airline/autoload/airline/extensions/denite.vim new file mode 100644 index 0000000..c0ae0f3 --- /dev/null +++ b/.config/nvim/plugged/vim-airline/autoload/airline/extensions/denite.vim @@ -0,0 +1,55 @@ +" MIT License. Copyright (c) 2017-2019 Thomas Dy et al. +" Plugin: https://github.com/Shougo/denite.nvim +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_denite', 0) + finish +endif + +let s:denite_ver = (exists('*denite#get_status_mode') ? 2 : 3) +" Denite does not use vim's built-in modal editing but has a custom prompt +" that implements its own insert/normal mode so we have to handle changing the +" highlight +function! airline#extensions#denite#check_denite_mode(bufnr) + if &filetype !=# 'denite' || &filetype !=# 'denite-filter' + return '' + endif + + if s:denite_ver == 3 + let mode = split(denite#get_status("mode"), ' ') + else + let mode = split(denite#get_status_mode(), ' ') + endif + let mode = tolower(get(mode, 1, '')) + if !exists('b:denite_mode_cache') || mode != b:denite_mode_cache + call airline#highlighter#highlight([mode], a:bufnr) + let b:denite_mode_cache = mode + endif + return '' +endfunction + +function! airline#extensions#denite#apply(...) + if &filetype ==# 'denite' || &filetype ==# 'denite-filter' + let w:airline_skip_empty_sections = 0 + call a:1.add_section('airline_a', ' Denite %{airline#extensions#denite#check_denite_mode('.a:2['bufnr'].')}') + if s:denite_ver == 3 + call a:1.add_section('airline_c', ' %{denite#get_status("sources")}') + call a:1.split() + call a:1.add_section('airline_y', ' %{denite#get_status("path")} ') + call a:1.add_section('airline_z', ' %{denite#get_status("linenr")} ') + else + call a:1.add_section('airline_c', ' %{denite#get_status_sources()}') + call a:1.split() + call a:1.add_section('airline_y', ' %{denite#get_status_path()} ') + call a:1.add_section('airline_z', ' %{denite#get_status_linenr()} ') + endif + return 1 + endif +endfunction + +function! airline#extensions#denite#init(ext) + call denite#custom#option('_', 'statusline', 0) + call a:ext.add_statusline_func('airline#extensions#denite#apply') +endfunction |