Add support for cdelledonne/vim-cmake

This commit is contained in:
Carlo Delle Donne 2020-07-17 15:14:40 +02:00
parent b6d6485a90
commit 72a19ed9ed
5 changed files with 47 additions and 0 deletions

View File

@ -14,6 +14,7 @@ This is the Changelog for the vim-airline project.
- [OmniSharp](https://github.com/OmniSharp/omnisharp-vim) support - [OmniSharp](https://github.com/OmniSharp/omnisharp-vim) support
- [searchcount](https://vim-jp.org/vimdoc-en/eval.html#searchcount()) support - [searchcount](https://vim-jp.org/vimdoc-en/eval.html#searchcount()) support
- [fern.vim](https://github.com/lambdalisue/fern.vim) support - [fern.vim](https://github.com/lambdalisue/fern.vim) support
- [Vim-CMake](https://github.com/cdelledonne/vim-cmake) support
- Improvements - Improvements
- git branch can also be displayed using [gina.vim](https://github.com/lambdalisue/gina.vim) - git branch can also be displayed using [gina.vim](https://github.com/lambdalisue/gina.vim)
- coc extensions can also show additional status messages - coc extensions can also show additional status messages

View File

@ -188,6 +188,9 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
#### [LanguageClient][57] #### [LanguageClient][57]
![image](https://user-images.githubusercontent.com/9622/45275524-52f45c00-b48b-11e8-8b83-a66240b10747.gif) ![image](https://user-images.githubusercontent.com/9622/45275524-52f45c00-b48b-11e8-8b83-a66240b10747.gif)
#### [Vim-CMake][60]
![image](https://user-images.githubusercontent.com/24732205/87788512-c876a380-c83d-11ea-9ee3-5f639f986a8f.png)
## Extras ## Extras
vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also: vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also:
@ -353,3 +356,4 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
[57]: https://github.com/autozimu/LanguageClient-neovim [57]: https://github.com/autozimu/LanguageClient-neovim
[58]: https://github.com/vim-airline/vim-airline/blob/master/LICENSE [58]: https://github.com/vim-airline/vim-airline/blob/master/LICENSE
[59]: https://github.com/neoclide/coc-git [59]: https://github.com/neoclide/coc-git
[60]: https://github.com/cdelledonne/vim-cmake

View File

@ -181,6 +181,12 @@ function! airline#extensions#load()
call add(s:loaded_ext, 'fzf') call add(s:loaded_ext, 'fzf')
endif endif
" Vim-CMake buffers are also terminal buffers, so this must be above term.
if get(g:, 'loaded_cmake', 0) && get(g:, 'airline#extensions#vimcmake#enabled', 1)
call airline#extensions#vimcmake#init(s:ext)
call add(s:loaded_ext, 'vimcmake')
endif
if (has("terminal") || has('nvim')) && if (has("terminal") || has('nvim')) &&
\ get(g:, 'airline#extensions#term#enabled', 1) \ get(g:, 'airline#extensions#term#enabled', 1)
call airline#extensions#term#init(s:ext) call airline#extensions#term#init(s:ext)

View File

@ -0,0 +1,30 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/cdelledonne/vim-cmake
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#vimcmake#init(ext) abort
call a:ext.add_statusline_func('airline#extensions#vimcmake#apply')
call a:ext.add_inactive_statusline_func('airline#extensions#vimcmake#inactive_apply')
endfunction
function! airline#extensions#vimcmake#apply(...) abort
if &filetype ==# 'vimcmake'
let spc = g:airline_symbols.space
call a:1.add_section('airline_a', spc.'CMake'.spc)
call a:1.add_section('airline_b', spc.'%{cmake#statusline#GetBuildInfo(1)}'.spc)
call a:1.add_section('airline_c', spc.'%{cmake#statusline#GetCmdInfo()}'.spc)
return 1
endif
endfunction
function! airline#extensions#vimcmake#inactive_apply(...) abort
if getbufvar(a:2.bufnr, '&filetype') ==# 'vimcmake'
let spc = g:airline_symbols.space
call a:1.add_section('airline_a', spc.'[CMake]')
call a:1.add_section('airline_b', spc.'%{cmake#statusline#GetBuildInfo(0)}')
call a:1.add_section('airline_c', spc.'%{cmake#statusline#GetCmdInfo()}')
return 1
endif
endfunction

View File

@ -1311,6 +1311,12 @@ vimagit <https://github.com/jreybert/vimagit>
* enable/disable vimagit integration > * enable/disable vimagit integration >
let g:airline#extensions#vimagit#enabled = 1 let g:airline#extensions#vimagit#enabled = 1
< <
------------------------------------- *airline-vimcmake*
Vim-CMake <https://github.com/cdelledonne/vim-cmake>
* enable/disable Vim-CMake integration >
let g:airline#extensions#vimcmake#enabled = 1
<
------------------------------------- *airline-vimtex* ------------------------------------- *airline-vimtex*
vimtex <https://github.com/lervag/vimtex> vimtex <https://github.com/lervag/vimtex>