mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-12-09 05:24:47 +08:00
Compare commits
180 Commits
dynamic_wi
...
v0.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e02176aca1 | ||
|
|
b7d3feb4d2 | ||
|
|
a3bdb10aea | ||
|
|
927c910af1 | ||
|
|
a104e40b10 | ||
|
|
9a2ed35ff9 | ||
|
|
02816a3cb6 | ||
|
|
182675dc10 | ||
|
|
ab49a1c7ae | ||
|
|
5db4c408bd | ||
|
|
6c4f3277f1 | ||
|
|
6cdcaf13b1 | ||
|
|
3a2323feac | ||
|
|
c76019ac9e | ||
|
|
a90ac37cb3 | ||
|
|
2ef81d4140 | ||
|
|
3b5f2bd470 | ||
|
|
88130fd377 | ||
|
|
7215a1fdd5 | ||
|
|
ebda798080 | ||
|
|
c17ad9a123 | ||
|
|
73d8abff2f | ||
|
|
4d0233ebdb | ||
|
|
d283a25e3f | ||
|
|
ce83c39bed | ||
|
|
133a76d2d4 | ||
|
|
c518f79aab | ||
|
|
9d28f0dcc7 | ||
|
|
30652c05c4 | ||
|
|
90cf752c90 | ||
|
|
3b631ef0c4 | ||
|
|
3985ece131 | ||
|
|
45878a7947 | ||
|
|
503b9977fb | ||
|
|
69aa1e93b3 | ||
|
|
645f65d8d9 | ||
|
|
45236ba7c7 | ||
|
|
a25757ac64 | ||
|
|
d78f686ce5 | ||
|
|
6ba65b2c8c | ||
|
|
708c76e22c | ||
|
|
d03c3fa7b9 | ||
|
|
72e457d8c2 | ||
|
|
2e3cdeb808 | ||
|
|
66991f53fa | ||
|
|
a3d5e84417 | ||
|
|
c386332570 | ||
|
|
125d3443e4 | ||
|
|
18da5aa699 | ||
|
|
1ee057362d | ||
|
|
450fa168ea | ||
|
|
e0dd3d8125 | ||
|
|
bc985301db | ||
|
|
6c8d0f5e6a | ||
|
|
77ab703a55 | ||
|
|
3b304f36ae | ||
|
|
7afc60af25 | ||
|
|
e415c5301f | ||
|
|
8c4bf37588 | ||
|
|
33663d7df2 | ||
|
|
009f7932fb | ||
|
|
f0093ceaa6 | ||
|
|
3e13bab201 | ||
|
|
d719d0664a | ||
|
|
640d6762f7 | ||
|
|
58328b347c | ||
|
|
4a1f65841c | ||
|
|
1f84ad886c | ||
|
|
c88dca5c96 | ||
|
|
dd368b3e31 | ||
|
|
20a6fe2b9f | ||
|
|
f3aae5f72b | ||
|
|
52ce640534 | ||
|
|
396cc92261 | ||
|
|
b044b4b204 | ||
|
|
a1b7479b54 | ||
|
|
ccc4c9f430 | ||
|
|
e72ec51e59 | ||
|
|
78ca75af6e | ||
|
|
6e2a9e38cd | ||
|
|
a5d9a4bcb2 | ||
|
|
7bf1d9b1fb | ||
|
|
27acd851a7 | ||
|
|
0ad4f97c1a | ||
|
|
bd613e69b6 | ||
|
|
4d645711e5 | ||
|
|
031cb31056 | ||
|
|
9f186d899a | ||
|
|
cfb107c75f | ||
|
|
a763c6b53f | ||
|
|
8a3e3e2794 | ||
|
|
ea46192561 | ||
|
|
81f089322a | ||
|
|
571f892fcd | ||
|
|
cdaa5117b0 | ||
|
|
e7a5c97df1 | ||
|
|
9e3fcc4cdb | ||
|
|
f0a508b121 | ||
|
|
942458f19b | ||
|
|
d3f8873469 | ||
|
|
09ab45a2fb | ||
|
|
195f2e1dae | ||
|
|
97f3f84881 | ||
|
|
c07b28d199 | ||
|
|
3b225a1322 | ||
|
|
f430246aff | ||
|
|
57cda93aad | ||
|
|
89e484ac59 | ||
|
|
20de588fd1 | ||
|
|
2b45581f1c | ||
|
|
db907f5598 | ||
|
|
3e25ca5a5a | ||
|
|
e357f88de6 | ||
|
|
f4caf598fa | ||
|
|
42e5c82d64 | ||
|
|
5345c8fafa | ||
|
|
9bd2c40e7d | ||
|
|
ab6acdee41 | ||
|
|
5df7d961bc | ||
|
|
b6a98bcd10 | ||
|
|
b77f326b33 | ||
|
|
06272275b5 | ||
|
|
2c05a48a26 | ||
|
|
4c74a95045 | ||
|
|
50bfe8dd68 | ||
|
|
a01d03a78a | ||
|
|
3ec22a524c | ||
|
|
8cd7e35027 | ||
|
|
e553433430 | ||
|
|
5147d385a5 | ||
|
|
232b6415d9 | ||
|
|
e8b6312dd9 | ||
|
|
04bc544db2 | ||
|
|
5fc5a43802 | ||
|
|
c2b2351d99 | ||
|
|
470e9870f1 | ||
|
|
e5f9ccad8e | ||
|
|
3535243c50 | ||
|
|
69ad039d07 | ||
|
|
d8eb12845f | ||
|
|
a8c4424244 | ||
|
|
6ee75bdbde | ||
|
|
a96681d459 | ||
|
|
e9a7a12d9e | ||
|
|
c65d7fe36b | ||
|
|
96352f9b53 | ||
|
|
2ec563bd57 | ||
|
|
83ceae726e | ||
|
|
711f50a567 | ||
|
|
c0695feb13 | ||
|
|
4e24036782 | ||
|
|
039fd6b50f | ||
|
|
a2e20bc3ca | ||
|
|
0c307d5f73 | ||
|
|
d54613d2dd | ||
|
|
846d85aaa1 | ||
|
|
72e5f04f7c | ||
|
|
e79188c3bd | ||
|
|
61c624ef6c | ||
|
|
e03afa1733 | ||
|
|
afcda0510e | ||
|
|
b78c2ec475 | ||
|
|
4f43e5c93d | ||
|
|
0205baa963 | ||
|
|
b6eaa60a88 | ||
|
|
39c61288e8 | ||
|
|
72ca1c344f | ||
|
|
42522f994a | ||
|
|
a10d321809 | ||
|
|
a914cfb754 | ||
|
|
313a6fcad2 | ||
|
|
825aec9e4d | ||
|
|
62952b3887 | ||
|
|
b2f301f73c | ||
|
|
174b7e1962 | ||
|
|
6ab0098ced | ||
|
|
feee9bcf3c | ||
|
|
583ae3d5f9 | ||
|
|
560092a9ec | ||
|
|
7f19896dc6 |
47
CHANGELOG.md
47
CHANGELOG.md
@@ -4,6 +4,50 @@ This is the Changelog for the vim-airline project.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.9] - 2018-01-15
|
||||
- Changes
|
||||
- Look of default Airline Symbols has been improved [#1397](https://github.com/vim-airline/vim-airline/issues/1397)
|
||||
- Airline does now set `laststatus=2` if needed
|
||||
- Syntastic extension now displays warnings and errors separately
|
||||
- Updates on Resize and SessionLoad events
|
||||
- Add `maxlinenr` symbol to `airline_section_z`
|
||||
- Add quickfix title to inactive windows
|
||||
- Improvements
|
||||
- Many performance improvements (using caching and async feature when possible)
|
||||
- Cache changes to highlighting groups if `g:airline_highlighting_cache = 1` is set
|
||||
- Allow to skip empty sections by setting `g:airline_skip_empty_sections` variable
|
||||
- Make use of improved Vim Script API, if available (e.g. getwininfo())
|
||||
- Support for Vims terminal feature (very experimental since it hasn't been stabilized yet)
|
||||
- More configuration for the tabline extension (with clickable buffers for Neovim)
|
||||
- Works better on smaller window sizes
|
||||
- Make airline aware of git worktrees
|
||||
- Improvements to the fugitive extension [#1603](https://github.com/vim-airline/vim-airline/issues/1603)
|
||||
- Allows for configurable fileformat output if `g:airline#parts#ffenc#skip_expected_string` is set
|
||||
- Improvements to the documentation
|
||||
- New features
|
||||
- Full async support for Vim 8 and Neovim
|
||||
- Extensions:
|
||||
- [vim-bufmru](https://github.com/mildred/vim-bufmru)
|
||||
- [xkb-switch](https://github.com/ierton/xkb-switch)
|
||||
- [input-source-switcher](https://github.com/vovkasm/input-source-switcher)
|
||||
- [vimagit](https://github.com/jreybert/vimagit)
|
||||
- [denite](https://github.com/Shougo/denite.nvim)
|
||||
- [dein](https://github.com/Shougo/dein.vim)
|
||||
- [vimtex](https://github.com/lervag/vimtex)
|
||||
- [minpac](https://github.com/k-takata/minpac/)
|
||||
- [vim-cursormode](https://github.com/vheon/vim-cursormode)
|
||||
- [Neomake](https://github.com/neomake/neomake)
|
||||
- [Ale](https://github.com/w0rp/ale)
|
||||
- [vim-obsession](https://github.com/tpope/vim-obsession)
|
||||
- spell (can also display Spell language)
|
||||
- keymap
|
||||
- Formatters:
|
||||
- Formatters for JavaScript [#1617](https://github.com/vim-airline/vim-airline/issues/1617)
|
||||
- Tabline: Allow for custom formatter for `tab_nr_type` [#1418](https://github.com/vim-airline/vim-airline/issues/1418)
|
||||
- Customizable wordcount formatter [#1584](https://github.com/vim-airline/vim-airline/issues/1584)
|
||||
- Add User autocommand for Theme changing [#1226](https://github.com/vim-airline/vim-airline/issues/1226)
|
||||
- Shows mercurial mq status if hg mq extension is enabled
|
||||
|
||||
## [0.8] - 2016-03-09
|
||||
- Changes
|
||||
- Airline converted to an organization and moved to new [repository](https://github.com/vim-airline/vim-airline)
|
||||
@@ -109,7 +153,8 @@ This is the Changelog for the vim-airline project.
|
||||
- integration with other plugins: netrw, unite, nerdtree, undotree, gundo, tagbar, minibufexplr, ctrlp
|
||||
- support for themes: 8 included
|
||||
|
||||
[Unreleased]: https://github.com/vim-airline/vim-airline/compare/v0.8...HEAD
|
||||
[Unreleased]: https://github.com/vim-airline/vim-airline/compare/v0.9...HEAD
|
||||
[0.9]: https://github.com/vim-airline/vim-airline/compare/v0.8...v0.9
|
||||
[0.8]: https://github.com/vim-airline/vim-airline/compare/v0.7...v0.8
|
||||
[0.7]: https://github.com/vim-airline/vim-airline/compare/v0.6...v0.7
|
||||
[0.6]: https://github.com/vim-airline/vim-airline/compare/v0.5...v0.6
|
||||
|
||||
87
README.md
87
README.md
@@ -4,6 +4,60 @@ Lean & mean status/tabline for vim that's light as air.
|
||||
|
||||

|
||||
|
||||
When the plugin is correctly loaded, 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
|
||||
[...] | additional sections (warning/errors/statistics) from external plugins (e.g. YCM, syntastic, ...)
|
||||
|
||||
The information in Section Z looks like this:
|
||||
|
||||
`10% ☰ 10/100 ln : 20`
|
||||
|
||||
This means:
|
||||
```
|
||||
10% - 10 percent down the top of the file
|
||||
☰ 10 - current line 10
|
||||
/100 ln - of 100 lines
|
||||
: 20 - current column 20
|
||||
```
|
||||
|
||||
For a better look, those sections can be colored differently, depending on various conditions
|
||||
(e.g. the mode or whether the current file is 'modified')
|
||||
|
||||
# Features
|
||||
|
||||
* Tiny core written with extensibility in mind ([open/closed principle][8]).
|
||||
@@ -62,6 +116,26 @@ Separators can be configured independently for the tabline, so here is how you c
|
||||
let g:airline#extensions#tabline#left_sep = ' '
|
||||
let g:airline#extensions#tabline#left_alt_sep = '|'
|
||||
|
||||
In addition, you can also choose which path formatter airline uses. This affects how file paths are
|
||||
displayed in each individual tab as well as the current buffer indicator in the upper right.
|
||||
To do so, set the `formatter` field with:
|
||||
|
||||
let g:airline#extensions#tabline#formatter = 'default'
|
||||
|
||||
Here is a complete list of formatters with screenshots:
|
||||
|
||||
#### `default`
|
||||

|
||||
|
||||
#### `jsformatter`
|
||||

|
||||
|
||||
#### `unique_tail`
|
||||

|
||||
|
||||
#### `unique_tail_improved`
|
||||

|
||||
|
||||
## Seamless integration
|
||||
|
||||
vim-airline integrates with a variety of plugins out of the box. These extensions will be lazily loaded if and only if you have the other plugins installed (and of course you can turn them off).
|
||||
@@ -160,15 +234,13 @@ This plugin follows the standard runtime path structure, and as such it can be i
|
||||
| [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')` |
|
||||
| pack feature (native Vim 8 package feature)| `git clone https://github.com/vim-airline/vim-airline ~/.vim/pack/dist/start/vim-airline`<br/>Remember to run `:helptags` to generate help tags |
|
||||
| manual | copy all of the files into your `~/.vim` directory |
|
||||
|
||||
# Configuration
|
||||
# Documentation
|
||||
|
||||
`:help airline`
|
||||
|
||||
The default setting of 'laststatus' is for the statusline to not appear until a split is created. If you want it to appear all the time, add the following to your vimrc:
|
||||
`set laststatus=2`
|
||||
|
||||
# Integrating with powerline fonts
|
||||
|
||||
For the nice looking powerline symbols to appear, you will need to install a patched font. Instructions can be found in the official powerline [documentation][20]. Prepatched fonts can be found in the [powerline-fonts][3] repository.
|
||||
@@ -189,7 +261,11 @@ Many optimizations have been made such that the majority of users will not see a
|
||||
|
||||
The [minivimrc][7] project has some helper mappings to troubleshoot performance related issues.
|
||||
|
||||
If you don't want all the bells and whistles enabled by default, you can define a value for `g:airline_extensions`. When this variable is defined, only the extensions listed will be loaded; an empty array would effectively disable all extensions.
|
||||
If you don't want all the bells and whistles enabled by default, you can define a value for `g:airline_extensions`. When this variable is defined, only the extensions listed will be loaded; an empty array would effectively disable all extensions (e.g. `:let g:airline_extensions = []`).
|
||||
|
||||
Also, you can enable caching of the various syntax highlighting groups. This will try to prevent some of the more expensive `:hi` calls in Vim, which seem to be expensive in the Vim core at the expense of possibly not being hunderet percent correct all the times (especially if you often change highlighting groups yourself using `:hi` commands). To set this up do `:let g:airline_highlighting_cache = 1`. A `:AirlineRefresh` will however clear the cache.
|
||||
|
||||
In addition you might want to check out the [dark_minimal theme][55], which does not change highlighting groups once they are defined. Also please check the [FAQ][27] for more information on how to diagnose and fix the problem.
|
||||
|
||||
# Screenshots
|
||||
|
||||
@@ -259,3 +335,4 @@ MIT License. Copyright (c) 2013-2017 Bailey Ling & Contributors.
|
||||
[52]: https://github.com/Shougo/dein.vim
|
||||
[53]: https://github.com/lervag/vimtex
|
||||
[54]: https://github.com/k-takata/minpac/
|
||||
[55]: https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/dark_minimal.vim
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -34,6 +34,7 @@ function! airline#add_inactive_statusline_func(name)
|
||||
endfunction
|
||||
|
||||
function! airline#load_theme()
|
||||
let g:airline_theme = get(g:, 'airline_theme', 'dark')
|
||||
if exists('*airline#themes#{g:airline_theme}#refresh')
|
||||
call airline#themes#{g:airline_theme}#refresh()
|
||||
endif
|
||||
@@ -76,7 +77,7 @@ endfunction
|
||||
function! airline#switch_matching_theme()
|
||||
if exists('g:colors_name')
|
||||
let existing = g:airline_theme
|
||||
let theme = substitute(g:colors_name, '-', '_', 'g')
|
||||
let theme = substitute(tolower(g:colors_name), '-', '_', 'g')
|
||||
try
|
||||
let palette = g:airline#themes#{theme}#palette
|
||||
call airline#switch_theme(theme)
|
||||
@@ -143,11 +144,6 @@ 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)
|
||||
@@ -190,13 +186,6 @@ function! airline#check_mode(winnr)
|
||||
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, context.bufnr)
|
||||
|
||||
254
autoload/airline/async.vim
Normal file
254
autoload/airline/async.vim
Normal file
@@ -0,0 +1,254 @@
|
||||
" MIT License. Copyright (c) 2013-2018 C.Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:untracked_jobs = {}
|
||||
let s:mq_jobs = {}
|
||||
let s:po_jobs = {}
|
||||
|
||||
" Generic functions handling on exit event of the various async functions
|
||||
function! s:untracked_output(dict, buf)
|
||||
if a:buf =~? ('^'. a:dict.cfg['untracked_mark'])
|
||||
let a:dict.cfg.untracked[a:dict.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
|
||||
else
|
||||
let a:dict.cfg.untracked[a:dict.file] = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" also called from branch extension (for non-async vims)
|
||||
function! airline#async#mq_output(buf, file)
|
||||
let buf=a:buf
|
||||
if !empty(a:buf)
|
||||
if a:buf =~# 'no patches applied' ||
|
||||
\ a:buf =~# "unknown command 'qtop'" ||
|
||||
\ a:buf =~# "abort"
|
||||
let buf = ''
|
||||
elseif exists("b:mq") && b:mq isnot# buf
|
||||
" make sure, statusline is updated
|
||||
unlet! b:airline_head
|
||||
endif
|
||||
let b:mq = buf
|
||||
endif
|
||||
if has_key(s:mq_jobs, a:file)
|
||||
call remove(s:mq_jobs, a:file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:po_output(buf, file)
|
||||
if !empty(a:buf)
|
||||
let b:airline_po_stats = printf("[%s]", a:buf)
|
||||
else
|
||||
let b:airline_po_stats = ''
|
||||
endif
|
||||
if has_key(s:po_jobs, a:file)
|
||||
call remove(s:po_jobs, a:file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:valid_dir(dir)
|
||||
if empty(a:dir) || !isdirectory(a:dir)
|
||||
return getcwd()
|
||||
endif
|
||||
return a:dir
|
||||
endfunction
|
||||
|
||||
if v:version >= 800 && has("job")
|
||||
" Vim 8.0 with Job feature
|
||||
" TODO: Check if we need the cwd option for the job_start() functions
|
||||
" (only works starting with Vim 8.0.0902)
|
||||
|
||||
function! s:on_stdout(channel, msg) dict abort
|
||||
let self.buf .= a:msg
|
||||
endfunction
|
||||
|
||||
function! s:on_exit_mq(channel) dict abort
|
||||
call airline#async#mq_output(self.buf, self.file)
|
||||
endfunction
|
||||
|
||||
function! s:on_exit_untracked(channel) dict abort
|
||||
call s:untracked_output(self, self.buf)
|
||||
if has_key(s:untracked_jobs, self.file)
|
||||
call remove(s:untracked_jobs, self.file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:on_exit_po(channel) dict abort
|
||||
call s:po_output(self.buf, self.file)
|
||||
call airline#extensions#po#shorten()
|
||||
endfunction
|
||||
|
||||
function! airline#async#get_mq_async(cmd, file)
|
||||
if g:airline#init#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:mq_jobs, a:file)
|
||||
if job_status(get(s:mq_jobs, a:file)) == 'run'
|
||||
return
|
||||
elseif has_key(s:mq_jobs, a:file)
|
||||
call remove(s:mq_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:mq_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
function! airline#async#get_msgfmt_stat(cmd, file)
|
||||
if g:airline#init#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:po_jobs, a:file)
|
||||
if job_status(get(s:po_jobs, a:file)) == 'run'
|
||||
return
|
||||
elseif has_key(s:po_jobs, a:file)
|
||||
call remove(s:po_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_po', options)})
|
||||
let s:po_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
function airline#async#vim_vcs_untracked(config, file)
|
||||
if g:airline#init#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 = {'cfg': a:config, 'buf': '', 'file': a:file}
|
||||
if has_key(s:untracked_jobs, a:file)
|
||||
if job_status(get(s:untracked_jobs, a:file)) == 'run'
|
||||
return
|
||||
elseif has_key(s:untracked_jobs, a:file)
|
||||
call remove(s:untracked_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_untracked', options)})
|
||||
let s:untracked_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
elseif has("nvim")
|
||||
" NVim specific functions
|
||||
|
||||
function! s:nvim_output_handler(job_id, data, event) dict
|
||||
if a:event == 'stdout' || a:event == 'stderr'
|
||||
let self.buf .= join(a:data)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:nvim_untracked_job_handler(job_id, data, event) dict
|
||||
if a:event == 'exit'
|
||||
call s:untracked_output(self, self.buf)
|
||||
if has_key(s:untracked_jobs, self.file)
|
||||
call remove(s:untracked_jobs, self.file)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:nvim_mq_job_handler(job_id, data, event) dict
|
||||
if a:event == 'exit'
|
||||
call airline#async#mq_output(self.buf, self.file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:nvim_po_job_handler(job_id, data, event) dict
|
||||
if a:event == 'exit'
|
||||
call s:po_output(self.buf, self.file)
|
||||
call airline#extensions#po#shorten()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#async#nvim_get_mq_async(cmd, file)
|
||||
let config = {
|
||||
\ 'buf': '',
|
||||
\ 'file': a:file,
|
||||
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')),
|
||||
\ 'on_stdout': function('s:nvim_output_handler'),
|
||||
\ 'on_stderr': function('s:nvim_output_handler'),
|
||||
\ 'on_exit': function('s:nvim_mq_job_handler')
|
||||
\ }
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
let cmd = a:cmd
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd]
|
||||
endif
|
||||
|
||||
if has_key(s:mq_jobs, a:file)
|
||||
call remove(s:mq_jobs, a:file)
|
||||
endif
|
||||
let id = jobstart(cmd, config)
|
||||
let s:mq_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
function! airline#async#nvim_get_msgfmt_stat(cmd, file)
|
||||
let config = {
|
||||
\ 'buf': '',
|
||||
\ 'file': a:file,
|
||||
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')),
|
||||
\ 'on_stdout': function('s:nvim_output_handler'),
|
||||
\ 'on_stderr': function('s:nvim_output_handler'),
|
||||
\ 'on_exit': function('s:nvim_po_job_handler')
|
||||
\ }
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
" no msgfmt on windows?
|
||||
return
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
|
||||
endif
|
||||
|
||||
if has_key(s:po_jobs, a:file)
|
||||
call remove(s:po_jobs, a:file)
|
||||
endif
|
||||
let id = jobstart(cmd, config)
|
||||
let s:po_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
" Should work in either Vim pre 8 or Nvim
|
||||
function! airline#async#nvim_vcs_untracked(cfg, file, vcs)
|
||||
let cmd = a:cfg.cmd . shellescape(a:file)
|
||||
let id = -1
|
||||
let config = {
|
||||
\ 'buf': '',
|
||||
\ 'vcs': a:vcs,
|
||||
\ 'cfg': a:cfg,
|
||||
\ 'file': a:file,
|
||||
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h'))
|
||||
\ }
|
||||
if has("nvim")
|
||||
call extend(config, {
|
||||
\ 'on_stdout': function('s:nvim_output_handler'),
|
||||
\ 'on_exit': function('s:nvim_untracked_job_handler')})
|
||||
if has_key(s:untracked_jobs, config.file)
|
||||
" still running
|
||||
return
|
||||
endif
|
||||
let id = jobstart(cmd, config)
|
||||
let s:untracked_jobs[a:file] = id
|
||||
endif
|
||||
" vim without job feature or nvim jobstart failed
|
||||
if id < 1
|
||||
let output=system(cmd)
|
||||
call s:untracked_output(config, output)
|
||||
call airline#extensions#branch#update_untracked_config(a:file, a:vcs)
|
||||
endif
|
||||
endfunction
|
||||
@@ -1,21 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" 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(...) dict
|
||||
@@ -62,7 +49,9 @@ function! s:prototype.build() dict
|
||||
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')
|
||||
if group ==# 'airline_c' && &buftype ==# 'terminal' && self._context.active
|
||||
let group = 'airline_term'
|
||||
elseif 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
|
||||
@@ -100,7 +89,6 @@ function! s:prototype.build() dict
|
||||
let line .= s:get_seperator(self, prev_group, group, side)
|
||||
endif
|
||||
endif
|
||||
let contents = s:calculate_max_width(self, contents, group)
|
||||
let line .= is_empty ? '' : s:get_accented_line(self, group, contents)
|
||||
endif
|
||||
|
||||
@@ -130,9 +118,16 @@ endfunction
|
||||
function! s:get_transitioned_seperator(self, prev_group, group, side)
|
||||
let line = ''
|
||||
call airline#highlighter#add_separator(a:prev_group, a:group, a:side)
|
||||
let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
|
||||
let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep
|
||||
let line .= '%#'.a:group.'#'
|
||||
if get(a:self._context, 'tabline', 0) && get(g:, 'airline#extensions#tabline#alt_sep', 0) && a:group ==# 'airline_tabsel' && a:side
|
||||
call airline#highlighter#add_separator(a:prev_group, a:group, 0)
|
||||
let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
|
||||
let line .= a:self._context.right_sep.'%#'.a:group.'#'
|
||||
else
|
||||
call airline#highlighter#add_separator(a:prev_group, a:group, a:side)
|
||||
let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
|
||||
let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep
|
||||
let line .= '%#'.a:group.'#'
|
||||
endif
|
||||
return line
|
||||
endfunction
|
||||
|
||||
@@ -161,37 +156,6 @@ 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
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -49,4 +49,3 @@ function! airline#debug#profile3()
|
||||
profile pause
|
||||
noautocmd qall!
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -153,6 +153,11 @@ function! airline#extensions#load()
|
||||
call add(loaded_ext, 'netrw')
|
||||
endif
|
||||
|
||||
if has("terminal")
|
||||
call airline#extensions#term#init(s:ext)
|
||||
call add(loaded_ext, 'term')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#ycm#enabled', 0)
|
||||
call airline#extensions#ycm#init(s:ext)
|
||||
call add(loaded_ext, 'ycm')
|
||||
@@ -224,6 +229,12 @@ function! airline#extensions#load()
|
||||
call add(loaded_ext, 'bufferline')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#fugitiveline#enabled', 1)
|
||||
\ && exists('*fugitive#head')
|
||||
call airline#extensions#fugitiveline#init(s:ext)
|
||||
call add(loaded_ext, 'fugitiveline')
|
||||
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')
|
||||
@@ -300,6 +311,11 @@ function! airline#extensions#load()
|
||||
call add(loaded_ext, 'xkblayout')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap'))
|
||||
call airline#extensions#keymap#init(s:ext)
|
||||
call add(loaded_ext, 'keymap')
|
||||
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')
|
||||
@@ -316,6 +332,11 @@ function! airline#extensions#load()
|
||||
call add(loaded_ext, 'vimtex')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#cursormode#enabled', 0))
|
||||
call airline#extensions#cursormode#init(s:ext)
|
||||
call add(loaded_ext, 'cursormode')
|
||||
endif
|
||||
|
||||
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
|
||||
" load all other extensions, which are not part of the default distribution.
|
||||
" (autoload/airline/extensions/*.vim outside of our s:script_path).
|
||||
@@ -337,4 +358,3 @@ function! airline#extensions#load()
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,32 +1,58 @@
|
||||
" MIT License. Copyright (c) 2013-2017 Bjorn Neergaard, w0rp
|
||||
" MIT License. Copyright (c) 2013-2018 Bjorn Neergaard, w0rp et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
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! s:airline_ale_count(cnt, symbol)
|
||||
return a:cnt ? a:symbol. a:cnt : ''
|
||||
endfunction
|
||||
|
||||
function! s:airline_ale_get_line_number(cnt, type) abort
|
||||
if a:cnt == 0
|
||||
return ''
|
||||
endif
|
||||
|
||||
let buffer = bufnr('')
|
||||
let problem_type = (a:type ==# 'error') ? 'E' : 'W'
|
||||
let problems = copy(ale#engine#GetLoclist(buffer))
|
||||
|
||||
call filter(problems, 'v:val.bufnr is buffer && v:val.type is# problem_type')
|
||||
|
||||
if empty(problems)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let open_lnum_symbol = get(g:, 'airline#extensions#ale#open_lnum_symbol', '(L')
|
||||
let close_lnum_symbol = get(g:, 'airline#extensions#ale#close_lnum_symbol', ')')
|
||||
|
||||
return open_lnum_symbol . problems[0].lnum . close_lnum_symbol
|
||||
endfunction
|
||||
|
||||
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
|
||||
let is_err = a:type ==# 'error'
|
||||
let symbol = is_err ? s:error_symbol : s:warning_symbol
|
||||
|
||||
if type(l:counts) == type({}) && has_key(l:counts, 'error')
|
||||
let is_err = a:type ==# 'error'
|
||||
let counts = ale#statusline#Count(bufnr(''))
|
||||
let symbol = is_err ? s:error_symbol : s:warning_symbol
|
||||
|
||||
if type(counts) == type({}) && has_key(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
|
||||
let errors = counts.error + counts.style_error
|
||||
let num = is_err ? errors : counts.total - errors
|
||||
else
|
||||
" Use the old List format.
|
||||
let l:num = l:is_err ? l:counts[0] : l:counts[1]
|
||||
let num = is_err ? counts[0] : counts[1]
|
||||
endif
|
||||
|
||||
if l:num == 0
|
||||
return ''
|
||||
else
|
||||
return l:symbol . l:num
|
||||
endif
|
||||
return s:airline_ale_count(num, symbol) . <sid>airline_ale_get_line_number(num, a:type)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ale#get_warning()
|
||||
@@ -40,4 +66,14 @@ 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')
|
||||
augroup airline_ale
|
||||
autocmd!
|
||||
autocmd CursorHold,BufWritePost * call <sid>ale_refresh()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:ale_refresh()
|
||||
if get(g:, 'airline_skip_empty_sections', 0)
|
||||
exe ':AirlineRefresh'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -11,8 +11,6 @@ if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand
|
||||
finish
|
||||
endif
|
||||
|
||||
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
|
||||
@@ -28,8 +26,9 @@ let s:vcs_config = {
|
||||
\ 'exe': 'git',
|
||||
\ 'cmd': 'git status --porcelain -- ',
|
||||
\ 'untracked_mark': '??',
|
||||
\ 'update_branch': 's:update_git_branch',
|
||||
\ 'exclude': '\.git',
|
||||
\ 'update_branch': 's:update_git_branch',
|
||||
\ 'display_branch': 's:display_git_branch',
|
||||
\ 'branch': '',
|
||||
\ 'untracked': {},
|
||||
\ },
|
||||
@@ -39,6 +38,7 @@ let s:vcs_config = {
|
||||
\ 'untracked_mark': '?',
|
||||
\ 'exclude': '\.hg',
|
||||
\ 'update_branch': 's:update_hg_branch',
|
||||
\ 'display_branch': 's:display_hg_branch',
|
||||
\ 'branch': '',
|
||||
\ 'untracked': {},
|
||||
\ },
|
||||
@@ -83,55 +83,69 @@ else
|
||||
endfunction
|
||||
endif
|
||||
|
||||
let s:git_dirs = {}
|
||||
|
||||
function! s:update_git_branch(path)
|
||||
" Fugitive special revisions. call '0' "staging" ?
|
||||
let s:names = {'0': 'index', '1': 'orig', '2':'fetch', '3':'merge'}
|
||||
let s:sha1size = get(g:, 'airline#extensions#branch#sha1_len', 7)
|
||||
|
||||
function! s:update_git_branch()
|
||||
if !s:has_fugitive
|
||||
let s:vcs_config['git'].branch = ''
|
||||
return
|
||||
endif
|
||||
|
||||
let name = fugitive#head(7)
|
||||
if empty(name)
|
||||
if has_key(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)
|
||||
if empty(dir)
|
||||
let name = ''
|
||||
else
|
||||
try
|
||||
let line = join(readfile(dir . '/HEAD'))
|
||||
if strpart(line, 0, 16) == 'ref: refs/heads/'
|
||||
let name = strpart(line, 16)
|
||||
else
|
||||
" raw commit hash
|
||||
let name = strpart(line, 0, 7)
|
||||
endif
|
||||
catch
|
||||
let name = ''
|
||||
endtry
|
||||
endif
|
||||
let s:vcs_config['git'].branch = fugitive#head(s:sha1size)
|
||||
if s:vcs_config['git'].branch is# 'master' && winwidth(0) < 81
|
||||
" Shorten default a bit
|
||||
let s:vcs_config['git'].branch='mas'
|
||||
endif
|
||||
|
||||
let s:git_dirs[a:path] = name
|
||||
let s:vcs_config['git'].branch = name
|
||||
endfunction
|
||||
|
||||
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'))
|
||||
function! s:display_git_branch()
|
||||
let name = b:buffer_vcs_config['git'].branch
|
||||
try
|
||||
let commit = fugitive#buffer().commit()
|
||||
|
||||
if has_key(s:names, commit)
|
||||
let name = get(s:names, commit)."(".name.")"
|
||||
elseif !empty(commit)
|
||||
let ref = fugitive#repo().git_chomp('describe', '--all', '--exact-match', commit)
|
||||
if ref !~ "^fatal: no tag exactly matches"
|
||||
let name = s:format_name(substitute(ref, '\v\C^%(heads/|remotes/|tags/)=','',''))."(".name.")"
|
||||
else
|
||||
let name = commit[0:s:sha1size-1]."(".name.")"
|
||||
endif
|
||||
endif
|
||||
if exists("s:mq") && !empty(s:mq)
|
||||
catch
|
||||
endtry
|
||||
|
||||
return name
|
||||
endfunction
|
||||
|
||||
function! s:update_hg_branch()
|
||||
if s:has_lawrencium
|
||||
let cmd='LC_ALL=C hg qtop'
|
||||
let stl=lawrencium#statusline()
|
||||
let file=expand('%:p')
|
||||
if !empty(stl) && get(b:, 'airline_do_mq_check', 1)
|
||||
if g:airline#init#vim_async
|
||||
call airline#async#get_mq_async(cmd, file)
|
||||
elseif has("nvim")
|
||||
call airline#async#nvim_get_mq_async(cmd, file)
|
||||
else
|
||||
" remove \n at the end of the command
|
||||
let output=system(cmd)[0:-2]
|
||||
call airline#async#mq_output(output, file)
|
||||
endif
|
||||
endif
|
||||
" do not do mq check anymore
|
||||
let b:airline_do_mq_check = 0
|
||||
if exists("b:mq") && !empty(b:mq)
|
||||
if stl is# 'default'
|
||||
" Shorten default a bit
|
||||
let stl='def'
|
||||
endif
|
||||
let stl.=' ['.s:mq.']'
|
||||
let stl.=' ['.b:mq.']'
|
||||
endif
|
||||
let s:vcs_config['mercurial'].branch = stl
|
||||
else
|
||||
@@ -139,10 +153,13 @@ function! s:update_hg_branch(path)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:display_hg_branch()
|
||||
return b:buffer_vcs_config['mercurial'].branch
|
||||
endfunction
|
||||
|
||||
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)
|
||||
call {s:vcs_config[vcs].update_branch}()
|
||||
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
|
||||
@@ -150,7 +167,7 @@ function! s:update_branch()
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:update_untracked_in_buffer_config(file, vcs)
|
||||
function! airline#extensions#branch#update_untracked_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
|
||||
@@ -160,129 +177,43 @@ function! s:update_untracked_in_buffer_config(file, vcs)
|
||||
endfunction
|
||||
|
||||
function! s:update_untracked()
|
||||
let l:file = expand("%:p")
|
||||
if empty(l:file) || isdirectory(l:file)
|
||||
let file = expand("%:p")
|
||||
if empty(file) || isdirectory(file)
|
||||
return
|
||||
endif
|
||||
|
||||
let l:needs_update = 1
|
||||
let needs_update = 1
|
||||
for vcs in keys(s:vcs_config)
|
||||
if l:file =~ s:vcs_config[vcs].exclude
|
||||
if file =~ s:vcs_config[vcs].exclude
|
||||
" Skip check for files that live in the exclude directory
|
||||
let l:needs_update = 0
|
||||
let 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)
|
||||
if has_key(s:vcs_config[vcs].untracked, file)
|
||||
let needs_update = 0
|
||||
call airline#extensions#branch#update_untracked_config(file, vcs)
|
||||
endif
|
||||
endfor
|
||||
|
||||
if !l:needs_update
|
||||
if !needs_update
|
||||
return
|
||||
endif
|
||||
|
||||
for vcs in keys(s:vcs_config)
|
||||
let l:config = s:vcs_config[vcs]
|
||||
if s:has_async
|
||||
let config = s:vcs_config[vcs]
|
||||
if g:airline#init#vim_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)
|
||||
call airline#async#vim_vcs_untracked(config, file)
|
||||
else
|
||||
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)
|
||||
" nvim async or vim without job-feature
|
||||
call airline#async#nvim_vcs_untracked(config, file, vcs)
|
||||
endif
|
||||
endfor
|
||||
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()
|
||||
@@ -296,24 +227,27 @@ function! airline#extensions#branch#head()
|
||||
endif
|
||||
|
||||
let b:airline_head = ''
|
||||
let l:vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"])
|
||||
let vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"])
|
||||
|
||||
let l:heads = {}
|
||||
for vcs in l:vcs_priority
|
||||
let heads = []
|
||||
for vcs in vcs_priority
|
||||
if !empty(b:buffer_vcs_config[vcs].branch)
|
||||
let l:heads[vcs] = b:buffer_vcs_config[vcs].branch
|
||||
let heads += [vcs]
|
||||
endif
|
||||
endfor
|
||||
|
||||
for vcs in keys(l:heads)
|
||||
for vcs in 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])
|
||||
if len(heads) > 1
|
||||
let b:airline_head .= s:vcs_config[vcs].exe .':'
|
||||
endif
|
||||
let b:airline_head .= s:format_name({s:vcs_config[vcs].display_branch}())
|
||||
let b:airline_head .= b:buffer_vcs_config[vcs].untracked
|
||||
endfor
|
||||
|
||||
if empty(l:heads)
|
||||
if empty(heads)
|
||||
if s:has_vcscommand
|
||||
call VCSCommandEnableBufferSetup()
|
||||
if exists('b:VCSCommandBufferInfo')
|
||||
@@ -329,9 +263,6 @@ function! airline#extensions#branch#head()
|
||||
endif
|
||||
endif
|
||||
|
||||
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
|
||||
@@ -346,38 +277,9 @@ function! airline#extensions#branch#get_head()
|
||||
\ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head)
|
||||
endfunction
|
||||
|
||||
function! s:check_in_path()
|
||||
if !exists('b:airline_file_in_root')
|
||||
let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', ''))
|
||||
let bufferpath = resolve(fnamemodify(expand('%'), ':p'))
|
||||
|
||||
if !filereadable(root) "not a file
|
||||
" if .git is a directory, it's the old submodule format
|
||||
if match(root, '\.git$') >= 0
|
||||
let root = expand(fnamemodify(root, ':h'))
|
||||
else
|
||||
" else it's the newer format, and we need to guesstimate
|
||||
" 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
|
||||
endif
|
||||
endif
|
||||
|
||||
let b:airline_file_in_root = stridx(bufferpath, root) > -1
|
||||
endif
|
||||
return b:airline_file_in_root
|
||||
endfunction
|
||||
|
||||
function! s:reset_untracked_cache(shellcmdpost)
|
||||
" shellcmdpost - whether function was called as a result of ShellCmdPost hook
|
||||
if !s:has_async && !has('nvim')
|
||||
if !g:airline#init#vim_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
|
||||
@@ -388,12 +290,12 @@ function! s:reset_untracked_cache(shellcmdpost)
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:file = expand("%:p")
|
||||
let 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)
|
||||
call airline#extensions#branch#update_untracked_config(file, vcs)
|
||||
let s:vcs_config[vcs].untracked = {}
|
||||
endfor
|
||||
endfunction
|
||||
@@ -401,9 +303,8 @@ endfunction
|
||||
function! airline#extensions#branch#init(ext)
|
||||
call airline#parts#define_function('branch', 'airline#extensions#branch#get_head')
|
||||
|
||||
autocmd BufReadPost * unlet! b:airline_file_in_root
|
||||
autocmd CursorHold,ShellCmdPost,CmdwinLeave * unlet! b:airline_head
|
||||
autocmd User AirlineBeforeRefresh unlet! b:airline_head
|
||||
autocmd ShellCmdPost,CmdwinLeave * unlet! b:airline_head b:airline_do_mq_check
|
||||
autocmd User AirlineBeforeRefresh unlet! b:airline_head b:airline_do_mq_check
|
||||
autocmd BufWritePost * call s:reset_untracked_cache(0)
|
||||
autocmd ShellCmdPost * call s:reset_untracked_cache(1)
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014 Mathias Andersson.
|
||||
" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -14,4 +14,3 @@ endfunction
|
||||
function! airline#extensions#capslock#init(ext)
|
||||
call airline#parts#define_function('capslock', 'airline#extensions#capslock#status')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -30,4 +30,3 @@ endfunction
|
||||
function! airline#extensions#csv#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#csv#apply')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -79,4 +79,3 @@ function! airline#extensions#ctrlp#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#ctrlp#apply')
|
||||
call a:ext.add_theme_func('airline#extensions#ctrlp#load_theme')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" 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
|
||||
let s:cs = ctrlspace#context#Configuration().Symbols.CS
|
||||
|
||||
function! airline#extensions#ctrlspace#statusline(...)
|
||||
let b = airline#builder#new({ 'active': 1 })
|
||||
call b.add_section('airline_b', '⌗' . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding))
|
||||
call b.add_section('airline_b', s:cs . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding))
|
||||
call b.split()
|
||||
call b.add_section('airline_x', s:spc . ctrlspace#api#StatuslineTabSegment() . s:spc)
|
||||
return b.build()
|
||||
|
||||
128
autoload/airline/extensions/cursormode.vim
Normal file
128
autoload/airline/extensions/cursormode.vim
Normal file
@@ -0,0 +1,128 @@
|
||||
" Copyright (C) 2014 Andrea Cedraro <a.cedraro@gmail.com>
|
||||
" Copyright (C) 2017 Eduardo Suarez-Santana <e.suarezsantana@gmail.com>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the "Software"),
|
||||
" to deal in the Software without restriction, including without limitation
|
||||
" the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
" and/or sell copies of the Software, and to permit persons to whom the
|
||||
" Software is furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
" OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:is_win = has('win32') || has('win64')
|
||||
let s:is_iTerm = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'iTerm.app'
|
||||
let s:is_AppleTerminal = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'Apple_Terminal'
|
||||
|
||||
let s:is_good = !has('gui_running') && !s:is_win && !s:is_AppleTerminal
|
||||
|
||||
let s:last_mode = ''
|
||||
|
||||
if !exists('g:cursormode_exit_mode')
|
||||
let g:cursormode_exit_mode='n'
|
||||
endif
|
||||
|
||||
function! airline#extensions#cursormode#tmux_escape(escape)
|
||||
return '\033Ptmux;'.substitute(a:escape, '\\033', '\\033\\033', 'g').'\033\\'
|
||||
endfunction
|
||||
|
||||
let s:iTerm_escape_template = '\033]Pl%s\033\\'
|
||||
let s:xterm_escape_template = '\033]12;%s\007'
|
||||
|
||||
function! airline#extensions#cursormode#set(...)
|
||||
let mode = mode()
|
||||
if mode !=# s:last_mode
|
||||
let s:last_mode = mode
|
||||
call s:set_cursor_color_for(mode)
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:set_cursor_color_for(mode)
|
||||
let mode = a:mode
|
||||
for mode in [a:mode, a:mode.&background]
|
||||
if has_key(s:color_map, mode)
|
||||
try
|
||||
let save_eventignore = &eventignore
|
||||
set eventignore=all
|
||||
let save_shelltemp = &shelltemp
|
||||
set noshelltemp
|
||||
|
||||
silent call system(s:build_command(s:color_map[mode]))
|
||||
return
|
||||
finally
|
||||
let &shelltemp = save_shelltemp
|
||||
let &eventignore = save_eventignore
|
||||
endtry
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:build_command(color)
|
||||
if s:is_iTerm
|
||||
let color = substitute(a:color, '^#', '', '')
|
||||
let escape_template = s:iTerm_escape_template
|
||||
else
|
||||
let color = a:color
|
||||
let escape_template = s:xterm_escape_template
|
||||
endif
|
||||
|
||||
let escape = printf(escape_template, color)
|
||||
if exists('$TMUX')
|
||||
let escape = airline#extensions#cursormode#tmux_escape(escape)
|
||||
endif
|
||||
return "printf '".escape."' > /dev/tty"
|
||||
endfunction
|
||||
|
||||
function! s:get_color_map()
|
||||
if exists('g:cursormode_color_map')
|
||||
return g:cursormode_color_map
|
||||
endif
|
||||
|
||||
try
|
||||
let map = g:cursormode#{g:colors_name}#color_map
|
||||
return map
|
||||
catch
|
||||
return {
|
||||
\ "nlight": "#000000",
|
||||
\ "ndark": "#BBBBBB",
|
||||
\ "i": "#0000BB",
|
||||
\ "v": "#FF5555",
|
||||
\ "V": "#BBBB00",
|
||||
\ "\<C-V>": "#BB00BB",
|
||||
\ }
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
augroup airline#extensions#cursormode
|
||||
autocmd!
|
||||
autocmd VimLeave * call s:set_cursor_color_for(g:cursormode_exit_mode)
|
||||
" autocmd VimEnter * call airline#extensions#cursormode#activate()
|
||||
autocmd Colorscheme * call airline#extensions#cursormode#activate()
|
||||
augroup END
|
||||
|
||||
function! airline#extensions#cursormode#activate()
|
||||
let s:color_map = s:get_color_map()
|
||||
call airline#extensions#cursormode#set()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#cursormode#apply(...)
|
||||
let w:airline_section_a = get(w:, 'airline_section_a', g:airline_section_a)
|
||||
let w:airline_section_a .= '%{airline#extensions#cursormode#set()}'
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#cursormode#init(ext)
|
||||
let s:color_map = s:get_color_map()
|
||||
call a:ext.add_statusline_func('airline#extensions#cursormode#apply')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -98,4 +98,3 @@ function! airline#extensions#default#apply(builder, context)
|
||||
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017 Thomas Dy
|
||||
" MIT License. Copyright (c) 2017-2018 Thomas Dy et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -11,11 +11,14 @@ endif
|
||||
" 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
|
||||
if &filetype != 'denite'
|
||||
return ''
|
||||
endif
|
||||
let mode = split(denite#get_status_mode(), ' ')
|
||||
let mode = tolower(mode[1])
|
||||
if !exists('b:denite_mode_cache') || mode != b:denite_mode_cache
|
||||
call airline#highlighter#highlight([mode], a:bufnr)
|
||||
let b:denite_mode_cache = mode
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
@@ -35,13 +38,4 @@ 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,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -59,4 +59,3 @@ function! airline#extensions#eclim#init(ext)
|
||||
call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings')
|
||||
call a:ext.add_statusline_func('airline#extensions#eclim#creat_line')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -53,4 +53,3 @@ function! airline#extensions#example#get_cats()
|
||||
endfor
|
||||
return cats
|
||||
endfunction
|
||||
|
||||
|
||||
45
autoload/airline/extensions/fugitiveline.vim
Normal file
45
autoload/airline/extensions/fugitiveline.vim
Normal file
@@ -0,0 +1,45 @@
|
||||
" MIT License. Copyright (c) 2017-2018 Cimbali et al
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('*fugitive#head')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
if exists("+autochdir") && &autochdir == 1
|
||||
let s:fmod = ':p'
|
||||
else
|
||||
let s:fmod = ':.'
|
||||
endif
|
||||
|
||||
function! airline#extensions#fugitiveline#bufname()
|
||||
if !exists('b:fugitive_name')
|
||||
let b:fugitive_name = ''
|
||||
try
|
||||
let buffer = fugitive#buffer()
|
||||
if buffer.type('blob')
|
||||
let b:fugitive_name = buffer.repo().translate(buffer.path())
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
|
||||
if empty(b:fugitive_name)
|
||||
return fnamemodify(bufname('%'), s:fmod)
|
||||
else
|
||||
return fnamemodify(b:fugitive_name, s:fmod)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#fugitiveline#init(ext)
|
||||
if exists("+autochdir") && &autochdir == 1
|
||||
" if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well
|
||||
call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m')
|
||||
else
|
||||
call airline#parts#define_raw('file', '%<%{airline#extensions#fugitiveline#bufname()}%m')
|
||||
endif
|
||||
autocmd ShellCmdPost,CmdwinLeave * unlet! b:fugitive_name
|
||||
autocmd User AirlineBeforeRefresh unlet! b:fugitive_name
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -19,7 +19,8 @@ function! s:get_hunks_signify()
|
||||
endfunction
|
||||
|
||||
function! s:is_branch_empty()
|
||||
return exists('*airline#extensions#branch#head') && empty(airline#extensions#branch#head())
|
||||
return exists('*airline#extensions#branch#head') &&
|
||||
\ empty(get(b:, 'airline_head', ''))
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_gitgutter()
|
||||
@@ -34,12 +35,7 @@ function! s:get_hunks_changes()
|
||||
return []
|
||||
endif
|
||||
let hunks = changes#GetStats()
|
||||
for i in hunks
|
||||
if i > 0
|
||||
return hunks
|
||||
endif
|
||||
endfor
|
||||
return []
|
||||
return hunks == [0, 0, 0] ? [] : hunks
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_empty()
|
||||
@@ -67,13 +63,14 @@ function! airline#extensions#hunks#get_hunks()
|
||||
if !get(w:, 'airline_active', 0)
|
||||
return ''
|
||||
endif
|
||||
" Cache vavlues, so that it isn't called too often
|
||||
" Cache values, so that it isn't called too often
|
||||
if exists("b:airline_hunks") &&
|
||||
\ get(b:, 'airline_changenr', 0) == changenr() &&
|
||||
\ get(b:, 'airline_changenr', 0) == b:changedtick &&
|
||||
\ 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'
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_empty' &&
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_changes'
|
||||
return b:airline_hunks
|
||||
endif
|
||||
let hunks = s:get_hunks()
|
||||
@@ -86,7 +83,7 @@ function! airline#extensions#hunks#get_hunks()
|
||||
endfor
|
||||
endif
|
||||
let b:airline_hunks = string
|
||||
let b:airline_changenr = changenr()
|
||||
let b:airline_changenr = b:changedtick
|
||||
let s:airline_winwidth = winwidth(0)
|
||||
return string
|
||||
endfunction
|
||||
|
||||
20
autoload/airline/extensions/keymap.vim
Normal file
20
autoload/airline/extensions/keymap.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Doron Behar, C.Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !has('keymap')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#keymap#status()
|
||||
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap'))
|
||||
return printf('%s', (!empty(&keymap) ? (g:airline_symbols.keymap . ' '. &keymap) : ''))
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#keymap#init(ext)
|
||||
call airline#parts#define_function('keymap', 'airline#extensions#keymap#status')
|
||||
endfunction
|
||||
@@ -1,3 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':Neomake')
|
||||
@@ -7,14 +8,24 @@ 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! s:get_counts()
|
||||
let l:counts = neomake#statusline#LoclistCounts()
|
||||
|
||||
if empty(l:counts)
|
||||
return neomake#statusline#QflistCounts()
|
||||
else
|
||||
return l:counts
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#neomake#get_warnings()
|
||||
let counts = neomake#statusline#LoclistCounts()
|
||||
let counts = s:get_counts()
|
||||
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 counts = s:get_counts()
|
||||
let errors = get(counts, 'E', 0)
|
||||
return errors ? s:error_symbol.errors : ''
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -19,4 +20,3 @@ endfunction
|
||||
function! airline#extensions#obsession#get_status()
|
||||
return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:has_async = airline#util#async
|
||||
|
||||
function! s:shorten()
|
||||
function! airline#extensions#po#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
|
||||
@@ -14,49 +12,6 @@ function! s:shorten()
|
||||
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()}')
|
||||
@@ -70,8 +25,10 @@ function! airline#extensions#po#stats()
|
||||
endif
|
||||
|
||||
let cmd = 'msgfmt --statistics -o /dev/null -- '
|
||||
if s:has_async
|
||||
call s:get_msgfmt_stat_async(cmd, expand('%:p'))
|
||||
if g:airline#init#vim_async
|
||||
call airline#async#get_msgfmt_stat(cmd, expand('%:p'))
|
||||
elseif has("nvim")
|
||||
call airline#async#nvim_get_msgfmt_stat(cmd, expand('%:p'))
|
||||
else
|
||||
let airline_po_stats = system(cmd. shellescape(expand('%:p')))
|
||||
if v:shell_error
|
||||
@@ -83,7 +40,7 @@ function! airline#extensions#po#stats()
|
||||
catch
|
||||
let b:airline_po_stats = ''
|
||||
endtry
|
||||
call s:shorten()
|
||||
call airline#extensions#po#shorten()
|
||||
endif
|
||||
return get(b:, 'airline_po_stats', '')
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -22,15 +22,15 @@ 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}'
|
||||
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%e(#%fe)]}')
|
||||
else
|
||||
let g:syntastic_stl_format = '%W{%w}'
|
||||
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_warn', '%W{[%w(#%fw)]}')
|
||||
endif
|
||||
let cnt = SyntasticStatuslineFlag()
|
||||
if !empty(_backup)
|
||||
let g:syntastic_stl_format = _backup
|
||||
endif
|
||||
if cnt == 0
|
||||
if empty(cnt)
|
||||
return ''
|
||||
else
|
||||
return (is_err ? s:error_symbol : s:warning_symbol).cnt
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" 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)
|
||||
let s:ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree')
|
||||
|
||||
let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0)
|
||||
if s:taboo
|
||||
@@ -31,14 +27,18 @@ function! s:toggle_off()
|
||||
call airline#extensions#tabline#autoshow#off()
|
||||
call airline#extensions#tabline#tabs#off()
|
||||
call airline#extensions#tabline#buffers#off()
|
||||
call airline#extensions#tabline#ctrlspace#off()
|
||||
if s:ctrlspace
|
||||
call airline#extensions#tabline#ctrlspace#off()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:toggle_on()
|
||||
call airline#extensions#tabline#autoshow#on()
|
||||
call airline#extensions#tabline#tabs#on()
|
||||
call airline#extensions#tabline#buffers#on()
|
||||
call airline#extensions#tabline#ctrlspace#on()
|
||||
if s:ctrlspace
|
||||
call airline#extensions#tabline#ctrlspace#on()
|
||||
endif
|
||||
|
||||
set tabline=%!airline#extensions#tabline#get()
|
||||
endfunction
|
||||
@@ -48,17 +48,22 @@ function! s:update_tabline()
|
||||
return
|
||||
endif
|
||||
let match = expand('<afile>')
|
||||
let ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat',
|
||||
\ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree')
|
||||
if pumvisible()
|
||||
return
|
||||
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
|
||||
return
|
||||
" return, if buffer matches ignore pattern or is directory (netrw)
|
||||
elseif empty(match)
|
||||
\ || match(match, s:ignore_bufadd_pat) > -1
|
||||
\ || match(match, ignore_bufadd_pat) > -1
|
||||
\ || isdirectory(expand("<afile>"))
|
||||
return
|
||||
endif
|
||||
doautocmd User BufMRUChange
|
||||
" sometimes, the tabline is not correctly updated see #1580
|
||||
" so force redraw here
|
||||
let &tabline = &tabline
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#load_theme(palette)
|
||||
@@ -66,47 +71,53 @@ function! airline#extensions#tabline#load_theme(palette)
|
||||
return
|
||||
endif
|
||||
let colors = get(a:palette, 'tabline', {})
|
||||
let tablabel = get(colors, 'airline_tablabel', a:palette.normal.airline_b)
|
||||
" Theme for tabs on the left
|
||||
let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b)
|
||||
let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
|
||||
let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
|
||||
let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
|
||||
let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
|
||||
let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c)
|
||||
let tab = get(colors, 'airline_tab', a:palette.normal.airline_b)
|
||||
let tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
|
||||
let tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
|
||||
let tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
|
||||
let tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
|
||||
let tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c)
|
||||
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
|
||||
let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
|
||||
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
|
||||
else
|
||||
"Fall back to normal airline_c if modified airline_c isn't present
|
||||
let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
|
||||
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
|
||||
endif
|
||||
call airline#highlighter#exec('airline_tab', l:tab)
|
||||
call airline#highlighter#exec('airline_tabsel', l:tabsel)
|
||||
call airline#highlighter#exec('airline_tabtype', l:tabtype)
|
||||
call airline#highlighter#exec('airline_tabfill', l:tabfill)
|
||||
call airline#highlighter#exec('airline_tabmod', l:tabmod)
|
||||
call airline#highlighter#exec('airline_tabmod_unsel', l:tabmodu)
|
||||
call airline#highlighter#exec('airline_tabhid', l:tabhid)
|
||||
call airline#highlighter#exec('airline_tablabel', tablabel)
|
||||
call airline#highlighter#exec('airline_tab', tab)
|
||||
call airline#highlighter#exec('airline_tabsel', tabsel)
|
||||
call airline#highlighter#exec('airline_tabtype', tabtype)
|
||||
call airline#highlighter#exec('airline_tabfill', tabfill)
|
||||
call airline#highlighter#exec('airline_tabmod', tabmod)
|
||||
call airline#highlighter#exec('airline_tabmod_unsel', tabmodu)
|
||||
call airline#highlighter#exec('airline_tabhid', tabhid)
|
||||
|
||||
" Theme for tabs on the right
|
||||
let l:tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
|
||||
let l:tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
|
||||
let l:tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
|
||||
let l:tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c)
|
||||
let tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
|
||||
let tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
|
||||
let tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
|
||||
let tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c)
|
||||
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
|
||||
let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c)
|
||||
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c)
|
||||
else
|
||||
"Fall back to normal airline_c if modified airline_c isn't present
|
||||
let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
|
||||
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
|
||||
endif
|
||||
call airline#highlighter#exec('airline_tab_right', l:tab_right)
|
||||
call airline#highlighter#exec('airline_tabsel_right', l:tabsel_right)
|
||||
call airline#highlighter#exec('airline_tabmod_right', l:tabmod_right)
|
||||
call airline#highlighter#exec('airline_tabhid_right', l:tabhid_right)
|
||||
call airline#highlighter#exec('airline_tabmod_unsel_right', l:tabmodu_right)
|
||||
call airline#highlighter#exec('airline_tab_right', tab_right)
|
||||
call airline#highlighter#exec('airline_tabsel_right', tabsel_right)
|
||||
call airline#highlighter#exec('airline_tabmod_right', tabmod_right)
|
||||
call airline#highlighter#exec('airline_tabhid_right', tabhid_right)
|
||||
call airline#highlighter#exec('airline_tabmod_unsel_right', tabmodu_right)
|
||||
endfunction
|
||||
|
||||
let s:current_tabcnt = -1
|
||||
|
||||
function! airline#extensions#tabline#get()
|
||||
let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
||||
|
||||
let curtabcnt = tabpagenr('$')
|
||||
if curtabcnt != s:current_tabcnt
|
||||
let s:current_tabcnt = curtabcnt
|
||||
@@ -120,7 +131,7 @@ function! airline#extensions#tabline#get()
|
||||
endif
|
||||
if s:ctrlspace
|
||||
return airline#extensions#tabline#ctrlspace#get()
|
||||
elseif s:show_buffers && curtabcnt == 1 || !s:show_tabs
|
||||
elseif show_buffers && curtabcnt == 1 || !show_tabs
|
||||
return airline#extensions#tabline#buffers#get()
|
||||
else
|
||||
return airline#extensions#tabline#tabs#get()
|
||||
@@ -151,7 +162,8 @@ endfunction
|
||||
|
||||
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)
|
||||
let formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
|
||||
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, buffers)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#new_builder()
|
||||
@@ -191,3 +203,10 @@ function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
|
||||
endif
|
||||
return group
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#add_label(dict, type)
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
call a:dict.add_section_spaced('airline_tablabel',
|
||||
\ get(g:, 'airline#extensions#tabline#'.a:type.'_label', '['.a:type.']'))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
|
||||
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
let s:current_bufnr = -1
|
||||
@@ -49,7 +46,11 @@ function! airline#extensions#tabline#buffers#invalidate()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buffers#get()
|
||||
call <sid>map_keys()
|
||||
try
|
||||
call <sid>map_keys()
|
||||
catch
|
||||
" no-op
|
||||
endtry
|
||||
let cur = bufnr('%')
|
||||
if cur == s:current_bufnr
|
||||
if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified
|
||||
@@ -57,9 +58,18 @@ function! airline#extensions#tabline#buffers#get()
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:index = 1
|
||||
let index = 1
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
let tab_bufs = tabpagebuflist(tabpagenr())
|
||||
let show_buf_label_first = 0
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#buf_label_first', 0)
|
||||
let show_buf_label_first = 1
|
||||
endif
|
||||
if show_buf_label_first
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
endif
|
||||
let pgroup = ''
|
||||
for nr in s:get_visible_buffers()
|
||||
if nr < 0
|
||||
call b.add_raw('%#airline_tabhid#...')
|
||||
@@ -76,27 +86,33 @@ function! airline#extensions#tabline#buffers#get()
|
||||
if has("tablineat")
|
||||
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@')
|
||||
endif
|
||||
if s:buffer_idx_mode
|
||||
|
||||
let space= (pgroup == group ? s:spc : '')
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
|
||||
if len(s:number_map) > 0
|
||||
call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
|
||||
call b.add_section(group, space. get(s:number_map, index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
|
||||
else
|
||||
call b.add_section(group, '['.l:index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
|
||||
call b.add_section(group, '['.index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
|
||||
endif
|
||||
let l:index = l:index + 1
|
||||
let index += 1
|
||||
else
|
||||
call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
|
||||
call b.add_section(group, space.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
|
||||
endif
|
||||
|
||||
if has("tablineat")
|
||||
call b.add_raw('%X')
|
||||
endif
|
||||
let pgroup=group
|
||||
endfor
|
||||
|
||||
call b.add_section('airline_tabfill', '')
|
||||
call b.split()
|
||||
call b.add_section('airline_tabfill', '')
|
||||
if s:show_tab_type
|
||||
call b.add_section_spaced('airline_tabtype', s:buffers_label)
|
||||
if !show_buf_label_first
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
endif
|
||||
|
||||
if tabpagenr('$') > 1
|
||||
call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
endif
|
||||
@@ -109,6 +125,12 @@ endfunction
|
||||
function! s:get_visible_buffers()
|
||||
let buffers = airline#extensions#tabline#buflist#list()
|
||||
let cur = bufnr('%')
|
||||
if get(g:, 'airline#extensions#tabline#current_first', 0)
|
||||
if index(buffers, cur) > -1
|
||||
call remove(buffers, index(buffers, cur))
|
||||
endif
|
||||
let buffers = [cur] + buffers
|
||||
endif
|
||||
|
||||
let total_width = 0
|
||||
let max_width = 0
|
||||
@@ -160,8 +182,9 @@ function! s:get_visible_buffers()
|
||||
endfunction
|
||||
|
||||
function! s:select_tab(buf_index)
|
||||
" no-op when called in the NERDTree buffer
|
||||
if exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName
|
||||
" no-op when called in 'keymap_ignored_filetypes'
|
||||
if count(get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes',
|
||||
\ ['vimfiler', 'nerdtree']), &ft)
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -177,15 +200,15 @@ function! s:select_tab(buf_index)
|
||||
endfunction
|
||||
|
||||
function! s:jump_to_tab(offset)
|
||||
let l = s:current_visible_buffers
|
||||
let l = airline#extensions#tabline#buflist#list()
|
||||
let i = index(l, bufnr('%'))
|
||||
if i > -1
|
||||
exec 'b!' . l[float2nr(fmod(i + a:offset, len(l)))]
|
||||
exec 'b!' . l[(i + a:offset) % len(l)]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:map_keys()
|
||||
if s:buffer_idx_mode
|
||||
if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1)
|
||||
noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -41,4 +41,3 @@ function! airline#extensions#tabline#buflist#list()
|
||||
let s:current_buffer_list = buffers
|
||||
return buffers
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016 Kevin Sapper
|
||||
" MIT License. Copyright (c) 2016-2018 Kevin Sapper et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -7,12 +7,6 @@ let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
let s:current_tabline = ''
|
||||
|
||||
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
|
||||
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
|
||||
let s:switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0)
|
||||
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#off()
|
||||
augroup airline_tabline_ctrlspace
|
||||
autocmd!
|
||||
@@ -39,6 +33,15 @@ function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_t
|
||||
endif
|
||||
|
||||
let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab)
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if the current buffer no in the buffer list
|
||||
" return false and no redraw tabline.
|
||||
" Fixes #1515. if there a BufEnter autocmd execute redraw. The tabline may no update.
|
||||
let bufnr_list = map(copy(s:buffer_list), 'v:val["index"]')
|
||||
if index(bufnr_list, a:cur_buf) == -1
|
||||
return 0
|
||||
endif
|
||||
|
||||
for buffer in s:buffer_list
|
||||
if a:cur_buf == buffer.index
|
||||
if buffer.modified
|
||||
@@ -64,6 +67,10 @@ function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_t
|
||||
|
||||
call a:builder.add_section_spaced(group, buf_name)
|
||||
endfor
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if the selected buffer was updated
|
||||
" return true
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos)
|
||||
@@ -94,8 +101,15 @@ endfunction
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#get()
|
||||
let cur_buf = bufnr('%')
|
||||
let buffer_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
|
||||
let tab_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
|
||||
let switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0)
|
||||
|
||||
call airline#extensions#tabline#tabs#map_keys()
|
||||
try
|
||||
call airline#extensions#tabline#tabs#map_keys()
|
||||
catch
|
||||
" no-op
|
||||
endtry
|
||||
let s:tab_list = ctrlspace#api#TabList()
|
||||
for tab in s:tab_list
|
||||
if tab.current
|
||||
@@ -110,16 +124,24 @@ function! airline#extensions#tabline#ctrlspace#get()
|
||||
let builder = airline#extensions#tabline#new_builder()
|
||||
|
||||
" Add left tabline content
|
||||
if s:show_buffers == 0
|
||||
if get(g:, 'airline#extensions#tabline#show_buffers', 1) == 0
|
||||
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
|
||||
elseif s:show_tabs == 0
|
||||
call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0)
|
||||
elseif get(g:, 'airline#extensions#tabline#show_tabs', 1) == 0
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if current buffer no in the buffer list, does't update tabline
|
||||
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0
|
||||
return s:current_tabline
|
||||
endif
|
||||
else
|
||||
if s:switch_buffers_and_tabs == 0
|
||||
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
|
||||
call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0)
|
||||
if switch_buffers_and_tabs == 0
|
||||
call builder.add_section_spaced('airline_tabtype', buffer_label)
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if current buffer no in the buffer list, does't update tabline
|
||||
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0
|
||||
return s:current_tabline
|
||||
endif
|
||||
else
|
||||
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
|
||||
call builder.add_section_spaced('airline_tabtype', tab_label)
|
||||
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
|
||||
endif
|
||||
endif
|
||||
@@ -129,17 +151,21 @@ function! airline#extensions#tabline#ctrlspace#get()
|
||||
call builder.add_section('airline_tabfill', '')
|
||||
|
||||
" Add right tabline content
|
||||
if s:show_buffers == 0
|
||||
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
|
||||
elseif s:show_tabs == 0
|
||||
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
|
||||
if get(g:, 'airline#extensions#tabline#show_buffers', 1) == 0
|
||||
call builder.add_section_spaced('airline_tabtype', tab_label)
|
||||
elseif get(g:, 'airline#extensions#tabline#show_tabs', 1) == 0
|
||||
call builder.add_section_spaced('airline_tabtype', buffer_label)
|
||||
else
|
||||
if s:switch_buffers_and_tabs == 0
|
||||
if switch_buffers_and_tabs == 0
|
||||
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1)
|
||||
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
|
||||
call builder.add_section_spaced('airline_tabtype', tab_label)
|
||||
else
|
||||
call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1)
|
||||
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if current buffer no in the buffer list, does't update tabline
|
||||
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1) == 0
|
||||
return s:current_tabline
|
||||
endif
|
||||
call builder.add_section_spaced('airline_tabtype', buffer_label)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#tabline#formatters#jsformatter#format(bufnr, buffers)
|
||||
let buf = bufname(a:bufnr)
|
||||
let filename = fnamemodify(buf, ':t')
|
||||
|
||||
if filename == 'index.js' || filename == 'index.jsx'
|
||||
return fnamemodify(buf, ':p:h:t') . '/i'
|
||||
else
|
||||
return airline#extensions#tabline#formatters#unique_tail_improved#format(a:bufnr, a:buffers)
|
||||
endif
|
||||
endfunction
|
||||
14
autoload/airline/extensions/tabline/formatters/tabnr.vim
Normal file
14
autoload/airline/extensions/tabline/formatters/tabnr.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
" MIT License. Copyright (c) 2017-2018 C.Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#tabline#formatters#tabnr#format(tab_nr_type, nr)
|
||||
if a:tab_nr_type == 0 " nr of splits
|
||||
return (g:airline_symbols.space).'%{len(tabpagebuflist('.a:nr.'))}'
|
||||
elseif a:tab_nr_type == 1 " tab number
|
||||
return (g:airline_symbols.space).a:nr
|
||||
else "== 2 splits and tab number
|
||||
return (g:airline_symbols.space).a:nr.'.%{len(tabpagebuflist('.a:nr.'))}'
|
||||
endif
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -21,8 +21,14 @@ function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffer
|
||||
endif
|
||||
endfor
|
||||
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.')
|
||||
for nr in values(duplicates)
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.'))
|
||||
let fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
|
||||
if fnamecollapse
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g'))
|
||||
else
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), fmod))
|
||||
endif
|
||||
endfor
|
||||
|
||||
if has_key(map, a:bufnr)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" 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)
|
||||
let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
|
||||
let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X')
|
||||
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
|
||||
let s:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1)
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
let s:current_modified = 0
|
||||
@@ -36,16 +28,30 @@ endfunction
|
||||
function! airline#extensions#tabline#tabs#get()
|
||||
let curbuf = bufnr('%')
|
||||
let curtab = tabpagenr()
|
||||
call airline#extensions#tabline#tabs#map_keys()
|
||||
try
|
||||
call airline#extensions#tabline#tabs#map_keys()
|
||||
catch
|
||||
" no-op
|
||||
endtry
|
||||
if curbuf == s:current_bufnr && curtab == s:current_tabnr
|
||||
if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified
|
||||
return s:current_tabline
|
||||
endif
|
||||
endif
|
||||
|
||||
let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
|
||||
for i in range(1, tabpagenr('$'))
|
||||
call airline#extensions#tabline#add_label(b, 'tabs')
|
||||
" always have current tabpage first
|
||||
let tablist = range(1, tabpagenr('$'))
|
||||
if get(g:, 'airline#extensions#tabline#current_first', 0)
|
||||
if index(tablist, curtab) > -1
|
||||
call remove(tablist, index(tablist, curtab))
|
||||
endif
|
||||
let tablist = [curtab] + tablist
|
||||
endif
|
||||
for i in tablist
|
||||
if i == curtab
|
||||
let group = 'airline_tabsel'
|
||||
if g:airline_detect_modified
|
||||
@@ -60,14 +66,9 @@ function! airline#extensions#tabline#tabs#get()
|
||||
let group = 'airline_tab'
|
||||
endif
|
||||
let val = '%('
|
||||
if s:show_tab_nr
|
||||
if s:tab_nr_type == 0
|
||||
let val .= (g:airline_symbols.space).'%{len(tabpagebuflist('.i.'))}'
|
||||
elseif s:tab_nr_type == 1
|
||||
let val .= (g:airline_symbols.space).i
|
||||
else "== 2
|
||||
let val .= (g:airline_symbols.space).i.'.%{len(tabpagebuflist('.i.'))}'
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||
let val .= airline#extensions#tabline#tabs#tabnr_formatter(tab_nr_type, i)
|
||||
endif
|
||||
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)')
|
||||
endfor
|
||||
@@ -76,18 +77,18 @@ function! airline#extensions#tabline#tabs#get()
|
||||
call b.split()
|
||||
call b.add_section('airline_tabfill', '')
|
||||
|
||||
if s:show_close_button
|
||||
call b.add_section('airline_tab_right', ' %999X'.s:close_symbol.' ')
|
||||
if get(g:, 'airline#extensions#tabline#show_close_button', 1)
|
||||
call b.add_section('airline_tab_right', ' %999X'.
|
||||
\ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ')
|
||||
endif
|
||||
|
||||
if s:show_splits == 1
|
||||
if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1
|
||||
let buffers = tabpagebuflist(curtab)
|
||||
for nr in buffers
|
||||
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
|
||||
call b.add_section_spaced('airline_tabtype', s:tabs_label)
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
endif
|
||||
|
||||
let s:current_bufnr = curbuf
|
||||
@@ -97,6 +98,9 @@ function! airline#extensions#tabline#tabs#get()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#map_keys()
|
||||
if exists("s:airline_tabline_map_key")
|
||||
return
|
||||
endif
|
||||
noremap <silent> <Plug>AirlineSelectTab1 :1tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR>
|
||||
@@ -109,4 +113,10 @@ function! airline#extensions#tabline#tabs#map_keys()
|
||||
noremap <silent> <Plug>AirlineSelectPrevTab gT
|
||||
" tabn {count} goes to count tab does not go {count} tab pages forward!
|
||||
noremap <silent> <Plug>AirlineSelectNextTab :<C-U>exe repeat(':tabn\|', v:count1)<cr>
|
||||
let s:airline_tabline_map_key = 1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i)
|
||||
let formatter = get(g:, 'airline#extensions#tabline#tabnr_formatter', 'tabnr')
|
||||
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, a:i)
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -9,6 +9,7 @@ endif
|
||||
|
||||
let s:flags = get(g:, 'airline#extensions#tagbar#flags', '')
|
||||
let s:spc = g:airline_symbols.space
|
||||
let s:init=0
|
||||
|
||||
" Arguments: current, sort, fname
|
||||
function! airline#extensions#tagbar#get_status(...)
|
||||
@@ -29,7 +30,18 @@ let s:airline_tagbar_last_lookup_time = 0
|
||||
let s:airline_tagbar_last_lookup_val = ''
|
||||
function! airline#extensions#tagbar#currenttag()
|
||||
if get(w:, 'airline_active', 0)
|
||||
if s:airline_tagbar_last_lookup_time != localtime()
|
||||
if !s:init
|
||||
try
|
||||
" try to load the plugin, if filetypes are disabled,
|
||||
" this will cause an error, so try only once
|
||||
let a=tagbar#currenttag('%', '', '')
|
||||
catch
|
||||
endtry
|
||||
unlet! a
|
||||
let s:init=1
|
||||
endif
|
||||
" function tagbar#currenttag does not exist, if filetype is not enabled
|
||||
if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag")
|
||||
let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags)
|
||||
let s:airline_tagbar_last_lookup_time = localtime()
|
||||
endif
|
||||
@@ -44,4 +56,3 @@ function! airline#extensions#tagbar#init(ext)
|
||||
|
||||
call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag')
|
||||
endfunction
|
||||
|
||||
|
||||
22
autoload/airline/extensions/term.vim
Normal file
22
autoload/airline/extensions/term.vim
Normal file
@@ -0,0 +1,22 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#term#apply(...)
|
||||
if &buftype == 'terminal'
|
||||
let spc = g:airline_symbols.space
|
||||
|
||||
call a:1.add_section('airline_a', spc.'TERMINAL'.spc)
|
||||
call a:1.add_section('airline_b', '')
|
||||
call a:1.add_section('airline_c', spc.'%f')
|
||||
call a:1.split()
|
||||
call a:1.add_section('airline_y', '')
|
||||
call a:1.add_section('airline_z', spc.airline#section#create_right(['linenr', 'maxlinenr']))
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#term#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#term#apply')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -25,4 +25,3 @@ function! airline#extensions#tmuxline#set_tmux_colors(palette)
|
||||
call tmuxline#api#snapshot(s:tmuxline_snapshot_file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -26,4 +26,3 @@ endfunction
|
||||
function! airline#extensions#undotree#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#undotree#apply')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -14,7 +14,7 @@ function! airline#extensions#unicode#apply(...)
|
||||
\ 'accent': 'bold' })
|
||||
let w:airline_section_a = airline#section#create(['unicode'])
|
||||
let w:airline_section_b = ''
|
||||
let w:airline_section_c = ''
|
||||
let w:airline_section_c = ' '
|
||||
let w:airline_section_y = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -22,4 +22,3 @@ function! airline#extensions#unite#init(ext)
|
||||
let g:unite_force_overwrite_statusline = 0
|
||||
call a:ext.add_statusline_func('airline#extensions#unite#apply')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016 Jerome Reybert
|
||||
" MIT License. Copyright (c) 2016-2018 Jerome Reybert et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" This plugin replace the whole section_a when in vimagit buffer
|
||||
@@ -13,14 +13,18 @@ function! airline#extensions#vimagit#init(ext)
|
||||
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 "???"
|
||||
if ( exists("*magit#get_current_mode") )
|
||||
return magit#get_current_mode()
|
||||
else
|
||||
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 "???"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimagit#apply(...)
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" This plugin replace the whole section_a when in vimagit buffer
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
@@ -78,4 +82,3 @@ function! airline#extensions#vimtex#get_scope()
|
||||
endif
|
||||
return l:status
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
|
||||
@@ -9,18 +9,12 @@ 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', '[%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' ])
|
||||
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
|
||||
|
||||
function! s:check_mixed_indent()
|
||||
if s:indent_algo == 1
|
||||
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
|
||||
if indent_algo == 1
|
||||
" [<tab>]<space><tab>
|
||||
" spaces before or between tabs are not allowed
|
||||
let t_s_t = '(^\t* +\t\s*\S)'
|
||||
@@ -28,7 +22,7 @@ function! s:check_mixed_indent()
|
||||
" count of spaces at the end of tabs should be less than tabstop value
|
||||
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
|
||||
return search('\v' . t_s_t . '|' . t_l_s, 'nw')
|
||||
elseif s:indent_algo == 2
|
||||
elseif indent_algo == 2
|
||||
return search('\v(^\t* +\t\s*\S)', 'nw')
|
||||
else
|
||||
return search('\v(^\t+ +)|(^ +\t+)', 'nw')
|
||||
@@ -36,7 +30,9 @@ function! s:check_mixed_indent()
|
||||
endfunction
|
||||
|
||||
function! s:check_mixed_indent_file()
|
||||
if index(s:c_like_langs, &ft) > -1
|
||||
let c_like_langs = get(g:, 'airline#extensions#c_like_langs',
|
||||
\ [ 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ])
|
||||
if index(c_like_langs, &ft) > -1
|
||||
" for C-like languages: allow /** */ comment style with one space before the '*'
|
||||
let head_spc = '\v(^ +\*@!)'
|
||||
else
|
||||
@@ -52,7 +48,8 @@ function! s:check_mixed_indent_file()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#check()
|
||||
if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines
|
||||
let max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
|
||||
if &readonly || !&modifiable || !s:enabled || line('$') > max_lines
|
||||
\ || get(b:, 'airline_whitespace_disabled', 0)
|
||||
return ''
|
||||
endif
|
||||
@@ -67,7 +64,7 @@ function! airline#extensions#whitespace#check()
|
||||
let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$')
|
||||
let trailing = search(regexp, 'nw')
|
||||
catch
|
||||
echomsg 'airline#whitespace: error occured evaluating '. regexp
|
||||
echomsg 'airline#whitespace: error occurred evaluating '. regexp
|
||||
echomsg v:exception
|
||||
return ''
|
||||
endtry
|
||||
@@ -100,16 +97,20 @@ function! airline#extensions#whitespace#check()
|
||||
|
||||
if s:show_message
|
||||
if trailing != 0
|
||||
let b:airline_whitespace_check .= space.printf(s:trailing_format, trailing)
|
||||
let trailing_fmt = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing')
|
||||
let b:airline_whitespace_check .= space.printf(trailing_fmt, trailing)
|
||||
endif
|
||||
if mixed != 0
|
||||
let b:airline_whitespace_check .= space.printf(s:mixed_indent_format, mixed)
|
||||
let mixed_indent_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent')
|
||||
let b:airline_whitespace_check .= space.printf(mixed_indent_fmt, mixed)
|
||||
endif
|
||||
if long != 0
|
||||
let b:airline_whitespace_check .= space.printf(s:long_format, long)
|
||||
let long_fmt = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long')
|
||||
let b:airline_whitespace_check .= space.printf(long_fmt, long)
|
||||
endif
|
||||
if !empty(mixed_file)
|
||||
let b:airline_whitespace_check .= space.printf(s:mixed_indent_file_format, mixed_file)
|
||||
let mixed_indent_file_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', '[%s]mix-indent-file')
|
||||
let b:airline_whitespace_check .= space.printf(mixed_indent_file_fmt, mixed_file)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -26,4 +27,3 @@ function! airline#extensions#windowswap#get_status()
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#wordcount#formatters#default#format()
|
||||
let fmt = get(g:, 'airline#extensions#wordcount#formatter#default#fmt', '%s words')
|
||||
let fmt_short = get(g:, 'airline#extensions#wordcount#formatter#default#fmt_short', fmt == '%s words' ? '%sW' : fmt)
|
||||
let words = string(s:wordcount())
|
||||
if empty(words)
|
||||
return
|
||||
@@ -15,9 +17,9 @@ function! airline#extensions#wordcount#formatters#default#format()
|
||||
" 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
|
||||
let result = printf(fmt, words). result
|
||||
else
|
||||
let result = printf("%s%s", words, "W"). result
|
||||
let result = printf(fmt_short, words). result
|
||||
endif
|
||||
return result
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017 YoungHoon Rhiu.
|
||||
" MIT License. Copyright (c) 2017-2018 YoungHoon Rhiu et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -22,4 +22,3 @@ endfunction
|
||||
function! airline#extensions#xkblayout#init(ext)
|
||||
call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2015 Evgeny Firsov.
|
||||
" MIT License. Copyright (c) 2015-2018 Evgeny Firsov et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -35,4 +35,3 @@ function! airline#extensions#ycm#get_warning_count()
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -10,6 +10,7 @@ let s:is_win32term = (has('win32') || has('win64')) &&
|
||||
|
||||
let s:separators = {}
|
||||
let s:accents = {}
|
||||
let s:hl_groups = {}
|
||||
|
||||
function! s:gui2cui(rgb, fallback)
|
||||
if a:rgb == ''
|
||||
@@ -41,19 +42,35 @@ function! s:get_syn(group, what)
|
||||
endfunction
|
||||
|
||||
function! s:get_array(fg, bg, opts)
|
||||
let opts=empty(a:opts) ? '' : join(a:opts, ',')
|
||||
return g:airline_gui_mode ==# 'gui'
|
||||
\ ? [ a:fg, a:bg, '', '', join(a:opts, ',') ]
|
||||
\ : [ '', '', a:fg, a:bg, join(a:opts, ',') ]
|
||||
\ ? [ a:fg, a:bg, '', '', opts ]
|
||||
\ : [ '', '', a:fg, a:bg, opts ]
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#reset_hlcache()
|
||||
let s:hl_groups = {}
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#get_highlight(group, ...)
|
||||
let fg = s:get_syn(a:group, 'fg')
|
||||
let bg = s:get_syn(a:group, 'bg')
|
||||
let reverse = g:airline_gui_mode ==# 'gui'
|
||||
\ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui')
|
||||
\ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
|
||||
\|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term')
|
||||
return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000)
|
||||
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group)
|
||||
return s:hl_groups[a:group]
|
||||
else
|
||||
let fg = s:get_syn(a:group, 'fg')
|
||||
let bg = s:get_syn(a:group, 'bg')
|
||||
let reverse = g:airline_gui_mode ==# 'gui'
|
||||
\ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui')
|
||||
\ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
|
||||
\|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term')
|
||||
let bold = synIDattr(synIDtrans(hlID(a:group)), 'bold')
|
||||
let opts = a:000
|
||||
if bold
|
||||
let opts = ['bold']
|
||||
endif
|
||||
let res = reverse ? s:get_array(bg, fg, opts) : s:get_array(fg, bg, opts)
|
||||
endif
|
||||
let s:hl_groups[a:group] = res
|
||||
return res
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#get_highlight2(fg, bg, ...)
|
||||
@@ -84,14 +101,22 @@ function! airline#highlighter#exec(group, colors)
|
||||
if len(colors) == 4
|
||||
call add(colors, '')
|
||||
endif
|
||||
if g:airline_gui_mode ==# 'gui'
|
||||
let new_hi = [colors[0], colors[1], '', '', colors[4]]
|
||||
else
|
||||
let new_hi = ['', '', printf("%s", colors[2]), printf("%s", colors[3]), colors[4]]
|
||||
endif
|
||||
let colors = s:CheckDefined(colors)
|
||||
if old_hi != colors || !s:hl_group_exists(a:group)
|
||||
if old_hi != new_hi || !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=', ''))
|
||||
\ 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
|
||||
if has_key(s:hl_groups, a:group)
|
||||
let s:hl_groups[a:group] = colors
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -127,11 +152,12 @@ function! s:CheckDefined(colors)
|
||||
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)
|
||||
else
|
||||
function! s:Get(dict, key, prefix)
|
||||
let res=get(a:dict, a:key, '')
|
||||
if res is ''
|
||||
return ''
|
||||
else
|
||||
return a:prefix. res
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -197,6 +223,11 @@ function! airline#highlighter#highlight(modes, ...)
|
||||
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
|
||||
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
|
||||
for mode in mapped
|
||||
if mode == 'inactive' && winnr('$') == 1
|
||||
" there exist no inactive windows, don't need to create all those
|
||||
" highlighting groups
|
||||
continue
|
||||
endif
|
||||
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
|
||||
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
|
||||
for kvp in items(dict)
|
||||
@@ -234,4 +265,3 @@ function! airline#highlighter#highlight(modes, ...)
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -18,13 +18,14 @@ function! airline#init#bootstrap()
|
||||
|
||||
let g:airline#init#bootstrapping = 1
|
||||
|
||||
let g:airline#util#async = v:version >= 800 && has('job')
|
||||
let g:airline#util#is_windows = has('win32') || has('win64')
|
||||
let g:airline#init#vim_async = (v:version >= 800 && has('job'))
|
||||
let g:airline#init#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_spelllang', 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'])
|
||||
@@ -68,7 +69,8 @@ function! airline#init#bootstrap()
|
||||
\ 'paste': 'PASTE',
|
||||
\ 'spell': 'SPELL',
|
||||
\ 'modified': '+',
|
||||
\ 'space': ' '
|
||||
\ 'space': ' ',
|
||||
\ 'keymap': 'Keymap:'
|
||||
\ }, 'keep')
|
||||
|
||||
if get(g:, 'airline_powerline_fonts', 0)
|
||||
@@ -148,6 +150,7 @@ function! airline#init#bootstrap()
|
||||
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count'])
|
||||
call airline#parts#define_text('capslock', '')
|
||||
call airline#parts#define_text('xkblayout', '')
|
||||
call airline#parts#define_text('keymap', '')
|
||||
|
||||
unlet g:airline#init#bootstrapping
|
||||
endfunction
|
||||
@@ -161,7 +164,7 @@ 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', 'spell', 'capslock', 'xkblayout', 'iminsert'])
|
||||
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'keymap', 'spell', 'capslock', 'xkblayout', 'iminsert'])
|
||||
endif
|
||||
if !exists('g:airline_section_b')
|
||||
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -65,7 +65,17 @@ function! airline#parts#paste()
|
||||
endfunction
|
||||
|
||||
function! airline#parts#spell()
|
||||
return g:airline_detect_spell && &spell ? g:airline_symbols.spell : ''
|
||||
let spelllang = g:airline_detect_spelllang ? printf(" [%s]", toupper(substitute(&spelllang, ',', '/', 'g'))) : ''
|
||||
if g:airline_detect_spell && &spell
|
||||
if winwidth(0) >= 90
|
||||
return g:airline_symbols.spell . spelllang
|
||||
elseif winwidth(0) >= 70
|
||||
return g:airline_symbols.spell
|
||||
else
|
||||
return split(g:airline_symbols.spell, '\zs')[0]
|
||||
endif
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#parts#iminsert()
|
||||
@@ -76,7 +86,7 @@ function! airline#parts#iminsert()
|
||||
endfunction
|
||||
|
||||
function! airline#parts#readonly()
|
||||
if &readonly && &modifiable && !filereadable(bufname('%'))
|
||||
if &readonly && !filereadable(bufname('%'))
|
||||
return '[noperm]'
|
||||
else
|
||||
return &readonly ? g:airline_symbols.readonly : ''
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -82,4 +82,3 @@ endfunction
|
||||
function! airline#section#create_right(parts)
|
||||
return s:create(a:parts, -1)
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -44,6 +44,10 @@ function! airline#themes#patch(palette)
|
||||
if !has_key(a:palette[mode], 'airline_error')
|
||||
let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
|
||||
endif
|
||||
if !has_key(a:palette[mode], 'airline_term')
|
||||
"let a:palette[mode]['airline_term'] = [ '#9cffd3', '#202020', 85, 232]
|
||||
let a:palette[mode]['airline_term'] = airline#highlighter#get_highlight('airline_c')
|
||||
endif
|
||||
endfor
|
||||
|
||||
let a:palette.accents = get(a:palette, 'accents', {})
|
||||
@@ -70,4 +74,3 @@ function! airline#themes#patch(palette)
|
||||
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,39 +1,92 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 tw=80
|
||||
|
||||
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
|
||||
" readable string. The following is a list currently supported modes: normal,
|
||||
" insert, replace, visual, and inactive.
|
||||
" Airline themes are generated based on the following concepts:
|
||||
" * The section of the status line, valid Airline statusline sections are:
|
||||
" * airline_a (left most section)
|
||||
" * airline_b (section just to the right of airline_a)
|
||||
" * airline_c (section just to the right of airline_b)
|
||||
" * airline_x (first section of the right most sections)
|
||||
" * airline_y (section just to the right of airline_x)
|
||||
" * airline_z (right most section)
|
||||
" * The mode of the buffer, as reported by the :mode() function. Airline
|
||||
" converts the values reported by mode() to the following:
|
||||
" * normal
|
||||
" * insert
|
||||
" * replace
|
||||
" * visual
|
||||
" * inactive
|
||||
" The last one is actually no real mode as returned by mode(), but used by
|
||||
" airline to style inactive statuslines (e.g. windows, where the cursor
|
||||
" currently does not reside in).
|
||||
" * In addition to each section and mode specified above, airline themes
|
||||
" can also specify overrides. Overrides can be provided for the following
|
||||
" scenarios:
|
||||
" * 'modified'
|
||||
" * 'paste'
|
||||
"
|
||||
" Each mode can also have overrides. These are small changes to the mode that
|
||||
" don't require a completely different look. "modified" and "paste" are two
|
||||
" such supported overrides. These are simply suffixed to the major mode,
|
||||
" separated by an underscore. For example, "normal_modified" would be normal
|
||||
" mode where the current buffer is modified.
|
||||
" Airline themes are specified as a global viml dictionary using the above
|
||||
" sections, modes and overrides as keys to the dictionary. The name of the
|
||||
" dictionary is significant and should be specified as:
|
||||
" * g:airline#themes#<theme_name>#palette
|
||||
" where <theme_name> is substituted for the name of the theme.vim file where the
|
||||
" theme definition resides. Airline themes should reside somewhere on the
|
||||
" 'runtimepath' where it will be loaded at vim startup, for example:
|
||||
" * autoload/airline/themes/theme_name.vim
|
||||
"
|
||||
" The theming algorithm is a 2-pass system where the mode will draw over all
|
||||
" parts of the statusline, and then the override is applied after. This means
|
||||
" it is possible to specify a subset of the theme in overrides, as it will
|
||||
" simply overwrite the previous colors. If you want simultaneous overrides,
|
||||
" then they will need to change different parts of the statusline so they do
|
||||
" not conflict with each other.
|
||||
"
|
||||
" First, let's define an empty dictionary and assign it to the "palette"
|
||||
" variable. The # is a separator that maps with the directory structure. If
|
||||
" you get this wrong, Vim will complain loudly.
|
||||
" For this, the dark.vim, theme, this is defined as
|
||||
let g:airline#themes#dark#palette = {}
|
||||
|
||||
" First let's define some arrays. The s: is just a VimL thing for scoping the
|
||||
" variables to the current script. Without this, these variables would be
|
||||
" declared globally. Now let's declare some colors for normal mode and add it
|
||||
" to the dictionary. The array is in the format:
|
||||
" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid
|
||||
" values for the "opt" value.
|
||||
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
|
||||
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
|
||||
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
|
||||
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
" Keys in the dictionary are composed of the mode, and if specified the
|
||||
" override. For example:
|
||||
" * g:airline#themes#dark#palette.normal
|
||||
" * the colors for a statusline while in normal mode
|
||||
" * g:airline#themes#dark#palette.normal_modified
|
||||
" * the colors for a statusline while in normal mode when the buffer has
|
||||
" been modified
|
||||
" * g:airline#themes#dark#palette.visual
|
||||
" * the colors for a statusline while in visual mode
|
||||
"
|
||||
" Values for each dictionary key is an array of color values that should be
|
||||
" familiar for colorscheme designers:
|
||||
" * [guifg, guibg, ctermfg, ctermbg, opts]
|
||||
" See "help attr-list" for valid values for the "opt" value.
|
||||
"
|
||||
" Each theme must provide an array of such values for each airline section of
|
||||
" the statusline (airline_a through airline_z). A convenience function,
|
||||
" airline#themes#generate_color_map() exists to mirror airline_a/b/c to
|
||||
" airline_x/y/z, respectively.
|
||||
|
||||
" The dark.vim theme:
|
||||
let s:airline_a_normal = [ '#00005f' , '#dfff00' , 17 , 190 ]
|
||||
let s:airline_b_normal = [ '#ffffff' , '#444444' , 255 , 238 ]
|
||||
let s:airline_c_normal = [ '#9cffd3' , '#202020' , 85 , 234 ]
|
||||
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:airline_a_normal, s:airline_b_normal, s:airline_c_normal)
|
||||
|
||||
" It should be noted the above is equivalent to:
|
||||
" let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(
|
||||
" \ [ '#00005f' , '#dfff00' , 17 , 190 ], " section airline_a
|
||||
" \ [ '#ffffff' , '#444444' , 255 , 238 ], " section airline_b
|
||||
" \ [ '#9cffd3' , '#202020' , 85 , 234 ] " section airline_c
|
||||
" \)
|
||||
"
|
||||
" In turn, that is equivalent to:
|
||||
" let g:airline#themes#dark#palette.normal = {
|
||||
" \ 'airline_a': [ '#00005f' , '#dfff00' , 17 , 190 ], "section airline_a
|
||||
" \ 'airline_b': [ '#ffffff' , '#444444' , 255 , 238 ], "section airline_b
|
||||
" \ 'airline_c': [ '#9cffd3' , '#202020' , 85 , 234 ], "section airline_c
|
||||
" \ 'airline_x': [ '#9cffd3' , '#202020' , 85 , 234 ], "section airline_x
|
||||
" \ 'airline_y': [ '#ffffff' , '#444444' , 255 , 238 ], "section airline_y
|
||||
" \ 'airline_z': [ '#00005f' , '#dfff00' , 17 , 190 ] "section airline_z
|
||||
" \}
|
||||
"
|
||||
" airline#themes#generate_color_map() also uses the values provided as
|
||||
" parameters to create intermediary groups such as:
|
||||
" airline_a_to_airline_b
|
||||
" airline_b_to_airline_c
|
||||
" etc...
|
||||
|
||||
" Here we define overrides for when the buffer is modified. This will be
|
||||
" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are
|
||||
@@ -43,36 +96,36 @@ let g:airline#themes#dark#palette.normal_modified = {
|
||||
\ }
|
||||
|
||||
|
||||
let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ]
|
||||
let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ]
|
||||
let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ]
|
||||
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let s:airline_a_insert = [ '#00005f' , '#00dfff' , 17 , 45 ]
|
||||
let s:airline_b_insert = [ '#ffffff' , '#005fff' , 255 , 27 ]
|
||||
let s:airline_c_insert = [ '#ffffff' , '#000080' , 15 , 17 ]
|
||||
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:airline_a_insert, s:airline_b_insert, s:airline_c_insert)
|
||||
let g:airline#themes#dark#palette.insert_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#dark#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
|
||||
\ 'airline_a': [ s:airline_a_insert[0] , '#d78700' , s:airline_a_insert[2] , 172 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert)
|
||||
let g:airline#themes#dark#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ]
|
||||
let g:airline#themes#dark#palette.replace.airline_a = [ s:airline_b_insert[0] , '#af0000' , s:airline_b_insert[2] , 124 , '' ]
|
||||
let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified
|
||||
|
||||
|
||||
let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ]
|
||||
let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ]
|
||||
let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ]
|
||||
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let s:airline_a_visual = [ '#000000' , '#ffaf00' , 232 , 214 ]
|
||||
let s:airline_b_visual = [ '#000000' , '#ff5f00' , 232 , 202 ]
|
||||
let s:airline_c_visual = [ '#ffffff' , '#5f0000' , 15 , 52 ]
|
||||
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:airline_a_visual, s:airline_b_visual, s:airline_c_visual)
|
||||
let g:airline#themes#dark#palette.visual_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
|
||||
let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
|
||||
let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
|
||||
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
|
||||
let s:airline_a_inactive = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
|
||||
let s:airline_b_inactive = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
|
||||
let s:airline_c_inactive = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
|
||||
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:airline_a_inactive, s:airline_b_inactive, s:airline_c_inactive)
|
||||
let g:airline#themes#dark#palette.inactive_modified = {
|
||||
\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
|
||||
\ }
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" TODO: Try to cache winwidth(0) function
|
||||
" e.g. store winwidth per window and access that, only update it, if the size
|
||||
" actually changed.
|
||||
scriptencoding utf-8
|
||||
|
||||
call airline#init#bootstrap()
|
||||
@@ -83,31 +86,3 @@ else
|
||||
return 0
|
||||
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
|
||||
|
||||
154
doc/airline.txt
154
doc/airline.txt
@@ -32,9 +32,8 @@ 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.
|
||||
When the plugin is correctly loaded, 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: >
|
||||
@@ -131,6 +130,10 @@ values):
|
||||
|
||||
* enable spell detection >
|
||||
let g:airline_detect_spell=1
|
||||
|
||||
* display spelling language when spell detection is enabled
|
||||
(if enough space is available) >
|
||||
let g:airline_detect_spelllang=1
|
||||
<
|
||||
* enable iminsert detection >
|
||||
let g:airline_detect_iminsert=0
|
||||
@@ -207,6 +210,10 @@ values):
|
||||
the same name (in the correct window): >
|
||||
let w:airline_skip_empty_sections = 0
|
||||
<
|
||||
* Caches the changes to the highlighting groups, should therefore be faster.
|
||||
Set this to one, if you experience a sluggish Vim: >
|
||||
let g:airline_highlighting_cache = 0
|
||||
<
|
||||
==============================================================================
|
||||
COMMANDS *airline-commands*
|
||||
|
||||
@@ -253,11 +260,12 @@ its contents. >
|
||||
let g:airline_right_sep = '«'
|
||||
let g:airline_right_sep = '◀'
|
||||
let g:airline_symbols.crypt = '🔒'
|
||||
let g:airline_symbols.linenr = '☰'
|
||||
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.maxlinenr = '㏑'
|
||||
let g:airline_symbols.branch = '⎇'
|
||||
let g:airline_symbols.paste = 'ρ'
|
||||
let g:airline_symbols.paste = 'Þ'
|
||||
@@ -273,7 +281,8 @@ its contents. >
|
||||
let g:airline_right_alt_sep = ''
|
||||
let g:airline_symbols.branch = ''
|
||||
let g:airline_symbols.readonly = ''
|
||||
let g:airline_symbols.linenr = ''
|
||||
let g:airline_symbols.linenr = '☰'
|
||||
let g:airline_symbols.maxlinenr = ''
|
||||
|
||||
" old vim-powerline symbols
|
||||
let g:airline_left_sep = '⮀'
|
||||
@@ -297,7 +306,7 @@ section.
|
||||
variable names default contents
|
||||
----------------------------------------------------------------------------
|
||||
let g:airline_section_a (mode, crypt, paste, spell, iminsert)
|
||||
let g:airline_section_b (hunks, branch)
|
||||
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)
|
||||
@@ -306,6 +315,9 @@ section.
|
||||
let g:airline_section_error (ycm_error_count, syntastic-err, eclim)
|
||||
let g:airline_section_warning (ycm_warning_count, syntastic-warn, whitespace)
|
||||
|
||||
" [*] This section needs at least the fugitive extension or else
|
||||
" it will remain empty
|
||||
"
|
||||
" here is an example of how you could replace the branch indicator with
|
||||
" the current working directory (limited to 10 characters),
|
||||
" followed by the filename.
|
||||
@@ -391,6 +403,13 @@ vim-bufferline <https://github.com/bling/vim-bufferline>
|
||||
* determine whether bufferline will overwrite customization variables >
|
||||
let g:airline#extensions#bufferline#overwrite_variables = 1
|
||||
<
|
||||
------------------------------------- *airline-fugitiveline*
|
||||
This extension hides the fugitive://**// part of the buffer names, to only
|
||||
show the file name as if it were in the current working tree.
|
||||
|
||||
* enable/disable bufferline integration >
|
||||
let g:airline#extensions#fugitiveline#enabled = 1
|
||||
<
|
||||
------------------------------------- *airline-branch*
|
||||
|
||||
vim-airline will display the branch-indicator together with the branch name in
|
||||
@@ -437,6 +456,9 @@ notexists symbol will be displayed after the branch name.
|
||||
return '[' . a:name . ']'
|
||||
endfunction
|
||||
<
|
||||
* truncate sha1 commits at this number of characters >
|
||||
let g:airline#extensions#branch#sha1_len = 10
|
||||
<
|
||||
------------------------------------- *airline-syntastic*
|
||||
syntastic <https://github.com/vim-syntastic/syntastic>
|
||||
|
||||
@@ -450,9 +472,15 @@ syntastic <https://github.com/vim-syntastic/syntastic>
|
||||
* syntastic error_symbol >
|
||||
let airline#extensions#syntastic#error_symbol = 'E:'
|
||||
<
|
||||
* syntastic statusline error format (see |syntastic_stl_format|) >
|
||||
let airline#extensions#syntastic#stl_format_err = '%E{[%e(#%fe)]}'
|
||||
|
||||
* syntastic warning >
|
||||
let airline#extensions#syntastic#warning_symbol = 'W:'
|
||||
<
|
||||
* syntastic statusline warning format (see |syntastic_stl_format|) >
|
||||
let airline#extensions#syntastic#stl_format_err = '%W{[%w(#%fw)]}'
|
||||
<
|
||||
------------------------------------- *airline-tagbar*
|
||||
tagbar <https://github.com/majutsushi/tagbar>
|
||||
|
||||
@@ -497,7 +525,7 @@ vimagit <https://github.com/jreybert/vimagit>
|
||||
let g:airline#extensions#vimagit#enabled = 1
|
||||
<
|
||||
------------------------------------- *airline-ctrlp*
|
||||
ctrlp <https://github.com/kien/ctrlp.vim>
|
||||
ctrlp <https://github.com/ctrlpvim/ctrlp.vim>
|
||||
|
||||
* configure which mode colors should ctrlp window use (takes effect
|
||||
only if the active airline theme doesn't define ctrlp colors) >
|
||||
@@ -543,14 +571,18 @@ eclim <https://eclim.org>
|
||||
" create a file in the dir autoload/airline/extensions/wordcount/formatters/
|
||||
" called foo.vim
|
||||
" this example needs at least Vim > 7.4.1042
|
||||
function! airline#extensions#wordcount#formatters#foo#format()
|
||||
function! airline#extensions#wordcount#formatters#foo#format(format,fmt)
|
||||
return (wordcount()['words'] == 0 ? 'NONE' :
|
||||
\ 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'
|
||||
* defines how to display the wordcount statistics for the default formatter: >
|
||||
" Defaults are below. If fmt_short isn't defined, fmt is used.
|
||||
" '%s' will be substituted by the word count
|
||||
" fmt_short is displayed when window width is less than 80
|
||||
let g:airline#extensions#wordcount#formatter#default#fmt = '%s words'
|
||||
let g:airline#extensions#wordcount#formatter#default#fmt_short = '%sW'
|
||||
<
|
||||
------------------------------------- *airline-whitespace*
|
||||
* enable/disable detection of whitespace errors. >
|
||||
@@ -618,25 +650,32 @@ eclim <https://eclim.org>
|
||||
Note: If you're using the ctrlspace tabline only the option marked with (c)
|
||||
are supported!
|
||||
|
||||
* enable/disable enhanced tabline. (c)
|
||||
* enable/disable enhanced tabline. (c) >
|
||||
let g:airline#extensions#tabline#enabled = 0
|
||||
|
||||
* enable/disable displaying open splits per tab (only when tabs are opened). >
|
||||
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)
|
||||
* 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)
|
||||
* if you want to show the current active buffer like this:
|
||||
----------------------
|
||||
buffer <buffer> buffer `
|
||||
>
|
||||
let g:airline#extensions#tabline#alt_sep = 1
|
||||
< Only makes sense, if g:airline_right_sep is not empty.
|
||||
default: 0
|
||||
|
||||
* enable/disable displaying tabs, regardless of number. (c) >
|
||||
let g:airline#extensions#tabline#show_tabs = 1
|
||||
<
|
||||
* configure filename match rules to exclude from the tabline. >
|
||||
@@ -649,22 +688,30 @@ with the middle mouse button to delete that buffer.
|
||||
let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default)
|
||||
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
|
||||
let g:airline#extensions#tabline#tab_nr_type = 2 " splits and tab number
|
||||
let g:airline#extensions#tabline#tabnr_formatter = 'tabnr'
|
||||
|
||||
Note: last option can be used to specify a different formatter for
|
||||
displaying the numbers. By default tabline/formatter/tabnr.vim is used
|
||||
<
|
||||
* enable/disable displaying tab number in tabs mode. >
|
||||
let g:airline#extensions#tabline#show_tab_nr = 1
|
||||
|
||||
* enable/disable displaying tab type (far right) >
|
||||
* enable/disable displaying tab type (e.g. [buffers]/[tabs]) >
|
||||
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)
|
||||
* show buffer label at first position: >
|
||||
let g:airline#extensions#tabline#buf_label_first = 1
|
||||
|
||||
* rename label for buffers (default: 'buffers') (c)
|
||||
* rename label for buffers (default: 'buffers') (c) >
|
||||
let g:airline#extensions#tabline#buffers_label = 'b'
|
||||
|
||||
* rename label for tabs (default: 'tabs') (c)
|
||||
* rename label for tabs (default: 'tabs') (c) >
|
||||
let g:airline#extensions#tabline#tabs_label = 't'
|
||||
|
||||
* always show current tabpage/buffer first >
|
||||
let airline#extensions#tabline#current_first = 1
|
||||
< default: 0
|
||||
|
||||
* enable/disable displaying index of the buffer.
|
||||
|
||||
When enabled, numbers will be displayed in the tabline and mappings will be
|
||||
@@ -683,14 +730,17 @@ with the middle mouse button to delete that buffer.
|
||||
nmap <leader>9 <Plug>AirlineSelectTab9
|
||||
nmap <leader>- <Plug>AirlineSelectPrevTab
|
||||
nmap <leader>+ <Plug>AirlineSelectNextTab
|
||||
|
||||
Note: Mappings will be ignored within a NERDTree buffer.
|
||||
<
|
||||
Note: Mappings will be ignored within "g:airline#extensions#tabline#keymap_ignored_filetypes".
|
||||
|
||||
Note: In buffer_idx_mode these mappings won't change the
|
||||
current tab, but switch to the buffer visible in that tab.
|
||||
Use |gt| for switching tabs.
|
||||
In tabmode, those mappings will switch to the specified tab.
|
||||
|
||||
* define the set of filetypes which are ignored selectTab keymappings >
|
||||
let g:airline#extensions#tabline#keymap_ignored_filetypes = ['vimfiler', 'nerdtree']
|
||||
|
||||
* change the display format of the buffer index >
|
||||
let g:airline#extensions#tabline#buffer_idx_format = {
|
||||
\ '0': '0 ',
|
||||
@@ -706,7 +756,7 @@ with the middle mouse button to delete that buffer.
|
||||
\}
|
||||
<
|
||||
|
||||
* defines the name of a formatter for how buffer names are displayed. (c)
|
||||
* 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:
|
||||
@@ -718,7 +768,7 @@ with the middle mouse button to delete that buffer.
|
||||
let g:airline#extensions#tabline#formatter = 'foo'
|
||||
<
|
||||
|
||||
Note: the following variables are only used by the 'default' formatter.
|
||||
Note: the following variables are used by the 'default' formatter.
|
||||
When no disambiguation is needed, both 'unique_tail_improved' and
|
||||
'unique_tail' delegate formatting to 'default', so these variables also
|
||||
control rendering of unique filenames when using these formatters.
|
||||
@@ -743,6 +793,12 @@ with the middle mouse button to delete that buffer.
|
||||
" with the containing parent directory.
|
||||
let g:airline#extensions#tabline#formatter = 'unique_tail'
|
||||
|
||||
" The following variables are also used by `unique_tail` formatter.
|
||||
" the meanings are the same as the ones in default formatter.
|
||||
|
||||
let g:airline#extensions#tabline#fnamemod = ':p:.'
|
||||
let g:airline#extensions#tabline#fnamecollapse = 1
|
||||
|
||||
" The `unique_tail_improved` - another algorithm, that will smartly uniquify
|
||||
" buffers names with similar filename, suppressing common parts of paths.
|
||||
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
|
||||
@@ -771,7 +827,7 @@ with the middle mouse button to delete that buffer.
|
||||
let g:airline#extensions#tabline#close_symbol = 'X'
|
||||
|
||||
* configure pattern to be ignored on BufAdd autocommand >
|
||||
" fixes unneccessary redraw, when e.g. opening Gundo window
|
||||
" fixes unnecessary redraw, when e.g. opening Gundo window
|
||||
let airline#extensions#tabline#ignore_bufadd_pat =
|
||||
\ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree'
|
||||
|
||||
@@ -783,7 +839,6 @@ Note: Enabling this extension will modify 'showtabline' and 'guioptions'.
|
||||
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*
|
||||
@@ -842,11 +897,18 @@ vim-xkblayout
|
||||
let g:airline#extensions#xkblayout#enabled = 1
|
||||
|
||||
* define path to the backend switcher library
|
||||
Linux (Install https://github.com/ierton/xkb-switch):
|
||||
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):
|
||||
<
|
||||
macOS (Install https://github.com/vovkasm/input-source-switcher): >
|
||||
let g:XkbSwitchLib = '/usr/local/lib/libInputSourceSwitcher.dylib'
|
||||
|
||||
------------------------------------- *airline-keymap*
|
||||
vim-keymap
|
||||
|
||||
* enable/disable vim-keymap extension >
|
||||
let g:airline#extensions#keymap#enabled = 1
|
||||
|
||||
------------------------------------- *airline-windowswap*
|
||||
vim-windowswap <https://github.com/wesQ3/vim-windowswap>
|
||||
|
||||
@@ -914,30 +976,30 @@ 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)
|
||||
* 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)
|
||||
* 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
|
||||
* 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
|
||||
and the compilation is set for this subfile >
|
||||
let g:airline#extensions#vimtex#sub_local = "l"
|
||||
|
||||
* single compilation is running
|
||||
* single compilation is running >
|
||||
let g:airline#extensions#vimtex#compiled = "c₁"
|
||||
|
||||
* continuousr compilation is running
|
||||
* continuousr compilation is running >
|
||||
let g:airline#extensions#vimtex#continuous = "c"
|
||||
|
||||
* viewer is opened
|
||||
* viewer is opened >
|
||||
let g:airline#extensions#vimtex#viewer = "v"
|
||||
|
||||
------------------------------------- *airline-ale*
|
||||
@@ -952,6 +1014,12 @@ ale <https://github.com/w0rp/ale>
|
||||
* ale warning >
|
||||
let airline#extensions#ale#warning_symbol = 'W:'
|
||||
<
|
||||
* ale open_lnum_symbol >
|
||||
let airline#extensions#ale#open_lnum_symbol = '(L'
|
||||
<
|
||||
* ale close_lnum_symbol >
|
||||
let airline#extensions#ale#close_lnum_symbol = ')'
|
||||
<
|
||||
------------------------------------- *airline-neomake*
|
||||
neomake <https://github.com/neomake/neomake>
|
||||
|
||||
@@ -964,6 +1032,15 @@ neomake <https://github.com/neomake/neomake>
|
||||
* neomake warning >
|
||||
let airline#extensions#neomake#warning_symbol = 'W:'
|
||||
<
|
||||
------------------------------------- *airline-cursormode*
|
||||
cursormode <https://github.com/vheon/vim-cursormode>
|
||||
|
||||
Displays cursor in different colors depending on the current mode (only works
|
||||
in terminals iTerm, AppleTerm and xterm)
|
||||
|
||||
* enable cursormode integration >
|
||||
let g:airline#extensions#cursormode#enabled = 1
|
||||
|
||||
==============================================================================
|
||||
ADVANCED CUSTOMIZATION *airline-advanced-customization*
|
||||
|
||||
@@ -1010,7 +1087,7 @@ Before is a list of parts that are predefined by vim-airline.
|
||||
* `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
|
||||
* `maxlinenr` displays the number of lines in the buffer
|
||||
* `ffenc` displays the file format and encoding
|
||||
|
||||
And the following are defined for their respective extensions:
|
||||
@@ -1228,6 +1305,9 @@ A. Themes have been extracted into the vim-airlines-themes repository. Simply
|
||||
clone https://github.com/vim-airline/vim-airline-themes and everything
|
||||
should work again.
|
||||
|
||||
Q. Performance is bad
|
||||
A. Check the question at the wiki:
|
||||
https://github.com/vim-airline/vim-airline/wiki/FAQ#i-have-a-performance-problem
|
||||
|
||||
Solutions to other common problems can be found in the Wiki:
|
||||
<https://github.com/vim-airline/vim-airline/wiki/FAQ>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -57,6 +57,7 @@ endfunction
|
||||
function! s:on_colorscheme_changed()
|
||||
call s:init()
|
||||
unlet! g:airline#highlighter#normal_fg_hi
|
||||
call airline#highlighter#reset_hlcache()
|
||||
let g:airline_gui_mode = airline#init#gui_mode()
|
||||
if !s:theme_in_vimrc
|
||||
call airline#switch_matching_theme()
|
||||
@@ -80,6 +81,7 @@ function! s:airline_toggle()
|
||||
if exists("s:stl")
|
||||
let &stl = s:stl
|
||||
endif
|
||||
call airline#highlighter#reset_hlcache()
|
||||
|
||||
silent doautocmd User AirlineToggledOff
|
||||
else
|
||||
@@ -93,6 +95,8 @@ function! s:airline_toggle()
|
||||
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
|
||||
|
||||
autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed()
|
||||
" Refresh airline for :syntax off
|
||||
autocmd SourcePre */syntax/*syntax.vim call <sid>airline_refresh()
|
||||
autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload *
|
||||
\ call <sid>on_window_changed()
|
||||
if exists('#CompleteDone')
|
||||
@@ -106,6 +110,9 @@ function! s:airline_toggle()
|
||||
\ | call airline#load_theme()
|
||||
augroup END
|
||||
|
||||
if &laststatus < 2
|
||||
set laststatus=2
|
||||
endif
|
||||
if s:airline_initialized
|
||||
call s:on_window_changed()
|
||||
endif
|
||||
@@ -137,6 +144,7 @@ function! s:airline_refresh()
|
||||
let nomodeline = '<nomodeline>'
|
||||
endif
|
||||
exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline)
|
||||
call airline#highlighter#reset_hlcache()
|
||||
call airline#load_theme()
|
||||
call airline#update_statusline()
|
||||
endfunction
|
||||
|
||||
@@ -19,6 +19,7 @@ describe 'active builder'
|
||||
end
|
||||
|
||||
it 'should reuse highlight group if background colors match'
|
||||
call airline#highlighter#reset_hlcache()
|
||||
highlight Foo1 ctermfg=1 ctermbg=2
|
||||
highlight Foo2 ctermfg=1 ctermbg=2
|
||||
call s:builder.add_section('Foo1', 'hello')
|
||||
@@ -28,6 +29,7 @@ describe 'active builder'
|
||||
end
|
||||
|
||||
it 'should switch highlight groups if foreground colors differ'
|
||||
call airline#highlighter#reset_hlcache()
|
||||
highlight Foo1 ctermfg=1 ctermbg=2
|
||||
highlight Foo2 ctermfg=2 ctermbg=2
|
||||
call s:builder.add_section('Foo1', 'hello')
|
||||
|
||||
@@ -5,6 +5,7 @@ describe 'themes'
|
||||
end
|
||||
|
||||
it 'should extract correct colors'
|
||||
call airline#highlighter#reset_hlcache()
|
||||
highlight Foo ctermfg=1 ctermbg=2
|
||||
let colors = airline#themes#get_highlight('Foo')
|
||||
Expect colors[2] == '1'
|
||||
@@ -12,6 +13,7 @@ describe 'themes'
|
||||
end
|
||||
|
||||
it 'should extract from normal if colors unavailable'
|
||||
call airline#highlighter#reset_hlcache()
|
||||
highlight Normal ctermfg=100 ctermbg=200
|
||||
highlight Foo ctermbg=2
|
||||
let colors = airline#themes#get_highlight('Foo')
|
||||
@@ -20,6 +22,7 @@ describe 'themes'
|
||||
end
|
||||
|
||||
it 'should flip target group if it is reversed'
|
||||
call airline#highlighter#reset_hlcache()
|
||||
highlight Foo ctermbg=222 ctermfg=103 term=reverse
|
||||
let colors = airline#themes#get_highlight('Foo')
|
||||
Expect colors[2] == '222'
|
||||
@@ -27,6 +30,8 @@ describe 'themes'
|
||||
end
|
||||
|
||||
it 'should pass args through correctly'
|
||||
call airline#highlighter#reset_hlcache()
|
||||
hi clear Normal
|
||||
let hl = airline#themes#get_highlight('Foo', 'bold', 'italic')
|
||||
Expect hl == ['', '', 'NONE', 'NONE', 'bold,italic']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user