1 Commits
Author SHA1 Message Date
Christian Brabandt 0f78ad819a Calculate section width dynamically 2017-06-26 14:04:54 +02:00
69 changed files with 677 additions and 1427 deletions
+1 -46
View File
@@ -4,50 +4,6 @@ This is the Changelog for the vim-airline project.
## [Unreleased] ## [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 ## [0.8] - 2016-03-09
- Changes - Changes
- Airline converted to an organization and moved to new [repository](https://github.com/vim-airline/vim-airline) - Airline converted to an organization and moved to new [repository](https://github.com/vim-airline/vim-airline)
@@ -153,8 +109,7 @@ This is the Changelog for the vim-airline project.
- integration with other plugins: netrw, unite, nerdtree, undotree, gundo, tagbar, minibufexplr, ctrlp - integration with other plugins: netrw, unite, nerdtree, undotree, gundo, tagbar, minibufexplr, ctrlp
- support for themes: 8 included - support for themes: 8 included
[Unreleased]: https://github.com/vim-airline/vim-airline/compare/v0.9...HEAD [Unreleased]: https://github.com/vim-airline/vim-airline/compare/v0.8...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.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.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 [0.6]: https://github.com/vim-airline/vim-airline/compare/v0.5...v0.6
+5 -82
View File
@@ -4,60 +4,6 @@ Lean & mean status/tabline for vim that's light as air.
![img](https://github.com/vim-airline/vim-airline/wiki/screenshots/demo.gif) ![img](https://github.com/vim-airline/vim-airline/wiki/screenshots/demo.gif)
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 # Features
* Tiny core written with extensibility in mind ([open/closed principle][8]). * Tiny core written with extensibility in mind ([open/closed principle][8]).
@@ -116,26 +62,6 @@ 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_sep = ' '
let g:airline#extensions#tabline#left_alt_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`
![image](https://user-images.githubusercontent.com/2652762/34422844-1d005efa-ebe6-11e7-8053-c784c0da7ba7.png)
#### `jsformatter`
![image](https://user-images.githubusercontent.com/2652762/34422843-1cf6a4d2-ebe6-11e7-810a-07e6eb08de24.png)
#### `unique_tail`
![image](https://user-images.githubusercontent.com/2652762/34422841-1ce5b4ec-ebe6-11e7-86e9-3d45c876068b.png)
#### `unique_tail_improved`
![image](https://user-images.githubusercontent.com/2652762/34422842-1cee23f2-ebe6-11e7-962d-97e068873077.png)
## Seamless integration ## 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). 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).
@@ -234,13 +160,15 @@ This plugin follows the standard runtime path structure, and as such it can be i
| [VAM][22] | `call vam#ActivateAddons([ 'vim-airline' ])` | | [VAM][22] | `call vam#ActivateAddons([ 'vim-airline' ])` |
| [Dein][52] | `call dein#add('vim-airline/vim-airline')` | | [Dein][52] | `call dein#add('vim-airline/vim-airline')` |
| [minpac][54] | `call minpac#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 | | manual | copy all of the files into your `~/.vim` directory |
# Documentation # Configuration
`:help airline` `: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 # 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. 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.
@@ -261,11 +189,7 @@ 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. 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 (e.g. `:let g:airline_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.
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 # Screenshots
@@ -335,4 +259,3 @@ MIT License. Copyright (c) 2013-2017 Bailey Ling & Contributors.
[52]: https://github.com/Shougo/dein.vim [52]: https://github.com/Shougo/dein.vim
[53]: https://github.com/lervag/vimtex [53]: https://github.com/lervag/vimtex
[54]: https://github.com/k-takata/minpac/ [54]: https://github.com/k-takata/minpac/
[55]: https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/dark_minimal.vim
+14 -3
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -34,7 +34,6 @@ function! airline#add_inactive_statusline_func(name)
endfunction endfunction
function! airline#load_theme() function! airline#load_theme()
let g:airline_theme = get(g:, 'airline_theme', 'dark')
if exists('*airline#themes#{g:airline_theme}#refresh') if exists('*airline#themes#{g:airline_theme}#refresh')
call airline#themes#{g:airline_theme}#refresh() call airline#themes#{g:airline_theme}#refresh()
endif endif
@@ -77,7 +76,7 @@ endfunction
function! airline#switch_matching_theme() function! airline#switch_matching_theme()
if exists('g:colors_name') if exists('g:colors_name')
let existing = g:airline_theme let existing = g:airline_theme
let theme = substitute(tolower(g:colors_name), '-', '_', 'g') let theme = substitute(g:colors_name, '-', '_', 'g')
try try
let palette = g:airline#themes#{theme}#palette let palette = g:airline#themes#{theme}#palette
call airline#switch_theme(theme) call airline#switch_theme(theme)
@@ -144,6 +143,11 @@ function! airline#statusline(winnr)
endfunction endfunction
function! airline#check_mode(winnr) 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] let context = s:contexts[a:winnr]
if get(w:, 'airline_active', 1) if get(w:, 'airline_active', 1)
@@ -186,6 +190,13 @@ function! airline#check_mode(winnr)
endif endif
let mode_string = join(l:mode) 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 if get(w:, 'airline_lastmode', '') != mode_string
call airline#highlighter#highlight_modified_inactive(context.bufnr) call airline#highlighter#highlight_modified_inactive(context.bufnr)
call airline#highlighter#highlight(l:mode, context.bufnr) call airline#highlighter#highlight(l:mode, context.bufnr)
-254
View File
@@ -1,254 +0,0 @@
" 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
+50 -14
View File
@@ -1,8 +1,21 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 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 = {} let s:prototype = {}
function! s:prototype.split(...) dict function! s:prototype.split(...) dict
@@ -49,9 +62,7 @@ function! s:prototype.build() dict
let contents = section[1] let contents = section[1]
let pgroup = prev_group let pgroup = prev_group
let prev_group = s:get_prev_group(self._sections, i) let prev_group = s:get_prev_group(self._sections, i)
if group ==# 'airline_c' && &buftype ==# 'terminal' && self._context.active if group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
let group = 'airline_term'
elseif group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
let group = 'airline_c'. self._context.bufnr let group = 'airline_c'. self._context.bufnr
elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr') elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
let prev_group = 'airline_c'. self._context.bufnr let prev_group = 'airline_c'. self._context.bufnr
@@ -89,6 +100,7 @@ function! s:prototype.build() dict
let line .= s:get_seperator(self, prev_group, group, side) let line .= s:get_seperator(self, prev_group, group, side)
endif endif
endif endif
let contents = s:calculate_max_width(self, contents, group)
let line .= is_empty ? '' : s:get_accented_line(self, group, contents) let line .= is_empty ? '' : s:get_accented_line(self, group, contents)
endif endif
@@ -118,16 +130,9 @@ endfunction
function! s:get_transitioned_seperator(self, prev_group, group, side) function! s:get_transitioned_seperator(self, prev_group, group, side)
let line = '' let line = ''
call airline#highlighter#add_separator(a:prev_group, a:group, a:side) call airline#highlighter#add_separator(a:prev_group, a:group, a:side)
if get(a:self._context, 'tabline', 0) && get(g:, 'airline#extensions#tabline#alt_sep', 0) && a:group ==# 'airline_tabsel' && a:side let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
call airline#highlighter#add_separator(a:prev_group, a:group, 0) let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep
let line .= '%#'.a:prev_group.'_to_'.a:group.'#' let line .= '%#'.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 return line
endfunction endfunction
@@ -156,6 +161,37 @@ function! s:get_accented_line(self, group, contents)
return line return line
endfunction 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) function! s:section_is_empty(self, content)
let start=1 let start=1
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -49,3 +49,4 @@ function! airline#debug#profile3()
profile pause profile pause
noautocmd qall! noautocmd qall!
endfunction endfunction
+2 -22
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -153,11 +153,6 @@ function! airline#extensions#load()
call add(loaded_ext, 'netrw') call add(loaded_ext, 'netrw')
endif 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) if get(g:, 'airline#extensions#ycm#enabled', 0)
call airline#extensions#ycm#init(s:ext) call airline#extensions#ycm#init(s:ext)
call add(loaded_ext, 'ycm') call add(loaded_ext, 'ycm')
@@ -229,12 +224,6 @@ function! airline#extensions#load()
call add(loaded_ext, 'bufferline') call add(loaded_ext, 'bufferline')
endif 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))) if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV)))
call airline#extensions#virtualenv#init(s:ext) call airline#extensions#virtualenv#init(s:ext)
call add(loaded_ext, 'virtualenv') call add(loaded_ext, 'virtualenv')
@@ -311,11 +300,6 @@ function! airline#extensions#load()
call add(loaded_ext, 'xkblayout') call add(loaded_ext, 'xkblayout')
endif 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)) if (get(g:, 'airline#extensions#windowswap#enabled', 1) && get(g:, 'loaded_windowswap', 0))
call airline#extensions#windowswap#init(s:ext) call airline#extensions#windowswap#init(s:ext)
call add(loaded_ext, 'windowswap') call add(loaded_ext, 'windowswap')
@@ -332,11 +316,6 @@ function! airline#extensions#load()
call add(loaded_ext, 'vimtex') call add(loaded_ext, 'vimtex')
endif 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) if !get(g:, 'airline#extensions#disable_rtp_load', 0)
" load all other extensions, which are not part of the default distribution. " load all other extensions, which are not part of the default distribution.
" (autoload/airline/extensions/*.vim outside of our s:script_path). " (autoload/airline/extensions/*.vim outside of our s:script_path).
@@ -358,3 +337,4 @@ function! airline#extensions#load()
endfor endfor
endif endif
endfunction endfunction
+13 -49
View File
@@ -1,58 +1,32 @@
" MIT License. Copyright (c) 2013-2018 Bjorn Neergaard, w0rp et al. " MIT License. Copyright (c) 2013-2017 Bjorn Neergaard, w0rp
" vim: et ts=2 sts=2 sw=2 " 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:error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:') 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) function! airline#extensions#ale#get(type)
if !exists(':ALELint') if !exists(':ALELint')
return '' return ''
endif endif
let is_err = a:type ==# 'error' let l:is_err = a:type ==# 'error'
let symbol = is_err ? s:error_symbol : s:warning_symbol 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' if type(l:counts) == type({}) && has_key(l:counts, '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. " Use the current Dictionary format.
let errors = counts.error + counts.style_error let l:errors = l:counts.error + l:counts.style_error
let num = is_err ? errors : counts.total - errors let l:num = l:is_err ? l:errors : l:counts.total - l:errors
else else
" Use the old List format. " Use the old List format.
let num = is_err ? counts[0] : counts[1] let l:num = l:is_err ? l:counts[0] : l:counts[1]
endif endif
return s:airline_ale_count(num, symbol) . <sid>airline_ale_get_line_number(num, a:type) if l:num == 0
return ''
else
return l:symbol . l:num
endif
endfunction endfunction
function! airline#extensions#ale#get_warning() function! airline#extensions#ale#get_warning()
@@ -66,14 +40,4 @@ endfunction
function! airline#extensions#ale#init(ext) 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_error_count', 'airline#extensions#ale#get_error')
call airline#parts#define_function('ale_warning_count', 'airline#extensions#ale#get_warning') 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 endfunction
+185 -86
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -11,6 +11,8 @@ if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand
finish finish
endif endif
let s:has_async = airline#util#async
" s:vcs_config contains static configuration of VCSes and their status relative " s:vcs_config contains static configuration of VCSes and their status relative
" to the active file. " to the active file.
" 'branch' - The name of currently active branch. This field is empty iff it " 'branch' - The name of currently active branch. This field is empty iff it
@@ -26,9 +28,8 @@ let s:vcs_config = {
\ 'exe': 'git', \ 'exe': 'git',
\ 'cmd': 'git status --porcelain -- ', \ 'cmd': 'git status --porcelain -- ',
\ 'untracked_mark': '??', \ 'untracked_mark': '??',
\ 'exclude': '\.git',
\ 'update_branch': 's:update_git_branch', \ 'update_branch': 's:update_git_branch',
\ 'display_branch': 's:display_git_branch', \ 'exclude': '\.git',
\ 'branch': '', \ 'branch': '',
\ 'untracked': {}, \ 'untracked': {},
\ }, \ },
@@ -38,7 +39,6 @@ let s:vcs_config = {
\ 'untracked_mark': '?', \ 'untracked_mark': '?',
\ 'exclude': '\.hg', \ 'exclude': '\.hg',
\ 'update_branch': 's:update_hg_branch', \ 'update_branch': 's:update_hg_branch',
\ 'display_branch': 's:display_hg_branch',
\ 'branch': '', \ 'branch': '',
\ 'untracked': {}, \ 'untracked': {},
\ }, \ },
@@ -83,69 +83,55 @@ else
endfunction endfunction
endif endif
let s:git_dirs = {}
" Fugitive special revisions. call '0' "staging" ? function! s:update_git_branch(path)
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 if !s:has_fugitive
let s:vcs_config['git'].branch = '' let s:vcs_config['git'].branch = ''
return return
endif endif
let s:vcs_config['git'].branch = fugitive#head(s:sha1size) let name = fugitive#head(7)
if s:vcs_config['git'].branch is# 'master' && winwidth(0) < 81 if empty(name)
" Shorten default a bit if has_key(s:git_dirs, a:path)
let s:vcs_config['git'].branch='mas' 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
endif endif
let s:git_dirs[a:path] = name
let s:vcs_config['git'].branch = name
endfunction endfunction
function! s:display_git_branch() function! s:update_hg_branch(path)
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
catch
endtry
return name
endfunction
function! s:update_hg_branch()
if s:has_lawrencium if s:has_lawrencium
let cmd='LC_ALL=C hg qtop'
let stl=lawrencium#statusline() let stl=lawrencium#statusline()
let file=expand('%:p') if !empty(stl) && s:has_async
if !empty(stl) && get(b:, 'airline_do_mq_check', 1) call s:get_mq_async('LC_ALL=C hg qtop', expand('%:p'))
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 endif
" do not do mq check anymore if exists("s:mq") && !empty(s:mq)
let b:airline_do_mq_check = 0
if exists("b:mq") && !empty(b:mq)
if stl is# 'default' if stl is# 'default'
" Shorten default a bit " Shorten default a bit
let stl='def' let stl='def'
endif endif
let stl.=' ['.b:mq.']' let stl.=' ['.s:mq.']'
endif endif
let s:vcs_config['mercurial'].branch = stl let s:vcs_config['mercurial'].branch = stl
else else
@@ -153,13 +139,10 @@ function! s:update_hg_branch()
endif endif
endfunction endfunction
function! s:display_hg_branch()
return b:buffer_vcs_config['mercurial'].branch
endfunction
function! s:update_branch() function! s:update_branch()
let l:path = exists("*fnamemodify") ? fnamemodify(resolve(@%), ":p:h") : expand("%:p:h")
for vcs in keys(s:vcs_config) for vcs in keys(s:vcs_config)
call {s:vcs_config[vcs].update_branch}() call {s:vcs_config[vcs].update_branch}(l:path)
if b:buffer_vcs_config[vcs].branch != s:vcs_config[vcs].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 let b:buffer_vcs_config[vcs].branch = s:vcs_config[vcs].branch
unlet! b:airline_head unlet! b:airline_head
@@ -167,7 +150,7 @@ function! s:update_branch()
endfor endfor
endfunction endfunction
function! airline#extensions#branch#update_untracked_config(file, vcs) function! s:update_untracked_in_buffer_config(file, vcs)
if !has_key(s:vcs_config[a:vcs].untracked, a:file) if !has_key(s:vcs_config[a:vcs].untracked, a:file)
return return
elseif s:vcs_config[a:vcs].untracked[a:file] != b:buffer_vcs_config[a:vcs].untracked elseif s:vcs_config[a:vcs].untracked[a:file] != b:buffer_vcs_config[a:vcs].untracked
@@ -177,43 +160,129 @@ function! airline#extensions#branch#update_untracked_config(file, vcs)
endfunction endfunction
function! s:update_untracked() function! s:update_untracked()
let file = expand("%:p") let l:file = expand("%:p")
if empty(file) || isdirectory(file) if empty(l:file) || isdirectory(l:file)
return return
endif endif
let needs_update = 1 let l:needs_update = 1
for vcs in keys(s:vcs_config) for vcs in keys(s:vcs_config)
if file =~ s:vcs_config[vcs].exclude if l:file =~ s:vcs_config[vcs].exclude
" Skip check for files that live in the exclude directory " Skip check for files that live in the exclude directory
let needs_update = 0 let l:needs_update = 0
endif endif
if has_key(s:vcs_config[vcs].untracked, file) if has_key(s:vcs_config[vcs].untracked, l:file)
let needs_update = 0 let l:needs_update = 0
call airline#extensions#branch#update_untracked_config(file, vcs) call s:update_untracked_in_buffer_config(l:file, vcs)
endif endif
endfor endfor
if !needs_update if !l:needs_update
return return
endif endif
for vcs in keys(s:vcs_config) for vcs in keys(s:vcs_config)
let config = s:vcs_config[vcs] let l:config = s:vcs_config[vcs]
if g:airline#init#vim_async if s:has_async
" Note that asynchronous update updates s:vcs_config only, and only " Note that asynchronous update updates s:vcs_config only, and only
" s:update_untracked updates b:buffer_vcs_config. If s:vcs_config is " 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 " 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 " 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. " doesn't happen often in practice, so we let it be.
call airline#async#vim_vcs_untracked(config, file) call s:get_vcs_untracked_async(l:config, l:file)
else else
" nvim async or vim without job-feature let output = airline#util#system(l:config.cmd . shellescape(l:file))
call airline#async#nvim_vcs_untracked(config, file, vcs) if output =~? ('^' . l:config.untracked_mark)
let l:config.untracked[l:file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
else
let l:config.untracked[l:file] = ''
endif
call s:update_untracked_in_buffer_config(l:file, vcs)
endif endif
endfor endfor
endfunction 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() function! airline#extensions#branch#head()
if !exists('b:buffer_vcs_config') if !exists('b:buffer_vcs_config')
call s:init_buffer() call s:init_buffer()
@@ -227,27 +296,24 @@ function! airline#extensions#branch#head()
endif endif
let b:airline_head = '' let b:airline_head = ''
let vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"]) let l:vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"])
let heads = [] let l:heads = {}
for vcs in vcs_priority for vcs in l:vcs_priority
if !empty(b:buffer_vcs_config[vcs].branch) if !empty(b:buffer_vcs_config[vcs].branch)
let heads += [vcs] let l:heads[vcs] = b:buffer_vcs_config[vcs].branch
endif endif
endfor endfor
for vcs in heads for vcs in keys(l:heads)
if !empty(b:airline_head) if !empty(b:airline_head)
let b:airline_head .= ' | ' let b:airline_head .= ' | '
endif endif
if len(heads) > 1 let b:airline_head .= (len(l:heads) > 1 ? s:vcs_config[l:vcs].exe .':' : '') . s:format_name(l:heads[l:vcs])
let b:airline_head .= 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 let b:airline_head .= b:buffer_vcs_config[vcs].untracked
endfor endfor
if empty(heads) if empty(l:heads)
if s:has_vcscommand if s:has_vcscommand
call VCSCommandEnableBufferSetup() call VCSCommandEnableBufferSetup()
if exists('b:VCSCommandBufferInfo') if exists('b:VCSCommandBufferInfo')
@@ -263,6 +329,9 @@ function! airline#extensions#branch#head()
endif endif
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 minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth) let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth)
return b:airline_head return b:airline_head
@@ -277,9 +346,38 @@ function! airline#extensions#branch#get_head()
\ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head) \ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head)
endfunction 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) function! s:reset_untracked_cache(shellcmdpost)
" shellcmdpost - whether function was called as a result of ShellCmdPost hook " shellcmdpost - whether function was called as a result of ShellCmdPost hook
if !g:airline#init#vim_async && !has('nvim') if !s:has_async && !has('nvim')
if a:shellcmdpost if a:shellcmdpost
" Clear cache only if there was no error or the script uses an " Clear cache only if there was no error or the script uses an
" asynchronous interface. Otherwise, cache clearing would overwrite " asynchronous interface. Otherwise, cache clearing would overwrite
@@ -290,12 +388,12 @@ function! s:reset_untracked_cache(shellcmdpost)
endif endif
endif endif
let file = expand("%:p") let l:file = expand("%:p")
for vcs in keys(s:vcs_config) for vcs in keys(s:vcs_config)
" Dump the value of the cache for the current file. Partially mitigates the " Dump the value of the cache for the current file. Partially mitigates the
" issue of cache invalidation happening before a call to " issue of cache invalidation happening before a call to
" s:update_untracked() " s:update_untracked()
call airline#extensions#branch#update_untracked_config(file, vcs) call s:update_untracked_in_buffer_config(l:file, l:vcs)
let s:vcs_config[vcs].untracked = {} let s:vcs_config[vcs].untracked = {}
endfor endfor
endfunction endfunction
@@ -303,8 +401,9 @@ endfunction
function! airline#extensions#branch#init(ext) function! airline#extensions#branch#init(ext)
call airline#parts#define_function('branch', 'airline#extensions#branch#get_head') call airline#parts#define_function('branch', 'airline#extensions#branch#get_head')
autocmd ShellCmdPost,CmdwinLeave * unlet! b:airline_head b:airline_do_mq_check autocmd BufReadPost * unlet! b:airline_file_in_root
autocmd User AirlineBeforeRefresh unlet! b:airline_head b:airline_do_mq_check autocmd CursorHold,ShellCmdPost,CmdwinLeave * unlet! b:airline_head
autocmd User AirlineBeforeRefresh unlet! b:airline_head
autocmd BufWritePost * call s:reset_untracked_cache(0) autocmd BufWritePost * call s:reset_untracked_cache(0)
autocmd ShellCmdPost * call s:reset_untracked_cache(1) autocmd ShellCmdPost * call s:reset_untracked_cache(1)
endfunction endfunction
+1 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al. " MIT License. Copyright (c) 2014 Mathias Andersson.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -14,3 +14,4 @@ endfunction
function! airline#extensions#capslock#init(ext) function! airline#extensions#capslock#init(ext)
call airline#parts#define_function('capslock', 'airline#extensions#capslock#status') call airline#parts#define_function('capslock', 'airline#extensions#capslock#status')
endfunction endfunction
+1 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -30,3 +30,4 @@ endfunction
function! airline#extensions#csv#init(ext) function! airline#extensions#csv#init(ext)
call a:ext.add_statusline_func('airline#extensions#csv#apply') call a:ext.add_statusline_func('airline#extensions#csv#apply')
endfunction endfunction
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -79,3 +79,4 @@ function! airline#extensions#ctrlp#init(ext)
call a:ext.add_statusline_func('airline#extensions#ctrlp#apply') call a:ext.add_statusline_func('airline#extensions#ctrlp#apply')
call a:ext.add_theme_func('airline#extensions#ctrlp#load_theme') call a:ext.add_theme_func('airline#extensions#ctrlp#load_theme')
endfunction endfunction
+2 -3
View File
@@ -1,15 +1,14 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
let s:spc = g:airline_symbols.space let s:spc = g:airline_symbols.space
let s:padding = s:spc . s:spc . s:spc let s:padding = s:spc . s:spc . s:spc
let s:cs = ctrlspace#context#Configuration().Symbols.CS
function! airline#extensions#ctrlspace#statusline(...) function! airline#extensions#ctrlspace#statusline(...)
let b = airline#builder#new({ 'active': 1 }) let b = airline#builder#new({ 'active': 1 })
call b.add_section('airline_b', s:cs . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding)) call b.add_section('airline_b', '⌗' . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding))
call b.split() call b.split()
call b.add_section('airline_x', s:spc . ctrlspace#api#StatuslineTabSegment() . s:spc) call b.add_section('airline_x', s:spc . ctrlspace#api#StatuslineTabSegment() . s:spc)
return b.build() return b.build()
-128
View File
@@ -1,128 +0,0 @@
" 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
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -98,3 +98,4 @@ function! airline#extensions#default#apply(builder, context)
return 1 return 1
endfunction endfunction
+15 -9
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2017-2018 Thomas Dy et al. " MIT License. Copyright (c) 2017 Thomas Dy
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -11,14 +11,11 @@ endif
" that implements its own insert/normal mode so we have to handle changing the " that implements its own insert/normal mode so we have to handle changing the
" highlight " highlight
function! airline#extensions#denite#check_denite_mode(bufnr) function! airline#extensions#denite#check_denite_mode(bufnr)
if &filetype != 'denite' let l:mode = split(denite#get_status_mode(), ' ')
return '' let l:mode = tolower(l:mode[1])
endif if !exists('b:denite_mode_cache') || l:mode != b:denite_mode_cache
let mode = split(denite#get_status_mode(), ' ') call airline#highlighter#highlight([l:mode], a:bufnr)
let mode = tolower(mode[1]) let b:denite_mode_cache = l:mode
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 endif
return '' return ''
endfunction endfunction
@@ -38,4 +35,13 @@ endfunction
function! airline#extensions#denite#init(ext) function! airline#extensions#denite#init(ext)
call denite#custom#option('_', 'statusline', 0) call denite#custom#option('_', 'statusline', 0)
call a:ext.add_statusline_func('airline#extensions#denite#apply') 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 endfunction
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -59,3 +59,4 @@ function! airline#extensions#eclim#init(ext)
call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings') call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings')
call a:ext.add_statusline_func('airline#extensions#eclim#creat_line') call a:ext.add_statusline_func('airline#extensions#eclim#creat_line')
endfunction endfunction
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -53,3 +53,4 @@ function! airline#extensions#example#get_cats()
endfor endfor
return cats return cats
endfunction endfunction
@@ -1,45 +0,0 @@
" 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
+12 -9
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -19,8 +19,7 @@ function! s:get_hunks_signify()
endfunction endfunction
function! s:is_branch_empty() function! s:is_branch_empty()
return exists('*airline#extensions#branch#head') && return exists('*airline#extensions#branch#head') && empty(airline#extensions#branch#head())
\ empty(get(b:, 'airline_head', ''))
endfunction endfunction
function! s:get_hunks_gitgutter() function! s:get_hunks_gitgutter()
@@ -35,7 +34,12 @@ function! s:get_hunks_changes()
return [] return []
endif endif
let hunks = changes#GetStats() let hunks = changes#GetStats()
return hunks == [0, 0, 0] ? [] : hunks for i in hunks
if i > 0
return hunks
endif
endfor
return []
endfunction endfunction
function! s:get_hunks_empty() function! s:get_hunks_empty()
@@ -63,14 +67,13 @@ function! airline#extensions#hunks#get_hunks()
if !get(w:, 'airline_active', 0) if !get(w:, 'airline_active', 0)
return '' return ''
endif endif
" Cache values, so that it isn't called too often " Cache vavlues, so that it isn't called too often
if exists("b:airline_hunks") && if exists("b:airline_hunks") &&
\ get(b:, 'airline_changenr', 0) == b:changedtick && \ get(b:, 'airline_changenr', 0) == changenr() &&
\ winwidth(0) == get(s:, 'airline_winwidth', 0) && \ winwidth(0) == get(s:, 'airline_winwidth', 0) &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_signify' && \ 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_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 return b:airline_hunks
endif endif
let hunks = s:get_hunks() let hunks = s:get_hunks()
@@ -83,7 +86,7 @@ function! airline#extensions#hunks#get_hunks()
endfor endfor
endif endif
let b:airline_hunks = string let b:airline_hunks = string
let b:airline_changenr = b:changedtick let b:airline_changenr = changenr()
let s:airline_winwidth = winwidth(0) let s:airline_winwidth = winwidth(0)
return string return string
endfunction endfunction
-20
View File
@@ -1,20 +0,0 @@
" 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
+2 -13
View File
@@ -1,4 +1,3 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
if !exists(':Neomake') if !exists(':Neomake')
@@ -8,24 +7,14 @@ endif
let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:') let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#neomake#warning_symbol', 'W:') 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() function! airline#extensions#neomake#get_warnings()
let counts = s:get_counts() let counts = neomake#statusline#LoclistCounts()
let warnings = get(counts, 'W', 0) let warnings = get(counts, 'W', 0)
return warnings ? s:warning_symbol.warnings : '' return warnings ? s:warning_symbol.warnings : ''
endfunction endfunction
function! airline#extensions#neomake#get_errors() function! airline#extensions#neomake#get_errors()
let counts = s:get_counts() let counts = neomake#statusline#LoclistCounts()
let errors = get(counts, 'E', 0) let errors = get(counts, 'E', 0)
return errors ? s:error_symbol.errors : '' return errors ? s:error_symbol.errors : ''
endfunction endfunction
+1 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
+1 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
+1 -1
View File
@@ -1,4 +1,3 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -20,3 +19,4 @@ endfunction
function! airline#extensions#obsession#get_status() function! airline#extensions#obsession#get_status()
return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '') return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '')
endfunction endfunction
+50 -7
View File
@@ -1,9 +1,11 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
function! airline#extensions#po#shorten() let s:has_async = airline#util#async
function! s:shorten()
if exists("g:airline#extensions#po#displayed_limit") if exists("g:airline#extensions#po#displayed_limit")
let w:displayed_po_limit = 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 if len(b:airline_po_stats) > w:displayed_po_limit - 1
@@ -12,6 +14,49 @@ function! airline#extensions#po#shorten()
endif endif
endfunction 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(...) function! airline#extensions#po#apply(...)
if &ft ==# 'po' if &ft ==# 'po'
call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}') call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}')
@@ -25,10 +70,8 @@ function! airline#extensions#po#stats()
endif endif
let cmd = 'msgfmt --statistics -o /dev/null -- ' let cmd = 'msgfmt --statistics -o /dev/null -- '
if g:airline#init#vim_async if s:has_async
call airline#async#get_msgfmt_stat(cmd, expand('%:p')) call s:get_msgfmt_stat_async(cmd, expand('%:p'))
elseif has("nvim")
call airline#async#nvim_get_msgfmt_stat(cmd, expand('%:p'))
else else
let airline_po_stats = system(cmd. shellescape(expand('%:p'))) let airline_po_stats = system(cmd. shellescape(expand('%:p')))
if v:shell_error if v:shell_error
@@ -40,7 +83,7 @@ function! airline#extensions#po#stats()
catch catch
let b:airline_po_stats = '' let b:airline_po_stats = ''
endtry endtry
call airline#extensions#po#shorten() call s:shorten()
endif endif
return get(b:, 'airline_po_stats', '') return get(b:, 'airline_po_stats', '')
endfunction endfunction
+1 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
+1 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
+4 -4
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -22,15 +22,15 @@ function! airline#extensions#syntastic#get(type)
let _backup = get(g:, 'syntastic_stl_format', '') let _backup = get(g:, 'syntastic_stl_format', '')
let is_err = (a:type is# 'error') let is_err = (a:type is# 'error')
if is_err if is_err
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%e(#%fe)]}') let g:syntastic_stl_format = '%E{%e}'
else else
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_warn', '%W{[%w(#%fw)]}') let g:syntastic_stl_format = '%W{%w}'
endif endif
let cnt = SyntasticStatuslineFlag() let cnt = SyntasticStatuslineFlag()
if !empty(_backup) if !empty(_backup)
let g:syntastic_stl_format = _backup let g:syntastic_stl_format = _backup
endif endif
if empty(cnt) if cnt == 0
return '' return ''
else else
return (is_err ? s:error_symbol : s:warning_symbol).cnt return (is_err ? s:error_symbol : s:warning_symbol).cnt
+36 -55
View File
@@ -1,8 +1,12 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 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) let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0)
if s:taboo if s:taboo
@@ -27,18 +31,14 @@ function! s:toggle_off()
call airline#extensions#tabline#autoshow#off() call airline#extensions#tabline#autoshow#off()
call airline#extensions#tabline#tabs#off() call airline#extensions#tabline#tabs#off()
call airline#extensions#tabline#buffers#off() call airline#extensions#tabline#buffers#off()
if s:ctrlspace call airline#extensions#tabline#ctrlspace#off()
call airline#extensions#tabline#ctrlspace#off()
endif
endfunction endfunction
function! s:toggle_on() function! s:toggle_on()
call airline#extensions#tabline#autoshow#on() call airline#extensions#tabline#autoshow#on()
call airline#extensions#tabline#tabs#on() call airline#extensions#tabline#tabs#on()
call airline#extensions#tabline#buffers#on() call airline#extensions#tabline#buffers#on()
if s:ctrlspace call airline#extensions#tabline#ctrlspace#on()
call airline#extensions#tabline#ctrlspace#on()
endif
set tabline=%!airline#extensions#tabline#get() set tabline=%!airline#extensions#tabline#get()
endfunction endfunction
@@ -48,22 +48,17 @@ function! s:update_tabline()
return return
endif endif
let match = expand('<afile>') 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() if pumvisible()
return return
elseif !get(g:, 'airline#extensions#tabline#enabled', 0) elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
return return
" return, if buffer matches ignore pattern or is directory (netrw) " return, if buffer matches ignore pattern or is directory (netrw)
elseif empty(match) elseif empty(match)
\ || match(match, ignore_bufadd_pat) > -1 \ || match(match, s:ignore_bufadd_pat) > -1
\ || isdirectory(expand("<afile>")) \ || isdirectory(expand("<afile>"))
return return
endif endif
doautocmd User BufMRUChange doautocmd User BufMRUChange
" sometimes, the tabline is not correctly updated see #1580
" so force redraw here
let &tabline = &tabline
endfunction endfunction
function! airline#extensions#tabline#load_theme(palette) function! airline#extensions#tabline#load_theme(palette)
@@ -71,53 +66,47 @@ function! airline#extensions#tabline#load_theme(palette)
return return
endif endif
let colors = get(a:palette, 'tabline', {}) let colors = get(a:palette, 'tabline', {})
let tablabel = get(colors, 'airline_tablabel', a:palette.normal.airline_b)
" Theme for tabs on the left " Theme for tabs on the left
let tab = get(colors, 'airline_tab', a:palette.normal.airline_b) let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b)
let tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a) let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
let tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a) let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
let tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c) let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
let tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a) let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
let tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c) let l: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') if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c) let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
else else
"Fall back to normal airline_c if modified airline_c isn't present "Fall back to normal airline_c if modified airline_c isn't present
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c) let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
endif endif
call airline#highlighter#exec('airline_tablabel', tablabel) call airline#highlighter#exec('airline_tab', l:tab)
call airline#highlighter#exec('airline_tab', tab) call airline#highlighter#exec('airline_tabsel', l:tabsel)
call airline#highlighter#exec('airline_tabsel', tabsel) call airline#highlighter#exec('airline_tabtype', l:tabtype)
call airline#highlighter#exec('airline_tabtype', tabtype) call airline#highlighter#exec('airline_tabfill', l:tabfill)
call airline#highlighter#exec('airline_tabfill', tabfill) call airline#highlighter#exec('airline_tabmod', l:tabmod)
call airline#highlighter#exec('airline_tabmod', tabmod) call airline#highlighter#exec('airline_tabmod_unsel', l:tabmodu)
call airline#highlighter#exec('airline_tabmod_unsel', tabmodu) call airline#highlighter#exec('airline_tabhid', l:tabhid)
call airline#highlighter#exec('airline_tabhid', tabhid)
" Theme for tabs on the right " Theme for tabs on the right
let tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a) let l: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 l: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 l: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) let l: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') if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c) let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c)
else else
"Fall back to normal airline_c if modified airline_c isn't present "Fall back to normal airline_c if modified airline_c isn't present
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c) let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
endif endif
call airline#highlighter#exec('airline_tab_right', tab_right) call airline#highlighter#exec('airline_tab_right', l:tab_right)
call airline#highlighter#exec('airline_tabsel_right', tabsel_right) call airline#highlighter#exec('airline_tabsel_right', l:tabsel_right)
call airline#highlighter#exec('airline_tabmod_right', tabmod_right) call airline#highlighter#exec('airline_tabmod_right', l:tabmod_right)
call airline#highlighter#exec('airline_tabhid_right', tabhid_right) call airline#highlighter#exec('airline_tabhid_right', l:tabhid_right)
call airline#highlighter#exec('airline_tabmod_unsel_right', tabmodu_right) call airline#highlighter#exec('airline_tabmod_unsel_right', l:tabmodu_right)
endfunction endfunction
let s:current_tabcnt = -1 let s:current_tabcnt = -1
function! airline#extensions#tabline#get() 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('$') let curtabcnt = tabpagenr('$')
if curtabcnt != s:current_tabcnt if curtabcnt != s:current_tabcnt
let s:current_tabcnt = curtabcnt let s:current_tabcnt = curtabcnt
@@ -131,7 +120,7 @@ function! airline#extensions#tabline#get()
endif endif
if s:ctrlspace if s:ctrlspace
return airline#extensions#tabline#ctrlspace#get() return airline#extensions#tabline#ctrlspace#get()
elseif show_buffers && curtabcnt == 1 || !show_tabs elseif s:show_buffers && curtabcnt == 1 || !s:show_tabs
return airline#extensions#tabline#buffers#get() return airline#extensions#tabline#buffers#get()
else else
return airline#extensions#tabline#tabs#get() return airline#extensions#tabline#tabs#get()
@@ -162,8 +151,7 @@ endfunction
function! airline#extensions#tabline#get_buffer_name(nr, ...) function! airline#extensions#tabline#get_buffer_name(nr, ...)
let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list() let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list()
let formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, buffers)
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, buffers)
endfunction endfunction
function! airline#extensions#tabline#new_builder() function! airline#extensions#tabline#new_builder()
@@ -203,10 +191,3 @@ function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
endif endif
return group return group
endfunction 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-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
+18 -41
View File
@@ -1,8 +1,11 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 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:spc = g:airline_symbols.space
let s:current_bufnr = -1 let s:current_bufnr = -1
@@ -46,11 +49,7 @@ function! airline#extensions#tabline#buffers#invalidate()
endfunction endfunction
function! airline#extensions#tabline#buffers#get() function! airline#extensions#tabline#buffers#get()
try call <sid>map_keys()
call <sid>map_keys()
catch
" no-op
endtry
let cur = bufnr('%') let cur = bufnr('%')
if cur == s:current_bufnr if cur == s:current_bufnr
if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified
@@ -58,18 +57,9 @@ function! airline#extensions#tabline#buffers#get()
endif endif
endif endif
let index = 1 let l:index = 1
let b = airline#extensions#tabline#new_builder() let b = airline#extensions#tabline#new_builder()
let tab_bufs = tabpagebuflist(tabpagenr()) 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() for nr in s:get_visible_buffers()
if nr < 0 if nr < 0
call b.add_raw('%#airline_tabhid#...') call b.add_raw('%#airline_tabhid#...')
@@ -86,33 +76,27 @@ function! airline#extensions#tabline#buffers#get()
if has("tablineat") if has("tablineat")
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@') call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@')
endif 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 if len(s:number_map) > 0
call b.add_section(group, space. get(s:number_map, index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc) call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
else else
call b.add_section(group, '['.index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']') call b.add_section(group, '['.l:index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
endif endif
let index += 1 let l:index = l:index + 1
else else
call b.add_section(group, space.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc) call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
endif endif
if has("tablineat") if has("tablineat")
call b.add_raw('%X') call b.add_raw('%X')
endif endif
let pgroup=group
endfor endfor
call b.add_section('airline_tabfill', '') call b.add_section('airline_tabfill', '')
call b.split() call b.split()
call b.add_section('airline_tabfill', '') call b.add_section('airline_tabfill', '')
if !show_buf_label_first if s:show_tab_type
call airline#extensions#tabline#add_label(b, 'buffers') call b.add_section_spaced('airline_tabtype', s:buffers_label)
endif endif
if tabpagenr('$') > 1 if tabpagenr('$') > 1
call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$'))) call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
endif endif
@@ -125,12 +109,6 @@ endfunction
function! s:get_visible_buffers() function! s:get_visible_buffers()
let buffers = airline#extensions#tabline#buflist#list() let buffers = airline#extensions#tabline#buflist#list()
let cur = bufnr('%') 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 total_width = 0
let max_width = 0 let max_width = 0
@@ -182,9 +160,8 @@ function! s:get_visible_buffers()
endfunction endfunction
function! s:select_tab(buf_index) function! s:select_tab(buf_index)
" no-op when called in 'keymap_ignored_filetypes' " no-op when called in the NERDTree buffer
if count(get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes', if exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName
\ ['vimfiler', 'nerdtree']), &ft)
return return
endif endif
@@ -200,15 +177,15 @@ function! s:select_tab(buf_index)
endfunction endfunction
function! s:jump_to_tab(offset) function! s:jump_to_tab(offset)
let l = airline#extensions#tabline#buflist#list() let l = s:current_visible_buffers
let i = index(l, bufnr('%')) let i = index(l, bufnr('%'))
if i > -1 if i > -1
exec 'b!' . l[(i + a:offset) % len(l)] exec 'b!' . l[float2nr(fmod(i + a:offset, len(l)))]
endif endif
endfunction endfunction
function! s:map_keys() function! s:map_keys()
if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1) if s:buffer_idx_mode
noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR> noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR> noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
noremap <silent> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR> noremap <silent> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR>
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -41,3 +41,4 @@ function! airline#extensions#tabline#buflist#list()
let s:current_buffer_list = buffers let s:current_buffer_list = buffers
return buffers return buffers
endfunction endfunction
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2016-2018 Kevin Sapper et al. " MIT License. Copyright (c) 2016 Kevin Sapper
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -7,6 +7,12 @@ let s:current_bufnr = -1
let s:current_tabnr = -1 let s:current_tabnr = -1
let s:current_tabline = '' 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() function! airline#extensions#tabline#ctrlspace#off()
augroup airline_tabline_ctrlspace augroup airline_tabline_ctrlspace
autocmd! autocmd!
@@ -33,15 +39,6 @@ function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_t
endif endif
let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab) 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 for buffer in s:buffer_list
if a:cur_buf == buffer.index if a:cur_buf == buffer.index
if buffer.modified if buffer.modified
@@ -67,10 +64,6 @@ function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_t
call a:builder.add_section_spaced(group, buf_name) call a:builder.add_section_spaced(group, buf_name)
endfor endfor
" add by tenfy(tenfyzhong@qq.com)
" if the selected buffer was updated
" return true
return 1
endfunction endfunction
function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos) function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos)
@@ -101,15 +94,8 @@ endfunction
function! airline#extensions#tabline#ctrlspace#get() function! airline#extensions#tabline#ctrlspace#get()
let cur_buf = bufnr('%') 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)
try call airline#extensions#tabline#tabs#map_keys()
call airline#extensions#tabline#tabs#map_keys()
catch
" no-op
endtry
let s:tab_list = ctrlspace#api#TabList() let s:tab_list = ctrlspace#api#TabList()
for tab in s:tab_list for tab in s:tab_list
if tab.current if tab.current
@@ -124,24 +110,16 @@ function! airline#extensions#tabline#ctrlspace#get()
let builder = airline#extensions#tabline#new_builder() let builder = airline#extensions#tabline#new_builder()
" Add left tabline content " Add left tabline content
if get(g:, 'airline#extensions#tabline#show_buffers', 1) == 0 if s:show_buffers == 0
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0) call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
elseif get(g:, 'airline#extensions#tabline#show_tabs', 1) == 0 elseif s:show_tabs == 0
" add by tenfy(tenfyzhong@qq.com) call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0)
" 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 else
if switch_buffers_and_tabs == 0 if s:switch_buffers_and_tabs == 0
call builder.add_section_spaced('airline_tabtype', buffer_label) call builder.add_section_spaced('airline_tabtype', s:buffers_label)
" add by tenfy(tenfyzhong@qq.com) call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0)
" 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 else
call builder.add_section_spaced('airline_tabtype', tab_label) call builder.add_section_spaced('airline_tabtype', s:tabs_label)
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0) call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
endif endif
endif endif
@@ -151,21 +129,17 @@ function! airline#extensions#tabline#ctrlspace#get()
call builder.add_section('airline_tabfill', '') call builder.add_section('airline_tabfill', '')
" Add right tabline content " Add right tabline content
if get(g:, 'airline#extensions#tabline#show_buffers', 1) == 0 if s:show_buffers == 0
call builder.add_section_spaced('airline_tabtype', tab_label) call builder.add_section_spaced('airline_tabtype', s:tabs_label)
elseif get(g:, 'airline#extensions#tabline#show_tabs', 1) == 0 elseif s:show_tabs == 0
call builder.add_section_spaced('airline_tabtype', buffer_label) call builder.add_section_spaced('airline_tabtype', s:buffers_label)
else else
if switch_buffers_and_tabs == 0 if s:switch_buffers_and_tabs == 0
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1) call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1)
call builder.add_section_spaced('airline_tabtype', tab_label) call builder.add_section_spaced('airline_tabtype', s:tabs_label)
else else
" add by tenfy(tenfyzhong@qq.com) call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1)
" if current buffer no in the buffer list, does't update tabline call builder.add_section_spaced('airline_tabtype', s:buffers_label)
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
endif endif
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -1,15 +0,0 @@
" 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
@@ -1,14 +0,0 @@
" 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-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -21,14 +21,8 @@ function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffer
endif endif
endfor endfor
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.')
for nr in values(duplicates) for nr in values(duplicates)
let fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.'))
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 endfor
if has_key(map, a:bufnr) if has_key(map, a:bufnr)
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
+24 -34
View File
@@ -1,9 +1,17 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 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:spc = g:airline_symbols.space
let s:current_bufnr = -1 let s:current_bufnr = -1
let s:current_tabnr = -1 let s:current_tabnr = -1
let s:current_modified = 0 let s:current_modified = 0
@@ -28,30 +36,16 @@ endfunction
function! airline#extensions#tabline#tabs#get() function! airline#extensions#tabline#tabs#get()
let curbuf = bufnr('%') let curbuf = bufnr('%')
let curtab = tabpagenr() let curtab = tabpagenr()
try call airline#extensions#tabline#tabs#map_keys()
call airline#extensions#tabline#tabs#map_keys()
catch
" no-op
endtry
if curbuf == s:current_bufnr && curtab == s:current_tabnr if curbuf == s:current_bufnr && curtab == s:current_tabnr
if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified
return s:current_tabline return s:current_tabline
endif endif
endif endif
let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
let b = airline#extensions#tabline#new_builder() let b = airline#extensions#tabline#new_builder()
call airline#extensions#tabline#add_label(b, 'tabs') for i in range(1, tabpagenr('$'))
" 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 if i == curtab
let group = 'airline_tabsel' let group = 'airline_tabsel'
if g:airline_detect_modified if g:airline_detect_modified
@@ -66,9 +60,14 @@ function! airline#extensions#tabline#tabs#get()
let group = 'airline_tab' let group = 'airline_tab'
endif endif
let val = '%(' let val = '%('
if s:show_tab_nr
if get(g:, 'airline#extensions#tabline#show_tab_nr', 1) if s:tab_nr_type == 0
let val .= airline#extensions#tabline#tabs#tabnr_formatter(tab_nr_type, i) 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
endif endif
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)') call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)')
endfor endfor
@@ -77,18 +76,18 @@ function! airline#extensions#tabline#tabs#get()
call b.split() call b.split()
call b.add_section('airline_tabfill', '') call b.add_section('airline_tabfill', '')
if get(g:, 'airline#extensions#tabline#show_close_button', 1) if s:show_close_button
call b.add_section('airline_tab_right', ' %999X'. call b.add_section('airline_tab_right', ' %999X'.s:close_symbol.' ')
\ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ')
endif endif
if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1 if s:show_splits == 1
let buffers = tabpagebuflist(curtab) let buffers = tabpagebuflist(curtab)
for nr in buffers for nr in buffers
let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right" let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right"
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)') call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
endfor endfor
call airline#extensions#tabline#add_label(b, 'buffers') elseif s:show_tab_type == 1
call b.add_section_spaced('airline_tabtype', s:tabs_label)
endif endif
let s:current_bufnr = curbuf let s:current_bufnr = curbuf
@@ -98,9 +97,6 @@ function! airline#extensions#tabline#tabs#get()
endfunction endfunction
function! airline#extensions#tabline#tabs#map_keys() 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>AirlineSelectTab1 :1tabn<CR>
noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR> noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR>
noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR> noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR>
@@ -113,10 +109,4 @@ function! airline#extensions#tabline#tabs#map_keys()
noremap <silent> <Plug>AirlineSelectPrevTab gT noremap <silent> <Plug>AirlineSelectPrevTab gT
" tabn {count} goes to count tab does not go {count} tab pages forward! " 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> 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 endfunction
+3 -14
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -9,7 +9,6 @@ endif
let s:flags = get(g:, 'airline#extensions#tagbar#flags', '') let s:flags = get(g:, 'airline#extensions#tagbar#flags', '')
let s:spc = g:airline_symbols.space let s:spc = g:airline_symbols.space
let s:init=0
" Arguments: current, sort, fname " Arguments: current, sort, fname
function! airline#extensions#tagbar#get_status(...) function! airline#extensions#tagbar#get_status(...)
@@ -30,18 +29,7 @@ let s:airline_tagbar_last_lookup_time = 0
let s:airline_tagbar_last_lookup_val = '' let s:airline_tagbar_last_lookup_val = ''
function! airline#extensions#tagbar#currenttag() function! airline#extensions#tagbar#currenttag()
if get(w:, 'airline_active', 0) if get(w:, 'airline_active', 0)
if !s:init if s:airline_tagbar_last_lookup_time != localtime()
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_val = tagbar#currenttag('%s', '', s:flags)
let s:airline_tagbar_last_lookup_time = localtime() let s:airline_tagbar_last_lookup_time = localtime()
endif endif
@@ -56,3 +44,4 @@ function! airline#extensions#tagbar#init(ext)
call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag') call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag')
endfunction endfunction
-22
View File
@@ -1,22 +0,0 @@
" 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
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -25,3 +25,4 @@ function! airline#extensions#tmuxline#set_tmux_colors(palette)
call tmuxline#api#snapshot(s:tmuxline_snapshot_file) call tmuxline#api#snapshot(s:tmuxline_snapshot_file)
endif endif
endfunction endfunction
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -26,3 +26,4 @@ endfunction
function! airline#extensions#undotree#init(ext) function! airline#extensions#undotree#init(ext)
call a:ext.add_statusline_func('airline#extensions#undotree#apply') call a:ext.add_statusline_func('airline#extensions#undotree#apply')
endfunction endfunction
+2 -2
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -14,7 +14,7 @@ function! airline#extensions#unicode#apply(...)
\ 'accent': 'bold' }) \ 'accent': 'bold' })
let w:airline_section_a = airline#section#create(['unicode']) let w:airline_section_a = airline#section#create(['unicode'])
let w:airline_section_b = '' let w:airline_section_b = ''
let w:airline_section_c = ' ' let w:airline_section_c = ''
let w:airline_section_y = '' let w:airline_section_y = ''
endif endif
endfunction endfunction
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -22,3 +22,4 @@ function! airline#extensions#unite#init(ext)
let g:unite_force_overwrite_statusline = 0 let g:unite_force_overwrite_statusline = 0
call a:ext.add_statusline_func('airline#extensions#unite#apply') call a:ext.add_statusline_func('airline#extensions#unite#apply')
endfunction endfunction
+9 -13
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2016-2018 Jerome Reybert et al. " MIT License. Copyright (c) 2016 Jerome Reybert
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
" This plugin replace the whole section_a when in vimagit buffer " This plugin replace the whole section_a when in vimagit buffer
@@ -13,18 +13,14 @@ function! airline#extensions#vimagit#init(ext)
endfunction endfunction
function! airline#extensions#vimagit#get_mode() function! airline#extensions#vimagit#get_mode()
if ( exists("*magit#get_current_mode") ) if ( b:magit_current_commit_mode == '' )
return magit#get_current_mode() return "STAGING"
else elseif ( b:magit_current_commit_mode == 'CC' )
if ( b:magit_current_commit_mode == '' ) return "COMMIT"
return "STAGING" elseif ( b:magit_current_commit_mode == 'CA' )
elseif ( b:magit_current_commit_mode == 'CC' ) return "AMEND"
return "COMMIT" else
elseif ( b:magit_current_commit_mode == 'CA' ) return "???"
return "AMEND"
else
return "???"
endif
endfunction endfunction
function! airline#extensions#vimagit#apply(...) function! airline#extensions#vimagit#apply(...)
+1 -4
View File
@@ -1,7 +1,3 @@
" 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 scriptencoding utf-8
let s:spc = g:airline_symbols.space let s:spc = g:airline_symbols.space
@@ -82,3 +78,4 @@ function! airline#extensions#vimtex#get_scope()
endif endif
return l:status return l:status
endfunction endfunction
+1 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
+18 -19
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html " http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
@@ -9,12 +9,18 @@ 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:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace)
let s:default_checks = ['indent', 'trailing', 'mixed-indent-file'] let s:default_checks = ['indent', 'trailing', 'mixed-indent-file']
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) 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:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
let s:c_like_langs = get(g:, 'airline#extensions#c_like_langs', [ 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ])
function! s:check_mixed_indent() function! s:check_mixed_indent()
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0) if s:indent_algo == 1
if indent_algo == 1
" [<tab>]<space><tab> " [<tab>]<space><tab>
" spaces before or between tabs are not allowed " spaces before or between tabs are not allowed
let t_s_t = '(^\t* +\t\s*\S)' let t_s_t = '(^\t* +\t\s*\S)'
@@ -22,7 +28,7 @@ function! s:check_mixed_indent()
" count of spaces at the end of tabs should be less than tabstop value " count of spaces at the end of tabs should be less than tabstop value
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
return search('\v' . t_s_t . '|' . t_l_s, 'nw') return search('\v' . t_s_t . '|' . t_l_s, 'nw')
elseif indent_algo == 2 elseif s:indent_algo == 2
return search('\v(^\t* +\t\s*\S)', 'nw') return search('\v(^\t* +\t\s*\S)', 'nw')
else else
return search('\v(^\t+ +)|(^ +\t+)', 'nw') return search('\v(^\t+ +)|(^ +\t+)', 'nw')
@@ -30,9 +36,7 @@ function! s:check_mixed_indent()
endfunction endfunction
function! s:check_mixed_indent_file() function! s:check_mixed_indent_file()
let c_like_langs = get(g:, 'airline#extensions#c_like_langs', if index(s:c_like_langs, &ft) > -1
\ [ '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 '*' " for C-like languages: allow /** */ comment style with one space before the '*'
let head_spc = '\v(^ +\*@!)' let head_spc = '\v(^ +\*@!)'
else else
@@ -48,8 +52,7 @@ function! s:check_mixed_indent_file()
endfunction endfunction
function! airline#extensions#whitespace#check() function! airline#extensions#whitespace#check()
let max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines
if &readonly || !&modifiable || !s:enabled || line('$') > max_lines
\ || get(b:, 'airline_whitespace_disabled', 0) \ || get(b:, 'airline_whitespace_disabled', 0)
return '' return ''
endif endif
@@ -64,7 +67,7 @@ function! airline#extensions#whitespace#check()
let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$') let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$')
let trailing = search(regexp, 'nw') let trailing = search(regexp, 'nw')
catch catch
echomsg 'airline#whitespace: error occurred evaluating '. regexp echomsg 'airline#whitespace: error occured evaluating '. regexp
echomsg v:exception echomsg v:exception
return '' return ''
endtry endtry
@@ -97,20 +100,16 @@ function! airline#extensions#whitespace#check()
if s:show_message if s:show_message
if trailing != 0 if trailing != 0
let trailing_fmt = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing') let b:airline_whitespace_check .= space.printf(s:trailing_format, trailing)
let b:airline_whitespace_check .= space.printf(trailing_fmt, trailing)
endif endif
if mixed != 0 if mixed != 0
let mixed_indent_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent') let b:airline_whitespace_check .= space.printf(s:mixed_indent_format, mixed)
let b:airline_whitespace_check .= space.printf(mixed_indent_fmt, mixed)
endif endif
if long != 0 if long != 0
let long_fmt = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long') let b:airline_whitespace_check .= space.printf(s:long_format, long)
let b:airline_whitespace_check .= space.printf(long_fmt, long)
endif endif
if !empty(mixed_file) if !empty(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(s:mixed_indent_file_format, mixed_file)
let b:airline_whitespace_check .= space.printf(mixed_indent_file_fmt, mixed_file)
endif endif
endif endif
endif endif
+1 -1
View File
@@ -1,4 +1,3 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -27,3 +26,4 @@ function! airline#extensions#windowswap#get_status()
endif endif
return '' return ''
endfunction endfunction
+1 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -1,11 +1,9 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
function! airline#extensions#wordcount#formatters#default#format() 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()) let words = string(s:wordcount())
if empty(words) if empty(words)
return return
@@ -17,9 +15,9 @@ function! airline#extensions#wordcount#formatters#default#format()
" Format number according to locale, e.g. German: 1.245 or English: 1,245 " Format number according to locale, e.g. German: 1.245 or English: 1,245
let words = substitute(words, '\d\@<=\(\(\d\{3\}\)\+\)$', separator.'&', 'g') let words = substitute(words, '\d\@<=\(\(\d\{3\}\)\+\)$', separator.'&', 'g')
endif endif
let result = printf(fmt, words). result let result = printf("%s%s", words, " words"). result
else else
let result = printf(fmt_short, words). result let result = printf("%s%s", words, "W"). result
endif endif
return result return result
endfunction endfunction
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2017-2018 YoungHoon Rhiu et al. " MIT License. Copyright (c) 2017 YoungHoon Rhiu.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -22,3 +22,4 @@ endfunction
function! airline#extensions#xkblayout#init(ext) function! airline#extensions#xkblayout#init(ext)
call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status') call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status')
endfunction endfunction
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2015-2018 Evgeny Firsov et al. " MIT License. Copyright (c) 2015 Evgeny Firsov.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -35,3 +35,4 @@ function! airline#extensions#ycm#get_warning_count()
return '' return ''
endfunction endfunction
+20 -50
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -10,7 +10,6 @@ let s:is_win32term = (has('win32') || has('win64')) &&
let s:separators = {} let s:separators = {}
let s:accents = {} let s:accents = {}
let s:hl_groups = {}
function! s:gui2cui(rgb, fallback) function! s:gui2cui(rgb, fallback)
if a:rgb == '' if a:rgb == ''
@@ -42,35 +41,19 @@ function! s:get_syn(group, what)
endfunction endfunction
function! s:get_array(fg, bg, opts) function! s:get_array(fg, bg, opts)
let opts=empty(a:opts) ? '' : join(a:opts, ',')
return g:airline_gui_mode ==# 'gui' return g:airline_gui_mode ==# 'gui'
\ ? [ a:fg, a:bg, '', '', opts ] \ ? [ a:fg, a:bg, '', '', join(a:opts, ',') ]
\ : [ '', '', a:fg, a:bg, opts ] \ : [ '', '', a:fg, a:bg, join(a:opts, ',') ]
endfunction
function! airline#highlighter#reset_hlcache()
let s:hl_groups = {}
endfunction endfunction
function! airline#highlighter#get_highlight(group, ...) function! airline#highlighter#get_highlight(group, ...)
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group) let fg = s:get_syn(a:group, 'fg')
return s:hl_groups[a:group] let bg = s:get_syn(a:group, 'bg')
else let reverse = g:airline_gui_mode ==# 'gui'
let fg = s:get_syn(a:group, 'fg') \ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui')
let bg = s:get_syn(a:group, 'bg') \ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
let reverse = g:airline_gui_mode ==# 'gui' \|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term')
\ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui') return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000)
\ : 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 endfunction
function! airline#highlighter#get_highlight2(fg, bg, ...) function! airline#highlighter#get_highlight2(fg, bg, ...)
@@ -101,22 +84,14 @@ function! airline#highlighter#exec(group, colors)
if len(colors) == 4 if len(colors) == 4
call add(colors, '') call add(colors, '')
endif 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) let colors = s:CheckDefined(colors)
if old_hi != new_hi || !s:hl_group_exists(a:group) if old_hi != colors || !s:hl_group_exists(a:group)
let cmd = printf('hi %s %s %s %s %s %s %s %s', let cmd = printf('hi %s %s %s %s %s %s %s %s',
\ a:group, s:Get(colors, 0, 'guifg='), s:Get(colors, 1, 'guibg='), \ 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, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''),
\ s:Get(colors, 4, 'gui='), s:Get(colors, 4, 'cterm='), \ s:Get(colors, 4, 'gui=', ''), s:Get(colors, 4, 'cterm=', ''),
\ s:Get(colors, 4, 'term=')) \ s:Get(colors, 4, 'term=', ''))
exe cmd exe cmd
if has_key(s:hl_groups, a:group)
let s:hl_groups[a:group] = colors
endif
endif endif
endfunction endfunction
@@ -152,12 +127,11 @@ function! s:CheckDefined(colors)
return a:colors[0:1] + [fg, bg] + [a:colors[4]] return a:colors[0:1] + [fg, bg] + [a:colors[4]]
endfunction endfunction
function! s:Get(dict, key, prefix) function! s:Get(dict, key, prefix, default)
let res=get(a:dict, a:key, '') if get(a:dict, a:key, a:default) isnot# a:default
if res is '' return a:prefix. get(a:dict, a:key)
return ''
else else
return a:prefix. res return ''
endif endif
endfunction endfunction
@@ -223,11 +197,6 @@ function! airline#highlighter#highlight(modes, ...)
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val') let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
let suffix = a:modes[0] == 'inactive' ? '_inactive' : '' let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
for mode in mapped 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]') if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
let dict = g:airline#themes#{g:airline_theme}#palette[mode] let dict = g:airline#themes#{g:airline_theme}#palette[mode]
for kvp in items(dict) for kvp in items(dict)
@@ -265,3 +234,4 @@ function! airline#highlighter#highlight(modes, ...)
endif endif
endfor endfor
endfunction endfunction
+5 -8
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -18,14 +18,13 @@ function! airline#init#bootstrap()
let g:airline#init#bootstrapping = 1 let g:airline#init#bootstrapping = 1
let g:airline#init#vim_async = (v:version >= 800 && has('job')) let g:airline#util#async = v:version >= 800 && has('job')
let g:airline#init#is_windows = has('win32') || has('win64') let g:airline#util#is_windows = has('win32') || has('win64')
call s:check_defined('g:airline_detect_modified', 1) call s:check_defined('g:airline_detect_modified', 1)
call s:check_defined('g:airline_detect_paste', 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_crypt', 1)
call s:check_defined('g:airline_detect_spell', 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_detect_iminsert', 0)
call s:check_defined('g:airline_inactive_collapse', 1) call s:check_defined('g:airline_inactive_collapse', 1)
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus']) call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])
@@ -69,8 +68,7 @@ function! airline#init#bootstrap()
\ 'paste': 'PASTE', \ 'paste': 'PASTE',
\ 'spell': 'SPELL', \ 'spell': 'SPELL',
\ 'modified': '+', \ 'modified': '+',
\ 'space': ' ', \ 'space': ' '
\ 'keymap': 'Keymap:'
\ }, 'keep') \ }, 'keep')
if get(g:, 'airline_powerline_fonts', 0) if get(g:, 'airline_powerline_fonts', 0)
@@ -150,7 +148,6 @@ function! airline#init#bootstrap()
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count']) \ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count'])
call airline#parts#define_text('capslock', '') call airline#parts#define_text('capslock', '')
call airline#parts#define_text('xkblayout', '') call airline#parts#define_text('xkblayout', '')
call airline#parts#define_text('keymap', '')
unlet g:airline#init#bootstrapping unlet g:airline#init#bootstrapping
endfunction endfunction
@@ -164,7 +161,7 @@ endfunction
function! airline#init#sections() function! airline#init#sections()
let spc = g:airline_symbols.space let spc = g:airline_symbols.space
if !exists('g:airline_section_a') if !exists('g:airline_section_a')
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'keymap', 'spell', 'capslock', 'xkblayout', 'iminsert']) let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'spell', 'capslock', 'xkblayout', 'iminsert'])
endif endif
if !exists('g:airline_section_b') if !exists('g:airline_section_b')
let g:airline_section_b = airline#section#create(['hunks', 'branch']) let g:airline_section_b = airline#section#create(['hunks', 'branch'])
+1 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
+3 -13
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -65,17 +65,7 @@ function! airline#parts#paste()
endfunction endfunction
function! airline#parts#spell() function! airline#parts#spell()
let spelllang = g:airline_detect_spelllang ? printf(" [%s]", toupper(substitute(&spelllang, ',', '/', 'g'))) : '' return g:airline_detect_spell && &spell ? g:airline_symbols.spell : ''
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 endfunction
function! airline#parts#iminsert() function! airline#parts#iminsert()
@@ -86,7 +76,7 @@ function! airline#parts#iminsert()
endfunction endfunction
function! airline#parts#readonly() function! airline#parts#readonly()
if &readonly && !filereadable(bufname('%')) if &readonly && &modifiable && !filereadable(bufname('%'))
return '[noperm]' return '[noperm]'
else else
return &readonly ? g:airline_symbols.readonly : '' return &readonly ? g:airline_symbols.readonly : ''
+2 -1
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -82,3 +82,4 @@ endfunction
function! airline#section#create_right(parts) function! airline#section#create_right(parts)
return s:create(a:parts, -1) return s:create(a:parts, -1)
endfunction endfunction
+2 -5
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -44,10 +44,6 @@ function! airline#themes#patch(palette)
if !has_key(a:palette[mode], 'airline_error') if !has_key(a:palette[mode], 'airline_error')
let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ] let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
endif 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 endfor
let a:palette.accents = get(a:palette, 'accents', {}) let a:palette.accents = get(a:palette, 'accents', {})
@@ -74,3 +70,4 @@ function! airline#themes#patch(palette)
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ] let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ]
endif endif
endfunction endfunction
+44 -97
View File
@@ -1,92 +1,39 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 tw=80
scriptencoding utf-8 scriptencoding utf-8
" Airline themes are generated based on the following concepts: " Each theme is contained in its own file and declares variables scoped to the
" * The section of the status line, valid Airline statusline sections are: " file. These variables represent the possible "modes" that airline can
" * airline_a (left most section) " detect. The mode is the return value of mode(), which gets converted to a
" * airline_b (section just to the right of airline_a) " readable string. The following is a list currently supported modes: normal,
" * airline_c (section just to the right of airline_b) " insert, replace, visual, and inactive.
" * 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'
" "
" Airline themes are specified as a global viml dictionary using the above " Each mode can also have overrides. These are small changes to the mode that
" sections, modes and overrides as keys to the dictionary. The name of the " don't require a completely different look. "modified" and "paste" are two
" dictionary is significant and should be specified as: " such supported overrides. These are simply suffixed to the major mode,
" * g:airline#themes#<theme_name>#palette " separated by an underscore. For example, "normal_modified" would be normal
" where <theme_name> is substituted for the name of the theme.vim file where the " mode where the current buffer is modified.
" 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
" "
" For this, the dark.vim, theme, this is defined as " 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.
let g:airline#themes#dark#palette = {} let g:airline#themes#dark#palette = {}
" Keys in the dictionary are composed of the mode, and if specified the " First let's define some arrays. The s: is just a VimL thing for scoping the
" override. For example: " variables to the current script. Without this, these variables would be
" * g:airline#themes#dark#palette.normal " declared globally. Now let's declare some colors for normal mode and add it
" * the colors for a statusline while in normal mode " to the dictionary. The array is in the format:
" * g:airline#themes#dark#palette.normal_modified " [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid
" * the colors for a statusline while in normal mode when the buffer has " values for the "opt" value.
" been modified let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
" * g:airline#themes#dark#palette.visual let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
" * the colors for a statusline while in visual mode 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)
" 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 " 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 " applied after g:airline#themes#dark#palette.normal, hence why only certain keys are
@@ -96,36 +43,36 @@ let g:airline#themes#dark#palette.normal_modified = {
\ } \ }
let s:airline_a_insert = [ '#00005f' , '#00dfff' , 17 , 45 ] let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ]
let s:airline_b_insert = [ '#ffffff' , '#005fff' , 255 , 27 ] let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ]
let s:airline_c_insert = [ '#ffffff' , '#000080' , 15 , 17 ] let s:I3 = [ '#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 = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#dark#palette.insert_modified = { let g:airline#themes#dark#palette.insert_modified = {
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ } \ }
let g:airline#themes#dark#palette.insert_paste = { let g:airline#themes#dark#palette.insert_paste = {
\ 'airline_a': [ s:airline_a_insert[0] , '#d78700' , s:airline_a_insert[2] , 172 , '' ] , \ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
\ } \ }
let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert) let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert)
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.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ]
let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified
let s:airline_a_visual = [ '#000000' , '#ffaf00' , 232 , 214 ] let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ]
let s:airline_b_visual = [ '#000000' , '#ff5f00' , 232 , 202 ] let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ]
let s:airline_c_visual = [ '#ffffff' , '#5f0000' , 15 , 52 ] let s:V3 = [ '#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 = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#dark#palette.visual_modified = { let g:airline#themes#dark#palette.visual_modified = {
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ } \ }
let s:airline_a_inactive = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
let s:airline_b_inactive = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ] let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
let s:airline_c_inactive = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ] let s:IA3 = [ '#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 = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
let g:airline#themes#dark#palette.inactive_modified = { let g:airline#themes#dark#palette.inactive_modified = {
\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] , \ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
\ } \ }
+29 -4
View File
@@ -1,9 +1,6 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " 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 scriptencoding utf-8
call airline#init#bootstrap() call airline#init#bootstrap()
@@ -86,3 +83,31 @@ else
return 0 return 0
endfunction endfunction
endif 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
+36 -116
View File
@@ -32,8 +32,9 @@ INTRODUCTION *airline-intro*
vim-airline is a fast and lightweight alternative to powerline, written vim-airline is a fast and lightweight alternative to powerline, written
in 100% vimscript with no outside dependencies. in 100% vimscript with no outside dependencies.
When the plugin is correctly loaded, Vim will draw a nice statusline at the When the plugin is correctly loaded, and Vim is configured for drawing a
bottom of each window. 'statusline' (set 'laststatus' to 2, to always display the airline
statusline) Vim will draw a nice statusline at the bottom of each window.
That line consists of several sections, each one displaying some piece of That line consists of several sections, each one displaying some piece of
information. By default (without configuration) this line will look like this: > information. By default (without configuration) this line will look like this: >
@@ -130,10 +131,6 @@ values):
* enable spell detection > * enable spell detection >
let g:airline_detect_spell=1 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 > * enable iminsert detection >
let g:airline_detect_iminsert=0 let g:airline_detect_iminsert=0
@@ -210,10 +207,6 @@ values):
the same name (in the correct window): > the same name (in the correct window): >
let w:airline_skip_empty_sections = 0 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* COMMANDS *airline-commands*
@@ -260,12 +253,11 @@ its contents. >
let g:airline_right_sep = '«' let g:airline_right_sep = '«'
let g:airline_right_sep = '◀' let g:airline_right_sep = '◀'
let g:airline_symbols.crypt = '🔒' 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.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.maxlinenr = '㏑'
let g:airline_symbols.branch = '⎇' let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ' let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ' let g:airline_symbols.paste = 'Þ'
@@ -281,8 +273,7 @@ its contents. >
let g:airline_right_alt_sep = '' let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = '' let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = '' let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = '' let g:airline_symbols.linenr = ''
let g:airline_symbols.maxlinenr = ''
" old vim-powerline symbols " old vim-powerline symbols
let g:airline_left_sep = '⮀' let g:airline_left_sep = '⮀'
@@ -306,7 +297,7 @@ section.
variable names default contents variable names default contents
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
let g:airline_section_a (mode, crypt, paste, spell, iminsert) 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_c (bufferline or filename)
let g:airline_section_gutter (readonly, csv) let g:airline_section_gutter (readonly, csv)
let g:airline_section_x (tagbar, filetype, virtualenv) let g:airline_section_x (tagbar, filetype, virtualenv)
@@ -315,9 +306,6 @@ section.
let g:airline_section_error (ycm_error_count, syntastic-err, eclim) let g:airline_section_error (ycm_error_count, syntastic-err, eclim)
let g:airline_section_warning (ycm_warning_count, syntastic-warn, whitespace) 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 " here is an example of how you could replace the branch indicator with
" the current working directory (limited to 10 characters), " the current working directory (limited to 10 characters),
" followed by the filename. " followed by the filename.
@@ -403,13 +391,6 @@ vim-bufferline <https://github.com/bling/vim-bufferline>
* determine whether bufferline will overwrite customization variables > * determine whether bufferline will overwrite customization variables >
let g:airline#extensions#bufferline#overwrite_variables = 1 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* ------------------------------------- *airline-branch*
vim-airline will display the branch-indicator together with the branch name in vim-airline will display the branch-indicator together with the branch name in
@@ -456,9 +437,6 @@ notexists symbol will be displayed after the branch name.
return '[' . a:name . ']' return '[' . a:name . ']'
endfunction endfunction
< <
* truncate sha1 commits at this number of characters >
let g:airline#extensions#branch#sha1_len = 10
<
------------------------------------- *airline-syntastic* ------------------------------------- *airline-syntastic*
syntastic <https://github.com/vim-syntastic/syntastic> syntastic <https://github.com/vim-syntastic/syntastic>
@@ -472,15 +450,9 @@ syntastic <https://github.com/vim-syntastic/syntastic>
* syntastic error_symbol > * syntastic error_symbol >
let airline#extensions#syntastic#error_symbol = 'E:' 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 > * syntastic warning >
let airline#extensions#syntastic#warning_symbol = 'W:' 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* ------------------------------------- *airline-tagbar*
tagbar <https://github.com/majutsushi/tagbar> tagbar <https://github.com/majutsushi/tagbar>
@@ -525,7 +497,7 @@ vimagit <https://github.com/jreybert/vimagit>
let g:airline#extensions#vimagit#enabled = 1 let g:airline#extensions#vimagit#enabled = 1
< <
------------------------------------- *airline-ctrlp* ------------------------------------- *airline-ctrlp*
ctrlp <https://github.com/ctrlpvim/ctrlp.vim> ctrlp <https://github.com/kien/ctrlp.vim>
* configure which mode colors should ctrlp window use (takes effect * configure which mode colors should ctrlp window use (takes effect
only if the active airline theme doesn't define ctrlp colors) > only if the active airline theme doesn't define ctrlp colors) >
@@ -571,18 +543,14 @@ eclim <https://eclim.org>
" create a file in the dir autoload/airline/extensions/wordcount/formatters/ " create a file in the dir autoload/airline/extensions/wordcount/formatters/
" called foo.vim " called foo.vim
" this example needs at least Vim > 7.4.1042 " this example needs at least Vim > 7.4.1042
function! airline#extensions#wordcount#formatters#foo#format(format,fmt) function! airline#extensions#wordcount#formatters#foo#format()
return (wordcount()['words'] == 0 ? 'NONE' : return (wordcount()['words'] == 0 ? 'NONE' :
\ wordcount()['words'] > 100 ? 'okay' : 'not enough') \ wordcount()['words'] > 100 ? 'okay' : 'not enough')
endfunction endfunction
let g:airline#extensions#wordline#formatter = 'foo' let g:airline#extensions#wordline#formatter = 'foo'
* defines how to display the wordcount statistics for the default formatter: > * defines how to display the wordcount statistics: >
" Defaults are below. If fmt_short isn't defined, fmt is used. let g:airline#extensions#wordcount#format = '%d words'
" '%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* ------------------------------------- *airline-whitespace*
* enable/disable detection of whitespace errors. > * enable/disable detection of whitespace errors. >
@@ -650,32 +618,25 @@ eclim <https://eclim.org>
Note: If you're using the ctrlspace tabline only the option marked with (c) Note: If you're using the ctrlspace tabline only the option marked with (c)
are supported! are supported!
* enable/disable enhanced tabline. (c) > * enable/disable enhanced tabline. (c)
let g:airline#extensions#tabline#enabled = 0 let g:airline#extensions#tabline#enabled = 0
* enable/disable displaying open splits per tab (only when tabs are opened). > * enable/disable displaying open splits per tab (only when tabs are opened). >
let g:airline#extensions#tabline#show_splits = 1 let g:airline#extensions#tabline#show_splits = 1
*
* switch position of buffers and tabs on splited tabline (c) * switch position of buffers and tabs on splited tabline (c)
(only supported for ctrlspace plugin). > (only supported for ctrlspace plugin). >
let g:airline#extensions#tabline#switch_buffers_and_tabs = 0 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 let g:airline#extensions#tabline#show_buffers = 1
<
Note: If you are using neovim (has('tablineat') = 1), then you can click 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 on the tabline with the left mouse button to switch to that buffer, and
with the middle mouse button to delete that buffer. with the middle mouse button to delete that buffer.
* if you want to show the current active buffer like this: * enable/disable displaying tabs, regardless of number. (c)
----------------------
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 let g:airline#extensions#tabline#show_tabs = 1
< <
* configure filename match rules to exclude from the tabline. > * configure filename match rules to exclude from the tabline. >
@@ -688,30 +649,22 @@ 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 = 0 " # of splits (default)
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number 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#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. > * enable/disable displaying tab number in tabs mode. >
let g:airline#extensions#tabline#show_tab_nr = 1 let g:airline#extensions#tabline#show_tab_nr = 1
* enable/disable displaying tab type (e.g. [buffers]/[tabs]) > * enable/disable displaying tab type (far right) >
let g:airline#extensions#tabline#show_tab_type = 1 let g:airline#extensions#tabline#show_tab_type = 1
* show buffer label at first position: > Note: The tab-type will only be displayed in tab-mode,
let g:airline#extensions#tabline#buf_label_first = 1 if there are no splits shown. (See: g:airline#extensions#tabline#show_splits)
* rename label for buffers (default: 'buffers') (c) > * rename label for buffers (default: 'buffers') (c)
let g:airline#extensions#tabline#buffers_label = 'b' 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' 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. * enable/disable displaying index of the buffer.
When enabled, numbers will be displayed in the tabline and mappings will be When enabled, numbers will be displayed in the tabline and mappings will be
@@ -730,17 +683,14 @@ with the middle mouse button to delete that buffer.
nmap <leader>9 <Plug>AirlineSelectTab9 nmap <leader>9 <Plug>AirlineSelectTab9
nmap <leader>- <Plug>AirlineSelectPrevTab nmap <leader>- <Plug>AirlineSelectPrevTab
nmap <leader>+ <Plug>AirlineSelectNextTab nmap <leader>+ <Plug>AirlineSelectNextTab
<
Note: Mappings will be ignored within "g:airline#extensions#tabline#keymap_ignored_filetypes". Note: Mappings will be ignored within a NERDTree buffer.
Note: In buffer_idx_mode these mappings won't change the Note: In buffer_idx_mode these mappings won't change the
current tab, but switch to the buffer visible in that tab. current tab, but switch to the buffer visible in that tab.
Use |gt| for switching tabs. Use |gt| for switching tabs.
In tabmode, those mappings will switch to the specified tab. 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 > * change the display format of the buffer index >
let g:airline#extensions#tabline#buffer_idx_format = { let g:airline#extensions#tabline#buffer_idx_format = {
\ '0': '0 ', \ '0': '0 ',
@@ -756,7 +706,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' let g:airline#extensions#tabline#formatter = 'default'
" here is how you can define a 'foo' formatter: " here is how you can define a 'foo' formatter:
@@ -768,7 +718,7 @@ with the middle mouse button to delete that buffer.
let g:airline#extensions#tabline#formatter = 'foo' let g:airline#extensions#tabline#formatter = 'foo'
< <
Note: the following variables are used by the 'default' formatter. Note: the following variables are only used by the 'default' formatter.
When no disambiguation is needed, both 'unique_tail_improved' and When no disambiguation is needed, both 'unique_tail_improved' and
'unique_tail' delegate formatting to 'default', so these variables also 'unique_tail' delegate formatting to 'default', so these variables also
control rendering of unique filenames when using these formatters. control rendering of unique filenames when using these formatters.
@@ -793,12 +743,6 @@ with the middle mouse button to delete that buffer.
" with the containing parent directory. " with the containing parent directory.
let g:airline#extensions#tabline#formatter = 'unique_tail' 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 " The `unique_tail_improved` - another algorithm, that will smartly uniquify
" buffers names with similar filename, suppressing common parts of paths. " buffers names with similar filename, suppressing common parts of paths.
let g:airline#extensions#tabline#formatter = 'unique_tail_improved' let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
@@ -827,7 +771,7 @@ with the middle mouse button to delete that buffer.
let g:airline#extensions#tabline#close_symbol = 'X' let g:airline#extensions#tabline#close_symbol = 'X'
* configure pattern to be ignored on BufAdd autocommand > * configure pattern to be ignored on BufAdd autocommand >
" fixes unnecessary redraw, when e.g. opening Gundo window " fixes unneccessary redraw, when e.g. opening Gundo window
let airline#extensions#tabline#ignore_bufadd_pat = let airline#extensions#tabline#ignore_bufadd_pat =
\ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree' \ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree'
@@ -839,6 +783,7 @@ Note: Enabling this extension will modify 'showtabline' and 'guioptions'.
let airline#extensions#tabline#disable_refresh = 0 let airline#extensions#tabline#disable_refresh = 0
* preserve windows when closing a buffer from the bufferline (default: 0) > * preserve windows when closing a buffer from the bufferline (default: 0) >
let airline#extensions#tabline#middle_click_preserves_windows = 1 let airline#extensions#tabline#middle_click_preserves_windows = 1
< <
------------------------------------- *airline-tmuxline* ------------------------------------- *airline-tmuxline*
@@ -897,18 +842,11 @@ vim-xkblayout
let g:airline#extensions#xkblayout#enabled = 1 let g:airline#extensions#xkblayout#enabled = 1
* define path to the backend switcher library * 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' 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' 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* ------------------------------------- *airline-windowswap*
vim-windowswap <https://github.com/wesQ3/vim-windowswap> vim-windowswap <https://github.com/wesQ3/vim-windowswap>
@@ -976,30 +914,30 @@ Shows the current file's vimtex related info.
* enable/disable vimtex integration > * enable/disable vimtex integration >
let g:airline#extensions#vimtex#enabled = 1 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#left = "{"
let g:airline#extensions#vimtex#right = "}" let g:airline#extensions#vimtex#right = "}"
State indicators: 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 = "" let g:airline#extensions#vimtex#main = ""
* the current tex file is a subfile of the project * the current tex file is a subfile of the project
and the compilation is set for the main file > and the compilation is set for the main file
let g:airline#extensions#vimtex#sub_main = "m" let g:airline#extensions#vimtex#sub_main = "m"
* the current tex file is a subfile of the project * 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" let g:airline#extensions#vimtex#sub_local = "l"
* single compilation is running > * single compilation is running
let g:airline#extensions#vimtex#compiled = "c₁" let g:airline#extensions#vimtex#compiled = "c₁"
* continuousr compilation is running > * continuousr compilation is running
let g:airline#extensions#vimtex#continuous = "c" let g:airline#extensions#vimtex#continuous = "c"
* viewer is opened > * viewer is opened
let g:airline#extensions#vimtex#viewer = "v" let g:airline#extensions#vimtex#viewer = "v"
------------------------------------- *airline-ale* ------------------------------------- *airline-ale*
@@ -1014,12 +952,6 @@ ale <https://github.com/w0rp/ale>
* ale warning > * ale warning >
let airline#extensions#ale#warning_symbol = 'W:' 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* ------------------------------------- *airline-neomake*
neomake <https://github.com/neomake/neomake> neomake <https://github.com/neomake/neomake>
@@ -1032,15 +964,6 @@ neomake <https://github.com/neomake/neomake>
* neomake warning > * neomake warning >
let airline#extensions#neomake#warning_symbol = 'W:' 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* ADVANCED CUSTOMIZATION *airline-advanced-customization*
@@ -1087,7 +1010,7 @@ Before is a list of parts that are predefined by vim-airline.
* `file` displays the filename and modified indicator * `file` displays the filename and modified indicator
* `path` displays the filename (absolute path) and modifier indicator * `path` displays the filename (absolute path) and modifier indicator
* `linenr` displays the current line number * `linenr` displays the current line number
* `maxlinenr` displays the number of lines in the buffer * `maxlinenr` dispalys the number of lines in the buffer
* `ffenc` displays the file format and encoding * `ffenc` displays the file format and encoding
And the following are defined for their respective extensions: And the following are defined for their respective extensions:
@@ -1305,9 +1228,6 @@ A. Themes have been extracted into the vim-airlines-themes repository. Simply
clone https://github.com/vim-airline/vim-airline-themes and everything clone https://github.com/vim-airline/vim-airline-themes and everything
should work again. 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: Solutions to other common problems can be found in the Wiki:
<https://github.com/vim-airline/vim-airline/wiki/FAQ> <https://github.com/vim-airline/vim-airline/wiki/FAQ>
+1 -9
View File
@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
scriptencoding utf-8 scriptencoding utf-8
@@ -57,7 +57,6 @@ endfunction
function! s:on_colorscheme_changed() function! s:on_colorscheme_changed()
call s:init() call s:init()
unlet! g:airline#highlighter#normal_fg_hi unlet! g:airline#highlighter#normal_fg_hi
call airline#highlighter#reset_hlcache()
let g:airline_gui_mode = airline#init#gui_mode() let g:airline_gui_mode = airline#init#gui_mode()
if !s:theme_in_vimrc if !s:theme_in_vimrc
call airline#switch_matching_theme() call airline#switch_matching_theme()
@@ -81,7 +80,6 @@ function! s:airline_toggle()
if exists("s:stl") if exists("s:stl")
let &stl = s:stl let &stl = s:stl
endif endif
call airline#highlighter#reset_hlcache()
silent doautocmd User AirlineToggledOff silent doautocmd User AirlineToggledOff
else else
@@ -95,8 +93,6 @@ function! s:airline_toggle()
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter') autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed() 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 * autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload *
\ call <sid>on_window_changed() \ call <sid>on_window_changed()
if exists('#CompleteDone') if exists('#CompleteDone')
@@ -110,9 +106,6 @@ function! s:airline_toggle()
\ | call airline#load_theme() \ | call airline#load_theme()
augroup END augroup END
if &laststatus < 2
set laststatus=2
endif
if s:airline_initialized if s:airline_initialized
call s:on_window_changed() call s:on_window_changed()
endif endif
@@ -144,7 +137,6 @@ function! s:airline_refresh()
let nomodeline = '<nomodeline>' let nomodeline = '<nomodeline>'
endif endif
exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline) exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline)
call airline#highlighter#reset_hlcache()
call airline#load_theme() call airline#load_theme()
call airline#update_statusline() call airline#update_statusline()
endfunction endfunction
-2
View File
@@ -19,7 +19,6 @@ describe 'active builder'
end end
it 'should reuse highlight group if background colors match' it 'should reuse highlight group if background colors match'
call airline#highlighter#reset_hlcache()
highlight Foo1 ctermfg=1 ctermbg=2 highlight Foo1 ctermfg=1 ctermbg=2
highlight Foo2 ctermfg=1 ctermbg=2 highlight Foo2 ctermfg=1 ctermbg=2
call s:builder.add_section('Foo1', 'hello') call s:builder.add_section('Foo1', 'hello')
@@ -29,7 +28,6 @@ describe 'active builder'
end end
it 'should switch highlight groups if foreground colors differ' it 'should switch highlight groups if foreground colors differ'
call airline#highlighter#reset_hlcache()
highlight Foo1 ctermfg=1 ctermbg=2 highlight Foo1 ctermfg=1 ctermbg=2
highlight Foo2 ctermfg=2 ctermbg=2 highlight Foo2 ctermfg=2 ctermbg=2
call s:builder.add_section('Foo1', 'hello') call s:builder.add_section('Foo1', 'hello')
-5
View File
@@ -5,7 +5,6 @@ describe 'themes'
end end
it 'should extract correct colors' it 'should extract correct colors'
call airline#highlighter#reset_hlcache()
highlight Foo ctermfg=1 ctermbg=2 highlight Foo ctermfg=1 ctermbg=2
let colors = airline#themes#get_highlight('Foo') let colors = airline#themes#get_highlight('Foo')
Expect colors[2] == '1' Expect colors[2] == '1'
@@ -13,7 +12,6 @@ describe 'themes'
end end
it 'should extract from normal if colors unavailable' it 'should extract from normal if colors unavailable'
call airline#highlighter#reset_hlcache()
highlight Normal ctermfg=100 ctermbg=200 highlight Normal ctermfg=100 ctermbg=200
highlight Foo ctermbg=2 highlight Foo ctermbg=2
let colors = airline#themes#get_highlight('Foo') let colors = airline#themes#get_highlight('Foo')
@@ -22,7 +20,6 @@ describe 'themes'
end end
it 'should flip target group if it is reversed' it 'should flip target group if it is reversed'
call airline#highlighter#reset_hlcache()
highlight Foo ctermbg=222 ctermfg=103 term=reverse highlight Foo ctermbg=222 ctermfg=103 term=reverse
let colors = airline#themes#get_highlight('Foo') let colors = airline#themes#get_highlight('Foo')
Expect colors[2] == '222' Expect colors[2] == '222'
@@ -30,8 +27,6 @@ describe 'themes'
end end
it 'should pass args through correctly' it 'should pass args through correctly'
call airline#highlighter#reset_hlcache()
hi clear Normal
let hl = airline#themes#get_highlight('Foo', 'bold', 'italic') let hl = airline#themes#get_highlight('Foo', 'bold', 'italic')
Expect hl == ['', '', 'NONE', 'NONE', 'bold,italic'] Expect hl == ['', '', 'NONE', 'NONE', 'bold,italic']