mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-12-08 21:14:44 +08:00
Compare commits
276 Commits
v0.8
...
dynamic_wi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f78ad819a | ||
|
|
f86f1e8103 | ||
|
|
811360a095 | ||
|
|
c8a5efc11e | ||
|
|
e7d18fe427 | ||
|
|
0a352c9f5b | ||
|
|
ac032b752a | ||
|
|
b101175683 | ||
|
|
fde2511201 | ||
|
|
57e564b227 | ||
|
|
7d082c03b2 | ||
|
|
87cdf8f6c4 | ||
|
|
52c0afadb9 | ||
|
|
258f3e5630 | ||
|
|
2e3055541e | ||
|
|
d2b697d27b | ||
|
|
ed95adea1e | ||
|
|
7f3d6287b5 | ||
|
|
1891933e59 | ||
|
|
9168b73411 | ||
|
|
c436592559 | ||
|
|
e16ff7cc88 | ||
|
|
9eb51f48f4 | ||
|
|
7865dc8149 | ||
|
|
466198adc0 | ||
|
|
8e64138ef4 | ||
|
|
d593359500 | ||
|
|
b3722b1e82 | ||
|
|
a950a2938a | ||
|
|
0c368681dd | ||
|
|
bcb52a1feb | ||
|
|
13bd4701ed | ||
|
|
4a47cd70cd | ||
|
|
f76ede3b28 | ||
|
|
396b49be4c | ||
|
|
e14f6579d7 | ||
|
|
b4ad02f906 | ||
|
|
703241942a | ||
|
|
7813a54912 | ||
|
|
223624d3e9 | ||
|
|
3a23eeac42 | ||
|
|
b57022bfc2 | ||
|
|
70dd0655d2 | ||
|
|
46b0b6bf5a | ||
|
|
c9a0c62b1b | ||
|
|
17d2db93fd | ||
|
|
ba7d8c59f7 | ||
|
|
d46fb524bd | ||
|
|
fb6231b479 | ||
|
|
134c0204f3 | ||
|
|
fbd791e7f0 | ||
|
|
52663545a9 | ||
|
|
9876a0a2de | ||
|
|
ac9e4092ef | ||
|
|
3c6135d75f | ||
|
|
2ea22c1aaa | ||
|
|
9d89375b8f | ||
|
|
727a2b48d9 | ||
|
|
7e6986651c | ||
|
|
f8c85e3e53 | ||
|
|
d624a44500 | ||
|
|
078537f1e2 | ||
|
|
72478dee02 | ||
|
|
dd2740f510 | ||
|
|
db01efd508 | ||
|
|
b2bbe7dbc2 | ||
|
|
562d060b08 | ||
|
|
d8b62aa426 | ||
|
|
f1574c4e0a | ||
|
|
69b132a6f4 | ||
|
|
583121bbc9 | ||
|
|
b66c1ef070 | ||
|
|
8a01eff1c2 | ||
|
|
8776a3e058 | ||
|
|
7df411d59b | ||
|
|
1a79d148dc | ||
|
|
b56a064377 | ||
|
|
9a95964256 | ||
|
|
e7e4769dc1 | ||
|
|
a1db013d3f | ||
|
|
92d3637384 | ||
|
|
3a857617e3 | ||
|
|
85cbdd8de3 | ||
|
|
9b1770f246 | ||
|
|
bfac656da9 | ||
|
|
d60323d623 | ||
|
|
a2431f2adb | ||
|
|
e83ed24088 | ||
|
|
706cee277a | ||
|
|
73a1238205 | ||
|
|
a69834f7dc | ||
|
|
a0ea8db1fc | ||
|
|
5e2ef0cd83 | ||
|
|
c375d050a8 | ||
|
|
7cd7972bbe | ||
|
|
dfc0cb772a | ||
|
|
7cb5c24151 | ||
|
|
781b4ea6a2 | ||
|
|
17b6bd9c8f | ||
|
|
0357b4fcbe | ||
|
|
4c39344cc1 | ||
|
|
718107c107 | ||
|
|
04be981de9 | ||
|
|
ccdc3d6c60 | ||
|
|
ee8173e41d | ||
|
|
53c8aa4fd6 | ||
|
|
b67509189b | ||
|
|
d4a239f14a | ||
|
|
3ebd7ad64b | ||
|
|
4e93a90441 | ||
|
|
c02d774b05 | ||
|
|
241f324b39 | ||
|
|
cebfc9a64b | ||
|
|
2dae2b364e | ||
|
|
a314038280 | ||
|
|
258430db82 | ||
|
|
433d5d8f97 | ||
|
|
545617f4f4 | ||
|
|
e7056db27a | ||
|
|
3899f848a7 | ||
|
|
02ecb8631d | ||
|
|
6dae3452db | ||
|
|
3bd6cb5ee4 | ||
|
|
b97d7a11f4 | ||
|
|
516870bf9f | ||
|
|
0ea4daa103 | ||
|
|
98fe4eabd4 | ||
|
|
2af2bdb424 | ||
|
|
5fe511c20b | ||
|
|
58e7e276fa | ||
|
|
6a155fabda | ||
|
|
69020706b2 | ||
|
|
14ab47cae6 | ||
|
|
64d91665fe | ||
|
|
be6e3db68b | ||
|
|
8964603844 | ||
|
|
2dc2748804 | ||
|
|
06351e86df | ||
|
|
45e5c907be | ||
|
|
4f8a16c31e | ||
|
|
81ccd3bdf6 | ||
|
|
c39e5f82cc | ||
|
|
f706edee9f | ||
|
|
57ca6c9e78 | ||
|
|
ffa3d59af2 | ||
|
|
75a0199a7d | ||
|
|
78439b2b35 | ||
|
|
2be9a044e0 | ||
|
|
7a736021ee | ||
|
|
f5359f9177 | ||
|
|
3c33251ee7 | ||
|
|
1c052e39b1 | ||
|
|
29c556dba4 | ||
|
|
5ee2cd9acf | ||
|
|
3d667c32d3 | ||
|
|
513afd25bc | ||
|
|
45d77ca909 | ||
|
|
c1704a2de0 | ||
|
|
73152217fb | ||
|
|
da457ae5ea | ||
|
|
7a720bbbd7 | ||
|
|
6e3c0c1c14 | ||
|
|
65b9aa4856 | ||
|
|
c058922358 | ||
|
|
afee79bbe0 | ||
|
|
0b1df0c524 | ||
|
|
73aea86a7a | ||
|
|
168b18ff0a | ||
|
|
c0cb03f48b | ||
|
|
54e4772ef8 | ||
|
|
5eaf658b9c | ||
|
|
f6155d11fb | ||
|
|
afb75adc11 | ||
|
|
ea98b42a0d | ||
|
|
7612aaf701 | ||
|
|
43e3ef5428 | ||
|
|
d00f7b35d2 | ||
|
|
36c7f5a2a3 | ||
|
|
62fa44f8b3 | ||
|
|
460ed02864 | ||
|
|
4b5441a8f7 | ||
|
|
53dcd8a49c | ||
|
|
657cf773ad | ||
|
|
797ad1ea79 | ||
|
|
64188c395f | ||
|
|
62eb44a9d6 | ||
|
|
4d0c4f6b1e | ||
|
|
fdd29caef4 | ||
|
|
a6c04644ef | ||
|
|
8fda614d0d | ||
|
|
a710cb99dd | ||
|
|
63dc4ba2a4 | ||
|
|
e1f7bffe71 | ||
|
|
c6f5d8b823 | ||
|
|
98b329daf1 | ||
|
|
e715bce77b | ||
|
|
409e8b0cbd | ||
|
|
5b00d54cd6 | ||
|
|
fadd737a29 | ||
|
|
ece61f346e | ||
|
|
fbfea6daee | ||
|
|
39f046664d | ||
|
|
bc095bcde1 | ||
|
|
5c24c3c504 | ||
|
|
72b316c871 | ||
|
|
41df6668c7 | ||
|
|
8d681c7119 | ||
|
|
7b9b68f15d | ||
|
|
f51f73773d | ||
|
|
429cfcd71e | ||
|
|
6c8f33f192 | ||
|
|
74aacca55d | ||
|
|
64f06309b1 | ||
|
|
5a170c5ef0 | ||
|
|
4d39cb6f20 | ||
|
|
985f3d3eca | ||
|
|
83b6dd11a8 | ||
|
|
70c16f4c46 | ||
|
|
8d8d9afaef | ||
|
|
e67b2847ea | ||
|
|
ba94fa12b9 | ||
|
|
eef069d7bc | ||
|
|
99cd26cda4 | ||
|
|
46f854fc83 | ||
|
|
bd4cb97e85 | ||
|
|
0d05196426 | ||
|
|
4ca34804b2 | ||
|
|
727208d766 | ||
|
|
a4840f1585 | ||
|
|
62dfab26de | ||
|
|
8171fcaf2e | ||
|
|
811e51575c | ||
|
|
2d7f5b2cc1 | ||
|
|
30f078daf5 | ||
|
|
eaf2034163 | ||
|
|
cf5632bb94 | ||
|
|
9bcb6ae64e | ||
|
|
a8dfdd40b7 | ||
|
|
64a3bfd439 | ||
|
|
d36085a5b0 | ||
|
|
9dfc4d0c04 | ||
|
|
ad3eee7e72 | ||
|
|
057b429b02 | ||
|
|
b91f729586 | ||
|
|
81b58028f0 | ||
|
|
a5f7b9520a | ||
|
|
86e7d19df1 | ||
|
|
e1627d2144 | ||
|
|
1b9035cc51 | ||
|
|
b8c1b26f0e | ||
|
|
1e77e6cbcc | ||
|
|
39039aceb2 | ||
|
|
5652b576b0 | ||
|
|
abcb3c4bb3 | ||
|
|
95237f6604 | ||
|
|
a5fab144aa | ||
|
|
3f2247593a | ||
|
|
0c251e20a7 | ||
|
|
1bb8b6278e | ||
|
|
a79e35b5e3 | ||
|
|
168dd7970a | ||
|
|
066d936076 | ||
|
|
377010ea6e | ||
|
|
f402b78be9 | ||
|
|
8f83231078 | ||
|
|
dba50e9eea | ||
|
|
842e562359 | ||
|
|
5ee24f5d87 | ||
|
|
9afebc9233 | ||
|
|
79899c76bf | ||
|
|
b2461f612e | ||
|
|
73146e3e73 | ||
|
|
ae4a978509 | ||
|
|
bc7aa0c812 | ||
|
|
582958d6c5 | ||
|
|
c8048973cd |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
doc/tags
|
||||
*.lock
|
||||
.vim-flavor
|
||||
*.swp
|
||||
|
||||
@@ -3,7 +3,14 @@
|
||||
- vim: ????
|
||||
- vim-airline: ????
|
||||
- OS: ????
|
||||
- Have you reproduced with a minimal vimrc: ???
|
||||
- What is your airline configuration: ???
|
||||
if you are using terminal:
|
||||
- terminal: ????
|
||||
- $TERM variable: ???
|
||||
- color configuration (:set t_Co?):
|
||||
if you are using Neovim:
|
||||
- does it happen in Vim: ???
|
||||
|
||||
#### actual behavior
|
||||
|
||||
|
||||
51
README.md
51
README.md
@@ -12,7 +12,7 @@ Lean & mean status/tabline for vim that's light as air.
|
||||
[undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29],
|
||||
[vim-signify][30], [quickfixsigns][39], [syntastic][5], [eclim][34],
|
||||
[lawrencium][21], [virtualenv][31], [tmuxline][35], [taboo.vim][37],
|
||||
[ctrlspace][38] and more.
|
||||
[ctrlspace][38], [vim-bufmru][47], [vimagit][50], [denite][51] and more.
|
||||
* Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
|
||||
* Optimized for speed; it loads in under a millisecond.
|
||||
* Extensive suite of themes for popular color schemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others.
|
||||
@@ -72,6 +72,9 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
|
||||
#### [unite.vim][9]
|
||||

|
||||
|
||||
#### [denite.nvim][51]
|
||||

|
||||
|
||||
#### [tagbar][19]
|
||||

|
||||
|
||||
@@ -84,6 +87,9 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
|
||||
#### hunks ([vim-gitgutter][29] & [vim-signify][30])
|
||||

|
||||
|
||||
#### [vimagit][50]
|
||||

|
||||
|
||||
#### [virtualenv][31]
|
||||

|
||||
|
||||
@@ -96,6 +102,12 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
|
||||
#### [ctrlspace][38]
|
||||

|
||||
|
||||
#### [xkb-switch][48]/[xkb-layout][49]
|
||||

|
||||
|
||||
#### [vimtex][53]
|
||||

|
||||
|
||||
## Extras
|
||||
|
||||
vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also:
|
||||
@@ -139,19 +151,16 @@ I wrote the initial version on an airplane, and since it's light as air it turne
|
||||
|
||||
This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers:
|
||||
|
||||
* [Pathogen][11]
|
||||
* `git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline`
|
||||
* Remember to run `:Helptags` to generate help tags
|
||||
* [NeoBundle][12]
|
||||
* `NeoBundle 'vim-airline/vim-airline'`
|
||||
* [Vundle][13]
|
||||
* `Plugin 'vim-airline/vim-airline'`
|
||||
* [Plug][40]
|
||||
* `Plug 'vim-airline/vim-airline'`
|
||||
* [VAM][22]
|
||||
* `call vam#ActivateAddons([ 'vim-airline' ])`
|
||||
* manual
|
||||
* copy all of the files into your `~/.vim` directory
|
||||
| Plugin Manager | Install with... |
|
||||
| ------------- | ------------- |
|
||||
| [Pathogen][11] | `git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline`<br/>Remember to run `:Helptags` to generate help tags |
|
||||
| [NeoBundle][12] | `NeoBundle 'vim-airline/vim-airline'` |
|
||||
| [Vundle][13] | `Plugin 'vim-airline/vim-airline'` |
|
||||
| [Plug][40] | `Plug 'vim-airline/vim-airline'` |
|
||||
| [VAM][22] | `call vam#ActivateAddons([ 'vim-airline' ])` |
|
||||
| [Dein][52] | `call dein#add('vim-airline/vim-airline')` |
|
||||
| [minpac][54] | `call minpac#add('vim-airline/vim-airline')` |
|
||||
| manual | copy all of the files into your `~/.vim` directory |
|
||||
|
||||
# Configuration
|
||||
|
||||
@@ -194,9 +203,7 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
|
||||
|
||||
# License
|
||||
|
||||
MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
MIT License. Copyright (c) 2013-2017 Bailey Ling & Contributors.
|
||||
|
||||
[1]: https://github.com/Lokaltog/vim-powerline
|
||||
[2]: https://github.com/Lokaltog/powerline
|
||||
@@ -210,7 +217,7 @@ MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
[10]: https://github.com/ctrlpvim/ctrlp.vim
|
||||
[11]: https://github.com/tpope/vim-pathogen
|
||||
[12]: https://github.com/Shougo/neobundle.vim
|
||||
[13]: https://github.com/gmarik/vundle
|
||||
[13]: https://github.com/VundleVim/Vundle.vim
|
||||
[14]: https://github.com/vim-airline/vim-airline/wiki/Screenshots
|
||||
[15]: https://github.com/techlivezheng/vim-plugin-minibufexpl
|
||||
[16]: https://github.com/sjl/gundo.vim
|
||||
@@ -244,3 +251,11 @@ MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
[44]: https://github.com/mhartington
|
||||
[45]: https://github.com/vim-airline/vim-airline/commit/d7fd8ca649e441b3865551a325b10504cdf0711b
|
||||
[46]: https://github.com/vim-airline/vim-airline#themes
|
||||
[47]: https://github.com/mildred/vim-bufmru
|
||||
[48]: https://github.com/ierton/xkb-switch
|
||||
[49]: https://github.com/vovkasm/input-source-switcher
|
||||
[50]: https://github.com/jreybert/vimagit
|
||||
[51]: https://github.com/Shougo/denite.nvim
|
||||
[52]: https://github.com/Shougo/dein.vim
|
||||
[53]: https://github.com/lervag/vimtex
|
||||
[54]: https://github.com/k-takata/minpac/
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', [])
|
||||
|
||||
let s:sections = ['a','b','c','gutter','x','y','z', 'error', 'warning']
|
||||
@@ -65,6 +67,8 @@ function! airline#switch_theme(name)
|
||||
let w:airline_lastmode = ''
|
||||
call airline#load_theme()
|
||||
|
||||
silent doautocmd User AirlineAfterTheme
|
||||
|
||||
" this is required to prevent clobbering the startup info message, i don't know why...
|
||||
call airline#check_mode(winnr())
|
||||
endfunction
|
||||
@@ -107,11 +111,8 @@ function! airline#update_statusline()
|
||||
call s:invoke_funcrefs(context, s:inactive_funcrefs)
|
||||
endfor
|
||||
|
||||
unlet! w:airline_render_left
|
||||
unlet! w:airline_render_right
|
||||
for section in s:sections
|
||||
unlet! w:airline_section_{section}
|
||||
endfor
|
||||
unlet! w:airline_render_left w:airline_render_right
|
||||
exe 'unlet! ' 'w:airline_section_'. join(s:sections, ' w:airline_section_')
|
||||
|
||||
let w:airline_active = 1
|
||||
let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) }
|
||||
@@ -142,6 +143,11 @@ function! airline#statusline(winnr)
|
||||
endfunction
|
||||
|
||||
function! airline#check_mode(winnr)
|
||||
if !exists("s:airline_run")
|
||||
let s:airline_run = 0
|
||||
endif
|
||||
let s:airline_run += 1
|
||||
|
||||
let context = s:contexts[a:winnr]
|
||||
|
||||
if get(w:, 'airline_active', 1)
|
||||
@@ -175,17 +181,27 @@ function! airline#check_mode(winnr)
|
||||
call add(l:mode, 'crypt')
|
||||
endif
|
||||
|
||||
if g:airline_detect_spell && &spell
|
||||
call add(l:mode, 'spell')
|
||||
endif
|
||||
|
||||
if &readonly || ! &modifiable
|
||||
call add(l:mode, 'readonly')
|
||||
endif
|
||||
|
||||
let mode_string = join(l:mode)
|
||||
if s:airline_run < 3
|
||||
" skip this round.
|
||||
" When this function is run too early after startup,
|
||||
" it forces a redraw by vim which will remove the intro screen.
|
||||
let w:airline_lastmode = mode_string
|
||||
return ''
|
||||
endif
|
||||
if get(w:, 'airline_lastmode', '') != mode_string
|
||||
call airline#highlighter#highlight_modified_inactive(context.bufnr)
|
||||
call airline#highlighter#highlight(l:mode)
|
||||
call airline#highlighter#highlight(l:mode, context.bufnr)
|
||||
let w:airline_lastmode = mode_string
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,21 +1,37 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" min percentage width per section
|
||||
let g:section_width = get(g:, 'airline#extensions#default#section_width', {
|
||||
\ 'a': {'pct': 7},
|
||||
\ 'b': {'pct': 10},
|
||||
\ 'c': {'pct': 25},
|
||||
\ 'x': {'pct': 7},
|
||||
\ 'y': {'pct': 11},
|
||||
\ 'z': {'pct': 15},
|
||||
\ 'warning': {'pct': 10},
|
||||
\ 'error': {'pct': 10},
|
||||
\ 'gutter': {'pct': 5},
|
||||
\ })
|
||||
|
||||
let s:prototype = {}
|
||||
|
||||
function! s:prototype.split(...)
|
||||
function! s:prototype.split(...) dict
|
||||
call add(self._sections, ['|', a:0 ? a:1 : '%='])
|
||||
endfunction
|
||||
|
||||
function! s:prototype.add_section_spaced(group, contents)
|
||||
call self.add_section(a:group, (g:airline_symbols.space).a:contents.(g:airline_symbols.space))
|
||||
function! s:prototype.add_section_spaced(group, contents) dict
|
||||
let spc = empty(a:contents) ? '' : g:airline_symbols.space
|
||||
call self.add_section(a:group, spc.a:contents.spc)
|
||||
endfunction
|
||||
|
||||
function! s:prototype.add_section(group, contents)
|
||||
function! s:prototype.add_section(group, contents) dict
|
||||
call add(self._sections, [a:group, a:contents])
|
||||
endfunction
|
||||
|
||||
function! s:prototype.add_raw(text)
|
||||
function! s:prototype.add_raw(text) dict
|
||||
call add(self._sections, ['', a:text])
|
||||
endfunction
|
||||
|
||||
@@ -31,18 +47,39 @@ function! s:get_prev_group(sections, i)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:prototype.build()
|
||||
function! s:prototype.build() dict
|
||||
let side = 1
|
||||
let line = ''
|
||||
let i = 0
|
||||
let length = len(self._sections)
|
||||
let split = 0
|
||||
let is_empty = 0
|
||||
let prev_group = ''
|
||||
|
||||
while i < length
|
||||
let section = self._sections[i]
|
||||
let group = section[0]
|
||||
let contents = section[1]
|
||||
let pgroup = prev_group
|
||||
let prev_group = s:get_prev_group(self._sections, i)
|
||||
if group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
|
||||
let group = 'airline_c'. self._context.bufnr
|
||||
elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
|
||||
let prev_group = 'airline_c'. self._context.bufnr
|
||||
endif
|
||||
if is_empty
|
||||
let prev_group = pgroup
|
||||
endif
|
||||
let is_empty = s:section_is_empty(self, contents)
|
||||
|
||||
if is_empty
|
||||
" need to fix highlighting groups, since we
|
||||
" have skipped a section, we actually need
|
||||
" the previous previous group and so the
|
||||
" seperator goes from the previous previous group
|
||||
" to the current group
|
||||
let pgroup = group
|
||||
endif
|
||||
|
||||
if group == ''
|
||||
let line .= contents
|
||||
@@ -54,18 +91,24 @@ function! s:prototype.build()
|
||||
if prev_group == ''
|
||||
let line .= '%#'.group.'#'
|
||||
elseif split
|
||||
let line .= s:get_transitioned_seperator(self, prev_group, group, side)
|
||||
if !is_empty
|
||||
let line .= s:get_transitioned_seperator(self, prev_group, group, side)
|
||||
endif
|
||||
let split = 0
|
||||
else
|
||||
let line .= s:get_seperator(self, prev_group, group, side)
|
||||
if !is_empty
|
||||
let line .= s:get_seperator(self, prev_group, group, side)
|
||||
endif
|
||||
endif
|
||||
let line .= s:get_accented_line(self, group, contents)
|
||||
let contents = s:calculate_max_width(self, contents, group)
|
||||
let line .= is_empty ? '' : s:get_accented_line(self, group, contents)
|
||||
endif
|
||||
|
||||
let i = i + 1
|
||||
endwhile
|
||||
|
||||
if !self._context.active
|
||||
"let line = substitute(line, '%#airline_c#', '%#airline_c'.self._context.bufnr.'#', '')
|
||||
let line = substitute(line, '%#.\{-}\ze#', '\0_inactive', 'g')
|
||||
endif
|
||||
return line
|
||||
@@ -118,6 +161,84 @@ function! s:get_accented_line(self, group, contents)
|
||||
return line
|
||||
endfunction
|
||||
|
||||
function! s:calculate_section_width()
|
||||
if get(b:, 'airline_winwidth', 0) != winwidth(0)
|
||||
let winwidth = winwidth(0)
|
||||
for key in keys(g:section_width)
|
||||
let g:section_width[key]['width'] = float2nr(winwidth * (g:section_width[key]['pct']/100.0))
|
||||
endfor
|
||||
let b:airline_winwidth = winwidth
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:calculate_max_width(self, content, key)
|
||||
if a:self._context.active == 0 ||
|
||||
\ get(a:self._context, 'tabline', 0)
|
||||
return a:content
|
||||
endif
|
||||
call s:calculate_section_width()
|
||||
if winwidth(0) >= 100
|
||||
" only truncate sections for window width < 100
|
||||
return a:content
|
||||
endif
|
||||
let section_key = matchstr(a:key, 'airline_\zs.*')
|
||||
let width = g:section_width[section_key]['width']
|
||||
if section_key == 'c'
|
||||
" for the buffername, use a min-width
|
||||
return '%-'.(width > 50 ? 50 : width).'.('.a:content.'%)'
|
||||
else
|
||||
" the rest takes a maxwidth
|
||||
return '%-.'.width.'('.a:content.'%)'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:section_is_empty(self, content)
|
||||
let start=1
|
||||
|
||||
" do not check for inactive windows or the tabline
|
||||
if a:self._context.active == 0
|
||||
return 0
|
||||
elseif get(a:self._context, 'tabline', 0)
|
||||
return 0
|
||||
endif
|
||||
|
||||
" only check, if airline#skip_empty_sections == 1
|
||||
if get(g:, 'airline_skip_empty_sections', 0) == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" only check, if airline#skip_empty_sections == 1
|
||||
if get(w:, 'airline_skip_empty_sections', -1) == 0
|
||||
return 0
|
||||
endif
|
||||
" assume accents sections to be never empty
|
||||
" (avoides, that on startup the mode message becomes empty)
|
||||
if match(a:content, '%#__accent_[^#]*#.*__restore__#') > -1
|
||||
return 0
|
||||
endif
|
||||
if empty(a:content)
|
||||
return 1
|
||||
endif
|
||||
let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start)
|
||||
if empty(list)
|
||||
return 0 " no function in statusline text
|
||||
endif
|
||||
while len(list) > 0
|
||||
let expr = list[0]
|
||||
try
|
||||
" catch all exceptions, just in case
|
||||
if !empty(eval(expr))
|
||||
return 0
|
||||
endif
|
||||
catch
|
||||
return 0
|
||||
endtry
|
||||
let start += 1
|
||||
let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start)
|
||||
endw
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! airline#builder#new(context)
|
||||
let builder = copy(s:prototype)
|
||||
let builder._context = a:context
|
||||
@@ -131,4 +252,3 @@ function! airline#builder#new(context)
|
||||
\ }, 'keep')
|
||||
return builder
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#debug#profile1()
|
||||
profile start airline-profile-switch.log
|
||||
profile func *
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:ext = {}
|
||||
let s:ext._theme_funcrefs = []
|
||||
|
||||
@@ -118,28 +120,42 @@ function! s:sync_active_winnr()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#load()
|
||||
let loaded_ext = []
|
||||
" non-trivial number of external plugins use eventignore=all, so we need to account for that
|
||||
autocmd CursorMoved * call <sid>sync_active_winnr()
|
||||
|
||||
if exists('g:airline_extensions')
|
||||
for ext in g:airline_extensions
|
||||
call airline#extensions#{ext}#init(s:ext)
|
||||
try
|
||||
call airline#extensions#{ext}#init(s:ext)
|
||||
catch /^Vim\%((\a\+)\)\=:E117/ " E117, function does not exist
|
||||
call airline#util#warning("Extension '".ext."' not installed, ignoring!")
|
||||
endtry
|
||||
endfor
|
||||
return
|
||||
endif
|
||||
|
||||
call airline#extensions#quickfix#init(s:ext)
|
||||
call add(loaded_ext, 'quickfix')
|
||||
|
||||
if get(g:, 'loaded_unite', 0)
|
||||
call airline#extensions#unite#init(s:ext)
|
||||
call add(loaded_ext, 'unite')
|
||||
endif
|
||||
|
||||
if get(g:, 'loaded_denite', 0)
|
||||
call airline#extensions#denite#init(s:ext)
|
||||
call add(loaded_ext, 'denite')
|
||||
endif
|
||||
|
||||
if exists(':NetrwSettings')
|
||||
call airline#extensions#netrw#init(s:ext)
|
||||
call add(loaded_ext, 'netrw')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#ycm#enabled', 0)
|
||||
call airline#extensions#ycm#init(s:ext)
|
||||
call add(loaded_ext, 'ycm')
|
||||
endif
|
||||
|
||||
if get(g:, 'loaded_vimfiler', 0)
|
||||
@@ -148,33 +164,46 @@ function! airline#extensions#load()
|
||||
|
||||
if get(g:, 'loaded_ctrlp', 0)
|
||||
call airline#extensions#ctrlp#init(s:ext)
|
||||
call add(loaded_ext, 'ctrlp')
|
||||
endif
|
||||
|
||||
if get(g:, 'CtrlSpaceLoaded', 0)
|
||||
call airline#extensions#ctrlspace#init(s:ext)
|
||||
call add(loaded_ext, 'ctrlspace')
|
||||
endif
|
||||
|
||||
if get(g:, 'command_t_loaded', 0)
|
||||
call airline#extensions#commandt#init(s:ext)
|
||||
call add(loaded_ext, 'commandt')
|
||||
endif
|
||||
|
||||
if exists(':UndotreeToggle')
|
||||
call airline#extensions#undotree#init(s:ext)
|
||||
call add(loaded_ext, 'undotree')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#hunks#enabled', 1)
|
||||
\ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes') || exists('g:loaded_quickfixsigns'))
|
||||
call airline#extensions#hunks#init(s:ext)
|
||||
call add(loaded_ext, 'hunks')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#vimagit#enabled', 1)
|
||||
\ && (exists('g:loaded_magit'))
|
||||
call airline#extensions#vimagit#init(s:ext)
|
||||
call add(loaded_ext, 'vimagit')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tagbar#enabled', 1)
|
||||
\ && exists(':TagbarToggle')
|
||||
call airline#extensions#tagbar#init(s:ext)
|
||||
call add(loaded_ext, 'tagbar')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#csv#enabled', 1)
|
||||
\ && (get(g:, 'loaded_csv', 0) || exists(':Table'))
|
||||
call airline#extensions#csv#init(s:ext)
|
||||
call add(loaded_ext, 'csv')
|
||||
endif
|
||||
|
||||
if exists(':VimShell')
|
||||
@@ -186,64 +215,105 @@ function! airline#extensions#load()
|
||||
\ && (exists('*fugitive#head') || exists('*lawrencium#statusline') ||
|
||||
\ (get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine')))
|
||||
call airline#extensions#branch#init(s:ext)
|
||||
call add(loaded_ext, 'branch')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#bufferline#enabled', 1)
|
||||
\ && exists('*bufferline#get_status_string')
|
||||
call airline#extensions#bufferline#init(s:ext)
|
||||
call add(loaded_ext, 'bufferline')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV)))
|
||||
call airline#extensions#virtualenv#init(s:ext)
|
||||
call add(loaded_ext, 'virtualenv')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate'))
|
||||
call airline#extensions#eclim#init(s:ext)
|
||||
call add(loaded_ext, 'eclim')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#syntastic#enabled', 1)
|
||||
\ && exists(':SyntasticCheck')
|
||||
call airline#extensions#syntastic#init(s:ext)
|
||||
call add(loaded_ext, 'syntastic')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#ale#enabled', 1) && exists(':ALELint'))
|
||||
call airline#extensions#ale#init(s:ext)
|
||||
call add(loaded_ext, 'ale')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#whitespace#enabled', 1)
|
||||
call airline#extensions#whitespace#init(s:ext)
|
||||
call add(loaded_ext, 'whitespace')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#neomake#enabled', 1) && exists(':Neomake'))
|
||||
call airline#extensions#neomake#init(s:ext)
|
||||
call add(loaded_ext, 'neomake')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#po#enabled', 1) && executable('msgfmt')
|
||||
call airline#extensions#po#init(s:ext)
|
||||
call add(loaded_ext, 'po')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#wordcount#enabled', 1)
|
||||
call airline#extensions#wordcount#init(s:ext)
|
||||
call add(loaded_ext, 'wordcount')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#enabled', 0)
|
||||
call airline#extensions#tabline#init(s:ext)
|
||||
call add(loaded_ext, 'tabline')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tmuxline#enabled', 1) && exists(':Tmuxline')
|
||||
call airline#extensions#tmuxline#init(s:ext)
|
||||
call add(loaded_ext, 'tmuxline')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#promptline#enabled', 1) && exists(':PromptlineSnapshot') && len(get(g:, 'airline#extensions#promptline#snapshot_file', ''))
|
||||
call airline#extensions#promptline#init(s:ext)
|
||||
call add(loaded_ext, 'promptline')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2
|
||||
call airline#extensions#nrrwrgn#init(s:ext)
|
||||
call add(loaded_ext, 'nrrwrgn')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#unicode#enabled', 1) && exists(':UnicodeTable') == 2
|
||||
call airline#extensions#unicode#init(s:ext)
|
||||
call add(loaded_ext, 'nrrwrgn')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#capslock#enabled', 1) && exists('*CapsLockStatusline'))
|
||||
call airline#extensions#capslock#init(s:ext)
|
||||
call add(loaded_ext, 'capslock')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib'))
|
||||
call airline#extensions#xkblayout#init(s:ext)
|
||||
call add(loaded_ext, 'xkblayout')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#windowswap#enabled', 1) && get(g:, 'loaded_windowswap', 0))
|
||||
call airline#extensions#windowswap#init(s:ext)
|
||||
call add(loaded_ext, 'windowswap')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#obsession#enabled', 1) && exists('*ObsessionStatus'))
|
||||
call airline#extensions#obsession#init(s:ext)
|
||||
call add(loaded_ext, 'obsession')
|
||||
endif
|
||||
|
||||
runtime autoload/vimtex.vim
|
||||
if (get(g:, 'airline#extensions#vimtex#enabled', 1)) && exists('*vimtex#init')
|
||||
call airline#extensions#vimtex#init(s:ext)
|
||||
call add(loaded_ext, 'vimtex')
|
||||
endif
|
||||
|
||||
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
|
||||
@@ -255,7 +325,8 @@ function! airline#extensions#load()
|
||||
if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0
|
||||
\ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0
|
||||
let name = fnamemodify(file, ':t:r')
|
||||
if !get(g:, 'airline#extensions#'.name.'#enabled', 1)
|
||||
if !get(g:, 'airline#extensions#'.name.'#enabled', 1) ||
|
||||
\ index(loaded_ext, name) > -1
|
||||
continue
|
||||
endif
|
||||
try
|
||||
|
||||
43
autoload/airline/extensions/ale.vim
Normal file
43
autoload/airline/extensions/ale.vim
Normal file
@@ -0,0 +1,43 @@
|
||||
" MIT License. Copyright (c) 2013-2017 Bjorn Neergaard, w0rp
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:')
|
||||
|
||||
function! airline#extensions#ale#get(type)
|
||||
if !exists(':ALELint')
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:is_err = a:type ==# 'error'
|
||||
let l:counts = ale#statusline#Count(bufnr(''))
|
||||
let l:symbol = l:is_err ? s:error_symbol : s:warning_symbol
|
||||
|
||||
if type(l:counts) == type({}) && has_key(l:counts, 'error')
|
||||
" Use the current Dictionary format.
|
||||
let l:errors = l:counts.error + l:counts.style_error
|
||||
let l:num = l:is_err ? l:errors : l:counts.total - l:errors
|
||||
else
|
||||
" Use the old List format.
|
||||
let l:num = l:is_err ? l:counts[0] : l:counts[1]
|
||||
endif
|
||||
|
||||
if l:num == 0
|
||||
return ''
|
||||
else
|
||||
return l:symbol . l:num
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ale#get_warning()
|
||||
return airline#extensions#ale#get('warning')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ale#get_error()
|
||||
return airline#extensions#ale#get('error')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ale#init(ext)
|
||||
call airline#parts#define_function('ale_error_count', 'airline#extensions#ale#get_error')
|
||||
call airline#parts#define_function('ale_warning_count', 'airline#extensions#ale#get_warning')
|
||||
endfunction
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:has_fugitive = exists('*fugitive#head')
|
||||
let s:has_lawrencium = exists('*lawrencium#statusline')
|
||||
let s:has_vcscommand = get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine')
|
||||
@@ -9,9 +11,58 @@ if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:git_dirs = {}
|
||||
let s:untracked_git = {}
|
||||
let s:untracked_hg = {}
|
||||
let s:has_async = airline#util#async
|
||||
|
||||
" s:vcs_config contains static configuration of VCSes and their status relative
|
||||
" to the active file.
|
||||
" 'branch' - The name of currently active branch. This field is empty iff it
|
||||
" has not been initialized yet or the current file is not in
|
||||
" an active branch.
|
||||
" 'untracked' - Cache of untracked files represented as a dictionary with files
|
||||
" as keys. A file has a not exists symbol set as its value if it
|
||||
" is untracked. A file is present in this dictionary iff its
|
||||
" status is considered up to date.
|
||||
" 'untracked_mark' - used as regexp to test against the output of 'cmd'
|
||||
let s:vcs_config = {
|
||||
\ 'git': {
|
||||
\ 'exe': 'git',
|
||||
\ 'cmd': 'git status --porcelain -- ',
|
||||
\ 'untracked_mark': '??',
|
||||
\ 'update_branch': 's:update_git_branch',
|
||||
\ 'exclude': '\.git',
|
||||
\ 'branch': '',
|
||||
\ 'untracked': {},
|
||||
\ },
|
||||
\ 'mercurial': {
|
||||
\ 'exe': 'hg',
|
||||
\ 'cmd': 'hg status -u -- ',
|
||||
\ 'untracked_mark': '?',
|
||||
\ 'exclude': '\.hg',
|
||||
\ 'update_branch': 's:update_hg_branch',
|
||||
\ 'branch': '',
|
||||
\ 'untracked': {},
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Initializes b:buffer_vcs_config. b:buffer_vcs_config caches the branch and
|
||||
" untracked status of the file in the buffer. Caching those fields is necessary,
|
||||
" because s:vcs_config may be updated asynchronously and s:vcs_config fields may
|
||||
" be invalid during those updates. b:buffer_vcs_config fields are updated
|
||||
" whenever corresponding fields in s:vcs_config are updated or an inconsistency
|
||||
" is detected during update_* operation.
|
||||
"
|
||||
" b:airline_head caches the head string it is empty iff it needs to be
|
||||
" recalculated. b:airline_head is recalculated based on b:buffer_vcs_config.
|
||||
function! s:init_buffer()
|
||||
let b:buffer_vcs_config = {}
|
||||
for vcs in keys(s:vcs_config)
|
||||
let b:buffer_vcs_config[vcs] = {
|
||||
\ 'branch': '',
|
||||
\ 'untracked': '',
|
||||
\ }
|
||||
endfor
|
||||
unlet! b:airline_head
|
||||
endfunction
|
||||
|
||||
let s:head_format = get(g:, 'airline#extensions#branch#format', 0)
|
||||
if s:head_format == 1
|
||||
@@ -32,15 +83,19 @@ else
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! s:get_git_branch(path)
|
||||
let s:git_dirs = {}
|
||||
|
||||
function! s:update_git_branch(path)
|
||||
if !s:has_fugitive
|
||||
return ''
|
||||
let s:vcs_config['git'].branch = ''
|
||||
return
|
||||
endif
|
||||
|
||||
let name = fugitive#head(7)
|
||||
if empty(name)
|
||||
if has_key(s:git_dirs, a:path)
|
||||
return s:git_dirs[a:path]
|
||||
let s:vcs_config['git'].branch = s:git_dirs[a:path]
|
||||
return
|
||||
endif
|
||||
|
||||
let dir = fugitive#extract_git_dir(a:path)
|
||||
@@ -62,76 +117,201 @@ function! s:get_git_branch(path)
|
||||
endif
|
||||
|
||||
let s:git_dirs[a:path] = name
|
||||
return name
|
||||
let s:vcs_config['git'].branch = name
|
||||
endfunction
|
||||
|
||||
function! s:get_git_untracked(file)
|
||||
let untracked = ''
|
||||
if empty(a:file)
|
||||
return untracked
|
||||
endif
|
||||
if has_key(s:untracked_git, a:file)
|
||||
let untracked = s:untracked_git[a:file]
|
||||
function! s:update_hg_branch(path)
|
||||
if s:has_lawrencium
|
||||
let stl=lawrencium#statusline()
|
||||
if !empty(stl) && s:has_async
|
||||
call s:get_mq_async('LC_ALL=C hg qtop', expand('%:p'))
|
||||
endif
|
||||
if exists("s:mq") && !empty(s:mq)
|
||||
if stl is# 'default'
|
||||
" Shorten default a bit
|
||||
let stl='def'
|
||||
endif
|
||||
let stl.=' ['.s:mq.']'
|
||||
endif
|
||||
let s:vcs_config['mercurial'].branch = stl
|
||||
else
|
||||
let output = system('git status --porcelain -- '. a:file)
|
||||
if output[0:1] is# '??' && output[3:-2] is? a:file
|
||||
let untracked = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
|
||||
endif
|
||||
let s:untracked_git[a:file] = untracked
|
||||
let s:vcs_config['mercurial'].branch = ''
|
||||
endif
|
||||
return untracked
|
||||
endfunction
|
||||
|
||||
function! s:get_hg_untracked(file)
|
||||
if s:has_lawrencium
|
||||
" delete cache when unlet b:airline head?
|
||||
let untracked = ''
|
||||
if empty(a:file)
|
||||
return untracked
|
||||
function! s:update_branch()
|
||||
let l:path = exists("*fnamemodify") ? fnamemodify(resolve(@%), ":p:h") : expand("%:p:h")
|
||||
for vcs in keys(s:vcs_config)
|
||||
call {s:vcs_config[vcs].update_branch}(l:path)
|
||||
if b:buffer_vcs_config[vcs].branch != s:vcs_config[vcs].branch
|
||||
let b:buffer_vcs_config[vcs].branch = s:vcs_config[vcs].branch
|
||||
unlet! b:airline_head
|
||||
endif
|
||||
if has_key(s:untracked_hg, a:file)
|
||||
let untracked = s:untracked_hg[a:file]
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:update_untracked_in_buffer_config(file, vcs)
|
||||
if !has_key(s:vcs_config[a:vcs].untracked, a:file)
|
||||
return
|
||||
elseif s:vcs_config[a:vcs].untracked[a:file] != b:buffer_vcs_config[a:vcs].untracked
|
||||
let b:buffer_vcs_config[a:vcs].untracked = s:vcs_config[a:vcs].untracked[a:file]
|
||||
unlet! b:airline_head
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:update_untracked()
|
||||
let l:file = expand("%:p")
|
||||
if empty(l:file) || isdirectory(l:file)
|
||||
return
|
||||
endif
|
||||
|
||||
let l:needs_update = 1
|
||||
for vcs in keys(s:vcs_config)
|
||||
if l:file =~ s:vcs_config[vcs].exclude
|
||||
" Skip check for files that live in the exclude directory
|
||||
let l:needs_update = 0
|
||||
endif
|
||||
if has_key(s:vcs_config[vcs].untracked, l:file)
|
||||
let l:needs_update = 0
|
||||
call s:update_untracked_in_buffer_config(l:file, vcs)
|
||||
endif
|
||||
endfor
|
||||
|
||||
if !l:needs_update
|
||||
return
|
||||
endif
|
||||
|
||||
for vcs in keys(s:vcs_config)
|
||||
let l:config = s:vcs_config[vcs]
|
||||
if s:has_async
|
||||
" Note that asynchronous update updates s:vcs_config only, and only
|
||||
" s:update_untracked updates b:buffer_vcs_config. If s:vcs_config is
|
||||
" invalidated again before s:update_untracked is called, then we lose the
|
||||
" result of the previous call, i.e. the head string is not updated. It
|
||||
" doesn't happen often in practice, so we let it be.
|
||||
call s:get_vcs_untracked_async(l:config, l:file)
|
||||
else
|
||||
let untracked = (system('hg status -u -- '. a:file)[0] is# '?' ?
|
||||
\ get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) : '')
|
||||
let s:untracked_hg[a:file] = untracked
|
||||
let output = airline#util#system(l:config.cmd . shellescape(l:file))
|
||||
if output =~? ('^' . l:config.untracked_mark)
|
||||
let l:config.untracked[l:file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
|
||||
else
|
||||
let l:config.untracked[l:file] = ''
|
||||
endif
|
||||
call s:update_untracked_in_buffer_config(l:file, vcs)
|
||||
endif
|
||||
return untracked
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:get_hg_branch()
|
||||
if s:has_lawrencium
|
||||
return lawrencium#statusline()
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
if s:has_async
|
||||
let s:jobs = {}
|
||||
|
||||
function! s:on_stdout(channel, msg) dict abort
|
||||
let self.buf .= a:msg
|
||||
endfunction
|
||||
|
||||
function! s:on_exit(channel) dict abort
|
||||
if self.buf =~? ('^' . self.config['untracked_mark'])
|
||||
let self.config.untracked[self.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
|
||||
else
|
||||
let self.config.untracked[self.file] = ''
|
||||
endif
|
||||
" b:buffer_vcs_config will be updated on next call of update_untracked if
|
||||
" needed
|
||||
if has_key(s:jobs, self.file)
|
||||
call remove(s:jobs, self.file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_vcs_untracked_async(config, file)
|
||||
if g:airline#util#is_windows && &shell =~ 'cmd'
|
||||
let cmd = a:config['cmd'] . shellescape(a:file)
|
||||
else
|
||||
let cmd = ['sh', '-c', a:config['cmd'] . shellescape(a:file)]
|
||||
endif
|
||||
|
||||
let options = {'config': a:config, 'buf': '', 'file': a:file}
|
||||
if has_key(s:jobs, a:file)
|
||||
if job_status(get(s:jobs, a:file)) == 'run'
|
||||
return
|
||||
elseif has_key(s:jobs, a:file)
|
||||
call remove(s:jobs, a:file)
|
||||
endif
|
||||
endif
|
||||
let id = job_start(cmd, {
|
||||
\ 'err_io': 'out',
|
||||
\ 'out_cb': function('s:on_stdout', options),
|
||||
\ 'close_cb': function('s:on_exit', options)})
|
||||
let s:jobs[a:file] = id
|
||||
endfu
|
||||
|
||||
function! s:on_exit_mq(channel) dict abort
|
||||
if !empty(self.buf)
|
||||
if self.buf is# 'no patches applied' ||
|
||||
\ self.buf =~# "unknown command 'qtop'"
|
||||
let self.buf = ''
|
||||
elseif exists("s:mq") && s:mq isnot# self.buf
|
||||
" make sure, statusline is updated
|
||||
unlet! b:airline_head
|
||||
endif
|
||||
let s:mq = self.buf
|
||||
endif
|
||||
if has_key(s:jobs, self.file)
|
||||
call remove(s:jobs, self.file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_mq_async(cmd, file)
|
||||
if g:airline#util#is_windows && &shell =~ 'cmd'
|
||||
let cmd = a:cmd
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd]
|
||||
endif
|
||||
|
||||
let options = {'cmd': a:cmd, 'buf': '', 'file': a:file}
|
||||
if has_key(s:jobs, a:file)
|
||||
if job_status(get(s:jobs, a:file)) == 'run'
|
||||
return
|
||||
elseif has_key(s:jobs, a:file)
|
||||
call remove(s:jobs, a:file)
|
||||
endif
|
||||
endif
|
||||
let id = job_start(cmd, {
|
||||
\ 'err_io': 'out',
|
||||
\ 'out_cb': function('s:on_stdout', options),
|
||||
\ 'close_cb': function('s:on_exit_mq', options)})
|
||||
let s:jobs[a:file] = id
|
||||
endfu
|
||||
endif
|
||||
|
||||
function! airline#extensions#branch#head()
|
||||
if !exists('b:buffer_vcs_config')
|
||||
call s:init_buffer()
|
||||
endif
|
||||
|
||||
call s:update_branch()
|
||||
call s:update_untracked()
|
||||
|
||||
if exists('b:airline_head') && !empty(b:airline_head)
|
||||
return b:airline_head
|
||||
endif
|
||||
|
||||
let b:airline_head = ''
|
||||
let l:heads = {}
|
||||
let l:vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"])
|
||||
let found_fugitive_head = 0
|
||||
|
||||
let l:git_head = s:get_git_branch(expand("%:p:h"))
|
||||
let l:hg_head = s:get_hg_branch()
|
||||
let l:heads = {}
|
||||
for vcs in l:vcs_priority
|
||||
if !empty(b:buffer_vcs_config[vcs].branch)
|
||||
let l:heads[vcs] = b:buffer_vcs_config[vcs].branch
|
||||
endif
|
||||
endfor
|
||||
|
||||
if !empty(l:git_head)
|
||||
let found_fugitive_head = 1
|
||||
let l:heads.git = (!empty(l:hg_head) ? "git:" : '') . s:format_name(l:git_head)
|
||||
let l:git_untracked = s:get_git_untracked(expand("%:p"))
|
||||
let l:heads.git .= l:git_untracked
|
||||
endif
|
||||
|
||||
if !empty(l:hg_head)
|
||||
let l:heads.mercurial = (!empty(l:git_head) ? "hg:" : '') . s:format_name(l:hg_head)
|
||||
let l:hg_untracked = s:get_hg_untracked(expand("%:p"))
|
||||
let l:heads.mercurial.= l:hg_untracked
|
||||
endif
|
||||
for vcs in keys(l:heads)
|
||||
if !empty(b:airline_head)
|
||||
let b:airline_head .= ' | '
|
||||
endif
|
||||
let b:airline_head .= (len(l:heads) > 1 ? s:vcs_config[l:vcs].exe .':' : '') . s:format_name(l:heads[l:vcs])
|
||||
let b:airline_head .= b:buffer_vcs_config[vcs].untracked
|
||||
endfor
|
||||
|
||||
if empty(l:heads)
|
||||
if s:has_vcscommand
|
||||
@@ -140,15 +320,6 @@ function! airline#extensions#branch#head()
|
||||
let b:airline_head = s:format_name(get(b:VCSCommandBufferInfo, 0, ''))
|
||||
endif
|
||||
endif
|
||||
else
|
||||
for vcs in l:vcs_priority
|
||||
if has_key(l:heads, vcs)
|
||||
if !empty(b:airline_head)
|
||||
let b:airline_head = b:airline_head . " | "
|
||||
endif
|
||||
let b:airline_head = b:airline_head . l:heads[vcs]
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if exists("g:airline#extensions#branch#displayed_head_limit")
|
||||
@@ -158,9 +329,11 @@ function! airline#extensions#branch#head()
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(b:airline_head) || !found_fugitive_head && !s:check_in_path()
|
||||
if has_key(l:heads, 'git') && !s:check_in_path()
|
||||
let b:airline_head = ''
|
||||
endif
|
||||
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
|
||||
let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth)
|
||||
return b:airline_head
|
||||
endfunction
|
||||
|
||||
@@ -174,7 +347,7 @@ function! airline#extensions#branch#get_head()
|
||||
endfunction
|
||||
|
||||
function! s:check_in_path()
|
||||
if !exists('b:airline_branch_path')
|
||||
if !exists('b:airline_file_in_root')
|
||||
let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', ''))
|
||||
let bufferpath = resolve(fnamemodify(expand('%'), ':p'))
|
||||
|
||||
@@ -184,7 +357,13 @@ function! s:check_in_path()
|
||||
let root = expand(fnamemodify(root, ':h'))
|
||||
else
|
||||
" else it's the newer format, and we need to guesstimate
|
||||
let pattern = '\.git\(\\\|\/\)modules\(\\\|\/\)'
|
||||
" 1) check for worktrees
|
||||
if match(root, 'worktrees') > -1
|
||||
" worktree can be anywhere, so simply assume true here
|
||||
return 1
|
||||
endif
|
||||
" 2) check for submodules
|
||||
let pattern = '\.git[\\/]\(modules\)[\\/]'
|
||||
if match(root, pattern) >= 0
|
||||
let root = substitute(root, pattern, '', '')
|
||||
endif
|
||||
@@ -196,13 +375,27 @@ function! s:check_in_path()
|
||||
return b:airline_file_in_root
|
||||
endfunction
|
||||
|
||||
function! s:reset_untracked_cache()
|
||||
if exists("s:untracked_git")
|
||||
let s:untracked_git={}
|
||||
endif
|
||||
if exists("s:untracked_hg")
|
||||
let s:untracked_hg={}
|
||||
function! s:reset_untracked_cache(shellcmdpost)
|
||||
" shellcmdpost - whether function was called as a result of ShellCmdPost hook
|
||||
if !s:has_async && !has('nvim')
|
||||
if a:shellcmdpost
|
||||
" Clear cache only if there was no error or the script uses an
|
||||
" asynchronous interface. Otherwise, cache clearing would overwrite
|
||||
" v:shell_error with a system() call inside get_*_untracked.
|
||||
if v:shell_error
|
||||
return
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:file = expand("%:p")
|
||||
for vcs in keys(s:vcs_config)
|
||||
" Dump the value of the cache for the current file. Partially mitigates the
|
||||
" issue of cache invalidation happening before a call to
|
||||
" s:update_untracked()
|
||||
call s:update_untracked_in_buffer_config(l:file, l:vcs)
|
||||
let s:vcs_config[vcs].untracked = {}
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#branch#init(ext)
|
||||
@@ -211,5 +404,6 @@ function! airline#extensions#branch#init(ext)
|
||||
autocmd BufReadPost * unlet! b:airline_file_in_root
|
||||
autocmd CursorHold,ShellCmdPost,CmdwinLeave * unlet! b:airline_head
|
||||
autocmd User AirlineBeforeRefresh unlet! b:airline_head
|
||||
autocmd BufWritePost,ShellCmdPost * call s:reset_untracked_cache()
|
||||
autocmd BufWritePost * call s:reset_untracked_cache(0)
|
||||
autocmd ShellCmdPost * call s:reset_untracked_cache(1)
|
||||
endfunction
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('*bufferline#get_status_string')
|
||||
finish
|
||||
endif
|
||||
@@ -18,6 +20,10 @@ function! airline#extensions#bufferline#init(ext)
|
||||
let g:bufferline_separator = g:airline_symbols.space
|
||||
endif
|
||||
|
||||
call airline#parts#define_raw('file', '%{bufferline#refresh_status()}'.bufferline#get_status_string())
|
||||
if exists("+autochdir") && &autochdir == 1
|
||||
" if 'acd' is set, vim-airline uses the path section, so we need ot redefine this here as well
|
||||
call airline#parts#define_raw('path', '%{bufferline#refresh_status()}'.bufferline#get_status_string())
|
||||
else
|
||||
call airline#parts#define_raw('file', '%{bufferline#refresh_status()}'.bufferline#get_status_string())
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
" MIT License. Copyright (c) 2014 Mathias Andersson.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('*CapsLockStatusline')
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'command_t_loaded', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_csv', 0) && !exists(':Table')
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
let s:padding = s:spc . s:spc . s:spc
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:section_use_groups = get(g:, 'airline#extensions#default#section_use_groupitems', 1)
|
||||
let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', {
|
||||
\ 'b': 79,
|
||||
@@ -22,6 +24,9 @@ function! s:get_section(winnr, key, ...)
|
||||
endif
|
||||
endif
|
||||
let spc = g:airline_symbols.space
|
||||
if !exists('g:airline_section_{a:key}')
|
||||
return ''
|
||||
endif
|
||||
let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key})
|
||||
let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')]
|
||||
return empty(text) ? '' : prefix.text.suffix
|
||||
@@ -37,26 +42,27 @@ function! s:build_sections(builder, context, keys)
|
||||
endfunction
|
||||
|
||||
" There still is a highlighting bug when using groups %(%) in the statusline,
|
||||
" deactivate it, until this is properly fixed:
|
||||
" https://groups.google.com/d/msg/vim_dev/sb1jmVirXPU/mPhvDnZ-CwAJ
|
||||
" deactivate it, unless it is fixed (7.4.1511)
|
||||
if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81')))
|
||||
function s:add_section(builder, context, key)
|
||||
function! s:add_section(builder, context, key)
|
||||
let condition = (a:key is# "warning" || a:key is# "error") &&
|
||||
\ (v:version == 704 && !has("patch1511"))
|
||||
" i have no idea why the warning section needs special treatment, but it's
|
||||
" needed to prevent separators from showing up
|
||||
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
||||
return
|
||||
endif
|
||||
if (a:key == 'warning' || a:key == 'error')
|
||||
if condition
|
||||
call a:builder.add_raw('%(')
|
||||
endif
|
||||
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key))
|
||||
if (a:key == 'warning' || a:key == 'error')
|
||||
if condition
|
||||
call a:builder.add_raw('%)')
|
||||
endif
|
||||
endfunction
|
||||
else
|
||||
" older version don't like the use of %(%)
|
||||
function s:add_section(builder, context, key)
|
||||
function! s:add_section(builder, context, key)
|
||||
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
||||
return
|
||||
endif
|
||||
|
||||
47
autoload/airline/extensions/denite.vim
Normal file
47
autoload/airline/extensions/denite.vim
Normal file
@@ -0,0 +1,47 @@
|
||||
" MIT License. Copyright (c) 2017 Thomas Dy
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_denite', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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)
|
||||
let l:mode = split(denite#get_status_mode(), ' ')
|
||||
let l:mode = tolower(l:mode[1])
|
||||
if !exists('b:denite_mode_cache') || l:mode != b:denite_mode_cache
|
||||
call airline#highlighter#highlight([l:mode], a:bufnr)
|
||||
let b:denite_mode_cache = l:mode
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#denite#apply(...)
|
||||
if &ft == 'denite'
|
||||
let w:airline_skip_empty_sections = 0
|
||||
call a:1.add_section('airline_a', ' Denite %{airline#extensions#denite#check_denite_mode('.a:2['bufnr'].')}')
|
||||
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()} ')
|
||||
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')
|
||||
|
||||
" airline#extensions#denite#apply normally gets called only after the
|
||||
" denite window gets closed, so we have to call airline#update_statusline
|
||||
" ourselves to make sure it's applied when the window is opened.
|
||||
augroup airline_denite
|
||||
autocmd!
|
||||
autocmd FileType denite call airline#update_statusline()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':ProjectCreate')
|
||||
finish
|
||||
endif
|
||||
@@ -16,7 +18,13 @@ function! airline#extensions#eclim#creat_line(...)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#eclim#get_warnings()
|
||||
" Cache vavlues, so that it isn't called too often
|
||||
if exists("s:eclim_errors") &&
|
||||
\ get(b:, 'airline_changenr', 0) == changenr()
|
||||
return s:eclim_errors
|
||||
endif
|
||||
let eclimList = eclim#display#signs#GetExisting()
|
||||
let s:eclim_errors = ''
|
||||
|
||||
if !empty(eclimList)
|
||||
" Remove any non-eclim signs (see eclim#display#signs#Update)
|
||||
@@ -39,11 +47,12 @@ function! airline#extensions#eclim#get_warnings()
|
||||
let errorsNumber = len(eclimList)
|
||||
let errors = "[Eclim:" . type . " line:".string(errorsLine)." (".string(errorsNumber).")]"
|
||||
if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == ''
|
||||
return errors.(g:airline_symbols.space)
|
||||
let s:eclim_errors = errors.(g:airline_symbols.space)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return ''
|
||||
let b:airline_changenr = changenr()
|
||||
return s:eclim_errors
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#eclim#init(ext)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" we don't actually want this loaded :P
|
||||
finish
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) && !get(g:, 'loaded_quickfixsigns', 0)
|
||||
finish
|
||||
endif
|
||||
@@ -45,7 +47,7 @@ function! s:get_hunks_empty()
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks()
|
||||
if !exists('b:source_func')
|
||||
if !exists('b:source_func') || get(b:, 'source_func', '') is# 's:get_hunks_empty'
|
||||
if get(g:, 'loaded_signify') && sy#buffer_is_active()
|
||||
let b:source_func = 's:get_hunks_signify'
|
||||
elseif exists('*GitGutterGetHunkSummary')
|
||||
@@ -65,19 +67,30 @@ function! airline#extensions#hunks#get_hunks()
|
||||
if !get(w:, 'airline_active', 0)
|
||||
return ''
|
||||
endif
|
||||
" Cache vavlues, so that it isn't called too often
|
||||
if exists("b:airline_hunks") &&
|
||||
\ get(b:, 'airline_changenr', 0) == changenr() &&
|
||||
\ winwidth(0) == get(s:, 'airline_winwidth', 0) &&
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_signify' &&
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_gitgutter' &&
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_empty'
|
||||
return b:airline_hunks
|
||||
endif
|
||||
let hunks = s:get_hunks()
|
||||
let string = ''
|
||||
if !empty(hunks)
|
||||
for i in [0, 1, 2]
|
||||
if s:non_zero_only == 0 || hunks[i] > 0
|
||||
if (s:non_zero_only == 0 && winwidth(0) > 100) || hunks[i] > 0
|
||||
let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i])
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
let b:airline_hunks = string
|
||||
let b:airline_changenr = changenr()
|
||||
let s:airline_winwidth = winwidth(0)
|
||||
return string
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#hunks#init(ext)
|
||||
call airline#parts#define_function('hunks', 'airline#extensions#hunks#get_hunks')
|
||||
endfunction
|
||||
|
||||
|
||||
25
autoload/airline/extensions/neomake.vim
Normal file
25
autoload/airline/extensions/neomake.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':Neomake')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#neomake#warning_symbol', 'W:')
|
||||
|
||||
function! airline#extensions#neomake#get_warnings()
|
||||
let counts = neomake#statusline#LoclistCounts()
|
||||
let warnings = get(counts, 'W', 0)
|
||||
return warnings ? s:warning_symbol.warnings : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#neomake#get_errors()
|
||||
let counts = neomake#statusline#LoclistCounts()
|
||||
let errors = get(counts, 'E', 0)
|
||||
return errors ? s:error_symbol.errors : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#neomake#init(ext)
|
||||
call airline#parts#define_function('neomake_warning_count', 'airline#extensions#neomake#get_warnings')
|
||||
call airline#parts#define_function('neomake_error_count', 'airline#extensions#neomake#get_errors')
|
||||
endfunction
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':NetrwSettings')
|
||||
finish
|
||||
endif
|
||||
@@ -27,6 +29,6 @@ endfunction
|
||||
|
||||
|
||||
function! airline#extensions#netrw#sortstring()
|
||||
let order = (g:netrw_sort_direction =~ 'n') ? '+' : '-'
|
||||
let order = (get(g:, 'netrw_sort_direction', 'n') =~ 'n') ? '+' : '-'
|
||||
return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']'
|
||||
endfunction
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_nrrw_rgn', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
22
autoload/airline/extensions/obsession.vim
Normal file
22
autoload/airline/extensions/obsession.vim
Normal file
@@ -0,0 +1,22 @@
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('*ObsessionStatus')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
if !exists('g:airline#extensions#obsession#indicator_text')
|
||||
let g:airline#extensions#obsession#indicator_text = '$'
|
||||
endif
|
||||
|
||||
function! airline#extensions#obsession#init(ext)
|
||||
call airline#parts#define_function('obsession', 'airline#extensions#obsession#get_status')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#obsession#get_status()
|
||||
return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '')
|
||||
endfunction
|
||||
|
||||
@@ -1,6 +1,62 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:has_async = airline#util#async
|
||||
|
||||
function! s:shorten()
|
||||
if exists("g:airline#extensions#po#displayed_limit")
|
||||
let w:displayed_po_limit = g:airline#extensions#po#displayed_limit
|
||||
if len(b:airline_po_stats) > w:displayed_po_limit - 1
|
||||
let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 2)].(&encoding==?'utf-8' ? '…' : '.'). ']'
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if s:has_async
|
||||
let s:jobs = {}
|
||||
|
||||
function! s:on_stdout(channel, msg) dict abort
|
||||
let self.buf = a:msg
|
||||
endfunction
|
||||
|
||||
function! s:on_exit(channel) dict abort
|
||||
if !empty(self.buf)
|
||||
let b:airline_po_stats = printf("[%s]", self.buf)
|
||||
else
|
||||
let b:airline_po_stats = ''
|
||||
endif
|
||||
if has_key(s:jobs, self.file)
|
||||
call remove(s:jobs, self.file)
|
||||
endif
|
||||
call s:shorten()
|
||||
endfunction
|
||||
|
||||
function! s:get_msgfmt_stat_async(cmd, file)
|
||||
if g:airline#util#is_windows || !executable('msgfmt')
|
||||
" no msgfmt on windows?
|
||||
return
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
|
||||
endif
|
||||
|
||||
let options = {'buf': '', 'file': a:file}
|
||||
if has_key(s:jobs, a:file)
|
||||
if job_status(get(s:jobs, a:file)) == 'run'
|
||||
return
|
||||
elseif has_key(s:jobs, a:file)
|
||||
call remove(s:jobs, a:file)
|
||||
endif
|
||||
endif
|
||||
let id = job_start(cmd, {
|
||||
\ 'err_io': 'out',
|
||||
\ 'out_cb': function('s:on_stdout', options),
|
||||
\ 'close_cb': function('s:on_exit', options)})
|
||||
let s:jobs[a:file] = id
|
||||
endfu
|
||||
endif
|
||||
|
||||
function! airline#extensions#po#apply(...)
|
||||
if &ft ==# 'po'
|
||||
call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}')
|
||||
@@ -13,22 +69,23 @@ function! airline#extensions#po#stats()
|
||||
return b:airline_po_stats
|
||||
endif
|
||||
|
||||
let airline_po_stats = system('msgfmt --statistics -o /dev/null -- '. expand('%:p'))
|
||||
if v:shell_error
|
||||
return ''
|
||||
endif
|
||||
try
|
||||
let b:airline_po_stats = '['. split(airline_po_stats, '\n')[0]. ']'
|
||||
catch
|
||||
let b:airline_po_stats = ''
|
||||
endtry
|
||||
if exists("g:airline#extensions#po#displayed_limit")
|
||||
let w:displayed_po_limit = g:airline#extensions#po#displayed_limit
|
||||
if len(b:airline_po_stats) > w:displayed_po_limit - 1
|
||||
let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 1)].(&encoding==?'utf-8' ? '…' : '.')
|
||||
let cmd = 'msgfmt --statistics -o /dev/null -- '
|
||||
if s:has_async
|
||||
call s:get_msgfmt_stat_async(cmd, expand('%:p'))
|
||||
else
|
||||
let airline_po_stats = system(cmd. shellescape(expand('%:p')))
|
||||
if v:shell_error
|
||||
return ''
|
||||
endif
|
||||
try
|
||||
let b:airline_po_stats = '['. split(airline_po_stats, '\n')[0]. ']'
|
||||
let b:airline_po_stats = substitute(b:airline_po_stats, ' \(message\|translation\)s*\.*', '', 'g')
|
||||
catch
|
||||
let b:airline_po_stats = ''
|
||||
endtry
|
||||
call s:shorten()
|
||||
endif
|
||||
return b:airline_po_stats
|
||||
return get(b:, 'airline_po_stats', '')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#po#init(ext)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':PromptlineSnapshot')
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let g:airline#extensions#quickfix#quickfix_text = 'Quickfix'
|
||||
let g:airline#extensions#quickfix#location_text = 'Location'
|
||||
|
||||
@@ -15,9 +17,24 @@ endfunction
|
||||
|
||||
function! airline#extensions#quickfix#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#quickfix#apply')
|
||||
call a:ext.add_inactive_statusline_func('airline#extensions#quickfix#inactive_qf_window')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#quickfix#inactive_qf_window(...)
|
||||
if getbufvar(a:2.bufnr, '&filetype') is# 'qf' && !empty(airline#util#getwinvar(a:2.winnr, 'quickfix_title', ''))
|
||||
call setwinvar(a:2.winnr, 'airline_section_c', '[%{get(w:, "quickfix_title", "")}] %f %m')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_text()
|
||||
if exists("*win_getid") && exists("*getwininfo")
|
||||
let dict = getwininfo(win_getid())
|
||||
if len(dict) > 0 && get(dict[0], 'quickfix', 0) && !get(dict[0], 'loclist', 0)
|
||||
return g:airline#extensions#quickfix#quickfix_text
|
||||
elseif len(dict) > 0 && get(dict[0], 'quickfix', 0) && get(dict[0], 'loclist', 0)
|
||||
return g:airline#extensions#quickfix#location_text
|
||||
endif
|
||||
endif
|
||||
redir => buffers
|
||||
silent ls
|
||||
redir END
|
||||
@@ -34,4 +51,3 @@ function! s:get_text()
|
||||
endfor
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,19 +1,43 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':SyntasticCheck')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#syntastic#get_warnings()
|
||||
let errors = SyntasticStatuslineFlag()
|
||||
if strlen(errors) > 0
|
||||
return errors.(g:airline_symbols.space)
|
||||
let s:error_symbol = get(g:, 'airline#extensions#syntastic#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#syntastic#warning_symbol', 'W:')
|
||||
|
||||
function! airline#extensions#syntastic#get_warning()
|
||||
return airline#extensions#syntastic#get('warning')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#syntastic#get_error()
|
||||
return airline#extensions#syntastic#get('error')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#syntastic#get(type)
|
||||
let _backup = get(g:, 'syntastic_stl_format', '')
|
||||
let is_err = (a:type is# 'error')
|
||||
if is_err
|
||||
let g:syntastic_stl_format = '%E{%e}'
|
||||
else
|
||||
let g:syntastic_stl_format = '%W{%w}'
|
||||
endif
|
||||
let cnt = SyntasticStatuslineFlag()
|
||||
if !empty(_backup)
|
||||
let g:syntastic_stl_format = _backup
|
||||
endif
|
||||
if cnt == 0
|
||||
return ''
|
||||
else
|
||||
return (is_err ? s:error_symbol : s:warning_symbol).cnt
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#syntastic#init(ext)
|
||||
call airline#parts#define_function('syntastic', 'airline#extensions#syntastic#get_warnings')
|
||||
call airline#parts#define_function('syntastic-warn', 'airline#extensions#syntastic#get_warning')
|
||||
call airline#parts#define_function('syntastic-err', 'airline#extensions#syntastic#get_error')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
|
||||
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
||||
@@ -131,22 +133,31 @@ function! airline#extensions#tabline#title(n)
|
||||
let title = TabooTabTitle(a:n)
|
||||
endif
|
||||
|
||||
if empty(title) && exists('*gettabvar')
|
||||
let title = gettabvar(a:n, 'title')
|
||||
endif
|
||||
|
||||
if empty(title)
|
||||
let buflist = tabpagebuflist(a:n)
|
||||
let winnr = tabpagewinnr(a:n)
|
||||
return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1])
|
||||
let all_buffers = airline#extensions#tabline#buflist#list()
|
||||
return airline#extensions#tabline#get_buffer_name(
|
||||
\ buflist[winnr - 1],
|
||||
\ filter(buflist, 'index(all_buffers, v:val) != -1'))
|
||||
endif
|
||||
|
||||
return title
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#get_buffer_name(nr)
|
||||
return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, airline#extensions#tabline#buflist#list())
|
||||
function! airline#extensions#tabline#get_buffer_name(nr, ...)
|
||||
let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list()
|
||||
return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, buffers)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#new_builder()
|
||||
let builder_context = {
|
||||
\ 'active' : 1,
|
||||
\ 'tabline' : 1,
|
||||
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep),
|
||||
\ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep),
|
||||
\ }
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0)
|
||||
let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0)
|
||||
|
||||
@@ -13,8 +13,7 @@ let s:current_modified = 0
|
||||
let s:current_tabline = ''
|
||||
let s:current_visible_buffers = []
|
||||
|
||||
let s:number_map = &encoding == 'utf-8'
|
||||
\ ? {
|
||||
let s:number_map = {
|
||||
\ '0': '⁰',
|
||||
\ '1': '¹',
|
||||
\ '2': '²',
|
||||
@@ -26,6 +25,8 @@ let s:number_map = &encoding == 'utf-8'
|
||||
\ '8': '⁸',
|
||||
\ '9': '⁹'
|
||||
\ }
|
||||
let s:number_map = &encoding == 'utf-8'
|
||||
\ ? get(g:, 'airline#extensions#tabline#buffer_idx_format', s:number_map)
|
||||
\ : {}
|
||||
|
||||
function! airline#extensions#tabline#buffers#off()
|
||||
@@ -73,7 +74,7 @@ function! airline#extensions#tabline#buffers#get()
|
||||
|
||||
" Neovim feature: Have clickable buffers
|
||||
if has("tablineat")
|
||||
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#switchbuf@')
|
||||
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@')
|
||||
endif
|
||||
if s:buffer_idx_mode
|
||||
if len(s:number_map) > 0
|
||||
@@ -96,6 +97,9 @@ function! airline#extensions#tabline#buffers#get()
|
||||
if s:show_tab_type
|
||||
call b.add_section_spaced('airline_tabtype', s:buffers_label)
|
||||
endif
|
||||
if tabpagenr('$') > 1
|
||||
call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
endif
|
||||
|
||||
let s:current_bufnr = cur
|
||||
let s:current_tabline = b.build()
|
||||
@@ -180,7 +184,7 @@ function! s:jump_to_tab(offset)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function s:map_keys()
|
||||
function! s:map_keys()
|
||||
if s:buffer_idx_mode
|
||||
noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
|
||||
@@ -196,10 +200,52 @@ function s:map_keys()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function airline#extensions#tabline#buffers#switchbuf(minwid, clicks, button, modifiers) abort
|
||||
" Run the following code only on a single left mouse button click without modifiers pressed
|
||||
function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, modifiers) abort
|
||||
" Clickable buffers
|
||||
" works only in recent NeoVim with has('tablineat')
|
||||
if a:clicks == 1 && a:button is# 'l' && a:modifiers !~# '[^ ]'
|
||||
sil execute 'buffer' a:minwid
|
||||
|
||||
" single mouse button click without modifiers pressed
|
||||
if a:clicks == 1 && a:modifiers !~# '[^ ]'
|
||||
if a:button is# 'l'
|
||||
" left button - switch to buffer
|
||||
silent execute 'buffer' a:minwid
|
||||
elseif a:button is# 'm'
|
||||
" middle button - delete buffer
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#middle_click_preserves_windows', 0) == 0
|
||||
" just simply delete the clicked buffer. This will cause windows
|
||||
" associated with the clicked buffer to be closed.
|
||||
silent execute 'bdelete' a:minwid
|
||||
else
|
||||
" find windows displaying the clicked buffer and open an new
|
||||
" buffer in them.
|
||||
let current_window = bufwinnr("%")
|
||||
let window_number = bufwinnr(a:minwid)
|
||||
let last_window_visited = -1
|
||||
|
||||
" Set to 1 if the clicked buffer was open in any windows.
|
||||
let buffer_in_window = 0
|
||||
|
||||
" Find the next window with the clicked buffer open. If bufwinnr()
|
||||
" returns the same window number, this is because we clicked a new
|
||||
" buffer, and then tried editing a new buffer. Vim won't create a
|
||||
" new empty buffer for the same window, so we get the same window
|
||||
" number from bufwinnr(). In this case we just give up and don't
|
||||
" delete the buffer.
|
||||
" This could be made cleaner if we could check if the clicked buffer
|
||||
" is a new buffer, but I don't know if there is a way to do that.
|
||||
while window_number != -1 && window_number != last_window_visited
|
||||
let buffer_in_window = 1
|
||||
silent execute window_number . 'wincmd w'
|
||||
silent execute 'enew'
|
||||
let last_window_visited = window_number
|
||||
let window_number = bufwinnr(a:minwid)
|
||||
endwhile
|
||||
silent execute current_window . 'wincmd w'
|
||||
if window_number != last_window_visited || buffer_in_window == 0
|
||||
silent execute 'bdelete' a:minwid
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:excludes = get(g:, 'airline#extensions#tabline#excludes', [])
|
||||
let s:exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1)
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#tabline#buflist#invalidate()
|
||||
unlet! s:current_buffer_list
|
||||
@@ -13,6 +12,9 @@ function! airline#extensions#tabline#buflist#list()
|
||||
return s:current_buffer_list
|
||||
endif
|
||||
|
||||
let excludes = get(g:, 'airline#extensions#tabline#excludes', [])
|
||||
let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1)
|
||||
|
||||
let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$"))
|
||||
|
||||
let buffers = []
|
||||
@@ -26,9 +28,9 @@ function! airline#extensions#tabline#buflist#list()
|
||||
" 2) buffer is a quickfix buffer
|
||||
" 3) exclude preview windows (if 'bufhidden' == wipe
|
||||
" and 'buftype' == nofile
|
||||
if (!empty(s:excludes) && match(bufname(nr), join(s:excludes, '\|')) > -1) ||
|
||||
if (!empty(excludes) && match(bufname(nr), join(excludes, '\|')) > -1) ||
|
||||
\ (getbufvar(nr, 'current_syntax') == 'qf') ||
|
||||
\ (s:exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe'
|
||||
\ (exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe'
|
||||
\ && getbufvar(nr, '&buftype') == 'nofile')
|
||||
continue
|
||||
endif
|
||||
|
||||
@@ -57,6 +57,11 @@ function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_t
|
||||
endif
|
||||
|
||||
let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)'
|
||||
|
||||
if has("tablineat")
|
||||
let buf_name = '%'.buffer.index.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X'
|
||||
endif
|
||||
|
||||
call a:builder.add_section_spaced(group, buf_name)
|
||||
endfor
|
||||
endfunction
|
||||
@@ -83,13 +88,14 @@ function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos)
|
||||
endif
|
||||
endif
|
||||
|
||||
call a:builder.add_section_spaced(group, tab.title.ctrlspace#api#TabBuffersNumber(tab.index))
|
||||
call a:builder.add_section_spaced(group, '%'.tab.index.'T'.tab.title.ctrlspace#api#TabBuffersNumber(tab.index).'%T')
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#get()
|
||||
let cur_buf = bufnr('%')
|
||||
|
||||
call airline#extensions#tabline#tabs#map_keys()
|
||||
let s:tab_list = ctrlspace#api#TabList()
|
||||
for tab in s:tab_list
|
||||
if tab.current
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
|
||||
let s:fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
|
||||
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
|
||||
@@ -9,6 +10,7 @@ let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
|
||||
let s:buf_modified_symbol = g:airline_symbols.modified
|
||||
|
||||
function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
let _ = ''
|
||||
|
||||
let name = bufname(a:bufnr)
|
||||
@@ -16,9 +18,9 @@ function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
|
||||
let _ .= '[No Name]'
|
||||
else
|
||||
if s:fnamecollapse
|
||||
let _ .= substitute(fnamemodify(name, s:fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
|
||||
let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
|
||||
else
|
||||
let _ .= fnamemodify(name, s:fmod)
|
||||
let _ .= fnamemodify(name, fmod)
|
||||
endif
|
||||
if a:bufnr != bufnr('%') && s:fnametruncate && strlen(_) > s:fnametruncate
|
||||
let _ = strpart(_, 0, s:fnametruncate)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffers)
|
||||
let duplicates = {}
|
||||
let tails = {}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1)
|
||||
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||
@@ -34,7 +36,7 @@ endfunction
|
||||
function! airline#extensions#tabline#tabs#get()
|
||||
let curbuf = bufnr('%')
|
||||
let curtab = tabpagenr()
|
||||
call s:map_keys()
|
||||
call airline#extensions#tabline#tabs#map_keys()
|
||||
if curbuf == s:current_bufnr && curtab == s:current_tabnr
|
||||
if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified
|
||||
return s:current_tabline
|
||||
@@ -45,17 +47,17 @@ function! airline#extensions#tabline#tabs#get()
|
||||
|
||||
for i in range(1, tabpagenr('$'))
|
||||
if i == curtab
|
||||
let group = 'airline_tabsel_right'
|
||||
let group = 'airline_tabsel'
|
||||
if g:airline_detect_modified
|
||||
for bi in tabpagebuflist(i)
|
||||
if getbufvar(bi, '&modified')
|
||||
let group = 'airline_tabmod_right'
|
||||
let group = 'airline_tabmod'
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
let s:current_modified = (group == 'airline_tabmod_right') ? 1 : 0
|
||||
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
|
||||
else
|
||||
let group = 'airline_tab_right'
|
||||
let group = 'airline_tab'
|
||||
endif
|
||||
let val = '%('
|
||||
if s:show_tab_nr
|
||||
@@ -81,7 +83,7 @@ function! airline#extensions#tabline#tabs#get()
|
||||
if s:show_splits == 1
|
||||
let buffers = tabpagebuflist(curtab)
|
||||
for nr in buffers
|
||||
let group = airline#extensions#tabline#group_of_bufnr(buffers, nr)
|
||||
let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right"
|
||||
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
|
||||
endfor
|
||||
elseif s:show_tab_type == 1
|
||||
@@ -94,7 +96,7 @@ function! airline#extensions#tabline#tabs#get()
|
||||
return s:current_tabline
|
||||
endfunction
|
||||
|
||||
function s:map_keys()
|
||||
function! airline#extensions#tabline#tabs#map_keys()
|
||||
noremap <silent> <Plug>AirlineSelectTab1 :1tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':TagbarToggle')
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':Tmuxline')
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':UndotreeToggle')
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_unicodePlugin', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_unite', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
30
autoload/airline/extensions/vimagit.vim
Normal file
30
autoload/airline/extensions/vimagit.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
" MIT License. Copyright (c) 2016 Jerome Reybert
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" This plugin replace the whole section_a when in vimagit buffer
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_magit', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#vimagit#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#vimagit#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimagit#get_mode()
|
||||
if ( b:magit_current_commit_mode == '' )
|
||||
return "STAGING"
|
||||
elseif ( b:magit_current_commit_mode == 'CC' )
|
||||
return "COMMIT"
|
||||
elseif ( b:magit_current_commit_mode == 'CA' )
|
||||
return "AMEND"
|
||||
else
|
||||
return "???"
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimagit#apply(...)
|
||||
if ( &filetype == 'magit' )
|
||||
let w:airline_section_a = '%{airline#extensions#vimagit#get_mode()}'
|
||||
endif
|
||||
endfunction
|
||||
81
autoload/airline/extensions/vimtex.vim
Normal file
81
autoload/airline/extensions/vimtex.vim
Normal file
@@ -0,0 +1,81 @@
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! s:SetDefault(var, val)
|
||||
if !exists(a:var)
|
||||
execute 'let ' . a:var . '=' . string(a:val)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Left and right delimiters (added only when status string is not empty)
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#left', "{")
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#right', "}")
|
||||
|
||||
" The current tex file is the main project file
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#main', "" )
|
||||
"
|
||||
" The current tex file is a subfile of the project
|
||||
" and the compilation is set for the main file
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#sub_main', "m")
|
||||
"
|
||||
" The current tex file is a subfile of the project
|
||||
" and the compilation is set for this subfile
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#sub_local', "l")
|
||||
"
|
||||
" Compilation is running and continuous compilation is off
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#compiled', "c₁")
|
||||
|
||||
" Compilation is running and continuous compilation is on
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#continuous', "c")
|
||||
|
||||
" Viewer is opened
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#viewer', "v")
|
||||
|
||||
function! airline#extensions#vimtex#init(ext)
|
||||
call airline#parts#define_raw('vimtex', '%{airline#extensions#vimtex#get_scope()}')
|
||||
call a:ext.add_statusline_func('airline#extensions#vimtex#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimtex#apply(...)
|
||||
if exists("b:vimtex")
|
||||
let w:airline_section_x = get(w:, 'airline_section_x', g:airline_section_x)
|
||||
let w:airline_section_x.=s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#vimtex#get_scope()}'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimtex#get_scope()
|
||||
let l:status = ''
|
||||
|
||||
let vt_local = get(b:, 'vimtex_local', {})
|
||||
if empty(vt_local)
|
||||
let l:status .= g:airline#extensions#vimtex#main
|
||||
else
|
||||
if get(vt_local, 'active')
|
||||
let l:status .= g:airline#extensions#vimtex#sub_local
|
||||
else
|
||||
let l:status .= g:airline#extensions#vimtex#sub_main
|
||||
endif
|
||||
endif
|
||||
|
||||
if get(get(get(b:, 'vimtex', {}), 'viewer', {}), 'xwin_id')
|
||||
let l:status .= g:airline#extensions#vimtex#viewer
|
||||
endif
|
||||
|
||||
let l:compiler = get(get(b:, 'vimtex', {}), 'compiler', {})
|
||||
if !empty(l:compiler)
|
||||
if has_key(l:compiler, 'is_running') && b:vimtex.compiler.is_running()
|
||||
if get(l:compiler, 'continuous')
|
||||
let l:status .= g:airline#extensions#vimtex#continuous
|
||||
else
|
||||
let l:status .= g:airline#extensions#vimtex#compiled
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if !empty(l:status)
|
||||
let l:status = g:airline#extensions#vimtex#left . l:status . g:airline#extensions#vimtex#right
|
||||
endif
|
||||
return l:status
|
||||
endfunction
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! airline#extensions#virtualenv#init(ext)
|
||||
|
||||
@@ -3,20 +3,21 @@
|
||||
|
||||
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1)
|
||||
let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace)
|
||||
let s:default_checks = ['indent', 'trailing', 'mixed-indent-file']
|
||||
|
||||
let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]')
|
||||
let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', 'mixed-indent[%s]')
|
||||
let s:long_format = get(g:, 'airline#extensions#whitespace#long_format', 'long[%s]')
|
||||
let s:mixed_indent_file_format = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', 'mix-indent-file[%s]')
|
||||
let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing')
|
||||
let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent')
|
||||
let s:long_format = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long')
|
||||
let s:mixed_indent_file_format = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', '[%s]mix-indent-file')
|
||||
let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
|
||||
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
|
||||
|
||||
let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
|
||||
|
||||
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
|
||||
let s:c_like_langs = get(g:, 'airline#extensions#c_like_langs', [ 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ])
|
||||
|
||||
function! s:check_mixed_indent()
|
||||
if s:indent_algo == 1
|
||||
@@ -35,8 +36,8 @@ function! s:check_mixed_indent()
|
||||
endfunction
|
||||
|
||||
function! s:check_mixed_indent_file()
|
||||
if stridx(&ft, 'c') == 0 || stridx(&ft, 'cpp') == 0 || stridx(&ft, 'javascript') == 0
|
||||
" for C/CPP only allow /** */ comment style with one space before the '*'
|
||||
if index(s:c_like_langs, &ft) > -1
|
||||
" for C-like languages: allow /** */ comment style with one space before the '*'
|
||||
let head_spc = '\v(^ +\*@!)'
|
||||
else
|
||||
let head_spc = '\v(^ +)'
|
||||
@@ -52,12 +53,13 @@ endfunction
|
||||
|
||||
function! airline#extensions#whitespace#check()
|
||||
if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines
|
||||
\ || get(b:, 'airline_whitespace_disabled', 0)
|
||||
return ''
|
||||
endif
|
||||
|
||||
if !exists('b:airline_whitespace_check')
|
||||
let b:airline_whitespace_check = ''
|
||||
let checks = get(g:, 'airline#extensions#whitespace#checks', s:default_checks)
|
||||
let checks = get(b:, 'airline_whitespace_checks', get(g:, 'airline#extensions#whitespace#checks', s:default_checks))
|
||||
|
||||
let trailing = 0
|
||||
if index(checks, 'trailing') > -1
|
||||
@@ -90,23 +92,29 @@ function! airline#extensions#whitespace#check()
|
||||
|
||||
if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file)
|
||||
let b:airline_whitespace_check = s:symbol
|
||||
if strlen(s:symbol) > 0
|
||||
let space = (g:airline_symbols.space)
|
||||
else
|
||||
let space = ''
|
||||
endif
|
||||
|
||||
if s:show_message
|
||||
if trailing != 0
|
||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing)
|
||||
let b:airline_whitespace_check .= space.printf(s:trailing_format, trailing)
|
||||
endif
|
||||
if mixed != 0
|
||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixed)
|
||||
let b:airline_whitespace_check .= space.printf(s:mixed_indent_format, mixed)
|
||||
endif
|
||||
if long != 0
|
||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:long_format, long)
|
||||
let b:airline_whitespace_check .= space.printf(s:long_format, long)
|
||||
endif
|
||||
if !empty(mixed_file)
|
||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_file_format, mixed_file)
|
||||
let b:airline_whitespace_check .= space.printf(s:mixed_indent_file_format, mixed_file)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return b:airline_whitespace_check
|
||||
return airline#util#shorten(b:airline_whitespace_check, 120, 9)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#toggle()
|
||||
@@ -131,13 +139,29 @@ function! airline#extensions#whitespace#toggle()
|
||||
echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#disable()
|
||||
if s:enabled
|
||||
call airline#extensions#whitespace#toggle()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#init(...)
|
||||
call airline#parts#define_function('whitespace', 'airline#extensions#whitespace#check')
|
||||
|
||||
unlet! b:airline_whitespace_check
|
||||
augroup airline_whitespace
|
||||
autocmd!
|
||||
autocmd CursorHold,BufWritePost * unlet! b:airline_whitespace_check
|
||||
autocmd CursorHold,BufWritePost * call <sid>ws_refresh()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:ws_refresh()
|
||||
if get(b:, 'airline_ws_changedtick', 0) == b:changedtick
|
||||
return
|
||||
endif
|
||||
unlet! b:airline_whitespace_check
|
||||
if get(g:, 'airline_skip_empty_sections', 0)
|
||||
exe ':AirlineRefresh'
|
||||
endif
|
||||
let b:airline_ws_changedtick = b:changedtick
|
||||
endfunction
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('g:loaded_windowswap')
|
||||
finish
|
||||
endif
|
||||
@@ -15,7 +17,11 @@ function! airline#extensions#windowswap#init(ext)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#windowswap#get_status()
|
||||
if WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr()
|
||||
" use new tab-aware api if WS is up to date
|
||||
let s:mark = exists('*WindowSwap#IsCurrentWindowMarked') ?
|
||||
\WindowSwap#IsCurrentWindowMarked() :
|
||||
\(WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr())
|
||||
if s:mark
|
||||
return g:airline#extensions#windowswap#indicator_text.s:spc
|
||||
endif
|
||||
return ''
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:filetypes = get(g:, 'airline#extensions#wordcount#filetypes', '\vhelp|markdown|rst|org|text')
|
||||
let s:format = get(g:, 'airline#extensions#wordcount#format', '%d words')
|
||||
let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default')
|
||||
scriptencoding utf-8
|
||||
|
||||
function! s:update()
|
||||
if match(&ft, s:filetypes) > -1
|
||||
let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default')
|
||||
let g:airline#extensions#wordcount#filetypes = get(g:, 'airline#extensions#wordcount#filetypes',
|
||||
\ '\vhelp|markdown|rst|org|text|asciidoc|tex|mail')
|
||||
|
||||
function! s:wordcount_update()
|
||||
if empty(bufname(''))
|
||||
return
|
||||
endif
|
||||
if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1
|
||||
let l:mode = mode()
|
||||
if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S'
|
||||
let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format()
|
||||
@@ -14,23 +19,25 @@ function! s:update()
|
||||
else
|
||||
if get(b:, 'airline_wordcount_cache', '') is# '' ||
|
||||
\ b:airline_wordcount_cache isnot# get(b:, 'airline_wordcount', '') ||
|
||||
\ get(b:, 'airline_change_tick', 0) != b:changedtick
|
||||
\ get(b:, 'airline_change_tick', 0) != b:changedtick ||
|
||||
\ get(b:, 'airline_winwidth', 0) != winwidth(0)
|
||||
" cache data
|
||||
let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format()
|
||||
let b:airline_wordcount_cache = b:airline_wordcount
|
||||
let b:airline_change_tick = b:changedtick
|
||||
let b:airline_winwidth = winwidth(0)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#wordcount#apply(...)
|
||||
if &ft =~ s:filetypes
|
||||
if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1
|
||||
call airline#extensions#prepend_to_section('z', '%{get(b:, "airline_wordcount", "")}')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#wordcount#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#wordcount#apply')
|
||||
autocmd BufReadPost,CursorMoved,CursorMovedI * call s:update()
|
||||
autocmd BufReadPost,CursorMoved,CursorMovedI * call s:wordcount_update()
|
||||
endfunction
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#wordcount#formatters#default#format()
|
||||
let words = string(s:wordcount())
|
||||
if empty(words)
|
||||
return
|
||||
endif
|
||||
let separator = s:get_decimal_group()
|
||||
if words > 999 && !empty(separator)
|
||||
" Format number according to locale, e.g. German: 1.245 or English: 1,245
|
||||
let a = join(reverse(split(words, '.\zs')),'')
|
||||
let a = substitute(a, '...', '&'.separator, 'g')
|
||||
let words = join(reverse(split(a, '.\zs')),'')
|
||||
let result = g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space
|
||||
if winwidth(0) >= 80
|
||||
let separator = s:get_decimal_group()
|
||||
if words > 999 && !empty(separator)
|
||||
" Format number according to locale, e.g. German: 1.245 or English: 1,245
|
||||
let words = substitute(words, '\d\@<=\(\(\d\{3\}\)\+\)$', separator.'&', 'g')
|
||||
endif
|
||||
let result = printf("%s%s", words, " words"). result
|
||||
else
|
||||
let result = printf("%s%s", words, "W"). result
|
||||
endif
|
||||
return words . " words" . g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space
|
||||
return result
|
||||
endfunction
|
||||
|
||||
function! s:wordcount()
|
||||
@@ -48,7 +54,7 @@ function! s:wordcount()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function s:get_decimal_group()
|
||||
function! s:get_decimal_group()
|
||||
if match(v:lang, '\v\cC|en') > -1
|
||||
return ','
|
||||
elseif match(v:lang, '\v\cde|dk|fr|pt') > -1
|
||||
|
||||
25
autoload/airline/extensions/xkblayout.vim
Normal file
25
autoload/airline/extensions/xkblayout.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" MIT License. Copyright (c) 2017 YoungHoon Rhiu.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('g:XkbSwitchLib')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#xkblayout#status()
|
||||
let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
|
||||
let keyboard_layout = split(keyboard_layout, '\.')[-1]
|
||||
let short_codes = {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'}
|
||||
|
||||
if has_key(short_codes, keyboard_layout)
|
||||
let keyboard_layout = short_codes[keyboard_layout]
|
||||
endif
|
||||
|
||||
return keyboard_layout
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#xkblayout#init(ext)
|
||||
call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status')
|
||||
endfunction
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2015 Evgeny Firsov.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
let s:error_symbol = get(g:, 'airline#extensions#ycm#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#ycm#warning_symbol', 'W:')
|
||||
@@ -11,7 +13,7 @@ function! airline#extensions#ycm#init(ext)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ycm#get_error_count()
|
||||
if exists(':YcmDiag')
|
||||
if exists(':YcmDiag') && exists("*youcompleteme#GetErrorCount")
|
||||
let cnt = youcompleteme#GetErrorCount()
|
||||
|
||||
if cnt != 0
|
||||
@@ -23,7 +25,7 @@ function! airline#extensions#ycm#get_error_count()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ycm#get_warning_count()
|
||||
if exists(':YcmDiag')
|
||||
if exists(':YcmDiag') && exists("*youcompleteme#GetWarningCount")
|
||||
let cnt = youcompleteme#GetWarningCount()
|
||||
|
||||
if cnt != 0
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running') && (empty($CONEMUBUILD) || &term !=? 'xterm')
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:is_win32term = (has('win32') || has('win64')) &&
|
||||
\ !has('gui_running') &&
|
||||
\ (empty($CONEMUBUILD) || &term !=? 'xterm') &&
|
||||
\ !(exists("+termguicolors") && &termguicolors)
|
||||
|
||||
let s:separators = {}
|
||||
let s:accents = {}
|
||||
@@ -20,22 +25,25 @@ function! s:get_syn(group, what)
|
||||
if !exists("g:airline_gui_mode")
|
||||
let g:airline_gui_mode = airline#init#gui_mode()
|
||||
endif
|
||||
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode)
|
||||
if empty(color) || color == -1
|
||||
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode)
|
||||
let color = ''
|
||||
if hlexists(a:group)
|
||||
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode)
|
||||
endif
|
||||
if empty(color) || color == -1
|
||||
let color = 'NONE'
|
||||
" should always exists
|
||||
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode)
|
||||
" however, just in case
|
||||
if empty(color) || color == -1
|
||||
let color = 'NONE'
|
||||
endif
|
||||
endif
|
||||
return color
|
||||
endfunction
|
||||
|
||||
function! s:get_array(fg, bg, opts)
|
||||
let fg = a:fg
|
||||
let bg = a:bg
|
||||
return g:airline_gui_mode ==# 'gui'
|
||||
\ ? [ fg, bg, '', '', join(a:opts, ',') ]
|
||||
\ : [ '', '', fg, bg, join(a:opts, ',') ]
|
||||
\ ? [ a:fg, a:bg, '', '', join(a:opts, ',') ]
|
||||
\ : [ '', '', a:fg, a:bg, join(a:opts, ',') ]
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#get_highlight(group, ...)
|
||||
@@ -54,6 +62,15 @@ function! airline#highlighter#get_highlight2(fg, bg, ...)
|
||||
return s:get_array(fg, bg, a:000)
|
||||
endfunction
|
||||
|
||||
function! s:hl_group_exists(group)
|
||||
if !hlexists(a:group)
|
||||
return 0
|
||||
elseif empty(synIDattr(hlID(a:group), 'fg'))
|
||||
return 0
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#exec(group, colors)
|
||||
if pumvisible()
|
||||
return
|
||||
@@ -63,20 +80,53 @@ function! airline#highlighter#exec(group, colors)
|
||||
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
|
||||
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
|
||||
endif
|
||||
let cmd= printf('hi %s %s %s %s %s %s %s %s',
|
||||
\ a:group, s:Get(colors, 0, 'guifg=', ''), s:Get(colors, 1, 'guibg=', ''),
|
||||
\ s:Get(colors, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''),
|
||||
\ s:Get(colors, 4, 'gui=', ''), s:Get(colors, 4, 'cterm=', ''),
|
||||
\ s:Get(colors, 4, 'term=', ''))
|
||||
let old_hi = airline#highlighter#get_highlight(a:group)
|
||||
if len(colors) == 4
|
||||
call add(colors, '')
|
||||
endif
|
||||
if old_hi != colors
|
||||
let colors = s:CheckDefined(colors)
|
||||
if old_hi != colors || !s:hl_group_exists(a:group)
|
||||
let cmd = printf('hi %s %s %s %s %s %s %s %s',
|
||||
\ a:group, s:Get(colors, 0, 'guifg=', ''), s:Get(colors, 1, 'guibg=', ''),
|
||||
\ s:Get(colors, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''),
|
||||
\ s:Get(colors, 4, 'gui=', ''), s:Get(colors, 4, 'cterm=', ''),
|
||||
\ s:Get(colors, 4, 'term=', ''))
|
||||
exe cmd
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:CheckDefined(colors)
|
||||
" Checks, whether the definition of the colors is valid and is not empty or NONE
|
||||
" e.g. if the colors would expand to this:
|
||||
" hi airline_c ctermfg=NONE ctermbg=NONE
|
||||
" that means to clear that highlighting group, therefore, fallback to Normal
|
||||
" highlighting group for the cterm values
|
||||
|
||||
" This only works, if the Normal highlighting group is actually defined, so
|
||||
" return early, if it has been cleared
|
||||
if !exists("g:airline#highlighter#normal_fg_hi")
|
||||
let g:airline#highlighter#normal_fg_hi = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm')
|
||||
endif
|
||||
if empty(g:airline#highlighter#normal_fg_hi) || g:airline#highlighter#normal_fg_hi < 0
|
||||
return a:colors
|
||||
endif
|
||||
|
||||
for val in a:colors
|
||||
if !empty(val) && val !=# 'NONE'
|
||||
return a:colors
|
||||
endif
|
||||
endfor
|
||||
" this adds the bold attribute to the term argument of the :hi command,
|
||||
" but at least this makes sure, the group will be defined
|
||||
let fg = g:airline#highlighter#normal_fg_hi
|
||||
let bg = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm')
|
||||
if bg < 0
|
||||
" in case there is no background color defined for Normal
|
||||
let bg = a:colors[3]
|
||||
endif
|
||||
return a:colors[0:1] + [fg, bg] + [a:colors[4]]
|
||||
endfunction
|
||||
|
||||
function! s:Get(dict, key, prefix, default)
|
||||
if get(a:dict, a:key, a:default) isnot# a:default
|
||||
return a:prefix. get(a:dict, a:key)
|
||||
@@ -109,7 +159,11 @@ function! airline#highlighter#load_theme()
|
||||
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
||||
endfor
|
||||
call airline#highlighter#highlight(['inactive'])
|
||||
call airline#highlighter#highlight(['normal'])
|
||||
if getbufvar( bufnr('%'), '&modified' )
|
||||
call airline#highlighter#highlight(['normal', 'modified'])
|
||||
else
|
||||
call airline#highlighter#highlight(['normal'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#add_separator(from, to, inverse)
|
||||
@@ -135,7 +189,8 @@ function! airline#highlighter#highlight_modified_inactive(bufnr)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#highlight(modes)
|
||||
function! airline#highlighter#highlight(modes, ...)
|
||||
let bufnr = a:0 ? a:1 : ''
|
||||
let p = g:airline#themes#{g:airline_theme}#palette
|
||||
|
||||
" draw the base mode, followed by any overrides
|
||||
@@ -146,7 +201,11 @@ function! airline#highlighter#highlight(modes)
|
||||
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
|
||||
for kvp in items(dict)
|
||||
let mode_colors = kvp[1]
|
||||
call airline#highlighter#exec(kvp[0].suffix, mode_colors)
|
||||
let name = kvp[0]
|
||||
if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive'
|
||||
let name = 'airline_c'.bufnr
|
||||
endif
|
||||
call airline#highlighter#exec(name.suffix, mode_colors)
|
||||
|
||||
for accent in keys(s:accents)
|
||||
if !has_key(p.accents, accent)
|
||||
@@ -164,7 +223,7 @@ function! airline#highlighter#highlight(modes)
|
||||
else
|
||||
call add(colors, get(p.accents[accent], 4, ''))
|
||||
endif
|
||||
call airline#highlighter#exec(kvp[0].suffix.'_'.accent, colors)
|
||||
call airline#highlighter#exec(name.suffix.'_'.accent, colors)
|
||||
endfor
|
||||
endfor
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! s:check_defined(variable, default)
|
||||
if !exists(a:variable)
|
||||
let {a:variable} = a:default
|
||||
@@ -15,13 +17,14 @@ function! airline#init#bootstrap()
|
||||
let s:loaded = 1
|
||||
|
||||
let g:airline#init#bootstrapping = 1
|
||||
call s:check_defined('g:airline_left_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b0":">")
|
||||
call s:check_defined('g:airline_left_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b1":">")
|
||||
call s:check_defined('g:airline_right_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b2":"<")
|
||||
call s:check_defined('g:airline_right_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b3":"<")
|
||||
|
||||
let g:airline#util#async = v:version >= 800 && has('job')
|
||||
let g:airline#util#is_windows = has('win32') || has('win64')
|
||||
|
||||
call s:check_defined('g:airline_detect_modified', 1)
|
||||
call s:check_defined('g:airline_detect_paste', 1)
|
||||
call s:check_defined('g:airline_detect_crypt', 1)
|
||||
call s:check_defined('g:airline_detect_spell', 1)
|
||||
call s:check_defined('g:airline_detect_iminsert', 0)
|
||||
call s:check_defined('g:airline_inactive_collapse', 1)
|
||||
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])
|
||||
@@ -53,20 +56,69 @@ function! airline#init#bootstrap()
|
||||
\ 'wombat': 'wombat',
|
||||
\ 'zenburn': 'zenburn',
|
||||
\ 'solarized': 'solarized',
|
||||
\ 'flattened': 'solarized',
|
||||
\ '\CNeoSolarized': 'solarized',
|
||||
\ }, 'keep')
|
||||
|
||||
call s:check_defined('g:airline_symbols', {})
|
||||
" First define the symbols,
|
||||
" that are common in Powerline/Unicode/ASCII mode,
|
||||
" then add specific symbols for either mode
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'paste': 'PASTE',
|
||||
\ 'readonly': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO',
|
||||
\ 'whitespace': get(g:, 'airline_powerline_fonts', 0) ? "\u2739" : '!',
|
||||
\ 'linenr': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a1" : ':',
|
||||
\ 'branch': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a0" : '',
|
||||
\ 'notexists': "\u2204",
|
||||
\ 'modified': '+',
|
||||
\ 'space': ' ',
|
||||
\ 'crypt': get(g:, 'airline_crypt_symbol', nr2char(0x1F512)),
|
||||
\ }, 'keep')
|
||||
\ 'paste': 'PASTE',
|
||||
\ 'spell': 'SPELL',
|
||||
\ 'modified': '+',
|
||||
\ 'space': ' '
|
||||
\ }, 'keep')
|
||||
|
||||
if get(g:, 'airline_powerline_fonts', 0)
|
||||
" Symbols for Powerline terminals
|
||||
call s:check_defined('g:airline_left_sep', "\ue0b0") "
|
||||
call s:check_defined('g:airline_left_alt_sep', "\ue0b1") "
|
||||
call s:check_defined('g:airline_right_sep', "\ue0b2") "
|
||||
call s:check_defined('g:airline_right_alt_sep', "\ue0b3") "
|
||||
" ro=, ws=☲, lnr=☰, mlnr=, br=, nx=Ɇ, crypt=🔒
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': "\ue0a2",
|
||||
\ 'whitespace': "\u2632",
|
||||
\ 'linenr': "\u2630 ",
|
||||
\ 'maxlinenr': " \ue0a1",
|
||||
\ 'branch': "\ue0a0",
|
||||
\ 'notexists': "\u0246",
|
||||
\ 'crypt': nr2char(0x1F512),
|
||||
\ }, 'keep')
|
||||
elseif &encoding==?'utf-8' && !get(g:, "airline_symbols_ascii", 0)
|
||||
" Symbols for Unicode terminals
|
||||
call s:check_defined('g:airline_left_sep', "")
|
||||
call s:check_defined('g:airline_left_alt_sep', "")
|
||||
call s:check_defined('g:airline_right_sep', "")
|
||||
call s:check_defined('g:airline_right_alt_sep', "")
|
||||
" ro=⊝, ws=☲, lnr=☰, mlnr=㏑, br=ᚠ, nx=Ɇ, crypt=🔒
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': "\u229D",
|
||||
\ 'whitespace': "\u2632",
|
||||
\ 'linenr': "\u2630 ",
|
||||
\ 'maxlinenr': " \u33D1",
|
||||
\ 'branch': "\u16A0",
|
||||
\ 'notexists': "\u0246",
|
||||
\ 'crypt': nr2char(0x1F512),
|
||||
\ }, 'keep')
|
||||
else
|
||||
" Symbols for ASCII terminals
|
||||
call s:check_defined('g:airline_left_sep', "")
|
||||
call s:check_defined('g:airline_left_alt_sep', "")
|
||||
call s:check_defined('g:airline_right_sep', "")
|
||||
call s:check_defined('g:airline_right_alt_sep', "")
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': 'RO',
|
||||
\ 'whitespace': '!',
|
||||
\ 'linenr': 'ln ',
|
||||
\ 'maxlinenr': ' :',
|
||||
\ 'branch': '',
|
||||
\ 'notexists': '?',
|
||||
\ 'crypt': 'cr',
|
||||
\ }, 'keep')
|
||||
endif
|
||||
|
||||
call airline#parts#define('mode', {
|
||||
\ 'function': 'airline#parts#mode',
|
||||
@@ -75,6 +127,7 @@ function! airline#init#bootstrap()
|
||||
call airline#parts#define_function('iminsert', 'airline#parts#iminsert')
|
||||
call airline#parts#define_function('paste', 'airline#parts#paste')
|
||||
call airline#parts#define_function('crypt', 'airline#parts#crypt')
|
||||
call airline#parts#define_function('spell', 'airline#parts#spell')
|
||||
call airline#parts#define_function('filetype', 'airline#parts#filetype')
|
||||
call airline#parts#define('readonly', {
|
||||
\ 'function': 'airline#parts#readonly',
|
||||
@@ -83,26 +136,32 @@ function! airline#init#bootstrap()
|
||||
call airline#parts#define_raw('file', '%f%m')
|
||||
call airline#parts#define_raw('path', '%F%m')
|
||||
call airline#parts#define('linenr', {
|
||||
\ 'raw': '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#',
|
||||
\ 'raw': '%{g:airline_symbols.linenr}%4l',
|
||||
\ 'accent': 'bold'})
|
||||
call airline#parts#define('maxlinenr', {
|
||||
\ 'raw': '/%L%{g:airline_symbols.maxlinenr}',
|
||||
\ 'accent': 'bold'})
|
||||
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
|
||||
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic',
|
||||
\ 'eclim', 'whitespace','windowswap', 'ycm_error_count', 'ycm_warning_count'])
|
||||
call airline#parts#define_empty(['hunks', 'branch', 'obsession', 'tagbar',
|
||||
\ 'syntastic-warn', 'syntastic-err', 'eclim', 'whitespace','windowswap',
|
||||
\ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count',
|
||||
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count'])
|
||||
call airline#parts#define_text('capslock', '')
|
||||
call airline#parts#define_text('xkblayout', '')
|
||||
|
||||
unlet g:airline#init#bootstrapping
|
||||
endfunction
|
||||
|
||||
function! airline#init#gui_mode()
|
||||
return ((has('nvim') && exists('$NVIM_TUI_ENABLE_TRUE_COLOR'))
|
||||
\ || has('gui_running') || (has("termtruecolor") && &guicolors == 1)) ?
|
||||
return ((has('nvim') && exists('$NVIM_TUI_ENABLE_TRUE_COLOR') && !exists("+termguicolors"))
|
||||
\ || has('gui_running') || (has("termtruecolor") && &guicolors == 1) || (has("termguicolors") && &termguicolors == 1)) ?
|
||||
\ 'gui' : 'cterm'
|
||||
endfunction
|
||||
|
||||
function! airline#init#sections()
|
||||
let spc = g:airline_symbols.space
|
||||
if !exists('g:airline_section_a')
|
||||
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'capslock', 'iminsert'])
|
||||
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'spell', 'capslock', 'xkblayout', 'iminsert'])
|
||||
endif
|
||||
if !exists('g:airline_section_b')
|
||||
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
|
||||
@@ -124,13 +183,16 @@ function! airline#init#sections()
|
||||
let g:airline_section_y = airline#section#create_right(['ffenc'])
|
||||
endif
|
||||
if !exists('g:airline_section_z')
|
||||
let g:airline_section_z = airline#section#create(['windowswap', '%3p%%'.spc, 'linenr', ':%3v '])
|
||||
if winwidth(0) > 80
|
||||
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
|
||||
else
|
||||
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3v'])
|
||||
endif
|
||||
endif
|
||||
if !exists('g:airline_section_error')
|
||||
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic', 'eclim'])
|
||||
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count'])
|
||||
endif
|
||||
if !exists('g:airline_section_warning')
|
||||
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'whitespace'])
|
||||
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'whitespace'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" basic 16 msdos from MSDOS
|
||||
" see output of color, should be
|
||||
" 0 Black
|
||||
@@ -21,7 +23,7 @@
|
||||
" 15 White
|
||||
|
||||
let s:basic16 = [
|
||||
\ [ 0x00, 0x00, 0x00 ],
|
||||
\ [ 0x00, 0x00, 0x00 ],
|
||||
\ [ 0x00, 0x00, 0x80 ],
|
||||
\ [ 0x00, 0x80, 0x00 ],
|
||||
\ [ 0x00, 0x80, 0x80 ],
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:parts = {}
|
||||
|
||||
" PUBLIC API {{{
|
||||
@@ -51,7 +53,7 @@ endfunction
|
||||
" }}}
|
||||
|
||||
function! airline#parts#mode()
|
||||
return get(w:, 'airline_current_mode', '')
|
||||
return airline#util#shorten(get(w:, 'airline_current_mode', ''), 79, 1)
|
||||
endfunction
|
||||
|
||||
function! airline#parts#crypt()
|
||||
@@ -62,6 +64,10 @@ function! airline#parts#paste()
|
||||
return g:airline_detect_paste && &paste ? g:airline_symbols.paste : ''
|
||||
endfunction
|
||||
|
||||
function! airline#parts#spell()
|
||||
return g:airline_detect_spell && &spell ? g:airline_symbols.spell : ''
|
||||
endfunction
|
||||
|
||||
function! airline#parts#iminsert()
|
||||
if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name')
|
||||
return toupper(b:keymap_name)
|
||||
@@ -78,10 +84,16 @@ function! airline#parts#readonly()
|
||||
endfunction
|
||||
|
||||
function! airline#parts#filetype()
|
||||
return &filetype
|
||||
return winwidth(0) < 90 && strlen(&filetype) > 3 ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? '…' : '>') : &filetype
|
||||
endfunction
|
||||
|
||||
function! airline#parts#ffenc()
|
||||
return printf('%s%s%s', &fenc, &l:bomb ? '[BOM]' : '', strlen(&ff) > 0 ? '['.&ff.']' : '')
|
||||
let expected = get(g:, 'airline#parts#ffenc#skip_expected_string', '')
|
||||
let bomb = &l:bomb ? '[BOM]' : ''
|
||||
let ff = strlen(&ff) ? '['.&ff.']' : ''
|
||||
if expected is# &fenc.bomb.ff
|
||||
return ''
|
||||
else
|
||||
return &fenc.bomb.ff
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
call airline#init#bootstrap()
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
@@ -17,6 +19,7 @@ function! s:create(parts, append)
|
||||
for idx in range(len(a:parts))
|
||||
let part = airline#parts#get(a:parts[idx])
|
||||
let val = ''
|
||||
let add_sep = get(l:, 'add_sep', 0)
|
||||
|
||||
if exists('part.function')
|
||||
let func = (part.function).'()'
|
||||
@@ -27,7 +30,11 @@ function! s:create(parts, append)
|
||||
let val .= s:spc.g:airline_left_alt_sep.s:spc
|
||||
endif
|
||||
if a:append < 0 && idx != 0
|
||||
let val = s:spc.g:airline_right_alt_sep.s:spc.val
|
||||
let t = ''
|
||||
if !add_sep
|
||||
let t = s:spc.g:airline_right_alt_sep.s:spc
|
||||
endif
|
||||
let val = t.val
|
||||
endif
|
||||
if exists('part.raw')
|
||||
let _ .= s:wrap_accent(part, val.(part.raw))
|
||||
@@ -42,10 +49,15 @@ function! s:create(parts, append)
|
||||
|
||||
if a:append > 0 && idx != 0
|
||||
let partval = printf('%%{airline#util#append(%s,%s)}', func, minwidth)
|
||||
" will add an extra separator, if minwidth is zero
|
||||
let add_sep = (minwidth == 0)
|
||||
elseif a:append < 0 && idx != len(a:parts) - 1
|
||||
let partval = printf('%%{airline#util#prepend(%s,%s)}', func, minwidth)
|
||||
" will add an extra separator, if minwidth is zero
|
||||
let add_sep = (minwidth == 0)
|
||||
else
|
||||
let partval = printf('%%{airline#util#wrap(%s,%s)}', func, minwidth)
|
||||
let add_sep = 0
|
||||
endif
|
||||
|
||||
if exists('part.condition')
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" generates a dictionary which defines the colors for each highlight group
|
||||
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...)
|
||||
let palette = {
|
||||
@@ -45,6 +47,7 @@ function! airline#themes#patch(palette)
|
||||
endfor
|
||||
|
||||
let a:palette.accents = get(a:palette, 'accents', {})
|
||||
let a:palette.accents.none = [ '', '', '', '', '' ]
|
||||
let a:palette.accents.bold = [ '', '', '', '', 'bold' ]
|
||||
let a:palette.accents.italic = [ '', '', '', '', 'italic' ]
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
|
||||
" Each theme is contained in its own file and declares variables scoped to the
|
||||
" file. These variables represent the possible "modes" that airline can
|
||||
" detect. The mode is the return value of mode(), which gets converted to a
|
||||
@@ -92,11 +94,10 @@ let g:airline#themes#dark#palette.accents = {
|
||||
" variable so that related functionality is loaded iff the user is using
|
||||
" ctrlp. Note that this is optional, and if you do not define ctrlp colors
|
||||
" they will be chosen automatically from the existing palette.
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
finish
|
||||
if get(g:, 'loaded_ctrlp', 0)
|
||||
let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ],
|
||||
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
|
||||
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])
|
||||
endif
|
||||
let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ],
|
||||
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
|
||||
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])
|
||||
|
||||
|
||||
@@ -1,9 +1,25 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
call airline#init#bootstrap()
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! airline#util#shorten(text, winwidth, minwidth, ...)
|
||||
if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth
|
||||
if get(a:000, 0, 0)
|
||||
" shorten from tail
|
||||
return '…'.matchstr(a:text, '.\{'.a:minwidth.'}$')
|
||||
else
|
||||
" shorten from beginning of string
|
||||
return matchstr(a:text, '^.\{'.a:minwidth.'}').'…'
|
||||
endif
|
||||
else
|
||||
return a:text
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#wrap(text, minwidth)
|
||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||
return ''
|
||||
@@ -19,6 +35,12 @@ function! airline#util#append(text, minwidth)
|
||||
return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text
|
||||
endfunction
|
||||
|
||||
function! airline#util#warning(msg)
|
||||
echohl WarningMsg
|
||||
echomsg "airline: ".a:msg
|
||||
echohl Normal
|
||||
endfunction
|
||||
|
||||
function! airline#util#prepend(text, minwidth)
|
||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||
return ''
|
||||
@@ -62,3 +84,30 @@ else
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" Define a wrapper over system() that uses nvim's async job control if
|
||||
" available. This way we avoid overwriting v:shell_error, which might
|
||||
" potentially disrupt other plugins.
|
||||
if has('nvim')
|
||||
function! s:system_job_handler(job_id, data, event) dict
|
||||
if a:event == 'stdout'
|
||||
let self.buf .= join(a:data)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#system(cmd)
|
||||
let l:config = {
|
||||
\ 'buf': '',
|
||||
\ 'on_stdout': function('s:system_job_handler'),
|
||||
\ }
|
||||
let l:id = jobstart(a:cmd, l:config)
|
||||
if l:id < 1
|
||||
return system(a:cmd)
|
||||
endif
|
||||
call jobwait([l:id])
|
||||
return l:config.buf
|
||||
endfunction
|
||||
else
|
||||
function! airline#util#system(cmd)
|
||||
return system(a:cmd)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
292
doc/airline.txt
292
doc/airline.txt
@@ -1,5 +1,5 @@
|
||||
*airline.txt* Lean and mean status/tabline that's light as air
|
||||
*airline*
|
||||
*airline* *vim-airline*
|
||||
_ _ _ _ ~
|
||||
__ _(_)_ __ ___ __ _(_)_ __| (_)_ __ ___ ~
|
||||
\ \ / / | '_ ` _ \ _____ / _` | | '__| | | '_ \ / _ \ ~
|
||||
@@ -32,6 +32,62 @@ INTRODUCTION *airline-intro*
|
||||
vim-airline is a fast and lightweight alternative to powerline, written
|
||||
in 100% vimscript with no outside dependencies.
|
||||
|
||||
When the plugin is correctly loaded, and Vim is configured for drawing a
|
||||
'statusline' (set 'laststatus' to 2, to always display the airline
|
||||
statusline) Vim will draw a nice statusline at the bottom of each window.
|
||||
|
||||
That line consists of several sections, each one displaying some piece of
|
||||
information. By default (without configuration) this line will look like this: >
|
||||
|
||||
+-----------------------------------------------------------------------------+
|
||||
|~ |
|
||||
|~ |
|
||||
|~ VIM - Vi IMproved |
|
||||
|~ |
|
||||
|~ version 8.0 |
|
||||
|~ by Bram Moolenaar et al. |
|
||||
|~ Vim is open source and freely distributable |
|
||||
|~ |
|
||||
|~ type :h :q<Enter> to exit |
|
||||
|~ type :help<Enter> or <F1> for on-line help |
|
||||
|~ type :help version8<Enter> for version info |
|
||||
|~ |
|
||||
|~ |
|
||||
+-----------------------------------------------------------------------------+
|
||||
| A | B | C X | Y | Z | [...] |
|
||||
+-----------------------------------------------------------------------------+
|
||||
|
||||
The statusline is the colored line at the bottom, which contains the sections
|
||||
(possibly in different colors):
|
||||
|
||||
section meaning (example)~
|
||||
--------------------------
|
||||
A displays the mode + additional flags like crypt/spell/paste (INSERT)
|
||||
B VCS information (branch, hunk summary) (master)
|
||||
C filename + read-only flag (~/.vim/vimrc RO)
|
||||
X filetype (vim)
|
||||
Y file encoding[fileformat] (utf-8[unix])
|
||||
Z current position in the file
|
||||
percentage % ☰ current line/number of lines ln : column
|
||||
So this: 10% ☰ 10/100 ln : 20 means: >
|
||||
10% - 10 percent
|
||||
☰ 10 - current line 10
|
||||
/100 ln - of 100 lines
|
||||
: 20 - current column 20
|
||||
<
|
||||
[...] additional sections (warning/errors/statistics)
|
||||
from external plugins (e.g. YCM/syntastic/...)
|
||||
|
||||
For a better look, those sections can be colored differently, depending on the mode and
|
||||
whether the current file is 'modified'
|
||||
|
||||
Additionally, several extensions exists, that can provide additional feature (e.g. the
|
||||
tabline extension provides an extra statusline on the top of the Vim window and can
|
||||
display loaded buffers and tabs in the current Vim session).
|
||||
|
||||
Most of this is customizable and the default sections can be configured using the vim
|
||||
variables g:airline_section_<name> (see |airline-default-sections|)
|
||||
|
||||
==============================================================================
|
||||
FEATURES *airline-features*
|
||||
|
||||
@@ -72,6 +128,9 @@ values):
|
||||
<
|
||||
* enable crypt detection >
|
||||
let g:airline_detect_crypt=1
|
||||
|
||||
* enable spell detection >
|
||||
let g:airline_detect_spell=1
|
||||
<
|
||||
* enable iminsert detection >
|
||||
let g:airline_detect_iminsert=0
|
||||
@@ -99,9 +158,12 @@ values):
|
||||
endif
|
||||
endfunction
|
||||
<
|
||||
* enable/disable automatic population of the `g:airline_symbols` dictionary
|
||||
with powerline symbols. >
|
||||
let g:airline_powerline_fonts=0
|
||||
* By default, airline will use unicode symbols if your encoding matches
|
||||
utf-8. If you want the powerline symbols set this variable: >
|
||||
let g:airline_powerline_fonts = 1
|
||||
<
|
||||
If you want to use plain ascii symbols, set this variable: >
|
||||
let g:airline_symbols_ascii = 1
|
||||
<
|
||||
* define the set of text to display for each mode. >
|
||||
let g:airline_mode_map = {} " see source for the defaults
|
||||
@@ -137,8 +199,14 @@ values):
|
||||
* disable the Airline customization for selective windows (this is a
|
||||
window-local variable so you can disable it for only some windows) >
|
||||
let w:airline_disabled = 1
|
||||
<
|
||||
|
||||
* Do not draw separators for empty sections (only for the active window) >
|
||||
let g:airline_skip_empty_sections = 1
|
||||
<
|
||||
This variable can be overriden by setting a window-local variable with
|
||||
the same name (in the correct window): >
|
||||
let w:airline_skip_empty_sections = 0
|
||||
<
|
||||
==============================================================================
|
||||
COMMANDS *airline-commands*
|
||||
|
||||
@@ -161,6 +229,7 @@ Airline comes with some user-defined autocommands.
|
||||
|
||||
|AirlineAfterInit| after plugin is initialized, but before the statusline
|
||||
is replaced
|
||||
|AirlineAfterTheme| after theme of the statusline has been changed
|
||||
|AirlineToggledOn| after airline is activated and replaced the statusline
|
||||
|AirlineToggledOff| after airline is deactivated and the statusline is
|
||||
restored to the original
|
||||
@@ -187,10 +256,13 @@ its contents. >
|
||||
let g:airline_symbols.linenr = '␊'
|
||||
let g:airline_symbols.linenr = ''
|
||||
let g:airline_symbols.linenr = '¶'
|
||||
let g:airline_symbols.maxlinenr = '☰'
|
||||
let g:airline_symbols.maxlinenr = ''
|
||||
let g:airline_symbols.branch = '⎇'
|
||||
let g:airline_symbols.paste = 'ρ'
|
||||
let g:airline_symbols.paste = 'Þ'
|
||||
let g:airline_symbols.paste = '∥'
|
||||
let g:airline_symbols.spell = 'Ꞩ'
|
||||
let g:airline_symbols.notexists = '∄'
|
||||
let g:airline_symbols.whitespace = 'Ξ'
|
||||
|
||||
@@ -220,22 +292,24 @@ Note: If you define any section variables it will replace the default values
|
||||
entirely. If you want to disable only certain parts of a section you can try
|
||||
using variables defined in the |airline-configuration| or |airline-extensions|
|
||||
section.
|
||||
|airline-default-sections|
|
||||
>
|
||||
variable names default contents
|
||||
----------------------------------------------------------------------------
|
||||
let g:airline_section_a (mode, crypt, paste, iminsert)
|
||||
let g:airline_section_a (mode, crypt, paste, spell, iminsert)
|
||||
let g:airline_section_b (hunks, branch)
|
||||
let g:airline_section_c (bufferline or filename)
|
||||
let g:airline_section_gutter (readonly, csv)
|
||||
let g:airline_section_x (tagbar, filetype, virtualenv)
|
||||
let g:airline_section_y (fileencoding, fileformat)
|
||||
let g:airline_section_z (percentage, line number, column number)
|
||||
let g:airline_section_error (ycm_error_count, syntastic, eclim)
|
||||
let g:airline_section_warning (ycm_warning_count, whitespace)
|
||||
let g:airline_section_error (ycm_error_count, syntastic-err, eclim)
|
||||
let g:airline_section_warning (ycm_warning_count, syntastic-warn, whitespace)
|
||||
|
||||
" here is an example of how you could replace the branch indicator with
|
||||
" the current working directory, followed by the filename.
|
||||
let g:airline_section_b = '%{getcwd()}'
|
||||
" the current working directory (limited to 10 characters),
|
||||
" followed by the filename.
|
||||
let g:airline_section_b = '%-0.10{getcwd()}'
|
||||
let g:airline_section_c = '%t'
|
||||
<
|
||||
==============================================================================
|
||||
@@ -290,6 +364,12 @@ configuration values that you can use.
|
||||
Try setting this to zero, if you notice bleeding color artifacts >
|
||||
let airline#extensions#default#section_use_groupitems = 1
|
||||
<
|
||||
* configure the fileformat output
|
||||
By default, it will display something like 'utf-8[unix]', however, you can
|
||||
skip displaying it, if the output matches a configured string. To do so,
|
||||
set >
|
||||
let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]'
|
||||
<
|
||||
------------------------------------- *airline-quickfix*
|
||||
The quickfix extension is a simple built-in extension which determines
|
||||
whether the buffer is a quickfix or location list buffer, and adjusts the
|
||||
@@ -312,10 +392,17 @@ vim-bufferline <https://github.com/bling/vim-bufferline>
|
||||
let g:airline#extensions#bufferline#overwrite_variables = 1
|
||||
<
|
||||
------------------------------------- *airline-branch*
|
||||
|
||||
vim-airline will display the branch-indicator together with the branch name in
|
||||
the statusline, if one of the following plugins is installed:
|
||||
|
||||
fugitive.vim <https://github.com/tpope/vim-fugitive>
|
||||
lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
|
||||
vcscommand <http://www.vim.org/scripts/script.php?script_id=90>
|
||||
|
||||
If a file is edited, that is not yet in the repository, the
|
||||
notexists symbol will be displayed after the branch name.
|
||||
|
||||
* enable/disable fugitive/lawrencium integration >
|
||||
let g:airline#extensions#branch#enabled = 1
|
||||
<
|
||||
@@ -351,10 +438,20 @@ vcscommand <http://www.vim.org/scripts/script.php?script_id=90>
|
||||
endfunction
|
||||
<
|
||||
------------------------------------- *airline-syntastic*
|
||||
syntastic <https://github.com/scrooloose/syntastic>
|
||||
syntastic <https://github.com/vim-syntastic/syntastic>
|
||||
|
||||
* enable/disable syntastic integration >
|
||||
let g:airline#extensions#syntastic#enabled = 1
|
||||
|
||||
Note: The recommendation from syntastic to modify the statusline directly
|
||||
does not apply, if you use vim-airline, since it will take care for you of
|
||||
adjusting the statusline.
|
||||
|
||||
* syntastic error_symbol >
|
||||
let airline#extensions#syntastic#error_symbol = 'E:'
|
||||
<
|
||||
* syntastic warning >
|
||||
let airline#extensions#syntastic#warning_symbol = 'W:'
|
||||
<
|
||||
------------------------------------- *airline-tagbar*
|
||||
tagbar <https://github.com/majutsushi/tagbar>
|
||||
@@ -393,6 +490,12 @@ quickfixsigns <https://github.com/tomtom/quickfixsigns_vim>
|
||||
* set hunk count symbols. >
|
||||
let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-']
|
||||
<
|
||||
------------------------------------- *airline-vimagit*
|
||||
vimagit <https://github.com/jreybert/vimagit>
|
||||
|
||||
* enable/disable vimagit integration >
|
||||
let g:airline#extensions#vimagit#enabled = 1
|
||||
<
|
||||
------------------------------------- *airline-ctrlp*
|
||||
ctrlp <https://github.com/kien/ctrlp.vim>
|
||||
|
||||
@@ -429,7 +532,7 @@ eclim <https://eclim.org>
|
||||
" the default value matches filetypes typically used for documentation
|
||||
" such as markdown and help files.
|
||||
let g:airline#extensions#wordcount#filetypes = ...
|
||||
(default: markdown,rst,org,help,text)
|
||||
(default: markdown,rst,org,help,text,tex,mail)
|
||||
|
||||
* defines the name of a formatter for word count will be displayed: >
|
||||
" The default will try to guess LC_NUMERIC and format number accordingly
|
||||
@@ -445,11 +548,18 @@ eclim <https://eclim.org>
|
||||
\ wordcount()['words'] > 100 ? 'okay' : 'not enough')
|
||||
endfunction
|
||||
let g:airline#extensions#wordline#formatter = 'foo'
|
||||
|
||||
* defines how to display the wordcount statistics: >
|
||||
let g:airline#extensions#wordcount#format = '%d words'
|
||||
<
|
||||
------------------------------------- *airline-whitespace*
|
||||
* enable/disable detection of whitespace errors. >
|
||||
let g:airline#extensions#whitespace#enabled = 1
|
||||
<
|
||||
* disable detection of whitespace errors. >
|
||||
" useful to call for particular file types (e.g., in "ftplugin/*")
|
||||
silent! call airline#extensions#whitespace#disable()
|
||||
<
|
||||
* customize the type of mixed indent checking to perform. >
|
||||
" must be all spaces or all tabs before the first non-whitespace character
|
||||
let g:airline#extensions#whitespace#mixed_indent_algo = 0 (default)
|
||||
@@ -472,6 +582,9 @@ eclim <https://eclim.org>
|
||||
" trailing: trailing whitespace
|
||||
" mixed-indent-file: different indentation in different lines
|
||||
let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing', 'long', 'mixed-indent-file' ]
|
||||
|
||||
" this can also be configured for an individual buffer
|
||||
let b:airline_whitespace_checks = [ 'indent', 'trailing', 'long', 'mixed-indent-file' ]
|
||||
<
|
||||
* configure the maximum number of lines where whitespace checking is enabled. >
|
||||
let g:airline#extensions#whitespace#max_lines = 20000
|
||||
@@ -487,6 +600,19 @@ eclim <https://eclim.org>
|
||||
|
||||
* configure custom trailing whitespace regexp rule >
|
||||
let g:airline#extensions#whitespace#trailing_regexp = '\s$'
|
||||
|
||||
* configure, which filetypes have special treatment of /* */ comments,
|
||||
matters for mix-indent-file algorithm: >
|
||||
let airline#extensions#c_like_langs = ['c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php']
|
||||
<
|
||||
* disable whitespace checking for an individual buffer >
|
||||
" Checking is enabled by default because b:airline_whitespace_disabled
|
||||
" is by default not defined:
|
||||
unlet b:airline_whitespace_disabled
|
||||
|
||||
" If b:airline_whitespace_disabled is defined and is non-zero for a buffer,
|
||||
" then whitespace checking will be disabled for that buffer; for example:
|
||||
" let b:airline_whitespace_disabled = 1
|
||||
<
|
||||
------------------------------------- *airline-tabline*
|
||||
Note: If you're using the ctrlspace tabline only the option marked with (c)
|
||||
@@ -499,11 +625,17 @@ are supported!
|
||||
let g:airline#extensions#tabline#show_splits = 1
|
||||
*
|
||||
* switch position of buffers and tabs on splited tabline (c)
|
||||
(only supported for ctrlspace plugin). >
|
||||
let g:airline#extensions#tabline#switch_buffers_and_tabs = 0
|
||||
|
||||
<
|
||||
* enable/disable displaying buffers with a single tab. (c)
|
||||
let g:airline#extensions#tabline#show_buffers = 1
|
||||
<
|
||||
|
||||
Note: If you are using neovim (has('tablineat') = 1), then you can click
|
||||
on the tabline with the left mouse button to switch to that buffer, and
|
||||
with the middle mouse button to delete that buffer.
|
||||
|
||||
* enable/disable displaying tabs, regardless of number. (c)
|
||||
let g:airline#extensions#tabline#show_tabs = 1
|
||||
<
|
||||
@@ -524,6 +656,9 @@ are supported!
|
||||
* enable/disable displaying tab type (far right) >
|
||||
let g:airline#extensions#tabline#show_tab_type = 1
|
||||
|
||||
Note: The tab-type will only be displayed in tab-mode,
|
||||
if there are no splits shown. (See: g:airline#extensions#tabline#show_splits)
|
||||
|
||||
* rename label for buffers (default: 'buffers') (c)
|
||||
let g:airline#extensions#tabline#buffers_label = 'b'
|
||||
|
||||
@@ -556,12 +691,27 @@ are supported!
|
||||
Use |gt| for switching tabs.
|
||||
In tabmode, those mappings will switch to the specified tab.
|
||||
|
||||
* change the display format of the buffer index >
|
||||
let g:airline#extensions#tabline#buffer_idx_format = {
|
||||
\ '0': '0 ',
|
||||
\ '1': '1 ',
|
||||
\ '2': '2 ',
|
||||
\ '3': '3 ',
|
||||
\ '4': '4 ',
|
||||
\ '5': '5 ',
|
||||
\ '6': '6 ',
|
||||
\ '7': '7 ',
|
||||
\ '8': '8 ',
|
||||
\ '9': '9 '
|
||||
\}
|
||||
<
|
||||
|
||||
* defines the name of a formatter for how buffer names are displayed. (c)
|
||||
let g:airline#extensions#tabline#formatter = 'default'
|
||||
|
||||
" here is how you can define a 'foo' formatter:
|
||||
" create a file in the dir autoload/airline/extensions/tabline/formatters/
|
||||
" called foo.vim
|
||||
" called foo.vim >
|
||||
function! airline#extensions#tabline#formatters#foo#format(bufnr, buffers)
|
||||
return fnamemodify(bufname(a:bufnr), ':t')
|
||||
endfunction
|
||||
@@ -632,6 +782,10 @@ Note: Enabling this extension will modify 'showtabline' and 'guioptions'.
|
||||
won't update airline on |:badd| commands) >
|
||||
let airline#extensions#tabline#disable_refresh = 0
|
||||
|
||||
* preserve windows when closing a buffer from the bufferline (default: 0) >
|
||||
|
||||
let airline#extensions#tabline#middle_click_preserves_windows = 1
|
||||
<
|
||||
------------------------------------- *airline-tmuxline*
|
||||
tmuxline <https://github.com/edkolev/tmuxline.vim>
|
||||
|
||||
@@ -681,6 +835,18 @@ vim-capslock <https://github.com/tpope/vim-capslock>
|
||||
* enable/disable vim-capslock integration >
|
||||
let g:airline#extensions#capslock#enabled = 1
|
||||
|
||||
------------------------------------- *airline-xkblayout*
|
||||
vim-xkblayout
|
||||
|
||||
* enable/disable vim-xkblayout extension >
|
||||
let g:airline#extensions#xkblayout#enabled = 1
|
||||
|
||||
* define path to the backend switcher library
|
||||
Linux (Install https://github.com/ierton/xkb-switch):
|
||||
let g:XkbSwitchLib = '/usr/local/lib/libxkbswitch.so'
|
||||
macOS (Install https://github.com/vovkasm/input-source-switcher):
|
||||
let g:XkbSwitchLib = '/usr/local/lib/libInputSourceSwitcher.dylib'
|
||||
|
||||
------------------------------------- *airline-windowswap*
|
||||
vim-windowswap <https://github.com/wesQ3/vim-windowswap>
|
||||
|
||||
@@ -690,6 +856,15 @@ vim-windowswap <https://github.com/wesQ3/vim-windowswap>
|
||||
* set marked window indicator string >
|
||||
let g:airline#extensions#windowswap#indicator_text = 'WS'
|
||||
<
|
||||
------------------------------------- *airline-obsession*
|
||||
vim-obsession <https://github.com/tpope/vim-obsession>
|
||||
|
||||
* enable/disable vim-obsession integration >
|
||||
let g:airline#extensions#obsession#enabled = 1
|
||||
|
||||
* set marked window indicator string >
|
||||
let g:airline#extensions#obsession#indicator_text = '$'
|
||||
<
|
||||
------------------------------------- *airline-taboo*
|
||||
taboo.vim <https://github.com/gcmt/taboo.vim>
|
||||
|
||||
@@ -701,10 +876,10 @@ vim-ctrlspace <https://github.com/szw/vim-ctrlspace>
|
||||
|
||||
* enable/disable vim-ctrlspace integration >
|
||||
let g:airline#extensions#ctrlspace#enabled = 1
|
||||
|
||||
<
|
||||
To make the vim-ctrlspace integration work you will need to make the
|
||||
ctrlspace statusline function call the correct airline function. Therefore
|
||||
add the following line into your .vimrc:
|
||||
add the following line into your .vimrc: >
|
||||
|
||||
let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()"
|
||||
<
|
||||
@@ -730,6 +905,64 @@ po.vim <http://www.vim.org/scripts/script.php?script_id=2530>
|
||||
<
|
||||
* truncate width names to a fixed length >
|
||||
let g:airline#extensions#po#displayed_limit = 0
|
||||
|
||||
------------------------------------- *airline-vimtex*
|
||||
vimtex <https://github.com/lervag/vimtex>
|
||||
|
||||
Shows the current file's vimtex related info.
|
||||
|
||||
* enable/disable vimtex integration >
|
||||
let g:airline#extensions#vimtex#enabled = 1
|
||||
<
|
||||
* left and right delimiters (shown only when status string is not empty)
|
||||
let g:airline#extensions#vimtex#left = "{"
|
||||
let g:airline#extensions#vimtex#right = "}"
|
||||
|
||||
State indicators:
|
||||
|
||||
* the current tex file is the main project file (nothing is shown by default)
|
||||
let g:airline#extensions#vimtex#main = ""
|
||||
|
||||
* the current tex file is a subfile of the project
|
||||
and the compilation is set for the main file
|
||||
let g:airline#extensions#vimtex#sub_main = "m"
|
||||
|
||||
* the current tex file is a subfile of the project
|
||||
and the compilation is set for this subfile
|
||||
let g:airline#extensions#vimtex#sub_local = "l"
|
||||
|
||||
* single compilation is running
|
||||
let g:airline#extensions#vimtex#compiled = "c₁"
|
||||
|
||||
* continuousr compilation is running
|
||||
let g:airline#extensions#vimtex#continuous = "c"
|
||||
|
||||
* viewer is opened
|
||||
let g:airline#extensions#vimtex#viewer = "v"
|
||||
|
||||
------------------------------------- *airline-ale*
|
||||
ale <https://github.com/w0rp/ale>
|
||||
|
||||
* enable/disable ale integration >
|
||||
let g:airline#extensions#ale#enabled = 1
|
||||
|
||||
* ale error_symbol >
|
||||
let airline#extensions#ale#error_symbol = 'E:'
|
||||
<
|
||||
* ale warning >
|
||||
let airline#extensions#ale#warning_symbol = 'W:'
|
||||
<
|
||||
------------------------------------- *airline-neomake*
|
||||
neomake <https://github.com/neomake/neomake>
|
||||
|
||||
* enable/disable neomake integration >
|
||||
let g:airline#extensions#neomake#enabled = 1
|
||||
|
||||
* neomake error_symbol >
|
||||
let airline#extensions#neomake#error_symbol = 'E:'
|
||||
<
|
||||
* neomake warning >
|
||||
let airline#extensions#neomake#warning_symbol = 'W:'
|
||||
<
|
||||
==============================================================================
|
||||
ADVANCED CUSTOMIZATION *airline-advanced-customization*
|
||||
@@ -771,14 +1004,21 @@ Before is a list of parts that are predefined by vim-airline.
|
||||
* `iminsert` displays the current insert method
|
||||
* `paste` displays the paste indicator
|
||||
* `crypt` displays the crypted indicator
|
||||
* `spell` displays the spell indicator
|
||||
* `filetype` displays the file type
|
||||
* `readonly` displays the read only indicator
|
||||
* `file` displays the filename and modified indicator
|
||||
* `path` displays the filename (absolute path) and modifier indicator
|
||||
* `linenr` displays the current line number
|
||||
* `maxlinenr` dispalys the number of lines in the buffer
|
||||
* `ffenc` displays the file format and encoding
|
||||
|
||||
And the following are defined for their respective extensions:
|
||||
|
||||
`hunks`, `branch`, `tagbar`, `syntastic`, `whitespace`
|
||||
`ale_error_count` `ale_warning_count` `branch` `eclim` `hunks`
|
||||
`neomake_error_count` `neomake_warning_count` `obsession`
|
||||
`syntastic-warn` `syntastic-err` `tagbar` `whitespace`
|
||||
`windowswap` `ycm_error_count` `ycm_warning_count`
|
||||
|
||||
------------------------------------- *airline-accents*
|
||||
Accents can be defined on any part, like so: >
|
||||
@@ -791,11 +1031,19 @@ colors instead of the section's default foreground color.
|
||||
|
||||
The following accents are defined by default. Themes can define their variants
|
||||
of the colors, but defaults will be provided if missing. >
|
||||
bold, italic, red, green, blue, yellow, orange, purple
|
||||
bold, italic, red, green, blue, yellow, orange, purple, none
|
||||
<
|
||||
The defaults configure the mode and line number parts to be bold, and the
|
||||
readonly part to be red.
|
||||
|
||||
"none" is special. This can be used, to remove a bold accent from an existing
|
||||
theme. For example, usually the mode part of the statusline is usually defined
|
||||
to be bold. However, it can be hard to remove an existing bold accent from the
|
||||
default configuration. Therefore, you can use the none accent to remove
|
||||
existing accents, so if you put >
|
||||
call airline#parts#define_accent('mode', 'none')
|
||||
the mode section will be set to non-bold font style.
|
||||
|
||||
------------------------------------- *airline-sections*
|
||||
Once a part is defined, you can use helper functions to generate the
|
||||
statuslines for each section. For example, to use the part above, we could
|
||||
@@ -814,9 +1062,10 @@ the space and cwd are not defined parts. For convenience, if a part of that
|
||||
key does not exist, it will be inserted as is. The unit tests will be a good
|
||||
resource for possibilities.
|
||||
|
||||
Note: The use of |VimEnter| is important, because most extensions are lazily
|
||||
Note: The use of |User| is important, because most extensions are lazily
|
||||
loaded, so we must give them a chance to define their parts before we can use
|
||||
them.
|
||||
them. Also this autocommand is only triggered, after the airline functions are
|
||||
actually available on startup.
|
||||
|
||||
Note: The `airline#section#create` function and friends will do its best to
|
||||
create a section with the appropriate separators, but it only works for
|
||||
@@ -858,7 +1107,6 @@ You can also remove a function as well, which is useful for when you want a
|
||||
temporary override. >
|
||||
call airline#remove_statusline_func('MyPlugin')
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
PIPELINE *airline-pipeline*
|
||||
|
||||
@@ -992,6 +1240,6 @@ Contributions and pull requests are welcome.
|
||||
==============================================================================
|
||||
LICENSE *airline-license*
|
||||
|
||||
MIT License. Copyright © 2013-2016 Bailey Ling.
|
||||
MIT License. Copyright © 2013-2017 Bailey Ling, Christian Brabandt
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline)
|
||||
finish
|
||||
endif
|
||||
@@ -37,12 +39,24 @@ function! s:on_window_changed()
|
||||
if pumvisible() && (!&previewwindow || g:airline_exclude_preview)
|
||||
return
|
||||
endif
|
||||
" Handle each window only once, since we might come here several times for
|
||||
" different autocommands.
|
||||
let l:key = [bufnr('%'), winnr(), winnr('$'), tabpagenr(), &ft]
|
||||
if get(g:, 'airline_last_window_changed', []) == l:key
|
||||
\ && &stl is# '%!airline#statusline('.winnr().')'
|
||||
\ && &ft !~? 'gitcommit'
|
||||
" fugitive is special, it changes names and filetypes several times,
|
||||
" make sure the caching does not get into its way
|
||||
return
|
||||
endif
|
||||
let g:airline_last_window_changed = l:key
|
||||
call s:init()
|
||||
call airline#update_statusline()
|
||||
endfunction
|
||||
|
||||
function! s:on_colorscheme_changed()
|
||||
call s:init()
|
||||
unlet! g:airline#highlighter#normal_fg_hi
|
||||
let g:airline_gui_mode = airline#init#gui_mode()
|
||||
if !s:theme_in_vimrc
|
||||
call airline#switch_matching_theme()
|
||||
@@ -52,7 +66,7 @@ function! s:on_colorscheme_changed()
|
||||
call airline#load_theme()
|
||||
endfunction
|
||||
|
||||
function airline#cmdwinenter(...)
|
||||
function! airline#cmdwinenter(...)
|
||||
call airline#extensions#apply_left_override('Command Line', '')
|
||||
endfunction
|
||||
|
||||
@@ -79,10 +93,14 @@ function! s:airline_toggle()
|
||||
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
|
||||
|
||||
autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed()
|
||||
autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload,VimResized *
|
||||
autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload *
|
||||
\ call <sid>on_window_changed()
|
||||
if exists('#CompleteDone')
|
||||
autocmd CompleteDone * call <sid>on_window_changed()
|
||||
endif
|
||||
|
||||
autocmd TabEnter * :unlet! w:airline_lastmode
|
||||
autocmd VimResized * unlet! w:airline_lastmode | :call <sid>airline_refresh()
|
||||
autocmd TabEnter * :unlet! w:airline_lastmode | let w:airline_active=1
|
||||
autocmd BufWritePost */autoload/airline/themes/*.vim
|
||||
\ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0]
|
||||
\ | call airline#load_theme()
|
||||
@@ -110,7 +128,15 @@ function! s:airline_theme(...)
|
||||
endfunction
|
||||
|
||||
function! s:airline_refresh()
|
||||
silent doautocmd User AirlineBeforeRefresh
|
||||
if !exists("#airline")
|
||||
" disabled
|
||||
return
|
||||
endif
|
||||
let nomodeline=''
|
||||
if v:version > 703 || v:version == 703 && has("patch438")
|
||||
let nomodeline = '<nomodeline>'
|
||||
endif
|
||||
exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline)
|
||||
call airline#load_theme()
|
||||
call airline#update_statusline()
|
||||
endfunction
|
||||
|
||||
@@ -15,7 +15,7 @@ describe 'active builder'
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('Search', 'world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ '%#Normal#hello%#Normal_to_Search#>%#Search#world'
|
||||
Expect stl =~ '%#Normal#hello%#Normal_to_Search#%#Search#world'
|
||||
end
|
||||
|
||||
it 'should reuse highlight group if background colors match'
|
||||
@@ -24,7 +24,7 @@ describe 'active builder'
|
||||
call s:builder.add_section('Foo1', 'hello')
|
||||
call s:builder.add_section('Foo2', 'world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ '%#Foo1#hello>world'
|
||||
Expect stl =~ '%#Foo1#helloworld'
|
||||
end
|
||||
|
||||
it 'should switch highlight groups if foreground colors differ'
|
||||
@@ -33,7 +33,7 @@ describe 'active builder'
|
||||
call s:builder.add_section('Foo1', 'hello')
|
||||
call s:builder.add_section('Foo2', 'world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ '%#Foo1#hello%#Foo1_to_Foo2#>%#Foo2#world'
|
||||
Expect stl =~ '%#Foo1#hello%#Foo1_to_Foo2#%#Foo2#world'
|
||||
end
|
||||
|
||||
it 'should split left/right sections'
|
||||
@@ -47,14 +47,14 @@ describe 'active builder'
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('Search', 'world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ 'hello%#Normal_to_Search#<%#Search#world'
|
||||
Expect stl =~ 'hello%#Normal_to_Search#%#Search#world'
|
||||
end
|
||||
|
||||
it 'should not repeat the same highlight group'
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
let stl = s:builder.build()
|
||||
Expect stl == '%#Normal#hello>hello'
|
||||
Expect stl == '%#Normal#hellohello'
|
||||
end
|
||||
|
||||
it 'should replace accent groups with the specified group'
|
||||
@@ -94,7 +94,7 @@ describe 'inactive builder'
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('Search', 'world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ '%#Normal_inactive#hello%#Normal_to_Search_inactive#>%#Search_inactive#world'
|
||||
Expect stl =~ '%#Normal_inactive#hello%#Normal_to_Search_inactive#%#Search_inactive#world'
|
||||
end
|
||||
|
||||
it 'should not render accents'
|
||||
|
||||
16
t/init.vim
16
t/init.vim
@@ -18,9 +18,10 @@ describe 'init sections'
|
||||
call s:clear()
|
||||
end
|
||||
|
||||
it 'section a should have mode, paste, iminsert'
|
||||
it 'section a should have mode, paste, spell, iminsert'
|
||||
Expect g:airline_section_a =~ 'mode'
|
||||
Expect g:airline_section_a =~ 'paste'
|
||||
Expect g:airline_section_a =~ 'spell'
|
||||
Expect g:airline_section_a =~ 'iminsert'
|
||||
end
|
||||
|
||||
@@ -58,12 +59,21 @@ describe 'init sections'
|
||||
end
|
||||
|
||||
it 'all default statusline extensions should be blank'
|
||||
Expect airline#parts#get('ale_error_count').raw == ''
|
||||
Expect airline#parts#get('ale_warning_count').raw == ''
|
||||
Expect airline#parts#get('hunks').raw == ''
|
||||
Expect airline#parts#get('branch').raw == ''
|
||||
Expect airline#parts#get('tagbar').raw == ''
|
||||
Expect airline#parts#get('syntastic').raw == ''
|
||||
Expect airline#parts#get('eclim').raw == ''
|
||||
Expect airline#parts#get('neomake_error_count').raw == ''
|
||||
Expect airline#parts#get('neomake_warning_count').raw == ''
|
||||
Expect airline#parts#get('obsession').raw == ''
|
||||
Expect airline#parts#get('syntastic-err').raw == ''
|
||||
Expect airline#parts#get('syntastic-warn').raw == ''
|
||||
Expect airline#parts#get('tagbar').raw == ''
|
||||
Expect airline#parts#get('whitespace').raw == ''
|
||||
Expect airline#parts#get('windowswap').raw == ''
|
||||
Expect airline#parts#get('ycm_error_count').raw == ''
|
||||
Expect airline#parts#get('ycm_warning_count').raw == ''
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -57,13 +57,13 @@ describe 'section'
|
||||
|
||||
it 'should force add separators for raw and missing keys'
|
||||
let s = airline#section#create_left(['asdf', 'raw'])
|
||||
Expect s == 'asdf > raw'
|
||||
Expect s == 'asdf raw'
|
||||
let s = airline#section#create_left(['asdf', 'aaaa', 'raw'])
|
||||
Expect s == 'asdf > aaaa > raw'
|
||||
Expect s == 'asdf aaaa raw'
|
||||
let s = airline#section#create_right(['raw', '%f'])
|
||||
Expect s == 'raw < %f'
|
||||
Expect s == 'raw %f'
|
||||
let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}'])
|
||||
Expect s == '%t < asdf < %{getcwd()}'
|
||||
Expect s == '%t asdf %{getcwd()}'
|
||||
end
|
||||
|
||||
it 'should empty out parts that do not pass their condition'
|
||||
@@ -72,5 +72,10 @@ describe 'section'
|
||||
let s = airline#section#create(['conditional'])
|
||||
Expect s == '%{0 ? airline#util#wrap("conditional",0) : ""}'
|
||||
end
|
||||
|
||||
it 'should not draw two separators after another'
|
||||
let s = airline#section#create_right(['ffenc','%{strftime("%H:%M")}'])
|
||||
Expect s == '%{airline#util#prepend(airline#parts#ffenc(),0)}%{strftime("%H:%M")}'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ describe 'util'
|
||||
|
||||
it 'has append wrapper function'
|
||||
Expect airline#util#append('', 0) == ''
|
||||
Expect airline#util#append('1', 0) == ' > 1'
|
||||
Expect airline#util#append('1', 0) == ' 1'
|
||||
end
|
||||
|
||||
it 'has prepend wrapper function'
|
||||
Expect airline#util#prepend('', 0) == ''
|
||||
Expect airline#util#prepend('1', 0) == '1 < '
|
||||
Expect airline#util#prepend('1', 0) == '1 '
|
||||
end
|
||||
|
||||
it 'has getwinvar function'
|
||||
@@ -40,8 +40,8 @@ describe 'util'
|
||||
end
|
||||
|
||||
it 'should ignore minwidth if less than 0'
|
||||
Expect airline#util#append('foo', -1) == ' > foo'
|
||||
Expect airline#util#prepend('foo', -1) == 'foo < '
|
||||
Expect airline#util#append('foo', -1) == ' foo'
|
||||
Expect airline#util#prepend('foo', -1) == 'foo '
|
||||
Expect airline#util#wrap('foo', -1) == 'foo'
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user