pax_global_header00006660000000000000000000000064126701525250014517gustar00rootroot0000000000000052 comment=410429a95c67eed8eeb26681838d3766a2437806 vim-airline-0.8/000077500000000000000000000000001267015252500136025ustar00rootroot00000000000000vim-airline-0.8/.gitignore000066400000000000000000000000341267015252500155670ustar00rootroot00000000000000doc/tags *.lock .vim-flavor vim-airline-0.8/.travis.yml000066400000000000000000000010061267015252500157100ustar00rootroot00000000000000language: ruby before_install: - curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/simple.vim" -o autoload/airline/themes/simple.vim - curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/molokai.vim" -o autoload/airline/themes/molokai.vim - mkdir colors && curl -f -L 'https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim' -o colors/molokai.vim rvm: - 1.9.3 script: rake ci vim-airline-0.8/CHANGELOG.md000066400000000000000000000114071267015252500154160ustar00rootroot00000000000000# Change Log This is the Changelog for the vim-airline project. ## [Unreleased] ## [0.8] - 2016-03-09 - Changes - Airline converted to an organization and moved to new [repository](https://github.com/vim-airline/vim-airline) - Themes have been split into an separate repository [vim-airline-themes](https://github.com/vim-airline/vim-airline-themes) - Improvements - Extensions - branch: support Git and Mercurial simultaneously, untracked files - whitespace: new mixed-indent rule - Windows support - Many bug fixes - Support for Neovim - New features - Many new themes - Extensions/integration - [taboo](https://github.com/gcmt/taboo.vim) - [vim-ctrlspace](https://github.com/szw/vim-ctrlspace) - [quickfixsigns](https://github.com/tomtom/quickfixsigns_vim) - [YouCompleteMe](https://github.com/Valloric/YouCompleteMe) - [po.vim](http://www.vim.org/scripts/script.php?script_id=695) - [unicode.vim](https://github.com/chrisbra/unicode.vim) - wordcount - crypt indicator - byte order mark indicator - Tabline's tab mode can display splits simultaneously ## [0.7] - 2014-12-10 - New features - accents support; allowing multiple colors/styles in the same section - extensions: eclim - themes: understated, monochrome, murmur, sol, lucius - Improvements - solarized theme; support for 8 color terminals - tabline resizes dynamically based on number of open buffers - miscellaneous bug fixes ## [0.6] - 2013-10-08 - New features - accents support; allowing multiple colors/styles in the same section - extensions: eclim - themes: understated, monochrome, murmur, sol, lucius - Improvements - solarized theme; support for 8 color terminals - tabline resizes dynamically based on number of open buffers - miscellaneous bug fixes ## [0.5] - 2013-09-13 - New features - smart tabline extension which displays all buffers when only one tab is visible - automatic section truncation when the window resizes - support for a declarative style of configuration, allowing parts to contain metadata such as minimum window width or conditional visibility - themes: zenburn, serene - Other - a sizable chunk of vim-airline is now running through a unit testing suite, automated via Travis CI ## [0.4] - 2013-08-26 - New features - integration with csv.vim and vim-virtualenv - hunks extension for vim-gitgutter and vim-signify - automatic theme switching with matching colorschemes - commands: AirlineToggle - themes: base16 (all variants) - Improvements - integration with undotree, tagbar, and unite - Other - refactored core and exposed statusline builder and pipeline - all extension related g:airline_variables have been deprecated in favor of g:airline#extensions# variables - extensions found in the runtimepath outside of the default distribution will be automatically loaded ## [0.3] - 2013-08-12 - New features - first-class integration with tagbar - white space detection for trailing spaces and mixed indentation - introduced warning section for syntastic and white space detection - improved ctrlp integration: colors are automatically selected based on the current airline theme - new themes: molokai, bubblegum, jellybeans, tomorrow - Bug fixes - improved handling of eventignore used by other plugins - Other - code cleaned up for clearer separation between core functionality and extensions - introduced color extraction from highlight groups, allowing themes to be generated off of the active colorscheme (e.g. jellybeans and tomorrow) - License changed to MIT ## [0.2] - 2013-07-28 - New features - iminsert detection - integration with vimshell, vimfiler, commandt, lawrencium - enhanced bufferline theming - support for ctrlp theming - support for custom window excludes - New themes - luna and wombat - Bug fixes - refresh branch name after switching with a shell command ## [0.1] - 2013-07-17 - Initial release - integration with other plugins: netrw, unite, nerdtree, undotree, gundo, tagbar, minibufexplr, ctrlp - support for themes: 8 included [Unreleased]: https://github.com/vim-airline/vim-airline/compare/v0.8...HEAD [0.8]: https://github.com/vim-airline/vim-airline/compare/v0.7...v0.8 [0.7]: https://github.com/vim-airline/vim-airline/compare/v0.6...v0.7 [0.6]: https://github.com/vim-airline/vim-airline/compare/v0.5...v0.6 [0.5]: https://github.com/vim-airline/vim-airline/compare/v0.4...v0.5 [0.4]: https://github.com/vim-airline/vim-airline/compare/v0.3...v0.4 [0.3]: https://github.com/vim-airline/vim-airline/compare/v0.2...v0.3 [0.2]: https://github.com/vim-airline/vim-airline/compare/v0.1...v0.2 [0.1]: https://github.com/vim-airline/vim-airline/releases/tag/v0.1 vim-airline-0.8/CONTRIBUTING.md000066400000000000000000000036231267015252500160370ustar00rootroot00000000000000# Contributions Contributions and pull requests are welcome. Please take note of the following guidelines: * Adhere to the existing style as much as possible; notably, 2 space indents and long-form keywords. * Keep the history clean! Squash your branches before you submit a pull request. `pull --rebase` is your friend. * Any changes to the core should be tested against Vim 7.2. # Bugs Tracking down bugs can take a very long time due to different configurations, versions, and operating systems. To ensure a timely response, please help me out by doing the following: * Reproduce it with this [minivimrc][7] repository to rule out any configuration conflicts. Even better, create a `gist` of your vimrc that is compatible with [pathogen][11]. * And to make it easier to reproduce, please supply the following: * the `:version` of vim * the commit of vim-airline you're using * the OS that you're using, including terminal emulator, GUI vs non-GUI # Themes * If you submit a theme, please create a screenshot so it can be added to the [Wiki][14]. * In the majority of cases, modifications to colors of existing themes will likely be rejected. Themes are a subjective thing, so while you may prefer that a particular color be darker, another user will prefer it to be lighter, or something entirely different. The more popular the theme, the more unlikely the change will be accepted. However, it's pretty simple to create your own theme; copy the theme to `~/.vim/autoload/airline/themes` under a new name with your modifications, and it can be used. # Maintenance If you would like to take a more active role in improving vim-airline, please consider [becoming a maintainer][43]. [7]: https://github.com/bling/minivimrc [11]: https://github.com/tpope/vim-pathogen [14]: https://github.com/vim-airline/vim-airline/wiki/Screenshots [43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer vim-airline-0.8/Gemfile000066400000000000000000000000711267015252500150730ustar00rootroot00000000000000source 'https://rubygems.org' gem 'vim-flavor', '~> 1.1' vim-airline-0.8/ISSUE_TEMPLATE.md000066400000000000000000000002101267015252500163000ustar00rootroot00000000000000#### environment - vim: ???? - vim-airline: ???? - OS: ???? - terminal: ???? #### actual behavior ???? #### expected behavior ???? vim-airline-0.8/LICENSE000066400000000000000000000020731267015252500146110ustar00rootroot00000000000000The MIT License (MIT) Copyright (C) 2013-2016 Bailey Ling 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. vim-airline-0.8/README.md000066400000000000000000000254161267015252500150710ustar00rootroot00000000000000# vim-airline [![Build Status](https://travis-ci.org/vim-airline/vim-airline.png)](https://travis-ci.org/vim-airline/vim-airline) Lean & mean status/tabline for vim that's light as air. ![img](https://github.com/vim-airline/vim-airline/wiki/screenshots/demo.gif) # Features * Tiny core written with extensibility in mind ([open/closed principle][8]). * Integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [vim-signify][30], [quickfixsigns][39], [syntastic][5], [eclim][34], [lawrencium][21], [virtualenv][31], [tmuxline][35], [taboo.vim][37], [ctrlspace][38] and more. * Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols. * Optimized for speed; it loads in under a millisecond. * Extensive suite of themes for popular color schemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others. Note these are now external to this plugin. See [below][46] for detail. * Supports 7.2 as the minimum Vim version. * The master branch tries to be as stable as possible, and new features are merged in only after they have gone through a [full regression test][33]. * Unit testing suite. ## Straightforward customization If you don't like the defaults, you can replace all sections with standard `statusline` syntax. Give your statusline that you've built over the years a face lift. ![image](https://f.cloud.github.com/assets/306502/1009429/d69306da-0b38-11e3-94bf-7c6e3eef41e9.png) ## Themes Themes have moved to another repository as of [this commit][45]. Install the themes as you would this plugin (Vundle example): ```vim Plugin 'vim-airline/vim-airline' Plugin 'vim-airline/vim-airline-themes' ``` See https://github.com/vim-airline/vim-airline-themes for more. ## Automatic truncation Sections and parts within sections can be configured to automatically hide when the window size shrinks. ![image](https://f.cloud.github.com/assets/306502/1060831/05c08aac-11bc-11e3-8470-a506a3037f45.png) ## Smarter tab line Automatically displays all buffers when there's only one tab open. ![tabline](https://f.cloud.github.com/assets/306502/1072623/44c292a0-1495-11e3-9ce6-dcada3f1c536.gif) This is disabled by default; add the following to your vimrc to enable the extension: let g:airline#extensions#tabline#enabled = 1 Separators can be configured independently for the tabline, so here is how you can define "straight" tabs: let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '|' ## 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). #### [ctrlp.vim][10] ![image](https://f.cloud.github.com/assets/306502/962258/7345a224-04ec-11e3-8b5a-f11724a47437.png) #### [unite.vim][9] ![image](https://f.cloud.github.com/assets/306502/962319/4d7d3a7e-04ed-11e3-9d59-ab29cb310ff8.png) #### [tagbar][19] ![image](https://f.cloud.github.com/assets/306502/962150/7e7bfae6-04ea-11e3-9e28-32af206aed80.png) #### [csv.vim][28] ![image](https://f.cloud.github.com/assets/306502/962204/cfc1210a-04eb-11e3-8a93-42e6bcd21efa.png) #### [syntastic][5] ![image](https://f.cloud.github.com/assets/306502/962864/9824c484-04f7-11e3-9928-da94f8c7da5a.png) #### hunks ([vim-gitgutter][29] & [vim-signify][30]) ![image](https://f.cloud.github.com/assets/306502/995185/73fc7054-09b9-11e3-9d45-618406c6ed98.png) #### [virtualenv][31] ![image](https://f.cloud.github.com/assets/390964/1022566/cf81f830-0d98-11e3-904f-cf4fe3ce201e.png) #### [tmuxline][35] ![image](https://f.cloud.github.com/assets/1532071/1559276/4c28fbac-4fc7-11e3-90ef-7e833d980f98.gif) #### [promptline][36] ![airline-promptline-sc](https://f.cloud.github.com/assets/1532071/1871900/7d4b28a0-789d-11e3-90e4-16f37269981b.gif) #### [ctrlspace][38] ![papercolor_with_ctrlspace](https://cloud.githubusercontent.com/assets/493242/12912041/7fc3c6ec-cf16-11e5-8775-8492b9c64ebf.png) ## Extras vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also: #### whitespace ![image](https://f.cloud.github.com/assets/306502/962401/2a75385e-04ef-11e3-935c-e3b9f0e954cc.png) ## Configurable and extensible #### Fine-tuned configuration Every section is composed of parts, and you can reorder and reconfigure them at will. ![image](https://f.cloud.github.com/assets/306502/1073278/f291dd4c-14a3-11e3-8a83-268e2753f97d.png) Sections can contain accents, which allows for very granular control of visuals (see configuration [here](https://github.com/vim-airline/vim-airline/issues/299#issuecomment-25772886)). ![image](https://f.cloud.github.com/assets/306502/1195815/4bfa38d0-249d-11e3-823e-773cfc2ca894.png) #### Extensible pipeline Completely transform the statusline to your liking. Build out the statusline as you see fit by extracting colors from the current colorscheme's highlight groups. ![allyourbase](https://f.cloud.github.com/assets/306502/1022714/e150034a-0da7-11e3-94a5-ca9d58a297e8.png) # Rationale There's already [powerline][2], why yet another statusline? * 100% vimscript; no python needed. What about [vim-powerline][1]? * vim-powerline has been deprecated in favor of the newer, unifying powerline, which is under active development; the new version is written in python at the core and exposes various bindings such that it can style statuslines not only in vim, but also tmux, bash, zsh, and others. # Where did the name come from? I wrote the initial version on an airplane, and since it's light as air it turned out to be a good name. Thanks for flying vim! # Installation This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers: * [Pathogen][11] * `git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline` * Remember to run `:Helptags` to generate help tags * [NeoBundle][12] * `NeoBundle 'vim-airline/vim-airline'` * [Vundle][13] * `Plugin 'vim-airline/vim-airline'` * [Plug][40] * `Plug 'vim-airline/vim-airline'` * [VAM][22] * `call vam#ActivateAddons([ 'vim-airline' ])` * manual * copy all of the files into your `~/.vim` directory # Configuration `:help airline` The default setting of 'laststatus' is for the statusline to not appear until a split is created. If you want it to appear all the time, add the following to your vimrc: `set laststatus=2` # Integrating with powerline fonts For the nice looking powerline symbols to appear, you will need to install a patched font. Instructions can be found in the official powerline [documentation][20]. Prepatched fonts can be found in the [powerline-fonts][3] repository. Finally, you can add the convenience variable `let g:airline_powerline_fonts = 1` to your vimrc which will automatically populate the `g:airline_symbols` dictionary with the powerline symbols. # FAQ Solutions to common problems can be found in the [Wiki][27]. # Performance Whoa! Everything got slow all of a sudden... vim-airline strives to make it easy to use out of the box, which means that by default it will look for all compatible plugins that you have installed and enable the relevant extension. Many optimizations have been made such that the majority of users will not see any performance degradation, but it can still happen. For example, users who routinely open very large files may want to disable the `tagbar` extension, as it can be very expensive to scan for the name of the current function. 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. # Screenshots A full list of screenshots for various themes can be found in the [Wiki][14]. # Maintainers The project is currently being maintained by [Bailey Ling][41], [Christian Brabandt][42], and [Mike Hartington][44]. If you are interested in becoming a maintainer (we always welcome more maintainers), please [go here][43]. # License MIT License. Copyright (c) 2013-2016 Bailey Ling. [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/vim-airline/vim-airline/trend.png)](https://bitdeli.com/free "Bitdeli Badge") [1]: https://github.com/Lokaltog/vim-powerline [2]: https://github.com/Lokaltog/powerline [3]: https://github.com/Lokaltog/powerline-fonts [4]: https://github.com/tpope/vim-fugitive [5]: https://github.com/scrooloose/syntastic [6]: https://github.com/bling/vim-bufferline [7]: https://github.com/bling/minivimrc [8]: http://en.wikipedia.org/wiki/Open/closed_principle [9]: https://github.com/Shougo/unite.vim [10]: https://github.com/ctrlpvim/ctrlp.vim [11]: https://github.com/tpope/vim-pathogen [12]: https://github.com/Shougo/neobundle.vim [13]: https://github.com/gmarik/vundle [14]: https://github.com/vim-airline/vim-airline/wiki/Screenshots [15]: https://github.com/techlivezheng/vim-plugin-minibufexpl [16]: https://github.com/sjl/gundo.vim [17]: https://github.com/mbbill/undotree [18]: https://github.com/scrooloose/nerdtree [19]: https://github.com/majutsushi/tagbar [20]: https://powerline.readthedocs.org/en/master/installation.html#patched-fonts [21]: https://bitbucket.org/ludovicchabant/vim-lawrencium [22]: https://github.com/MarcWeber/vim-addon-manager [23]: https://github.com/altercation/solarized [24]: https://github.com/chriskempson/tomorrow-theme [25]: https://github.com/tomasr/molokai [26]: https://github.com/nanotech/jellybeans.vim [27]: https://github.com/vim-airline/vim-airline/wiki/FAQ [28]: https://github.com/chrisbra/csv.vim [29]: https://github.com/airblade/vim-gitgutter [30]: https://github.com/mhinz/vim-signify [31]: https://github.com/jmcantrell/vim-virtualenv [32]: https://github.com/chriskempson/base16-vim [33]: https://github.com/vim-airline/vim-airline/wiki/Test-Plan [34]: http://eclim.org [35]: https://github.com/edkolev/tmuxline.vim [36]: https://github.com/edkolev/promptline.vim [37]: https://github.com/gcmt/taboo.vim [38]: https://github.com/szw/vim-ctrlspace [39]: https://github.com/tomtom/quickfixsigns_vim [40]: https://github.com/junegunn/vim-plug [41]: https://github.com/bling [42]: https://github.com/chrisbra [43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer [44]: https://github.com/mhartington [45]: https://github.com/vim-airline/vim-airline/commit/d7fd8ca649e441b3865551a325b10504cdf0711b [46]: https://github.com/vim-airline/vim-airline#themes vim-airline-0.8/Rakefile000066400000000000000000000002511267015252500152450ustar00rootroot00000000000000#!/usr/bin/env rake task :default => [:test] task :ci => [:dump, :test] task :dump do sh 'vim --version' end task :test do sh 'bundle exec vim-flavor test' end vim-airline-0.8/autoload/000077500000000000000000000000001267015252500154125ustar00rootroot00000000000000vim-airline-0.8/autoload/airline.vim000066400000000000000000000125171267015252500175600ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', []) let s:sections = ['a','b','c','gutter','x','y','z', 'error', 'warning'] let s:inactive_funcrefs = [] function! airline#add_statusline_func(name) call airline#add_statusline_funcref(function(a:name)) endfunction function! airline#add_statusline_funcref(function) if index(g:airline_statusline_funcrefs, a:function) >= 0 echohl WarningMsg echo 'The airline statusline funcref '.string(a:function).' has already been added.' echohl NONE return endif call add(g:airline_statusline_funcrefs, a:function) endfunction function! airline#remove_statusline_func(name) let i = index(g:airline_statusline_funcrefs, function(a:name)) if i > -1 call remove(g:airline_statusline_funcrefs, i) endif endfunction function! airline#add_inactive_statusline_func(name) call add(s:inactive_funcrefs, function(a:name)) endfunction function! airline#load_theme() if exists('*airline#themes#{g:airline_theme}#refresh') call airline#themes#{g:airline_theme}#refresh() endif let palette = g:airline#themes#{g:airline_theme}#palette call airline#themes#patch(palette) if exists('g:airline_theme_patch_func') let Fn = function(g:airline_theme_patch_func) call Fn(palette) endif call airline#highlighter#load_theme() call airline#extensions#load_theme() call airline#update_statusline() endfunction function! airline#switch_theme(name) try let palette = g:airline#themes#{a:name}#palette "also lazy loads the theme let g:airline_theme = a:name catch echohl WarningMsg | echo 'The specified theme cannot be found.' | echohl NONE if exists('g:airline_theme') return else let g:airline_theme = 'dark' endif endtry let w:airline_lastmode = '' call airline#load_theme() " this is required to prevent clobbering the startup info message, i don't know why... call airline#check_mode(winnr()) endfunction function! airline#switch_matching_theme() if exists('g:colors_name') let existing = g:airline_theme let theme = substitute(g:colors_name, '-', '_', 'g') try let palette = g:airline#themes#{theme}#palette call airline#switch_theme(theme) return 1 catch for map in items(g:airline_theme_map) if match(g:colors_name, map[0]) > -1 try let palette = g:airline#themes#{map[1]}#palette call airline#switch_theme(map[1]) catch call airline#switch_theme(existing) endtry return 1 endif endfor endtry endif return 0 endfunction function! airline#update_statusline() if airline#util#getwinvar(winnr(), 'airline_disabled', 0) return endif for nr in filter(range(1, winnr('$')), 'v:val != winnr()') if airline#util#getwinvar(nr, 'airline_disabled', 0) continue endif call setwinvar(nr, 'airline_active', 0) let context = { 'winnr': nr, 'active': 0, 'bufnr': winbufnr(nr) } call s:invoke_funcrefs(context, s:inactive_funcrefs) endfor unlet! w:airline_render_left unlet! w:airline_render_right for section in s:sections unlet! w:airline_section_{section} endfor let w:airline_active = 1 let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) } call s:invoke_funcrefs(context, g:airline_statusline_funcrefs) endfunction let s:contexts = {} let s:core_funcrefs = [ \ function('airline#extensions#apply'), \ function('airline#extensions#default#apply') ] function! s:invoke_funcrefs(context, funcrefs) let builder = airline#builder#new(a:context) let err = airline#util#exec_funcrefs(a:funcrefs + s:core_funcrefs, builder, a:context) if err == 1 let a:context.line = builder.build() let s:contexts[a:context.winnr] = a:context call setwinvar(a:context.winnr, '&statusline', '%!airline#statusline('.a:context.winnr.')') endif endfunction function! airline#statusline(winnr) if has_key(s:contexts, a:winnr) return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line endif " in rare circumstances this happens...see #276 return '' endfunction function! airline#check_mode(winnr) let context = s:contexts[a:winnr] if get(w:, 'airline_active', 1) let l:m = mode() if l:m ==# "i" let l:mode = ['insert'] elseif l:m ==# "R" let l:mode = ['replace'] elseif l:m =~# '\v(v|V||s|S|)' let l:mode = ['visual'] elseif l:m ==# "t" let l:mode = ['terminal'] else let l:mode = ['normal'] endif let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m) else let l:mode = ['inactive'] let w:airline_current_mode = get(g:airline_mode_map, '__') endif if g:airline_detect_modified && &modified call add(l:mode, 'modified') endif if g:airline_detect_paste && &paste call add(l:mode, 'paste') endif if g:airline_detect_crypt && exists("+key") && !empty(&key) call add(l:mode, 'crypt') endif if &readonly || ! &modifiable call add(l:mode, 'readonly') endif let mode_string = join(l:mode) if get(w:, 'airline_lastmode', '') != mode_string call airline#highlighter#highlight_modified_inactive(context.bufnr) call airline#highlighter#highlight(l:mode) let w:airline_lastmode = mode_string endif return '' endfunction vim-airline-0.8/autoload/airline/000077500000000000000000000000001267015252500170355ustar00rootroot00000000000000vim-airline-0.8/autoload/airline/builder.vim000066400000000000000000000072241267015252500212050ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:prototype = {} function! s:prototype.split(...) call add(self._sections, ['|', a:0 ? a:1 : '%=']) endfunction function! s:prototype.add_section_spaced(group, contents) call self.add_section(a:group, (g:airline_symbols.space).a:contents.(g:airline_symbols.space)) endfunction function! s:prototype.add_section(group, contents) call add(self._sections, [a:group, a:contents]) endfunction function! s:prototype.add_raw(text) call add(self._sections, ['', a:text]) endfunction function! s:get_prev_group(sections, i) let x = a:i - 1 while x >= 0 let group = a:sections[x][0] if group != '' && group != '|' return group endif let x = x - 1 endwhile return '' endfunction function! s:prototype.build() let side = 1 let line = '' let i = 0 let length = len(self._sections) let split = 0 while i < length let section = self._sections[i] let group = section[0] let contents = section[1] let prev_group = s:get_prev_group(self._sections, i) if group == '' let line .= contents elseif group == '|' let side = 0 let line .= contents let split = 1 else if prev_group == '' let line .= '%#'.group.'#' elseif split let line .= s:get_transitioned_seperator(self, prev_group, group, side) let split = 0 else let line .= s:get_seperator(self, prev_group, group, side) endif let line .= s:get_accented_line(self, group, contents) endif let i = i + 1 endwhile if !self._context.active let line = substitute(line, '%#.\{-}\ze#', '\0_inactive', 'g') endif return line endfunction function! s:should_change_group(group1, group2) if a:group1 == a:group2 return 0 endif let color1 = airline#highlighter#get_highlight(a:group1) let color2 = airline#highlighter#get_highlight(a:group2) if g:airline_gui_mode ==# 'gui' return color1[1] != color2[1] || color1[0] != color2[0] else return color1[3] != color2[3] || color1[2] != color2[2] endif endfunction function! s:get_transitioned_seperator(self, prev_group, group, side) let line = '' call airline#highlighter#add_separator(a:prev_group, a:group, a:side) let line .= '%#'.a:prev_group.'_to_'.a:group.'#' let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep let line .= '%#'.a:group.'#' return line endfunction function! s:get_seperator(self, prev_group, group, side) if s:should_change_group(a:prev_group, a:group) return s:get_transitioned_seperator(a:self, a:prev_group, a:group, a:side) else return a:side ? a:self._context.left_alt_sep : a:self._context.right_alt_sep endif endfunction function! s:get_accented_line(self, group, contents) if a:self._context.active let contents = [] let content_parts = split(a:contents, '__accent') for cpart in content_parts let accent = matchstr(cpart, '_\zs[^#]*\ze') call add(contents, cpart) endfor let line = join(contents, a:group) let line = substitute(line, '__restore__', a:group, 'g') else let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g') let line = substitute(line, '%#__restore__#', '', 'g') endif return line endfunction function! airline#builder#new(context) let builder = copy(s:prototype) let builder._context = a:context let builder._sections = [] call extend(builder._context, { \ 'left_sep': g:airline_left_sep, \ 'left_alt_sep': g:airline_left_alt_sep, \ 'right_sep': g:airline_right_sep, \ 'right_alt_sep': g:airline_right_alt_sep, \ }, 'keep') return builder endfunction vim-airline-0.8/autoload/airline/debug.vim000066400000000000000000000017661267015252500206520ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 function! airline#debug#profile1() profile start airline-profile-switch.log profile func * profile file * split for i in range(1, 1000) wincmd w redrawstatus endfor profile pause noautocmd qall! endfunction function! airline#debug#profile2() profile start airline-profile-cursor.log profile func * profile file * edit blank call setline(1, 'all your base are belong to us') call setline(2, 'all your base are belong to us') let positions = [[1,2], [2,2], [1,2], [1,1]] for i in range(1, 1000) for pos in positions call cursor(pos[0], pos[1]) redrawstatus endfor endfor profile pause noautocmd qall! endfunction function! airline#debug#profile3() profile start airline-profile-mode.log profile func * profile file * for i in range(1000) startinsert redrawstatus stopinsert redrawstatus endfor profile pause noautocmd qall! endfunction vim-airline-0.8/autoload/airline/extensions.vim000066400000000000000000000202771267015252500217610ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:ext = {} let s:ext._theme_funcrefs = [] function! s:ext.add_statusline_func(name) dict call airline#add_statusline_func(a:name) endfunction function! s:ext.add_statusline_funcref(function) dict call airline#add_statusline_funcref(a:function) endfunction function! s:ext.add_inactive_statusline_func(name) dict call airline#add_inactive_statusline_func(a:name) endfunction function! s:ext.add_theme_func(name) dict call add(self._theme_funcrefs, function(a:name)) endfunction let s:script_path = tolower(resolve(expand(':p:h'))) let s:filetype_overrides = { \ 'nerdtree': [ 'NERD', '' ], \ 'gundo': [ 'Gundo', '' ], \ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ], \ 'minibufexpl': [ 'MiniBufExplorer', '' ], \ 'startify': [ 'startify', '' ], \ 'vim-plug': [ 'Plugins', '' ], \ } let s:filetype_regex_overrides = {} function! s:check_defined_section(name) if !exists('w:airline_section_{a:name}') let w:airline_section_{a:name} = g:airline_section_{a:name} endif endfunction function! airline#extensions#append_to_section(name, value) call check_defined_section(a:name) let w:airline_section_{a:name} .= a:value endfunction function! airline#extensions#prepend_to_section(name, value) call check_defined_section(a:name) let w:airline_section_{a:name} = a:value . w:airline_section_{a:name} endfunction function! airline#extensions#apply_left_override(section1, section2) let w:airline_section_a = a:section1 let w:airline_section_b = a:section2 let w:airline_section_c = airline#section#create(['readonly']) let w:airline_render_left = 1 let w:airline_render_right = 0 endfunction let s:active_winnr = -1 function! airline#extensions#apply(...) let s:active_winnr = winnr() if s:is_excluded_window() return -1 endif if &buftype == 'help' call airline#extensions#apply_left_override('Help', '%f') let w:airline_section_x = '' let w:airline_section_y = '' let w:airline_render_right = 1 endif if &previewwindow let w:airline_section_a = 'Preview' let w:airline_section_b = '' let w:airline_section_c = bufname(winbufnr(winnr())) endif if has_key(s:filetype_overrides, &ft) let args = s:filetype_overrides[&ft] call airline#extensions#apply_left_override(args[0], args[1]) endif for item in items(s:filetype_regex_overrides) if match(&ft, item[0]) >= 0 call airline#extensions#apply_left_override(item[1][0], item[1][1]) endif endfor endfunction function! s:is_excluded_window() for matchft in g:airline_exclude_filetypes if matchft ==# &ft return 1 endif endfor for matchw in g:airline_exclude_filenames if matchstr(expand('%'), matchw) ==# matchw return 1 endif endfor if g:airline_exclude_preview && &previewwindow return 1 endif return 0 endfunction function! airline#extensions#load_theme() call airline#util#exec_funcrefs(s:ext._theme_funcrefs, g:airline#themes#{g:airline_theme}#palette) endfunction function! s:sync_active_winnr() if exists('#airline') && winnr() != s:active_winnr call airline#update_statusline() endif endfunction function! airline#extensions#load() " non-trivial number of external plugins use eventignore=all, so we need to account for that autocmd CursorMoved * call sync_active_winnr() if exists('g:airline_extensions') for ext in g:airline_extensions call airline#extensions#{ext}#init(s:ext) endfor return endif call airline#extensions#quickfix#init(s:ext) if get(g:, 'loaded_unite', 0) call airline#extensions#unite#init(s:ext) endif if exists(':NetrwSettings') call airline#extensions#netrw#init(s:ext) endif if get(g:, 'airline#extensions#ycm#enabled', 0) call airline#extensions#ycm#init(s:ext) endif if get(g:, 'loaded_vimfiler', 0) let g:vimfiler_force_overwrite_statusline = 0 endif if get(g:, 'loaded_ctrlp', 0) call airline#extensions#ctrlp#init(s:ext) endif if get(g:, 'CtrlSpaceLoaded', 0) call airline#extensions#ctrlspace#init(s:ext) endif if get(g:, 'command_t_loaded', 0) call airline#extensions#commandt#init(s:ext) endif if exists(':UndotreeToggle') call airline#extensions#undotree#init(s:ext) endif if get(g:, 'airline#extensions#hunks#enabled', 1) \ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes') || exists('g:loaded_quickfixsigns')) call airline#extensions#hunks#init(s:ext) endif if get(g:, 'airline#extensions#tagbar#enabled', 1) \ && exists(':TagbarToggle') call airline#extensions#tagbar#init(s:ext) endif if get(g:, 'airline#extensions#csv#enabled', 1) \ && (get(g:, 'loaded_csv', 0) || exists(':Table')) call airline#extensions#csv#init(s:ext) endif if exists(':VimShell') let s:filetype_overrides['vimshell'] = ['vimshell','%{vimshell#get_status_string()}'] let s:filetype_regex_overrides['^int-'] = ['vimshell','%{substitute(&ft, "int-", "", "")}'] endif if get(g:, 'airline#extensions#branch#enabled', 1) \ && (exists('*fugitive#head') || exists('*lawrencium#statusline') || \ (get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine'))) call airline#extensions#branch#init(s:ext) endif if get(g:, 'airline#extensions#bufferline#enabled', 1) \ && exists('*bufferline#get_status_string') call airline#extensions#bufferline#init(s:ext) endif if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV))) call airline#extensions#virtualenv#init(s:ext) endif if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate')) call airline#extensions#eclim#init(s:ext) endif if get(g:, 'airline#extensions#syntastic#enabled', 1) \ && exists(':SyntasticCheck') call airline#extensions#syntastic#init(s:ext) endif if get(g:, 'airline#extensions#whitespace#enabled', 1) call airline#extensions#whitespace#init(s:ext) endif if get(g:, 'airline#extensions#po#enabled', 1) && executable('msgfmt') call airline#extensions#po#init(s:ext) endif if get(g:, 'airline#extensions#wordcount#enabled', 1) call airline#extensions#wordcount#init(s:ext) endif if get(g:, 'airline#extensions#tabline#enabled', 0) call airline#extensions#tabline#init(s:ext) endif if get(g:, 'airline#extensions#tmuxline#enabled', 1) && exists(':Tmuxline') call airline#extensions#tmuxline#init(s:ext) endif if get(g:, 'airline#extensions#promptline#enabled', 1) && exists(':PromptlineSnapshot') && len(get(g:, 'airline#extensions#promptline#snapshot_file', '')) call airline#extensions#promptline#init(s:ext) endif if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2 call airline#extensions#nrrwrgn#init(s:ext) endif if get(g:, 'airline#extensions#unicode#enabled', 1) && exists(':UnicodeTable') == 2 call airline#extensions#unicode#init(s:ext) endif if (get(g:, 'airline#extensions#capslock#enabled', 1) && exists('*CapsLockStatusline')) call airline#extensions#capslock#init(s:ext) endif if (get(g:, 'airline#extensions#windowswap#enabled', 1) && get(g:, 'loaded_windowswap', 0)) call airline#extensions#windowswap#init(s:ext) endif if !get(g:, 'airline#extensions#disable_rtp_load', 0) " load all other extensions, which are not part of the default distribution. " (autoload/airline/extensions/*.vim outside of our s:script_path). for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n") " we have to check both resolved and unresolved paths, since it's possible " that they might not get resolved properly (see #187) if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0 \ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0 let name = fnamemodify(file, ':t:r') if !get(g:, 'airline#extensions#'.name.'#enabled', 1) continue endif try call airline#extensions#{name}#init(s:ext) catch endtry endif endfor endif endfunction vim-airline-0.8/autoload/airline/extensions/000077500000000000000000000000001267015252500212345ustar00rootroot00000000000000vim-airline-0.8/autoload/airline/extensions/branch.vim000066400000000000000000000142641267015252500232150ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:has_fugitive = exists('*fugitive#head') let s:has_lawrencium = exists('*lawrencium#statusline') let s:has_vcscommand = get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine') if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand finish endif let s:git_dirs = {} let s:untracked_git = {} let s:untracked_hg = {} let s:head_format = get(g:, 'airline#extensions#branch#format', 0) if s:head_format == 1 function! s:format_name(name) return fnamemodify(a:name, ':t') endfunction elseif s:head_format == 2 function! s:format_name(name) return pathshorten(a:name) endfunction elseif type(s:head_format) == type('') function! s:format_name(name) return call(s:head_format, [a:name]) endfunction else function! s:format_name(name) return a:name endfunction endif function! s:get_git_branch(path) if !s:has_fugitive return '' endif let name = fugitive#head(7) if empty(name) if has_key(s:git_dirs, a:path) return s:git_dirs[a:path] 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 let s:git_dirs[a:path] = name return name endfunction function! s:get_git_untracked(file) let untracked = '' if empty(a:file) return untracked endif if has_key(s:untracked_git, a:file) let untracked = s:untracked_git[a:file] else let output = system('git status --porcelain -- '. a:file) if output[0:1] is# '??' && output[3:-2] is? a:file let untracked = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) endif let s:untracked_git[a:file] = untracked endif return untracked endfunction function! s:get_hg_untracked(file) if s:has_lawrencium " delete cache when unlet b:airline head? let untracked = '' if empty(a:file) return untracked endif if has_key(s:untracked_hg, a:file) let untracked = s:untracked_hg[a:file] else let untracked = (system('hg status -u -- '. a:file)[0] is# '?' ? \ get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) : '') let s:untracked_hg[a:file] = untracked endif return untracked endif endfunction function! s:get_hg_branch() if s:has_lawrencium return lawrencium#statusline() endif return '' endfunction function! airline#extensions#branch#head() if exists('b:airline_head') && !empty(b:airline_head) return b:airline_head endif let b:airline_head = '' let l:heads = {} let l:vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"]) let found_fugitive_head = 0 let l:git_head = s:get_git_branch(expand("%:p:h")) let l:hg_head = s:get_hg_branch() if !empty(l:git_head) let found_fugitive_head = 1 let l:heads.git = (!empty(l:hg_head) ? "git:" : '') . s:format_name(l:git_head) let l:git_untracked = s:get_git_untracked(expand("%:p")) let l:heads.git .= l:git_untracked endif if !empty(l:hg_head) let l:heads.mercurial = (!empty(l:git_head) ? "hg:" : '') . s:format_name(l:hg_head) let l:hg_untracked = s:get_hg_untracked(expand("%:p")) let l:heads.mercurial.= l:hg_untracked endif if empty(l:heads) if s:has_vcscommand call VCSCommandEnableBufferSetup() if exists('b:VCSCommandBufferInfo') let b:airline_head = s:format_name(get(b:VCSCommandBufferInfo, 0, '')) endif endif else for vcs in l:vcs_priority if has_key(l:heads, vcs) if !empty(b:airline_head) let b:airline_head = b:airline_head . " | " endif let b:airline_head = b:airline_head . l:heads[vcs] endif endfor endif if exists("g:airline#extensions#branch#displayed_head_limit") let w:displayed_head_limit = g:airline#extensions#branch#displayed_head_limit if len(b:airline_head) > w:displayed_head_limit - 1 let b:airline_head = b:airline_head[0:(w:displayed_head_limit - 1)].(&encoding ==? 'utf-8' ? '…' : '.') endif endif if empty(b:airline_head) || !found_fugitive_head && !s:check_in_path() let b:airline_head = '' endif return b:airline_head endfunction function! airline#extensions#branch#get_head() let head = airline#extensions#branch#head() let empty_message = get(g:, 'airline#extensions#branch#empty_message', '') let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) return empty(head) \ ? empty_message \ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head) endfunction function! s:check_in_path() if !exists('b:airline_branch_path') 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 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() if exists("s:untracked_git") let s:untracked_git={} endif if exists("s:untracked_hg") let s:untracked_hg={} endif endfunction function! airline#extensions#branch#init(ext) call airline#parts#define_function('branch', 'airline#extensions#branch#get_head') autocmd BufReadPost * unlet! b:airline_file_in_root autocmd CursorHold,ShellCmdPost,CmdwinLeave * unlet! b:airline_head autocmd User AirlineBeforeRefresh unlet! b:airline_head autocmd BufWritePost,ShellCmdPost * call s:reset_untracked_cache() endfunction vim-airline-0.8/autoload/airline/extensions/bufferline.vim000066400000000000000000000014531267015252500240750ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists('*bufferline#get_status_string') finish endif let s:overwrite = get(g:, 'airline#extensions#bufferline#overwrite_variables', 1) function! airline#extensions#bufferline#init(ext) if s:overwrite highlight bufferline_selected gui=bold cterm=bold term=bold highlight link bufferline_selected_inactive airline_c_inactive let g:bufferline_inactive_highlight = 'airline_c' let g:bufferline_active_highlight = 'bufferline_selected' let g:bufferline_active_buffer_left = '' let g:bufferline_active_buffer_right = '' let g:bufferline_separator = g:airline_symbols.space endif call airline#parts#define_raw('file', '%{bufferline#refresh_status()}'.bufferline#get_status_string()) endfunction vim-airline-0.8/autoload/airline/extensions/capslock.vim000066400000000000000000000006221267015252500235500ustar00rootroot00000000000000" MIT License. Copyright (c) 2014 Mathias Andersson. " vim: et ts=2 sts=2 sw=2 if !exists('*CapsLockStatusline') finish endif function! airline#extensions#capslock#status() return tolower(CapsLockStatusline()) == '[caps]' ? 'CAPS' : '' endfunction function! airline#extensions#capslock#init(ext) call airline#parts#define_function('capslock', 'airline#extensions#capslock#status') endfunction vim-airline-0.8/autoload/airline/extensions/commandt.vim000066400000000000000000000006531267015252500235570ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'command_t_loaded', 0) finish endif function! airline#extensions#commandt#apply(...) if bufname('%') ==# 'GoToFile' call airline#extensions#apply_left_override('CommandT', '') endif endfunction function! airline#extensions#commandt#init(ext) call a:ext.add_statusline_func('airline#extensions#commandt#apply') endfunction vim-airline-0.8/autoload/airline/extensions/csv.vim000066400000000000000000000014471267015252500225520ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'loaded_csv', 0) && !exists(':Table') finish endif let s:column_display = get(g:, 'airline#extensions#csv#column_display', 'Number') function! airline#extensions#csv#get_column() if exists('*CSV_WCol') if s:column_display ==# 'Name' return '['.CSV_WCol('Name').CSV_WCol().']' else return '['.CSV_WCol().']' endif endif return '' endfunction function! airline#extensions#csv#apply(...) if &ft ==# "csv" call airline#extensions#prepend_to_section('gutter', \ g:airline_left_alt_sep.' %{airline#extensions#csv#get_column()}') endif endfunction function! airline#extensions#csv#init(ext) call a:ext.add_statusline_func('airline#extensions#csv#apply') endfunction vim-airline-0.8/autoload/airline/extensions/ctrlp.vim000066400000000000000000000054221267015252500231000ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'loaded_ctrlp', 0) finish endif let s:color_template = get(g:, 'airline#extensions#ctrlp#color_template', 'insert') function! airline#extensions#ctrlp#generate_color_map(dark, light, white) return { \ 'CtrlPdark' : a:dark, \ 'CtrlPlight' : a:light, \ 'CtrlPwhite' : a:white, \ 'CtrlParrow1' : [ a:light[1] , a:white[1] , a:light[3] , a:white[3] , '' ] , \ 'CtrlParrow2' : [ a:white[1] , a:light[1] , a:white[3] , a:light[3] , '' ] , \ 'CtrlParrow3' : [ a:light[1] , a:dark[1] , a:light[3] , a:dark[3] , '' ] , \ } endfunction function! airline#extensions#ctrlp#load_theme(palette) if exists('a:palette.ctrlp') let theme = a:palette.ctrlp else let s:color_template = has_key(a:palette, s:color_template) ? s:color_template : 'insert' let theme = airline#extensions#ctrlp#generate_color_map( \ a:palette[s:color_template]['airline_c'], \ a:palette[s:color_template]['airline_b'], \ a:palette[s:color_template]['airline_a']) endif for key in keys(theme) call airline#highlighter#exec(key, theme[key]) endfor endfunction " Arguments: focus, byfname, regexp, prv, item, nxt, marked function! airline#extensions#ctrlp#ctrlp_airline(...) let b = airline#builder#new({'active': 1}) if a:2 == 'file' call b.add_section_spaced('CtrlPlight', 'by fname') endif if a:3 call b.add_section_spaced('CtrlPlight', 'regex') endif if get(g:, 'airline#extensions#ctrlp#show_adjacent_modes', 1) call b.add_section_spaced('CtrlPlight', a:4) call b.add_section_spaced('CtrlPwhite', a:5) call b.add_section_spaced('CtrlPlight', a:6) else call b.add_section_spaced('CtrlPwhite', a:5) endif call b.add_section_spaced('CtrlPdark', a:7) call b.split() call b.add_section_spaced('CtrlPdark', a:1) call b.add_section_spaced('CtrlPdark', a:2) call b.add_section_spaced('CtrlPlight', '%{getcwd()}') return b.build() endfunction " Argument: len function! airline#extensions#ctrlp#ctrlp_airline_status(...) let len = '%#CtrlPdark# '.a:1 let dir = '%=%<%#CtrlParrow3#'.g:airline_right_sep.'%#CtrlPlight# '.getcwd().' %*' return len.dir endfunction function! airline#extensions#ctrlp#apply(...) " disable statusline overwrite if ctrlp already did it return match(&statusline, 'CtrlPwhite') >= 0 ? -1 : 0 endfunction function! airline#extensions#ctrlp#init(ext) let g:ctrlp_status_func = { \ 'main': 'airline#extensions#ctrlp#ctrlp_airline', \ 'prog': 'airline#extensions#ctrlp#ctrlp_airline_status', \ } call a:ext.add_statusline_func('airline#extensions#ctrlp#apply') call a:ext.add_theme_func('airline#extensions#ctrlp#load_theme') endfunction vim-airline-0.8/autoload/airline/extensions/ctrlspace.vim000066400000000000000000000011761267015252500237360ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:spc = g:airline_symbols.space let s:padding = s:spc . s:spc . s:spc function! airline#extensions#ctrlspace#statusline(...) let b = airline#builder#new({ 'active': 1 }) call b.add_section('airline_b', '⌗' . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding)) call b.split() call b.add_section('airline_x', s:spc . ctrlspace#api#StatuslineTabSegment() . s:spc) return b.build() endfunction function! airline#extensions#ctrlspace#init(ext) let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()" endfunction vim-airline-0.8/autoload/airline/extensions/default.vim000066400000000000000000000064411267015252500234020ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:section_use_groups = get(g:, 'airline#extensions#default#section_use_groupitems', 1) let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', { \ 'b': 79, \ 'x': 60, \ 'y': 88, \ 'z': 45, \ 'warning': 80, \ 'error': 80, \ }) let s:layout = get(g:, 'airline#extensions#default#layout', [ \ [ 'a', 'b', 'c' ], \ [ 'x', 'y', 'z', 'warning', 'error' ] \ ]) function! s:get_section(winnr, key, ...) if has_key(s:section_truncate_width, a:key) if winwidth(a:winnr) < s:section_truncate_width[a:key] return '' endif endif let spc = g:airline_symbols.space let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')] return empty(text) ? '' : prefix.text.suffix endfunction function! s:build_sections(builder, context, keys) for key in a:keys if (key == 'warning' || key == 'error') && !a:context.active continue endif call s:add_section(a:builder, a:context, key) endfor endfunction " There still is a highlighting bug when using groups %(%) in the statusline, " deactivate it, until this is properly fixed: " https://groups.google.com/d/msg/vim_dev/sb1jmVirXPU/mPhvDnZ-CwAJ if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81'))) function s:add_section(builder, context, key) " i have no idea why the warning section needs special treatment, but it's " needed to prevent separators from showing up if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) return endif if (a:key == 'warning' || a:key == 'error') call a:builder.add_raw('%(') endif call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) if (a:key == 'warning' || a:key == 'error') call a:builder.add_raw('%)') endif endfunction else " older version don't like the use of %(%) function s:add_section(builder, context, key) if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) return endif if a:key == 'warning' call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key)) elseif a:key == 'error' call a:builder.add_raw('%#airline_error#'.s:get_section(a:context.winnr, a:key)) else call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) endif endfunction endif function! airline#extensions#default#apply(builder, context) let winnr = a:context.winnr let active = a:context.active if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse)) call s:build_sections(a:builder, a:context, s:layout[0]) else let text = s:get_section(winnr, 'c') if empty(text) let text = ' %f%m ' endif call a:builder.add_section('airline_c'.(a:context.bufnr), text) endif call a:builder.split(s:get_section(winnr, 'gutter', '', '')) if airline#util#getwinvar(winnr, 'airline_render_right', 1) call s:build_sections(a:builder, a:context, s:layout[1]) endif return 1 endfunction vim-airline-0.8/autoload/airline/extensions/eclim.vim000066400000000000000000000031601267015252500230420ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':ProjectCreate') finish endif function! airline#extensions#eclim#creat_line(...) if &filetype == "tree" let builder = a:1 call builder.add_section('airline_a', ' Project ') call builder.add_section('airline_b', ' %f ') call builder.add_section('airline_c', '') return 1 endif endfunction function! airline#extensions#eclim#get_warnings() let eclimList = eclim#display#signs#GetExisting() if !empty(eclimList) " Remove any non-eclim signs (see eclim#display#signs#Update) " First check for just errors since they are more important. " If there are no errors, then check for warnings. let errorList = filter(copy(eclimList), 'v:val.name =~ "^\\(qf_\\)\\?\\(error\\)$"') if (empty(errorList)) " use the warnings call filter(eclimList, 'v:val.name =~ "^\\(qf_\\)\\?\\(warning\\)$"') let type = 'W' else " Use the errors let eclimList = errorList let type = 'E' endif if !empty(eclimList) let errorsLine = eclimList[0]['line'] let errorsNumber = len(eclimList) let errors = "[Eclim:" . type . " line:".string(errorsLine)." (".string(errorsNumber).")]" if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == '' return errors.(g:airline_symbols.space) endif endif endif return '' endfunction function! airline#extensions#eclim#init(ext) call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings') call a:ext.add_statusline_func('airline#extensions#eclim#creat_line') endfunction vim-airline-0.8/autoload/airline/extensions/example.vim000066400000000000000000000037271267015252500234150ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 " we don't actually want this loaded :P finish " Due to some potential rendering issues, the use of the `space` variable is " recommended. let s:spc = g:airline_symbols.space " Extension specific variables can be defined the usual fashion. if !exists('g:airline#extensions#example#number_of_cats') let g:airline#extensions#example#number_of_cats = 42 endif " First we define an init function that will be invoked from extensions.vim function! airline#extensions#example#init(ext) " Here we define a new part for the plugin. This allows users to place this " extension in arbitrary locations. call airline#parts#define_raw('cats', '%{airline#extensions#example#get_cats()}') " Next up we add a funcref so that we can run some code prior to the " statusline getting modifed. call a:ext.add_statusline_func('airline#extensions#example#apply') " You can also add a funcref for inactive statuslines. " call a:ext.add_inactive_statusline_func('airline#extensions#example#unapply') endfunction " This function will be invoked just prior to the statusline getting modified. function! airline#extensions#example#apply(...) " First we check for the filetype. if &filetype == "nyancat" " Let's say we want to append to section_c, first we check if there's " already a window-local override, and if not, create it off of the global " section_c. let w:airline_section_c = get(w:, 'airline_section_c', g:airline_section_c) " Then we just append this extenion to it, optionally using separators. let w:airline_section_c .= s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#example#get_cats()}' endif endfunction " Finally, this function will be invoked from the statusline. function! airline#extensions#example#get_cats() let cats = '' for i in range(1, g:airline#extensions#example#number_of_cats) let cats .= ' (,,,)=(^.^)=(,,,) ' endfor return cats endfunction vim-airline-0.8/autoload/airline/extensions/hunks.vim000066400000000000000000000042551267015252500231070ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) && !get(g:, 'loaded_quickfixsigns', 0) finish endif let s:non_zero_only = get(g:, 'airline#extensions#hunks#non_zero_only', 0) let s:hunk_symbols = get(g:, 'airline#extensions#hunks#hunk_symbols', ['+', '~', '-']) function! s:get_hunks_signify() let hunks = sy#repo#get_stats() if hunks[0] >= 0 return hunks endif return [] endfunction function! s:is_branch_empty() return exists('*airline#extensions#branch#head') && empty(airline#extensions#branch#head()) endfunction function! s:get_hunks_gitgutter() if !get(g:, 'gitgutter_enabled', 0) || s:is_branch_empty() return '' endif return GitGutterGetHunkSummary() endfunction function! s:get_hunks_changes() if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty() return [] endif let hunks = changes#GetStats() for i in hunks if i > 0 return hunks endif endfor return [] endfunction function! s:get_hunks_empty() return '' endfunction function! s:get_hunks() if !exists('b:source_func') if get(g:, 'loaded_signify') && sy#buffer_is_active() let b:source_func = 's:get_hunks_signify' elseif exists('*GitGutterGetHunkSummary') let b:source_func = 's:get_hunks_gitgutter' elseif exists('*changes#GetStats') let b:source_func = 's:get_hunks_changes' elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary') let b:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary' else let b:source_func = 's:get_hunks_empty' endif endif return {b:source_func}() endfunction function! airline#extensions#hunks#get_hunks() if !get(w:, 'airline_active', 0) return '' endif let hunks = s:get_hunks() let string = '' if !empty(hunks) for i in [0, 1, 2] if s:non_zero_only == 0 || hunks[i] > 0 let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i]) endif endfor endif return string endfunction function! airline#extensions#hunks#init(ext) call airline#parts#define_function('hunks', 'airline#extensions#hunks#get_hunks') endfunction vim-airline-0.8/autoload/airline/extensions/netrw.vim000066400000000000000000000017451267015252500231170ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':NetrwSettings') finish endif function! airline#extensions#netrw#apply(...) if &ft == 'netrw' let spc = g:airline_symbols.space call a:1.add_section('airline_a', spc.'netrw'.spc) if exists('*airline#extensions#branch#get_head') call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) endif call a:1.add_section('airline_c', spc.'%f'.spc) call a:1.split() call a:1.add_section('airline_y', spc.'%{airline#extensions#netrw#sortstring()}'.spc) return 1 endif endfunction function! airline#extensions#netrw#init(ext) let g:netrw_force_overwrite_statusline = 0 call a:ext.add_statusline_func('airline#extensions#netrw#apply') endfunction function! airline#extensions#netrw#sortstring() let order = (g:netrw_sort_direction =~ 'n') ? '+' : '-' return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']' endfunction vim-airline-0.8/autoload/airline/extensions/nrrwrgn.vim000066400000000000000000000042401267015252500234500ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'loaded_nrrw_rgn', 0) finish endif function! airline#extensions#nrrwrgn#apply(...) if exists(":WidenRegion") == 2 let spc = g:airline_symbols.space if !exists("*nrrwrgn#NrrwRgnStatus()") || empty(nrrwrgn#NrrwRgnStatus()) call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn)) let bufname=(get(b:, 'orig_buf', 0) ? bufname(b:orig_buf) : substitute(bufname('%'), '^Nrrwrgn_\zs.*\ze_\d\+$', submatch(0), '')) call a:1.add_section('airline_c', spc.bufname.spc) call a:1.split() else let dict=nrrwrgn#NrrwRgnStatus() let vmode = { 'v': 'Char ', 'V': 'Line ', '': 'Block '} let mode = dict.visual ? vmode[dict.visual] : vmode['V'] let winwidth = winwidth(0) if winwidth < 80 let mode = mode[0] endif let title = (winwidth < 80 ? "Nrrw" : "Narrowed ") let multi = (winwidth < 80 ? 'M' : 'Multi') call a:1.add_section('airline_a', printf('[%s%s%s#%d]%s', (dict.multi ? multi : ""), \ title, mode, b:nrrw_instn, spc)) let name = dict.fullname if name !=# '[No Name]' if winwidth > 100 " need some space let name = fnamemodify(dict.fullname, ':~') if strlen(name) > 8 " shorten name let name = substitute(name, '\(.\)[^/\\]*\([/\\]\)', '\1\2', 'g') endif else let name = fnamemodify(dict.fullname, ':t') endif endif let range=(dict.multi ? '' : printf("[%d-%d]", dict.start[1], dict.end[1])) call a:1.add_section('airline_c', printf("%s %s %s", name, range, \ dict.enabled ? (&encoding ==? 'utf-8' ? "\u2713" : '') : '!')) call a:1.split() call a:1.add_section('airline_x', get(g:, 'airline_section_x').spc) call a:1.add_section('airline_y', spc.get(g:, 'airline_section_y').spc) call a:1.add_section('airline_z', spc.get(g:, 'airline_section_z')) endif return 1 endif endfunction function! airline#extensions#nrrwrgn#init(ext) call a:ext.add_statusline_func('airline#extensions#nrrwrgn#apply') endfunction vim-airline-0.8/autoload/airline/extensions/po.vim000066400000000000000000000022431267015252500223700ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 function! airline#extensions#po#apply(...) if &ft ==# 'po' call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}') autocmd airline BufWritePost * unlet! b:airline_po_stats endif endfunction function! airline#extensions#po#stats() if exists('b:airline_po_stats') && !empty(b:airline_po_stats) return b:airline_po_stats endif let airline_po_stats = system('msgfmt --statistics -o /dev/null -- '. expand('%:p')) if v:shell_error return '' endif try let b:airline_po_stats = '['. split(airline_po_stats, '\n')[0]. ']' catch let b:airline_po_stats = '' endtry if exists("g:airline#extensions#po#displayed_limit") let w:displayed_po_limit = g:airline#extensions#po#displayed_limit if len(b:airline_po_stats) > w:displayed_po_limit - 1 let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 1)].(&encoding==?'utf-8' ? '…' : '.') endif endif return b:airline_po_stats endfunction function! airline#extensions#po#init(ext) call a:ext.add_statusline_func('airline#extensions#po#apply') endfunction vim-airline-0.8/autoload/airline/extensions/promptline.vim000066400000000000000000000023561267015252500241500ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':PromptlineSnapshot') finish endif if !exists('airline#extensions#promptline#snapshot_file') || !len('airline#extensions#promptline#snapshot_file') finish endif let s:prompt_snapshot_file = get(g:, 'airline#extensions#promptline#snapshot_file', '') let s:color_template = get(g:, 'airline#extensions#promptline#color_template', 'normal') function! airline#extensions#promptline#init(ext) call a:ext.add_theme_func('airline#extensions#promptline#set_prompt_colors') endfunction function! airline#extensions#promptline#set_prompt_colors(palette) let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' let mode_palette = a:palette[color_template] if !has_key(g:, 'promptline_symbols') let g:promptline_symbols = { \ 'left' : g:airline_left_sep, \ 'right' : g:airline_right_sep, \ 'left_alt' : g:airline_left_alt_sep, \ 'right_alt' : g:airline_right_alt_sep} endif let promptline_theme = promptline#api#create_theme_from_airline(mode_palette) call promptline#api#create_snapshot_with_theme(s:prompt_snapshot_file, promptline_theme) endfunction vim-airline-0.8/autoload/airline/extensions/quickfix.vim000066400000000000000000000017341267015252500236010ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let g:airline#extensions#quickfix#quickfix_text = 'Quickfix' let g:airline#extensions#quickfix#location_text = 'Location' function! airline#extensions#quickfix#apply(...) if &buftype == 'quickfix' let w:airline_section_a = s:get_text() let w:airline_section_b = '%{get(w:, "quickfix_title", "")}' let w:airline_section_c = '' let w:airline_section_x = '' endif endfunction function! airline#extensions#quickfix#init(ext) call a:ext.add_statusline_func('airline#extensions#quickfix#apply') endfunction function! s:get_text() redir => buffers silent ls redir END let nr = bufnr('%') for buf in split(buffers, '\n') if match(buf, '\v^\s*'.nr) > -1 if match(buf, '\cQuickfix') > -1 return g:airline#extensions#quickfix#quickfix_text else return g:airline#extensions#quickfix#location_text endif endif endfor return '' endfunction vim-airline-0.8/autoload/airline/extensions/syntastic.vim000066400000000000000000000007361267015252500240000ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':SyntasticCheck') finish endif function! airline#extensions#syntastic#get_warnings() let errors = SyntasticStatuslineFlag() if strlen(errors) > 0 return errors.(g:airline_symbols.space) endif return '' endfunction function! airline#extensions#syntastic#init(ext) call airline#parts#define_function('syntastic', 'airline#extensions#syntastic#get_warnings') endfunction vim-airline-0.8/autoload/airline/extensions/tabline.vim000066400000000000000000000157011267015252500233730ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1) let s:ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree') let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0) if s:taboo let g:taboo_tabline = 0 endif let s:ctrlspace = get(g:, 'CtrlSpaceLoaded', 0) function! airline#extensions#tabline#init(ext) if has('gui_running') set guioptions-=e endif autocmd User AirlineToggledOn call s:toggle_on() autocmd User AirlineToggledOff call s:toggle_off() call s:toggle_on() call a:ext.add_theme_func('airline#extensions#tabline#load_theme') endfunction function! s:toggle_off() call airline#extensions#tabline#autoshow#off() call airline#extensions#tabline#tabs#off() call airline#extensions#tabline#buffers#off() call airline#extensions#tabline#ctrlspace#off() endfunction function! s:toggle_on() call airline#extensions#tabline#autoshow#on() call airline#extensions#tabline#tabs#on() call airline#extensions#tabline#buffers#on() call airline#extensions#tabline#ctrlspace#on() set tabline=%!airline#extensions#tabline#get() endfunction function! s:update_tabline() if get(g:, 'airline#extensions#tabline#disable_refresh', 0) return endif let match = expand('') if pumvisible() return elseif !get(g:, 'airline#extensions#tabline#enabled', 0) return " return, if buffer matches ignore pattern or is directory (netrw) elseif empty(match) \ || match(match, s:ignore_bufadd_pat) > -1 \ || isdirectory(expand("")) return endif doautocmd User BufMRUChange endfunction function! airline#extensions#tabline#load_theme(palette) if pumvisible() return endif let colors = get(a:palette, 'tabline', {}) " Theme for tabs on the left let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b) let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a) let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a) let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c) let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a) let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c) if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c') let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c) else "Fall back to normal airline_c if modified airline_c isn't present let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c) endif call airline#highlighter#exec('airline_tab', l:tab) call airline#highlighter#exec('airline_tabsel', l:tabsel) call airline#highlighter#exec('airline_tabtype', l:tabtype) call airline#highlighter#exec('airline_tabfill', l:tabfill) call airline#highlighter#exec('airline_tabmod', l:tabmod) call airline#highlighter#exec('airline_tabmod_unsel', l:tabmodu) call airline#highlighter#exec('airline_tabhid', l:tabhid) " Theme for tabs on the right let l:tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a) let l:tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c) let l:tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a) let l:tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c) if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c') let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c) else "Fall back to normal airline_c if modified airline_c isn't present let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c) endif call airline#highlighter#exec('airline_tab_right', l:tab_right) call airline#highlighter#exec('airline_tabsel_right', l:tabsel_right) call airline#highlighter#exec('airline_tabmod_right', l:tabmod_right) call airline#highlighter#exec('airline_tabhid_right', l:tabhid_right) call airline#highlighter#exec('airline_tabmod_unsel_right', l:tabmodu_right) endfunction let s:current_tabcnt = -1 function! airline#extensions#tabline#get() let curtabcnt = tabpagenr('$') if curtabcnt != s:current_tabcnt let s:current_tabcnt = curtabcnt call airline#extensions#tabline#tabs#invalidate() call airline#extensions#tabline#buffers#invalidate() call airline#extensions#tabline#ctrlspace#invalidate() endif if !exists('#airline#BufAdd#*') autocmd airline BufAdd * call update_tabline() endif if s:ctrlspace return airline#extensions#tabline#ctrlspace#get() elseif s:show_buffers && curtabcnt == 1 || !s:show_tabs return airline#extensions#tabline#buffers#get() else return airline#extensions#tabline#tabs#get() endif endfunction function! airline#extensions#tabline#title(n) let title = '' if s:taboo let title = TabooTabTitle(a:n) endif if empty(title) let buflist = tabpagebuflist(a:n) let winnr = tabpagewinnr(a:n) return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1]) endif return title endfunction function! airline#extensions#tabline#get_buffer_name(nr) return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, airline#extensions#tabline#buflist#list()) endfunction function! airline#extensions#tabline#new_builder() let builder_context = { \ 'active' : 1, \ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep), \ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep), \ } if get(g:, 'airline_powerline_fonts', 0) let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep) let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep) else let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ') let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|') endif return airline#builder#new(builder_context) endfunction function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr) let cur = bufnr('%') if cur == a:bufnr if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') let group = 'airline_tabmod' else let group = 'airline_tabsel' endif else if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') let group = 'airline_tabmod_unsel' elseif index(a:tab_bufs, a:bufnr) > -1 let group = 'airline_tab' else let group = 'airline_tabhid' endif endif return group endfunction vim-airline-0.8/autoload/airline/extensions/tabline/000077500000000000000000000000001267015252500226525ustar00rootroot00000000000000vim-airline-0.8/autoload/airline/extensions/tabline/autoshow.vim000066400000000000000000000033121267015252500252370ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0) let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0) function! airline#extensions#tabline#autoshow#off() if exists('s:original_tabline') let &tabline = s:original_tabline let &showtabline = s:original_showtabline endif augroup airline_tabline_autoshow autocmd! augroup END endfunction function! airline#extensions#tabline#autoshow#on() let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ] augroup airline_tabline_autoshow autocmd! if s:buf_min_count <= 0 && s:tab_min_count <= 1 if &lines > 3 set showtabline=2 endif else if s:show_buffers == 1 autocmd BufEnter * call show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list())) autocmd BufUnload * call show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()) - 1) else autocmd TabEnter * call show_tabline(s:tab_min_count, tabpagenr('$')) endif endif " Invalidate cache. This has to come after the BufUnload for " s:show_buffers, to invalidate the cache for BufEnter. autocmd BufLeave,BufAdd,BufUnload * call airline#extensions#tabline#buflist#invalidate() augroup END endfunction function! s:show_tabline(min_count, total_count) if a:total_count >= a:min_count if &showtabline != 2 && &lines > 3 set showtabline=2 endif else if &showtabline != 0 set showtabline=0 endif endif endfunction vim-airline-0.8/autoload/airline/extensions/tabline/buffers.vim000066400000000000000000000143351267015252500250310ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 scriptencoding utf-8 let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') let s:spc = g:airline_symbols.space let s:current_bufnr = -1 let s:current_modified = 0 let s:current_tabline = '' let s:current_visible_buffers = [] let s:number_map = &encoding == 'utf-8' \ ? { \ '0': '⁰', \ '1': '¹', \ '2': '²', \ '3': '³', \ '4': '⁴', \ '5': '⁵', \ '6': '⁶', \ '7': '⁷', \ '8': '⁸', \ '9': '⁹' \ } \ : {} function! airline#extensions#tabline#buffers#off() augroup airline_tabline_buffers autocmd! augroup END endfunction function! airline#extensions#tabline#buffers#on() augroup airline_tabline_buffers autocmd! autocmd BufDelete * call airline#extensions#tabline#buffers#invalidate() autocmd User BufMRUChange call airline#extensions#tabline#buflist#invalidate() autocmd User BufMRUChange call airline#extensions#tabline#buffers#invalidate() augroup END endfunction function! airline#extensions#tabline#buffers#invalidate() let s:current_bufnr = -1 endfunction function! airline#extensions#tabline#buffers#get() call map_keys() let cur = bufnr('%') if cur == s:current_bufnr if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified return s:current_tabline endif endif let l:index = 1 let b = airline#extensions#tabline#new_builder() let tab_bufs = tabpagebuflist(tabpagenr()) for nr in s:get_visible_buffers() if nr < 0 call b.add_raw('%#airline_tabhid#...') continue endif let group = airline#extensions#tabline#group_of_bufnr(tab_bufs, nr) if nr == cur let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 endif " Neovim feature: Have clickable buffers if has("tablineat") call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#switchbuf@') endif if s:buffer_idx_mode if len(s:number_map) > 0 call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc) else call b.add_section(group, '['.l:index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']') endif let l:index = l:index + 1 else call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc) endif if has("tablineat") call b.add_raw('%X') endif endfor call b.add_section('airline_tabfill', '') call b.split() call b.add_section('airline_tabfill', '') if s:show_tab_type call b.add_section_spaced('airline_tabtype', s:buffers_label) endif let s:current_bufnr = cur let s:current_tabline = b.build() return s:current_tabline endfunction function! s:get_visible_buffers() let buffers = airline#extensions#tabline#buflist#list() let cur = bufnr('%') let total_width = 0 let max_width = 0 for nr in buffers let width = len(airline#extensions#tabline#get_buffer_name(nr)) + 4 let total_width += width let max_width = max([max_width, width]) endfor " only show current and surrounding buffers if there are too many buffers let position = index(buffers, cur) let vimwidth = &columns if total_width > vimwidth && position > -1 let buf_count = len(buffers) " determine how many buffers to show based on the longest buffer width, " use one on the right side and put the rest on the left let buf_max = vimwidth / max_width let buf_right = 1 let buf_left = max([0, buf_max - buf_right]) let start = max([0, position - buf_left]) let end = min([buf_count, position + buf_right]) " fill up available space on the right if position < buf_left let end += (buf_left - position) endif " fill up available space on the left if end > buf_count - 1 - buf_right let start -= max([0, buf_right - (buf_count - 1 - position)]) endif let buffers = eval('buffers[' . start . ':' . end . ']') if start > 0 call insert(buffers, -1, 0) endif if end < buf_count - 1 call add(buffers, -1) endif endif let s:current_visible_buffers = buffers return buffers endfunction function! s:select_tab(buf_index) " no-op when called in the NERDTree buffer if exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName return endif let idx = a:buf_index if s:current_visible_buffers[0] == -1 let idx = idx + 1 endif let buf = get(s:current_visible_buffers, idx, 0) if buf != 0 exec 'b!' . buf endif endfunction function! s:jump_to_tab(offset) let l = s:current_visible_buffers let i = index(l, bufnr('%')) if i > -1 exec 'b!' . l[float2nr(fmod(i + a:offset, len(l)))] endif endfunction function s:map_keys() if s:buffer_idx_mode noremap AirlineSelectTab1 :call select_tab(0) noremap AirlineSelectTab2 :call select_tab(1) noremap AirlineSelectTab3 :call select_tab(2) noremap AirlineSelectTab4 :call select_tab(3) noremap AirlineSelectTab5 :call select_tab(4) noremap AirlineSelectTab6 :call select_tab(5) noremap AirlineSelectTab7 :call select_tab(6) noremap AirlineSelectTab8 :call select_tab(7) noremap AirlineSelectTab9 :call select_tab(8) noremap AirlineSelectPrevTab :call jump_to_tab(-v:count1) noremap AirlineSelectNextTab :call jump_to_tab(v:count1) endif endfunction function airline#extensions#tabline#buffers#switchbuf(minwid, clicks, button, modifiers) abort " Run the following code only on a single left mouse button click without modifiers pressed " works only in recent NeoVim with has('tablineat') if a:clicks == 1 && a:button is# 'l' && a:modifiers !~# '[^ ]' sil execute 'buffer' a:minwid endif endfunction vim-airline-0.8/autoload/airline/extensions/tabline/buflist.vim000066400000000000000000000026511267015252500250430ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:excludes = get(g:, 'airline#extensions#tabline#excludes', []) let s:exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1) function! airline#extensions#tabline#buflist#invalidate() unlet! s:current_buffer_list endfunction function! airline#extensions#tabline#buflist#list() if exists('s:current_buffer_list') return s:current_buffer_list endif let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$")) let buffers = [] " If this is too slow, we can switch to a different algorithm. " Basically branch 535 already does it, but since it relies on " BufAdd autocommand, I'd like to avoid this if possible. for nr in list if buflisted(nr) " Do not add to the bufferlist, if either " 1) buffername matches exclude pattern " 2) buffer is a quickfix buffer " 3) exclude preview windows (if 'bufhidden' == wipe " and 'buftype' == nofile if (!empty(s:excludes) && match(bufname(nr), join(s:excludes, '\|')) > -1) || \ (getbufvar(nr, 'current_syntax') == 'qf') || \ (s:exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe' \ && getbufvar(nr, '&buftype') == 'nofile') continue endif call add(buffers, nr) endif endfor let s:current_buffer_list = buffers return buffers endfunction vim-airline-0.8/autoload/airline/extensions/tabline/ctrlspace.vim000066400000000000000000000106361267015252500253550ustar00rootroot00000000000000" MIT License. Copyright (c) 2016 Kevin Sapper " vim: et ts=2 sts=2 sw=2 scriptencoding utf-8 let s:current_bufnr = -1 let s:current_tabnr = -1 let s:current_tabline = '' let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') let s:switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0) let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1) function! airline#extensions#tabline#ctrlspace#off() augroup airline_tabline_ctrlspace autocmd! augroup END endfunction function! airline#extensions#tabline#ctrlspace#on() augroup airline_tabline_ctrlspace autocmd! autocmd BufDelete * call airline#extensions#tabline#ctrlspace#invalidate() augroup END endfunction function! airline#extensions#tabline#ctrlspace#invalidate() let s:current_bufnr = -1 let s:current_tabnr = -1 endfunction function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pos) if a:pos == 0 let pos_extension = '' else let pos_extension = '_right' endif let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab) for buffer in s:buffer_list if a:cur_buf == buffer.index if buffer.modified let group = 'airline_tabmod'.pos_extension else let group = 'airline_tabsel'.pos_extension endif else if buffer.modified let group = 'airline_tabmod_unsel'.pos_extension elseif buffer.visible let group = 'airline_tab'.pos_extension else let group = 'airline_tabhid'.pos_extension endif endif let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)' call a:builder.add_section_spaced(group, buf_name) endfor endfunction function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos) if a:pos == 0 let pos_extension = '' else let pos_extension = '_right' endif for tab in s:tab_list if tab.current if tab.modified let group = 'airline_tabmod'.pos_extension else let group = 'airline_tabsel'.pos_extension endif else if tab.modified let group = 'airline_tabmod_unsel'.pos_extension else let group = 'airline_tabhid'.pos_extension endif endif call a:builder.add_section_spaced(group, tab.title.ctrlspace#api#TabBuffersNumber(tab.index)) endfor endfunction function! airline#extensions#tabline#ctrlspace#get() let cur_buf = bufnr('%') let s:tab_list = ctrlspace#api#TabList() for tab in s:tab_list if tab.current let cur_tab = tab.index endif endfor if cur_buf == s:current_bufnr && cur_tab == s:current_tabnr return s:current_tabline endif let builder = airline#extensions#tabline#new_builder() " Add left tabline content if s:show_buffers == 0 call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0) elseif s:show_tabs == 0 call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) else if s:switch_buffers_and_tabs == 0 call builder.add_section_spaced('airline_tabtype', s:buffers_label) call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) else call builder.add_section_spaced('airline_tabtype', s:tabs_label) call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0) endif endif call builder.add_section('airline_tabfill', '') call builder.split() call builder.add_section('airline_tabfill', '') " Add right tabline content if s:show_buffers == 0 call builder.add_section_spaced('airline_tabtype', s:tabs_label) elseif s:show_tabs == 0 call builder.add_section_spaced('airline_tabtype', s:buffers_label) else if s:switch_buffers_and_tabs == 0 call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1) call builder.add_section_spaced('airline_tabtype', s:tabs_label) else call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1) call builder.add_section_spaced('airline_tabtype', s:buffers_label) endif endif let s:current_bufnr = cur_buf let s:current_tabnr = cur_tab let s:current_tabline = builder.build() return s:current_tabline endfunction vim-airline-0.8/autoload/airline/extensions/tabline/formatters/000077500000000000000000000000001267015252500250405ustar00rootroot00000000000000vim-airline-0.8/autoload/airline/extensions/tabline/formatters/default.vim000066400000000000000000000025741267015252500272110ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.') let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) let s:fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0) let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ') let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0) let s:buf_modified_symbol = g:airline_symbols.modified function! airline#extensions#tabline#formatters#default#format(bufnr, buffers) let _ = '' let name = bufname(a:bufnr) if empty(name) let _ .= '[No Name]' else if s:fnamecollapse let _ .= substitute(fnamemodify(name, s:fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g') else let _ .= fnamemodify(name, s:fmod) endif if a:bufnr != bufnr('%') && s:fnametruncate && strlen(_) > s:fnametruncate let _ = strpart(_, 0, s:fnametruncate) endif endif return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _) endfunction function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name) let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : '' let _ .= substitute(a:buffer_name, '\\', '/', 'g') if getbufvar(a:bufnr, '&modified') == 1 let _ .= s:buf_modified_symbol endif return _ endfunction vim-airline-0.8/autoload/airline/extensions/tabline/formatters/unique_tail.vim000066400000000000000000000017411267015252500300770ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffers) let duplicates = {} let tails = {} let map = {} for nr in a:buffers let name = bufname(nr) if empty(name) let map[nr] = '[No Name]' else let tail = fnamemodify(name, ':s?/\+$??:t') if has_key(tails, tail) let duplicates[nr] = nr endif let tails[tail] = 1 let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, tail) endif endfor for nr in values(duplicates) let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.')) endfor if has_key(map, a:bufnr) return map[a:bufnr] endif " if we get here, the buffer list isn't in sync with the selected buffer yet, fall back to the default return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) endfunction vim-airline-0.8/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim000066400000000000000000000054141267015252500320050ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 scriptencoding utf-8 let s:skip_symbol = '…' function! airline#extensions#tabline#formatters#unique_tail_improved#format(bufnr, buffers) if len(a:buffers) <= 1 " don't need to compare bufnames if has less than one buffer opened return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) endif let curbuf_tail = fnamemodify(bufname(a:bufnr), ':t') let do_deduplicate = 0 let path_tokens = {} for nr in a:buffers let name = bufname(nr) if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail " only perform actions if curbuf_tail isn't unique let do_deduplicate = 1 let tokens = reverse(split(substitute(fnamemodify(name, ':p:h'), '\\', '/', 'g'), '/')) let token_index = 0 for token in tokens if token == '' | continue | endif if token == '.' | break | endif if !has_key(path_tokens, token_index) let path_tokens[token_index] = {} endif let path_tokens[token_index][token] = 1 let token_index += 1 endfor endif endfor if do_deduplicate == 1 let path = [] let token_index = 0 for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:h'), '\\', '/', 'g'), '/')) if token == '.' | break | endif let duplicated = 0 let uniq = 1 let single = 1 if has_key(path_tokens, token_index) let duplicated = 1 if len(keys(path_tokens[token_index])) > 1 | let single = 0 | endif if has_key(path_tokens[token_index], token) | let uniq = 0 | endif endif call insert(path, {'token': token, 'duplicated': duplicated, 'uniq': uniq, 'single': single}) let token_index += 1 endfor let buf_name = [curbuf_tail] let has_uniq = 0 let has_skipped = 0 for token1 in reverse(path) if !token1['duplicated'] && len(buf_name) > 1 call insert(buf_name, s:skip_symbol) let has_skipped = 0 break endif if has_uniq == 1 call insert(buf_name, s:skip_symbol) let has_skipped = 0 break endif if token1['uniq'] == 0 && token1['single'] == 1 let has_skipped = 1 else if has_skipped == 1 call insert(buf_name, s:skip_symbol) let has_skipped = 0 endif call insert(buf_name, token1['token']) endif if token1['uniq'] == 1 let has_uniq = 1 endif endfor if has_skipped == 1 call insert(buf_name, s:skip_symbol) endif return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, join(buf_name, '/')) else return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) endif endfunction vim-airline-0.8/autoload/airline/extensions/tabline/tabs.vim000066400000000000000000000073711267015252500243300ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1) let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1) let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X') let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') let s:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1) let s:spc = g:airline_symbols.space let s:current_bufnr = -1 let s:current_tabnr = -1 let s:current_modified = 0 function! airline#extensions#tabline#tabs#off() augroup airline_tabline_tabs autocmd! augroup END endfunction function! airline#extensions#tabline#tabs#on() augroup airline_tabline_tabs autocmd! autocmd BufDelete * call airline#extensions#tabline#tabs#invalidate() augroup END endfunction function! airline#extensions#tabline#tabs#invalidate() let s:current_bufnr = -1 endfunction function! airline#extensions#tabline#tabs#get() let curbuf = bufnr('%') let curtab = tabpagenr() call s:map_keys() if curbuf == s:current_bufnr && curtab == s:current_tabnr if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified return s:current_tabline endif endif let b = airline#extensions#tabline#new_builder() for i in range(1, tabpagenr('$')) if i == curtab let group = 'airline_tabsel_right' if g:airline_detect_modified for bi in tabpagebuflist(i) if getbufvar(bi, '&modified') let group = 'airline_tabmod_right' endif endfor endif let s:current_modified = (group == 'airline_tabmod_right') ? 1 : 0 else let group = 'airline_tab_right' endif let val = '%(' if s:show_tab_nr if s:tab_nr_type == 0 let val .= (g:airline_symbols.space).'%{len(tabpagebuflist('.i.'))}' elseif s:tab_nr_type == 1 let val .= (g:airline_symbols.space).i else "== 2 let val .= (g:airline_symbols.space).i.'.%{len(tabpagebuflist('.i.'))}' endif endif call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)') endfor call b.add_section('airline_tabfill', '') call b.split() call b.add_section('airline_tabfill', '') if s:show_close_button call b.add_section('airline_tab_right', ' %999X'.s:close_symbol.' ') endif if s:show_splits == 1 let buffers = tabpagebuflist(curtab) for nr in buffers let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)') endfor elseif s:show_tab_type == 1 call b.add_section_spaced('airline_tabtype', s:tabs_label) endif let s:current_bufnr = curbuf let s:current_tabnr = curtab let s:current_tabline = b.build() return s:current_tabline endfunction function s:map_keys() noremap AirlineSelectTab1 :1tabn noremap AirlineSelectTab2 :2tabn noremap AirlineSelectTab3 :3tabn noremap AirlineSelectTab4 :4tabn noremap AirlineSelectTab5 :5tabn noremap AirlineSelectTab6 :6tabn noremap AirlineSelectTab7 :7tabn noremap AirlineSelectTab8 :8tabn noremap AirlineSelectTab9 :9tabn noremap AirlineSelectPrevTab gT " tabn {count} goes to count tab does not go {count} tab pages forward! noremap AirlineSelectNextTab :exe repeat(':tabn\|', v:count1) endfunction vim-airline-0.8/autoload/airline/extensions/tagbar.vim000066400000000000000000000026751267015252500232230ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':TagbarToggle') finish endif let s:flags = get(g:, 'airline#extensions#tagbar#flags', '') let s:spc = g:airline_symbols.space " Arguments: current, sort, fname function! airline#extensions#tagbar#get_status(...) let builder = airline#builder#new({ 'active': a:1 }) call builder.add_section('airline_a', s:spc.'Tagbar'.s:spc) call builder.add_section('airline_b', s:spc.a:2.s:spc) call builder.add_section('airline_c', s:spc.a:3.s:spc) return builder.build() endfunction function! airline#extensions#tagbar#inactive_apply(...) if getwinvar(a:2.winnr, '&filetype') == 'tagbar' return -1 endif endfunction let s:airline_tagbar_last_lookup_time = 0 let s:airline_tagbar_last_lookup_val = '' function! airline#extensions#tagbar#currenttag() if get(w:, 'airline_active', 0) if s:airline_tagbar_last_lookup_time != localtime() let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags) let s:airline_tagbar_last_lookup_time = localtime() endif return s:airline_tagbar_last_lookup_val endif return '' endfunction function! airline#extensions#tagbar#init(ext) call a:ext.add_inactive_statusline_func('airline#extensions#tagbar#inactive_apply') let g:tagbar_status_func = 'airline#extensions#tagbar#get_status' call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag') endfunction vim-airline-0.8/autoload/airline/extensions/tmuxline.vim000066400000000000000000000015471267015252500236250ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':Tmuxline') finish endif let s:tmuxline_snapshot_file = get(g:, 'airline#extensions#tmuxline#snapshot_file', '') let s:color_template = get(g:, 'airline#extensions#tmuxline#color_template', 'normal') function! airline#extensions#tmuxline#init(ext) call a:ext.add_theme_func('airline#extensions#tmuxline#set_tmux_colors') endfunction function! airline#extensions#tmuxline#set_tmux_colors(palette) let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' let mode_palette = a:palette[color_template] let tmuxline_theme = tmuxline#api#create_theme_from_airline(mode_palette) call tmuxline#api#set_theme(tmuxline_theme) if strlen(s:tmuxline_snapshot_file) call tmuxline#api#snapshot(s:tmuxline_snapshot_file) endif endfunction vim-airline-0.8/autoload/airline/extensions/undotree.vim000066400000000000000000000014161267015252500236000ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':UndotreeToggle') finish endif function! airline#extensions#undotree#apply(...) if exists('t:undotree') if &ft == 'undotree' if exists('*t:undotree.GetStatusLine') call airline#extensions#apply_left_override('undo', '%{t:undotree.GetStatusLine()}') else call airline#extensions#apply_left_override('undotree', '%f') endif endif if &ft == 'diff' && exists('*t:diffpanel.GetStatusLine') call airline#extensions#apply_left_override('diff', '%{t:diffpanel.GetStatusLine()}') endif endif endfunction function! airline#extensions#undotree#init(ext) call a:ext.add_statusline_func('airline#extensions#undotree#apply') endfunction vim-airline-0.8/autoload/airline/extensions/unicode.vim000066400000000000000000000012451267015252500234010ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'loaded_unicodePlugin', 0) finish endif function! airline#extensions#unicode#apply(...) if exists(":UnicodeTable") == 2 && bufname('') ==# 'UnicodeTable' call airline#parts#define('unicode', { \ 'text': '[UnicodeTable]', \ 'accent': 'bold' }) let w:airline_section_a = airline#section#create(['unicode']) let w:airline_section_b = '' let w:airline_section_c = '' let w:airline_section_y = '' endif endfunction function! airline#extensions#unicode#init(ext) call a:ext.add_statusline_func('airline#extensions#unicode#apply') endfunction vim-airline-0.8/autoload/airline/extensions/unite.vim000066400000000000000000000013231267015252500230740ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'loaded_unite', 0) finish endif function! airline#extensions#unite#apply(...) if &ft == 'unite' call a:1.add_section('airline_a', ' Unite ') call a:1.add_section('airline_b', ' %{get(unite#get_context(), "buffer_name", "")} ') call a:1.add_section('airline_c', ' %{unite#get_status_string()} ') call a:1.split() call a:1.add_section('airline_y', ' %{get(unite#get_context(), "real_buffer_name", "")} ') return 1 endif endfunction function! airline#extensions#unite#init(ext) let g:unite_force_overwrite_statusline = 0 call a:ext.add_statusline_func('airline#extensions#unite#apply') endfunction vim-airline-0.8/autoload/airline/extensions/virtualenv.vim000066400000000000000000000015131267015252500241500ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:spc = g:airline_symbols.space function! airline#extensions#virtualenv#init(ext) call a:ext.add_statusline_func('airline#extensions#virtualenv#apply') endfunction function! airline#extensions#virtualenv#apply(...) if &filetype =~# "python" if get(g:, 'virtualenv_loaded', 0) let statusline = virtualenv#statusline() else let statusline = fnamemodify($VIRTUAL_ENV, ':t') endif if !empty(statusline) call airline#extensions#append_to_section('x', \ s:spc.g:airline_right_alt_sep.s:spc.statusline) endif endif endfunction function! airline#extensions#virtualenv#update() if &filetype =~# "python" call airline#extensions#virtualenv#apply() call airline#update_statusline() endif endfunction vim-airline-0.8/autoload/airline/extensions/whitespace.vim000066400000000000000000000117461267015252500241160ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 " http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1) let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace) let s:default_checks = ['indent', 'trailing', 'mixed-indent-file'] let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]') let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', 'mixed-indent[%s]') let s:long_format = get(g:, 'airline#extensions#whitespace#long_format', 'long[%s]') let s:mixed_indent_file_format = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', 'mix-indent-file[%s]') let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0) let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] } let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) function! s:check_mixed_indent() if s:indent_algo == 1 " [] " spaces before or between tabs are not allowed let t_s_t = '(^\t* +\t\s*\S)' " ( x count) " count of spaces at the end of tabs should be less than tabstop value let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' return search('\v' . t_s_t . '|' . t_l_s, 'nw') elseif s:indent_algo == 2 return search('\v(^\t* +\t\s*\S)', 'nw') else return search('\v(^\t+ +)|(^ +\t+)', 'nw') endif endfunction function! s:check_mixed_indent_file() if stridx(&ft, 'c') == 0 || stridx(&ft, 'cpp') == 0 || stridx(&ft, 'javascript') == 0 " for C/CPP only allow /** */ comment style with one space before the '*' let head_spc = '\v(^ +\*@!)' else let head_spc = '\v(^ +)' endif let indent_tabs = search('\v(^\t+)', 'nw') let indent_spc = search(head_spc, 'nw') if indent_tabs > 0 && indent_spc > 0 return printf("%d:%d", indent_tabs, indent_spc) else return '' endif endfunction function! airline#extensions#whitespace#check() if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines return '' endif if !exists('b:airline_whitespace_check') let b:airline_whitespace_check = '' let checks = get(g:, 'airline#extensions#whitespace#checks', s:default_checks) let trailing = 0 if index(checks, 'trailing') > -1 try let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$') let trailing = search(regexp, 'nw') catch echomsg 'airline#whitespace: error occured evaluating '. regexp echomsg v:exception return '' endtry endif let mixed = 0 let check = 'indent' if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0 let mixed = s:check_mixed_indent() endif let mixed_file = '' let check = 'mixed-indent-file' if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0 let mixed_file = s:check_mixed_indent_file() endif let long = 0 if index(checks, 'long') > -1 && &tw > 0 let long = search('\%>'.&tw.'v.\+', 'nw') endif if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file) let b:airline_whitespace_check = s:symbol if s:show_message if trailing != 0 let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing) endif if mixed != 0 let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixed) endif if long != 0 let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:long_format, long) endif if !empty(mixed_file) let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_file_format, mixed_file) endif endif endif endif return b:airline_whitespace_check endfunction function! airline#extensions#whitespace#toggle() if s:enabled augroup airline_whitespace autocmd! augroup END augroup! airline_whitespace let s:enabled = 0 else call airline#extensions#whitespace#init() let s:enabled = 1 endif if exists("g:airline#extensions#whitespace#enabled") let g:airline#extensions#whitespace#enabled = s:enabled if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0 let g:airline_section_warning .= airline#section#create(['whitespace']) call airline#update_statusline() endif endif echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') endfunction function! airline#extensions#whitespace#init(...) call airline#parts#define_function('whitespace', 'airline#extensions#whitespace#check') unlet! b:airline_whitespace_check augroup airline_whitespace autocmd! autocmd CursorHold,BufWritePost * unlet! b:airline_whitespace_check augroup END endfunction vim-airline-0.8/autoload/airline/extensions/windowswap.vim000066400000000000000000000011661267015252500241570ustar00rootroot00000000000000" vim: et ts=2 sts=2 sw=2 if !exists('g:loaded_windowswap') finish endif let s:spc = g:airline_symbols.space if !exists('g:airline#extensions#windowswap#indicator_text') let g:airline#extensions#windowswap#indicator_text = 'WS' endif function! airline#extensions#windowswap#init(ext) call airline#parts#define_function('windowswap', 'airline#extensions#windowswap#get_status') endfunction function! airline#extensions#windowswap#get_status() if WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr() return g:airline#extensions#windowswap#indicator_text.s:spc endif return '' endfunction vim-airline-0.8/autoload/airline/extensions/wordcount.vim000066400000000000000000000027341267015252500240030ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:filetypes = get(g:, 'airline#extensions#wordcount#filetypes', '\vhelp|markdown|rst|org|text') let s:format = get(g:, 'airline#extensions#wordcount#format', '%d words') let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default') function! s:update() if match(&ft, s:filetypes) > -1 let l:mode = mode() if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S' let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format() let b:airline_change_tick = b:changedtick else if get(b:, 'airline_wordcount_cache', '') is# '' || \ b:airline_wordcount_cache isnot# get(b:, 'airline_wordcount', '') || \ get(b:, 'airline_change_tick', 0) != b:changedtick " cache data let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format() let b:airline_wordcount_cache = b:airline_wordcount let b:airline_change_tick = b:changedtick endif endif endif endfunction function! airline#extensions#wordcount#apply(...) if &ft =~ s:filetypes call airline#extensions#prepend_to_section('z', '%{get(b:, "airline_wordcount", "")}') endif endfunction function! airline#extensions#wordcount#init(ext) call a:ext.add_statusline_func('airline#extensions#wordcount#apply') autocmd BufReadPost,CursorMoved,CursorMovedI * call s:update() endfunction vim-airline-0.8/autoload/airline/extensions/wordcount/000077500000000000000000000000001267015252500232605ustar00rootroot00000000000000vim-airline-0.8/autoload/airline/extensions/wordcount/formatters/000077500000000000000000000000001267015252500254465ustar00rootroot00000000000000vim-airline-0.8/autoload/airline/extensions/wordcount/formatters/default.vim000066400000000000000000000030241267015252500276060ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 function! airline#extensions#wordcount#formatters#default#format() let words = string(s:wordcount()) if empty(words) return endif let separator = s:get_decimal_group() if words > 999 && !empty(separator) " Format number according to locale, e.g. German: 1.245 or English: 1,245 let a = join(reverse(split(words, '.\zs')),'') let a = substitute(a, '...', '&'.separator, 'g') let words = join(reverse(split(a, '.\zs')),'') endif return words . " words" . g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space endfunction function! s:wordcount() if exists("*wordcount") let l:mode = mode() if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S' let l:visual_words = wordcount()['visual_words'] if l:visual_words != '' return l:visual_words else return 0 endif else return wordcount()['words'] endif elseif mode() =~? 's' return else let old_status = v:statusmsg let position = getpos(".") exe "silent normal! g\" let stat = v:statusmsg call setpos('.', position) let v:statusmsg = old_status let parts = split(stat) if len(parts) > 11 return str2nr(parts[11]) else return endif endif endfunction function s:get_decimal_group() if match(v:lang, '\v\cC|en') > -1 return ',' elseif match(v:lang, '\v\cde|dk|fr|pt') > -1 return '.' endif return '' endfunction vim-airline-0.8/autoload/airline/extensions/ycm.vim000066400000000000000000000016751267015252500225520ustar00rootroot00000000000000" MIT License. Copyright (c) 2015 Evgeny Firsov. " vim: et ts=2 sts=2 sw=2 let s:spc = g:airline_symbols.space let s:error_symbol = get(g:, 'airline#extensions#ycm#error_symbol', 'E:') let s:warning_symbol = get(g:, 'airline#extensions#ycm#warning_symbol', 'W:') function! airline#extensions#ycm#init(ext) call airline#parts#define_function('ycm_error_count', 'airline#extensions#ycm#get_error_count') call airline#parts#define_function('ycm_warning_count', 'airline#extensions#ycm#get_warning_count') endfunction function! airline#extensions#ycm#get_error_count() if exists(':YcmDiag') let cnt = youcompleteme#GetErrorCount() if cnt != 0 return s:error_symbol.cnt endif endif return '' endfunction function! airline#extensions#ycm#get_warning_count() if exists(':YcmDiag') let cnt = youcompleteme#GetWarningCount() if cnt != 0 return s:warning_symbol.cnt.s:spc endif endif return '' endfunction vim-airline-0.8/autoload/airline/highlighter.vim000066400000000000000000000133741267015252500220600ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running') && (empty($CONEMUBUILD) || &term !=? 'xterm') let s:separators = {} let s:accents = {} function! s:gui2cui(rgb, fallback) if a:rgb == '' return a:fallback elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1 return a:rgb endif let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)') return airline#msdos#round_msdos_colors(rgb) endfunction function! s:get_syn(group, what) if !exists("g:airline_gui_mode") let g:airline_gui_mode = airline#init#gui_mode() endif let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode) if empty(color) || color == -1 let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode) endif if empty(color) || color == -1 let color = 'NONE' endif return color endfunction function! s:get_array(fg, bg, opts) let fg = a:fg let bg = a:bg return g:airline_gui_mode ==# 'gui' \ ? [ fg, bg, '', '', join(a:opts, ',') ] \ : [ '', '', fg, bg, join(a:opts, ',') ] endfunction function! airline#highlighter#get_highlight(group, ...) let fg = s:get_syn(a:group, 'fg') let bg = s:get_syn(a:group, 'bg') let reverse = g:airline_gui_mode ==# 'gui' \ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui') \ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm') \|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term') return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000) endfunction function! airline#highlighter#get_highlight2(fg, bg, ...) let fg = s:get_syn(a:fg[0], a:fg[1]) let bg = s:get_syn(a:bg[0], a:bg[1]) return s:get_array(fg, bg, a:000) endfunction function! airline#highlighter#exec(group, colors) if pumvisible() return endif let colors = a:colors if s:is_win32term let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, '')) let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, '')) endif let cmd= printf('hi %s %s %s %s %s %s %s %s', \ a:group, s:Get(colors, 0, 'guifg=', ''), s:Get(colors, 1, 'guibg=', ''), \ s:Get(colors, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''), \ s:Get(colors, 4, 'gui=', ''), s:Get(colors, 4, 'cterm=', ''), \ s:Get(colors, 4, 'term=', '')) let old_hi = airline#highlighter#get_highlight(a:group) if len(colors) == 4 call add(colors, '') endif if old_hi != colors exe cmd endif endfunction function! s:Get(dict, key, prefix, default) if get(a:dict, a:key, a:default) isnot# a:default return a:prefix. get(a:dict, a:key) else return '' endif endfunction function! s:exec_separator(dict, from, to, inverse, suffix) if pumvisible() return endif let l:from = airline#themes#get_highlight(a:from.a:suffix) let l:to = airline#themes#get_highlight(a:to.a:suffix) let group = a:from.'_to_'.a:to.a:suffix if a:inverse let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ] else let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ] endif let a:dict[group] = colors call airline#highlighter#exec(group, colors) endfunction function! airline#highlighter#load_theme() if pumvisible() return endif for winnr in filter(range(1, winnr('$')), 'v:val != winnr()') call airline#highlighter#highlight_modified_inactive(winbufnr(winnr)) endfor call airline#highlighter#highlight(['inactive']) call airline#highlighter#highlight(['normal']) endfunction function! airline#highlighter#add_separator(from, to, inverse) let s:separators[a:from.a:to] = [a:from, a:to, a:inverse] call exec_separator({}, a:from, a:to, a:inverse, '') endfunction function! airline#highlighter#add_accent(accent) let s:accents[a:accent] = 1 endfunction function! airline#highlighter#highlight_modified_inactive(bufnr) if getbufvar(a:bufnr, '&modified') let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c') \ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : [] else let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c') \ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : [] endif if !empty(colors) call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors) endif endfunction function! airline#highlighter#highlight(modes) let p = g:airline#themes#{g:airline_theme}#palette " draw the base mode, followed by any overrides let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val') let suffix = a:modes[0] == 'inactive' ? '_inactive' : '' for mode in mapped if exists('g:airline#themes#{g:airline_theme}#palette[mode]') let dict = g:airline#themes#{g:airline_theme}#palette[mode] for kvp in items(dict) let mode_colors = kvp[1] call airline#highlighter#exec(kvp[0].suffix, mode_colors) for accent in keys(s:accents) if !has_key(p.accents, accent) continue endif let colors = copy(mode_colors) if p.accents[accent][0] != '' let colors[0] = p.accents[accent][0] endif if p.accents[accent][2] != '' let colors[2] = p.accents[accent][2] endif if len(colors) >= 5 let colors[4] = get(p.accents[accent], 4, '') else call add(colors, get(p.accents[accent], 4, '')) endif call airline#highlighter#exec(kvp[0].suffix.'_'.accent, colors) endfor endfor " TODO: optimize this for sep in items(s:separators) call exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix) endfor endif endfor endfunction vim-airline-0.8/autoload/airline/init.vim000066400000000000000000000124551267015252500205240ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 function! s:check_defined(variable, default) if !exists(a:variable) let {a:variable} = a:default endif endfunction let s:loaded = 0 function! airline#init#bootstrap() if s:loaded return endif let s:loaded = 1 let g:airline#init#bootstrapping = 1 call s:check_defined('g:airline_left_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b0":">") call s:check_defined('g:airline_left_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b1":">") call s:check_defined('g:airline_right_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b2":"<") call s:check_defined('g:airline_right_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b3":"<") call s:check_defined('g:airline_detect_modified', 1) call s:check_defined('g:airline_detect_paste', 1) call s:check_defined('g:airline_detect_crypt', 1) call s:check_defined('g:airline_detect_iminsert', 0) 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_filetypes', []) call s:check_defined('g:airline_exclude_preview', 0) call s:check_defined('g:airline_gui_mode', airline#init#gui_mode()) call s:check_defined('g:airline_mode_map', {}) call extend(g:airline_mode_map, { \ '__' : '------', \ 'n' : 'NORMAL', \ 'i' : 'INSERT', \ 'R' : 'REPLACE', \ 'v' : 'VISUAL', \ 'V' : 'V-LINE', \ 'c' : 'COMMAND', \ '' : 'V-BLOCK', \ 's' : 'SELECT', \ 'S' : 'S-LINE', \ '' : 'S-BLOCK', \ 't' : 'TERMINAL', \ }, 'keep') call s:check_defined('g:airline_theme_map', {}) call extend(g:airline_theme_map, { \ '\CTomorrow': 'tomorrow', \ 'base16': 'base16', \ 'mo[l|n]okai': 'molokai', \ 'wombat': 'wombat', \ 'zenburn': 'zenburn', \ 'solarized': 'solarized', \ }, 'keep') call s:check_defined('g:airline_symbols', {}) call extend(g:airline_symbols, { \ 'paste': 'PASTE', \ 'readonly': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO', \ 'whitespace': get(g:, 'airline_powerline_fonts', 0) ? "\u2739" : '!', \ 'linenr': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a1" : ':', \ 'branch': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a0" : '', \ 'notexists': "\u2204", \ 'modified': '+', \ 'space': ' ', \ 'crypt': get(g:, 'airline_crypt_symbol', nr2char(0x1F512)), \ }, 'keep') call airline#parts#define('mode', { \ 'function': 'airline#parts#mode', \ 'accent': 'bold', \ }) call airline#parts#define_function('iminsert', 'airline#parts#iminsert') call airline#parts#define_function('paste', 'airline#parts#paste') call airline#parts#define_function('crypt', 'airline#parts#crypt') call airline#parts#define_function('filetype', 'airline#parts#filetype') call airline#parts#define('readonly', { \ 'function': 'airline#parts#readonly', \ 'accent': 'red', \ }) call airline#parts#define_raw('file', '%f%m') call airline#parts#define_raw('path', '%F%m') call airline#parts#define('linenr', { \ 'raw': '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#', \ 'accent': 'bold'}) call airline#parts#define_function('ffenc', 'airline#parts#ffenc') call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', \ 'eclim', 'whitespace','windowswap', 'ycm_error_count', 'ycm_warning_count']) call airline#parts#define_text('capslock', '') unlet g:airline#init#bootstrapping endfunction function! airline#init#gui_mode() return ((has('nvim') && exists('$NVIM_TUI_ENABLE_TRUE_COLOR')) \ || has('gui_running') || (has("termtruecolor") && &guicolors == 1)) ? \ 'gui' : 'cterm' endfunction function! airline#init#sections() let spc = g:airline_symbols.space if !exists('g:airline_section_a') let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'capslock', 'iminsert']) endif if !exists('g:airline_section_b') let g:airline_section_b = airline#section#create(['hunks', 'branch']) endif if !exists('g:airline_section_c') if exists("+autochdir") && &autochdir == 1 let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly']) else let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly']) endif endif if !exists('g:airline_section_gutter') let g:airline_section_gutter = airline#section#create(['%=']) endif if !exists('g:airline_section_x') let g:airline_section_x = airline#section#create_right(['tagbar', 'filetype']) endif if !exists('g:airline_section_y') let g:airline_section_y = airline#section#create_right(['ffenc']) endif if !exists('g:airline_section_z') let g:airline_section_z = airline#section#create(['windowswap', '%3p%%'.spc, 'linenr', ':%3v ']) endif if !exists('g:airline_section_error') let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic', 'eclim']) endif if !exists('g:airline_section_warning') let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'whitespace']) endif endfunction vim-airline-0.8/autoload/airline/msdos.vim000066400000000000000000000024311267015252500206770ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 " basic 16 msdos from MSDOS " see output of color, should be " 0 Black " 1 DarkBlue " 2 DarkGreen " 3 DarkCyan " 4 DarkRed " 5 DarkMagenta " 6 Brown " 7 LightGray " 8 DarkGray " 9 Blue " 10 Green " 11 Cyan " 12 Red " 13 Magenta " 14 Yellow " 15 White let s:basic16 = [ \ [ 0x00, 0x00, 0x00 ], \ [ 0x00, 0x00, 0x80 ], \ [ 0x00, 0x80, 0x00 ], \ [ 0x00, 0x80, 0x80 ], \ [ 0x80, 0x00, 0x00 ], \ [ 0x80, 0x00, 0x80 ], \ [ 0x80, 0x80, 0x00 ], \ [ 0xC0, 0xC0, 0xC0 ], \ [ 0x80, 0x80, 0x80 ], \ [ 0x00, 0x00, 0xFF ], \ [ 0x00, 0xFF, 0x00 ], \ [ 0x00, 0xFF, 0xFF ], \ [ 0xFF, 0x00, 0x00 ], \ [ 0xFF, 0x00, 0xFF ], \ [ 0xFF, 0xFF, 0x00 ], \ [ 0xFF, 0xFF, 0xFF ] \ ] function! airline#msdos#round_msdos_colors(rgblist) " Check for values from MSDOS 16 color terminal let best = [] let min = 100000 let list = s:basic16 for value in list let t = abs(value[0] - a:rgblist[0]) + \ abs(value[1] - a:rgblist[1]) + \ abs(value[2] - a:rgblist[2]) if min > t let min = t let best = value endif endfor return index(s:basic16, best) endfunction vim-airline-0.8/autoload/airline/parts.vim000066400000000000000000000043151267015252500207060ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:parts = {} " PUBLIC API {{{ function! airline#parts#define(key, config) let s:parts[a:key] = get(s:parts, a:key, {}) if exists('g:airline#init#bootstrapping') call extend(s:parts[a:key], a:config, 'keep') else call extend(s:parts[a:key], a:config, 'force') endif endfunction function! airline#parts#define_function(key, name) call airline#parts#define(a:key, { 'function': a:name }) endfunction function! airline#parts#define_text(key, text) call airline#parts#define(a:key, { 'text': a:text }) endfunction function! airline#parts#define_raw(key, raw) call airline#parts#define(a:key, { 'raw': a:raw }) endfunction function! airline#parts#define_minwidth(key, width) call airline#parts#define(a:key, { 'minwidth': a:width }) endfunction function! airline#parts#define_condition(key, predicate) call airline#parts#define(a:key, { 'condition': a:predicate }) endfunction function! airline#parts#define_accent(key, accent) call airline#parts#define(a:key, { 'accent': a:accent }) endfunction function! airline#parts#define_empty(keys) for key in a:keys call airline#parts#define_raw(key, '') endfor endfunction function! airline#parts#get(key) return get(s:parts, a:key, {}) endfunction " }}} function! airline#parts#mode() return get(w:, 'airline_current_mode', '') endfunction function! airline#parts#crypt() return g:airline_detect_crypt && exists("+key") && !empty(&key) ? g:airline_symbols.crypt : '' endfunction function! airline#parts#paste() return g:airline_detect_paste && &paste ? g:airline_symbols.paste : '' endfunction function! airline#parts#iminsert() if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name') return toupper(b:keymap_name) endif return '' endfunction function! airline#parts#readonly() if &readonly && &modifiable && !filereadable(bufname('%')) return '[noperm]' else return &readonly ? g:airline_symbols.readonly : '' endif endfunction function! airline#parts#filetype() return &filetype endfunction function! airline#parts#ffenc() return printf('%s%s%s', &fenc, &l:bomb ? '[BOM]' : '', strlen(&ff) > 0 ? '['.&ff.']' : '') endfunction vim-airline-0.8/autoload/airline/section.vim000066400000000000000000000037061267015252500212240ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 call airline#init#bootstrap() let s:spc = g:airline_symbols.space function! s:wrap_accent(part, value) if exists('a:part.accent') call airline#highlighter#add_accent(a:part.accent) return '%#__accent_'.(a:part.accent).'#'.a:value.'%#__restore__#' endif return a:value endfunction function! s:create(parts, append) let _ = '' for idx in range(len(a:parts)) let part = airline#parts#get(a:parts[idx]) let val = '' if exists('part.function') let func = (part.function).'()' elseif exists('part.text') let func = '"'.(part.text).'"' else if a:append > 0 && idx != 0 let val .= s:spc.g:airline_left_alt_sep.s:spc endif if a:append < 0 && idx != 0 let val = s:spc.g:airline_right_alt_sep.s:spc.val endif if exists('part.raw') let _ .= s:wrap_accent(part, val.(part.raw)) continue else let _ .= s:wrap_accent(part, val.a:parts[idx]) continue endif endif let minwidth = get(part, 'minwidth', 0) if a:append > 0 && idx != 0 let partval = printf('%%{airline#util#append(%s,%s)}', func, minwidth) elseif a:append < 0 && idx != len(a:parts) - 1 let partval = printf('%%{airline#util#prepend(%s,%s)}', func, minwidth) else let partval = printf('%%{airline#util#wrap(%s,%s)}', func, minwidth) endif if exists('part.condition') let partval = substitute(partval, '{', '\="{".(part.condition)." ? "', '') let partval = substitute(partval, '}', ' : ""}', '') endif let val .= s:wrap_accent(part, partval) let _ .= val endfor return _ endfunction function! airline#section#create(parts) return s:create(a:parts, 0) endfunction function! airline#section#create_left(parts) return s:create(a:parts, 1) endfunction function! airline#section#create_right(parts) return s:create(a:parts, -1) endfunction vim-airline-0.8/autoload/airline/themes.vim000066400000000000000000000052571267015252500210500ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 " generates a dictionary which defines the colors for each highlight group function! airline#themes#generate_color_map(sect1, sect2, sect3, ...) let palette = { \ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] , \ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] , \ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] , \ } if a:0 > 0 call extend(palette, { \ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] , \ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] , \ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] , \ }) else call extend(palette, { \ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] , \ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] , \ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] , \ }) endif return palette endfunction function! airline#themes#get_highlight(group, ...) return call('airline#highlighter#get_highlight', [a:group] + a:000) endfunction function! airline#themes#get_highlight2(fg, bg, ...) return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000) endfunction function! airline#themes#patch(palette) for mode in keys(a:palette) if !has_key(a:palette[mode], 'airline_warning') let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ] endif if !has_key(a:palette[mode], 'airline_error') let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ] endif endfor let a:palette.accents = get(a:palette, 'accents', {}) let a:palette.accents.bold = [ '', '', '', '', 'bold' ] let a:palette.accents.italic = [ '', '', '', '', 'italic' ] if !has_key(a:palette.accents, 'red') let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ] endif if !has_key(a:palette.accents, 'green') let a:palette.accents.green = [ '#008700' , '' , 22 , '' ] endif if !has_key(a:palette.accents, 'blue') let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ] endif if !has_key(a:palette.accents, 'yellow') let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ] endif if !has_key(a:palette.accents, 'orange') let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ] endif if !has_key(a:palette.accents, 'purple') let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ] endif endfunction vim-airline-0.8/autoload/airline/themes/000077500000000000000000000000001267015252500203225ustar00rootroot00000000000000vim-airline-0.8/autoload/airline/themes/dark.vim000066400000000000000000000117731267015252500217710ustar00rootroot00000000000000" Each theme is contained in its own file and declares variables scoped to the " file. These variables represent the possible "modes" that airline can " detect. The mode is the return value of mode(), which gets converted to a " readable string. The following is a list currently supported modes: normal, " insert, replace, visual, and inactive. " " Each mode can also have overrides. These are small changes to the mode that " don't require a completely different look. "modified" and "paste" are two " such supported overrides. These are simply suffixed to the major mode, " separated by an underscore. For example, "normal_modified" would be normal " mode where the current buffer is modified. " " 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 = {} " First let's define some arrays. The s: is just a VimL thing for scoping the " variables to the current script. Without this, these variables would be " declared globally. Now let's declare some colors for normal mode and add it " to the dictionary. The array is in the format: " [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid " values for the "opt" value. let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ] let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ] let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ] let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) " 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 " declared. let g:airline#themes#dark#palette.normal_modified = { \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , \ } let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ] let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ] let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ] let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#dark#palette.insert_modified = { \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , \ } let g:airline#themes#dark#palette.insert_paste = { \ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , \ } let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert) let g:airline#themes#dark#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ] let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ] let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ] let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ] let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#dark#palette.visual_modified = { \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , \ } let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ] let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ] let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) let g:airline#themes#dark#palette.inactive_modified = { \ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] , \ } " Accents are used to give parts within a section a slightly different look or " color. Here we are defining a "red" accent, which is used by the 'readonly' " part by default. Only the foreground colors are specified, so the background " colors are automatically extracted from the underlying section colors. What " this means is that regardless of which section the part is defined in, it " will be red instead of the section's foreground color. You can also have " multiple parts with accents within a section. let g:airline#themes#dark#palette.accents = { \ 'red': [ '#ff0000' , '' , 160 , '' ] \ } " Here we define the color map for ctrlp. We check for the g:loaded_ctrlp " variable so that related functionality is loaded iff the user is using " ctrlp. Note that this is optional, and if you do not define ctrlp colors " they will be chosen automatically from the existing palette. if !get(g:, 'loaded_ctrlp', 0) finish endif let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( \ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ], \ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ], \ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ]) vim-airline-0.8/autoload/airline/util.vim000066400000000000000000000031451267015252500205320ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 call airline#init#bootstrap() let s:spc = g:airline_symbols.space function! airline#util#wrap(text, minwidth) if a:minwidth > 0 && winwidth(0) < a:minwidth return '' endif return a:text endfunction function! airline#util#append(text, minwidth) if a:minwidth > 0 && winwidth(0) < a:minwidth return '' endif let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text endfunction function! airline#util#prepend(text, minwidth) if a:minwidth > 0 && winwidth(0) < a:minwidth return '' endif return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc endfunction if v:version >= 704 function! airline#util#getwinvar(winnr, key, def) return getwinvar(a:winnr, a:key, a:def) endfunction else function! airline#util#getwinvar(winnr, key, def) let winvals = getwinvar(a:winnr, '') return get(winvals, a:key, a:def) endfunction endif if v:version >= 704 function! airline#util#exec_funcrefs(list, ...) for Fn in a:list let code = call(Fn, a:000) if code != 0 return code endif endfor return 0 endfunction else function! airline#util#exec_funcrefs(list, ...) " for 7.2; we cannot iterate the list, hence why we use range() " for 7.3-[97, 328]; we cannot reuse the variable, hence the {} for i in range(0, len(a:list) - 1) let Fn{i} = a:list[i] let code = call(Fn{i}, a:000) if code != 0 return code endif endfor return 0 endfunction endif vim-airline-0.8/doc/000077500000000000000000000000001267015252500143475ustar00rootroot00000000000000vim-airline-0.8/doc/airline.txt000066400000000000000000001216571267015252500165470ustar00rootroot00000000000000*airline.txt* Lean and mean status/tabline that's light as air *airline* _ _ _ _ ~ __ _(_)_ __ ___ __ _(_)_ __| (_)_ __ ___ ~ \ \ / / | '_ ` _ \ _____ / _` | | '__| | | '_ \ / _ \ ~ \ V /| | | | | | |_____| (_| | | | | | | | | | __/ ~ \_/ |_|_| |_| |_| \__,_|_|_| |_|_|_| |_|\___| ~ ~ ============================================================================== CONTENTS *airline-contents* 01. Intro ............................................... |airline-intro| 02. Features ......................................... |airline-features| 03. Name ................................................. |airline-name| 04. Configuration ............................... |airline-configuration| 05. Commands ......................................... |airline-commands| 06. Autocommands ................................. |airline-autocommands| 07. Customization ............................... |airline-customization| 08. Extensions ..................................... |airline-extensions| 09. Advanced Customization ............. |airline-advanced-customization| 10. Funcrefs ......................................... |airline-funcrefs| 11. Pipeline ......................................... |airline-pipeline| 12. Writing Extensions ..................... |airline-writing-extensions| 13. Writing Themes ..................................... |airline-themes| 14. Troubleshooting ........................... |airline-troubleshooting| 15. Contributions ............................... |airline-contributions| 16. License ........................................... |airline-license| ============================================================================== INTRODUCTION *airline-intro* vim-airline is a fast and lightweight alternative to powerline, written in 100% vimscript with no outside dependencies. ============================================================================== FEATURES *airline-features* * tiny core written with extensibility in mind. * integrates with many popular plugins. * looks good with regular fonts, and provides configuration points so you can use unicode or powerline symbols. * optimized for speed; it loads in under a millisecond. * fully customizable; if you know a little 'statusline' syntax you can tweak it to your needs. * extremely easy to write themes. ============================================================================== NAME *airline-name* Where did the name come from? I wrote this on an airplane, and since it's light as air it turned out to be a good name :-) ============================================================================== CONFIGURATION *airline-configuration* There are a couple configuration values available (shown with their default values): * the separator used on the left side > let g:airline_left_sep='>' < * the separator used on the right side > let g:airline_right_sep='<' < * enable modified detection > let g:airline_detect_modified=1 * enable paste detection > let g:airline_detect_paste=1 < * enable crypt detection > let g:airline_detect_crypt=1 < * enable iminsert detection > let g:airline_detect_iminsert=0 < * determine whether inactive windows should have the left section collapsed to only the filename of that buffer. > let g:airline_inactive_collapse=1 < * themes are automatically selected based on the matching colorscheme. this can be overridden by defining a value. > let g:airline_theme='dark' < Note: Only the dark theme is distributed with vim-airline. For more themes, checkout the vim-airline-themes repository (github.com/vim-airline/vim-airline-themes) * if you want to patch the airline theme before it gets applied, you can supply the name of a function where you can modify the palette. > let g:airline_theme_patch_func = 'AirlineThemePatch' function! AirlineThemePatch(palette) if g:airline_theme == 'badwolf' for colors in values(a:palette.inactive) let colors[3] = 245 endfor endif endfunction < * enable/disable automatic population of the `g:airline_symbols` dictionary with powerline symbols. > let g:airline_powerline_fonts=0 < * define the set of text to display for each mode. > let g:airline_mode_map = {} " see source for the defaults " or copy paste the following into your vimrc for shortform text let g:airline_mode_map = { \ '__' : '-', \ 'n' : 'N', \ 'i' : 'I', \ 'R' : 'R', \ 'c' : 'C', \ 'v' : 'V', \ 'V' : 'V', \ '' : 'V', \ 's' : 'S', \ 'S' : 'S', \ '' : 'S', \ } < * define the set of filename match queries which excludes a window from having its statusline modified > let g:airline_exclude_filenames = [] " see source for current list < * define the set of filetypes which are excluded from having its window statusline modified > let g:airline_exclude_filetypes = [] " see source for current list < * defines whether the preview window should be excluded from have its window statusline modified (may help with plugins which use the preview window heavily) > let g:airline_exclude_preview = 0 < * disable the Airline customization for selective windows (this is a window-local variable so you can disable it for only some windows) > let w:airline_disabled = 1 < ============================================================================== COMMANDS *airline-commands* :AirlineTheme {theme-name} *:AirlineTheme* Displays or changes the current theme. :AirlineToggleWhitespace *:AirlineToggleWhitespace* Toggles whitespace detection. :AirlineToggle *:AirlineToggle* Toggles between the standard 'statusline' and airline. :AirlineRefresh *:AirlineRefresh* Refreshes all highlight groups and redraws the statusline. ============================================================================== AUTOCOMMANDS *airline-autocommands* Airline comes with some user-defined autocommands. |AirlineAfterInit| after plugin is initialized, but before the statusline is replaced |AirlineToggledOn| after airline is activated and replaced the statusline |AirlineToggledOff| after airline is deactivated and the statusline is restored to the original ============================================================================== CUSTOMIZATION *airline-customization* The following are some unicode symbols for customizing the left/right separators, as well as the powerline font glyphs. Note: You must define the dictionary first before setting values. Also, it's a good idea to check whether it exists as to avoid accidentally overwriting its contents. > if !exists('g:airline_symbols') let g:airline_symbols = {} endif " unicode symbols let g:airline_left_sep = '»' let g:airline_left_sep = '▶' let g:airline_right_sep = '«' let g:airline_right_sep = '◀' let g:airline_symbols.crypt = '🔒' let g:airline_symbols.linenr = '␊' let g:airline_symbols.linenr = '␤' let g:airline_symbols.linenr = '¶' let g:airline_symbols.branch = '⎇' let g:airline_symbols.paste = 'ρ' let g:airline_symbols.paste = 'Þ' let g:airline_symbols.paste = '∥' let g:airline_symbols.notexists = '∄' let g:airline_symbols.whitespace = 'Ξ' " powerline symbols let g:airline_left_sep = '' let g:airline_left_alt_sep = '' let g:airline_right_sep = '' let g:airline_right_alt_sep = '' let g:airline_symbols.branch = '' let g:airline_symbols.readonly = '' let g:airline_symbols.linenr = '' " old vim-powerline symbols let g:airline_left_sep = '⮀' let g:airline_left_alt_sep = '⮁' let g:airline_right_sep = '⮂' let g:airline_right_alt_sep = '⮃' let g:airline_symbols.branch = '⭠' let g:airline_symbols.readonly = '⭤' let g:airline_symbols.linenr = '⭡' < For more intricate customizations, you can replace the predefined sections with the usual statusline syntax. Note: If you define any section variables it will replace the default values entirely. If you want to disable only certain parts of a section you can try using variables defined in the |airline-configuration| or |airline-extensions| section. > variable names default contents ---------------------------------------------------------------------------- let g:airline_section_a (mode, crypt, paste, iminsert) let g:airline_section_b (hunks, branch) let g:airline_section_c (bufferline or filename) let g:airline_section_gutter (readonly, csv) let g:airline_section_x (tagbar, filetype, virtualenv) let g:airline_section_y (fileencoding, fileformat) let g:airline_section_z (percentage, line number, column number) let g:airline_section_error (ycm_error_count, syntastic, eclim) let g:airline_section_warning (ycm_warning_count, whitespace) " here is an example of how you could replace the branch indicator with " the current working directory, followed by the filename. let g:airline_section_b = '%{getcwd()}' let g:airline_section_c = '%t' < ============================================================================== EXTENSIONS *airline-extensions* Most extensions are enabled by default and lazily loaded when the corresponding plugin (if any) is detected. By default, airline will attempt to load any extension it can find in the 'runtimepath'. On some systems this can result in an undesirable startup cost. You can disable the check with the following flag. > let g:airline#extensions#disable_rtp_load = 1 < Note: Third party plugins that rely on this behavior will be affected. You will need to manually load them. Alternatively, if you want a minimalistic setup and would rather opt-in which extensions get loaded instead of disabling each individually, you can declare the following list variable: > " an empty list disables all extensions let g:airline_extensions = [] " or only load what you want let g:airline_extensions = ['branch', 'tabline'] < ------------------------------------- *airline-default* The default extension understands all of the `g:` variables in the |airline-configuration| section, however it also has some more fine-tuned configuration values that you can use. * control which sections get truncated and at what width. > let g:airline#extensions#default#section_truncate_width = { \ 'b': 79, \ 'x': 60, \ 'y': 88, \ 'z': 45, \ 'warning': 80, \ 'error': 80, \ } " Note: set to an empty dictionary to disable truncation. let g:airline#extensions#default#section_truncate_width = {} < * configure the layout of the sections by specifying an array of two arrays (first array is the left side, second array is the right side). > let g:airline#extensions#default#layout = [ \ [ 'a', 'b', 'c' ], \ [ 'x', 'y', 'z', 'error', 'warning' ] \ ] < * configure the layout to not use %(%) grouping items in the statusline. Try setting this to zero, if you notice bleeding color artifacts > let airline#extensions#default#section_use_groupitems = 1 < ------------------------------------- *airline-quickfix* The quickfix extension is a simple built-in extension which determines whether the buffer is a quickfix or location list buffer, and adjusts the title accordingly. * configure the title text for quickfix buffers > let g:airline#extensions#quickfix#quickfix_text = 'Quickfix' < * configure the title text for location list buffers > let g:airline#extensions#quickfix#location_text = 'Location' < ------------------------------------- *airline-bufferline* vim-bufferline * enable/disable bufferline integration > let g:airline#extensions#bufferline#enabled = 1 < * determine whether bufferline will overwrite customization variables > let g:airline#extensions#bufferline#overwrite_variables = 1 < ------------------------------------- *airline-branch* fugitive.vim lawrencium vcscommand * enable/disable fugitive/lawrencium integration > let g:airline#extensions#branch#enabled = 1 < * change the text for when no branch is detected > let g:airline#extensions#branch#empty_message = '' < * define the order in which the branches of different vcs systems will be displayed on the statusline (currently only for fugitive and lawrencium) > let g:airline#extensions#branch#vcs_priority = ["git", "mercurial"] < * use vcscommand.vim if available > let g:airline#extensions#branch#use_vcscommand = 0 < * truncate long branch names to a fixed length > let g:airline#extensions#branch#displayed_head_limit = 10 < * customize formatting of branch name > " default value leaves the name unmodifed let g:airline#extensions#branch#format = 0 " to only show the tail, e.g. a branch 'feature/foo' becomes 'foo', use let g:airline#extensions#branch#format = 1 " to truncate all path sections but the last one, e.g. a branch " 'foo/bar/baz' becomes 'f/b/baz', use let g:airline#extensions#branch#format = 2 " if a string is provided, it should be the name of a function that " takes a string and returns the desired value let g:airline#extensions#branch#format = 'CustomBranchName' function! CustomBranchName(name) return '[' . a:name . ']' endfunction < ------------------------------------- *airline-syntastic* syntastic * enable/disable syntastic integration > let g:airline#extensions#syntastic#enabled = 1 < ------------------------------------- *airline-tagbar* tagbar * enable/disable tagbar integration > let g:airline#extensions#tagbar#enabled = 1 < * change how tags are displayed (:help tagbar-statusline) > let g:airline#extensions#tagbar#flags = '' (default) let g:airline#extensions#tagbar#flags = 'f' let g:airline#extensions#tagbar#flags = 's' let g:airline#extensions#tagbar#flags = 'p' < ------------------------------------- *airline-csv* csv.vim * enable/disable csv integration for displaying the current column. > let g:airline#extensions#csv#enabled = 1 < * change how columns are displayed. > let g:airline#extensions#csv#column_display = 'Number' (default) let g:airline#extensions#csv#column_display = 'Name' < ------------------------------------- *airline-hunks* vim-gitgutter vim-signify changesPlugin quickfixsigns * enable/disable showing a summary of changed hunks under source control. > let g:airline#extensions#hunks#enabled = 1 < * enable/disable showing only non-zero hunks. > let g:airline#extensions#hunks#non_zero_only = 0 < * set hunk count symbols. > let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-'] < ------------------------------------- *airline-ctrlp* ctrlp * configure which mode colors should ctrlp window use (takes effect only if the active airline theme doesn't define ctrlp colors) > let g:airline#extensions#ctrlp#color_template = 'insert' (default) let g:airline#extensions#ctrlp#color_template = 'normal' let g:airline#extensions#ctrlp#color_template = 'visual' let g:airline#extensions#ctrlp#color_template = 'replace' < * configure whether to show the previous and next modes (mru, buffer, etc...) > let g:airline#extensions#ctrlp#show_adjacent_modes = 1 < ------------------------------------- *airline-virtualenv* virtualenv * enable/disable virtualenv integration > let g:airline#extensions#virtualenv#enabled = 1 < ------------------------------------- *airline-eclim* eclim * enable/disable eclim integration, which works well with the |airline-syntastic| extension. > let g:airline#extensions#eclim#enabled = 1 ------------------------------------- *airline-wordcount* * enable/disable word counting. > let g:airline#extensions#wordcount#enabled = 1 < * regex of filetypes to enable word counting. > " the default value matches filetypes typically used for documentation " such as markdown and help files. let g:airline#extensions#wordcount#filetypes = ... (default: markdown,rst,org,help,text) * defines the name of a formatter for word count will be displayed: > " The default will try to guess LC_NUMERIC and format number accordingly " e.g. 1,042 in English and 1.042 in German locale let g:airline#extensions#wordcount#formatter = 'default' " here is how you can define a 'foo' formatter: " create a file in the dir autoload/airline/extensions/wordcount/formatters/ " called foo.vim " this example needs at least Vim > 7.4.1042 function! airline#extensions#wordcount#formatters#foo#format() return (wordcount()['words'] == 0 ? 'NONE' : \ wordcount()['words'] > 100 ? 'okay' : 'not enough') endfunction let g:airline#extensions#wordline#formatter = 'foo' < ------------------------------------- *airline-whitespace* * enable/disable detection of whitespace errors. > let g:airline#extensions#whitespace#enabled = 1 < * customize the type of mixed indent checking to perform. > " must be all spaces or all tabs before the first non-whitespace character let g:airline#extensions#whitespace#mixed_indent_algo = 0 (default) " certain number of spaces are allowed after tabs, but not in between " this algorithm works well for /** */ style comments in a tab-indented file let g:airline#extensions#whitespace#mixed_indent_algo = 1 " spaces are allowed after tabs, but not in between " this algorithm works well with programming styles that use tabs for " indentation and spaces for alignment let g:airline#extensions#whitespace#mixed_indent_algo = 2 < * customize the whitespace symbol. > let g:airline#extensions#whitespace#symbol = '!' < * configure which whitespace checks to enable. > " indent: mixed indent within a line " long: overlong lines " trailing: trailing whitespace " mixed-indent-file: different indentation in different lines let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing', 'long', 'mixed-indent-file' ] < * configure the maximum number of lines where whitespace checking is enabled. > let g:airline#extensions#whitespace#max_lines = 20000 < * configure whether a message should be displayed. > let g:airline#extensions#whitespace#show_message = 1 < * configure the formatting of the warning messages. > let g:airline#extensions#whitespace#trailing_format = 'trailing[%s]' let g:airline#extensions#whitespace#mixed_indent_format = 'mixed-indent[%s]' let g:airline#extensions#whitespace#long_format = 'long[%s]' let g:airline#extensions#whitespace#mixed_indent_file_format = 'mix-indent-file[%s]' * configure custom trailing whitespace regexp rule > let g:airline#extensions#whitespace#trailing_regexp = '\s$' < ------------------------------------- *airline-tabline* Note: If you're using the ctrlspace tabline only the option marked with (c) are supported! * enable/disable enhanced tabline. (c) let g:airline#extensions#tabline#enabled = 0 * enable/disable displaying open splits per tab (only when tabs are opened). > let g:airline#extensions#tabline#show_splits = 1 * * switch position of buffers and tabs on splited tabline (c) let g:airline#extensions#tabline#switch_buffers_and_tabs = 0 * enable/disable displaying buffers with a single tab. (c) let g:airline#extensions#tabline#show_buffers = 1 < * enable/disable displaying tabs, regardless of number. (c) let g:airline#extensions#tabline#show_tabs = 1 < * configure filename match rules to exclude from the tabline. > let g:airline#extensions#tabline#excludes = [] * enable/disable display preview window buffer in the tabline. > let g:airline#extensions#tabline#exclude_preview = 1 * configure how numbers are displayed in tab mode. > let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default) let g:airline#extensions#tabline#tab_nr_type = 1 " tab number let g:airline#extensions#tabline#tab_nr_type = 2 " splits and tab number < * enable/disable displaying tab number in tabs mode. > let g:airline#extensions#tabline#show_tab_nr = 1 * enable/disable displaying tab type (far right) > let g:airline#extensions#tabline#show_tab_type = 1 * rename label for buffers (default: 'buffers') (c) let g:airline#extensions#tabline#buffers_label = 'b' * rename label for tabs (default: 'tabs') (c) let g:airline#extensions#tabline#tabs_label = 't' * enable/disable displaying index of the buffer. When enabled, numbers will be displayed in the tabline and mappings will be exposed to allow you to select a buffer directly. Up to 9 mappings will be exposed. > let g:airline#extensions#tabline#buffer_idx_mode = 1 nmap 1 AirlineSelectTab1 nmap 2 AirlineSelectTab2 nmap 3 AirlineSelectTab3 nmap 4 AirlineSelectTab4 nmap 5 AirlineSelectTab5 nmap 6 AirlineSelectTab6 nmap 7 AirlineSelectTab7 nmap 8 AirlineSelectTab8 nmap 9 AirlineSelectTab9 nmap - AirlineSelectPrevTab nmap + AirlineSelectNextTab Note: Mappings will be ignored within a NERDTree buffer. Note: In buffer_idx_mode these mappings won't change the current tab, but switch to the buffer visible in that tab. Use |gt| for switching tabs. In tabmode, those mappings will switch to the specified tab. * defines the name of a formatter for how buffer names are displayed. (c) let g:airline#extensions#tabline#formatter = 'default' " here is how you can define a 'foo' formatter: " create a file in the dir autoload/airline/extensions/tabline/formatters/ " called foo.vim function! airline#extensions#tabline#formatters#foo#format(bufnr, buffers) return fnamemodify(bufname(a:bufnr), ':t') endfunction let g:airline#extensions#tabline#formatter = 'foo' < Note: the following variables are only used by the 'default' formatter. When no disambiguation is needed, both 'unique_tail_improved' and 'unique_tail' delegate formatting to 'default', so these variables also control rendering of unique filenames when using these formatters. * configure whether buffer numbers should be shown. > let g:airline#extensions#tabline#buffer_nr_show = 0 < * configure how buffer numbers should be formatted with |printf()|. > let g:airline#extensions#tabline#buffer_nr_format = '%s: ' < * configure the formatting of filenames (see |filename-modifiers|). > let g:airline#extensions#tabline#fnamemod = ':p:.' < * configure collapsing parent directories in buffer name. > let g:airline#extensions#tabline#fnamecollapse = 1 < * configure truncating non-active buffer names to specified length. > let g:airline#extensions#tabline#fnametruncate = 0 " The `unique_tail` algorithm will display the tail of the filename, unless " there is another file of the same name, in which it will display it along " with the containing parent directory. let g:airline#extensions#tabline#formatter = 'unique_tail' " The `unique_tail_improved` - another algorithm, that will smartly uniquify " buffers names with similar filename, suppressing common parts of paths. let g:airline#extensions#tabline#formatter = 'unique_tail_improved' < * configure the minimum number of buffers needed to show the tabline. > let g:airline#extensions#tabline#buffer_min_count = 0 < Note: this setting only applies to a single tab and when `show_buffers` is true. * configure the minimum number of tabs needed to show the tabline. > let g:airline#extensions#tabline#tab_min_count = 0 < Note: this setting only applies when `show_buffers` is false. * configure separators for the tabline only. > let g:airline#extensions#tabline#left_sep = '' let g:airline#extensions#tabline#left_alt_sep = '' let g:airline#extensions#tabline#right_sep = '' let g:airline#extensions#tabline#right_alt_sep = '' * configure whether close button should be shown: > let g:airline#extensions#tabline#show_close_button = 1 * configure symbol used to represent close button > let g:airline#extensions#tabline#close_symbol = 'X' * configure pattern to be ignored on BufAdd autocommand > " fixes unneccessary redraw, when e.g. opening Gundo window let airline#extensions#tabline#ignore_bufadd_pat = \ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree' Note: Enabling this extension will modify 'showtabline' and 'guioptions'. * enable Refresh of tabline buffers on |BufAdd| autocommands (set this to one, if you note 'AirlineTablineRefresh', however, this won't update airline on |:badd| commands) > let airline#extensions#tabline#disable_refresh = 0 ------------------------------------- *airline-tmuxline* tmuxline * enable/disable tmuxline integration > let g:airline#extensions#tmuxline#enabled = 0 < * configure which mode colors should be used in tmux statusline > let airline#extensions#tmuxline#color_template = 'normal' (default) let airline#extensions#tmuxline#color_template = 'insert' let airline#extensions#tmuxline#color_template = 'visual' let airline#extensions#tmuxline#color_template = 'replace' < * if specified, setting this option will trigger writing to the file whenever the airline theme is applied, i.e. when :AirlineTheme is executed and on vim startup > airline#extensions#tmuxline#snapshot_file = "~/.tmux-statusline-colors.conf" < ------------------------------------- *airline-promptline* promptline * configure the path to the snapshot .sh file. Mandatory option. The created file should be sourced by the shell on login > " in .vimrc airline#extensions#promptline#snapshot_file = "~/.shell_prompt.sh" " in .bashrc/.zshrc [ -f ~/.shell_prompt.sh ] && source ~/.shell_prompt.sh < * enable/disable promptline integration > let g:airline#extensions#promptline#enabled = 0 < * configure which mode colors should be used in prompt > let airline#extensions#promptline#color_template = 'normal' (default) let airline#extensions#promptline#color_template = 'insert' let airline#extensions#promptline#color_template = 'visual' let airline#extensions#promptline#color_template = 'replace' < ------------------------------------- *airline-nrrwrgn* NrrwRgn * enable/disable NrrwRgn integration > let g:airline#extensions#nrrwrgn#enabled = 1 ------------------------------------- *airline-capslock* vim-capslock * enable/disable vim-capslock integration > let g:airline#extensions#capslock#enabled = 1 ------------------------------------- *airline-windowswap* vim-windowswap * enable/disable vim-windowswap integration > let g:airline#extensions#windowswap#enabled = 1 * set marked window indicator string > let g:airline#extensions#windowswap#indicator_text = 'WS' < ------------------------------------- *airline-taboo* taboo.vim * enable/disable taboo.vim integration > let g:airline#extensions#taboo#enabled = 1 < ------------------------------------- *airline-ctrlspace* vim-ctrlspace * enable/disable vim-ctrlspace integration > let g:airline#extensions#ctrlspace#enabled = 1 To make the vim-ctrlspace integration work you will need to make the ctrlspace statusline function call the correct airline function. Therefore add the following line into your .vimrc: let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()" < ------------------------------------- *airline-ycm* YouCompleteMe Shows number of errors and warnings in the current file detected by YCM. * enable/disable YCM integration > let g:airline#extensions#ycm#enabled = 1 * set error count prefix > let g:airline#extensions#ycm#error_symbol = 'E:' * set warning count prefix > let g:airline#extensions#ycm#warning_symbol = 'W:' < ------------------------------------- *airline-po* po.vim * enable/disable po integration > let g:airline#extensions#po#enabled = 1 < * truncate width names to a fixed length > let g:airline#extensions#po#displayed_limit = 0 < ============================================================================== ADVANCED CUSTOMIZATION *airline-advanced-customization* The defaults will accommodate the mass majority of users with minimal configuration. However, if you want to reposition sections or contents you can do so with built-in helper functions, which makes it possible to create sections in a more declarative style. ------------------------------------- *airline-parts* A part is something that contains metadata that eventually gets rendered into the statusline. You can define parts that contain constant strings or functions. Defining parts is needed if you want to use features like automatic insertion of separators or hiding based on window width. For example, this is how you would define a part function: > call airline#parts#define_function('foo', 'GetFooText') < Here is how you would define a part that is visible only if the window width greater than a minimum width. > call airline#parts#define_minwidth('foo', 50) < Parts can be configured to be visible conditionally. > call airline#parts#define_condition('foo', 'getcwd() =~ "work_dir"') < Now add part "foo" to section section airline_section_y: > let g:airline_section_y = airline#section#create_right(['ffenc','foo']) < Note: Part definitions are combinative; e.g. the two examples above modify the same `foo` part. Note: Look at the source code and tests for the full API. ------------------------------------- *airline-predefined-parts* Before is a list of parts that are predefined by vim-airline. * `mode` displays the current mode * `iminsert` displays the current insert method * `paste` displays the paste indicator * `crypt` displays the crypted indicator * `filetype` displays the file type * `readonly` displays the read only indicator * `file` displays the filename and modified indicator * `ffenc` displays the file format and encoding And the following are defined for their respective extensions: `hunks`, `branch`, `tagbar`, `syntastic`, `whitespace` ------------------------------------- *airline-accents* Accents can be defined on any part, like so: > call airline#parts#define_accent('foo', 'red') < This will override the colors of that part by using what is defined in that particular accent. In the above example, the `red` accent is used, which means regardless of which section the part is used in, it will have red foreground colors instead of the section's default foreground color. The following accents are defined by default. Themes can define their variants of the colors, but defaults will be provided if missing. > bold, italic, red, green, blue, yellow, orange, purple < The defaults configure the mode and line number parts to be bold, and the readonly part to be red. ------------------------------------- *airline-sections* Once a part is defined, you can use helper functions to generate the statuslines for each section. For example, to use the part above, we could define a section like this: > function! AirlineInit() let g:airline_section_a = airline#section#create(['mode', ' ', 'foo']) let g:airline_section_b = airline#section#create_left(['ffenc','file']) let g:airline_section_c = airline#section#create(['%{getcwd()}']) endfunction autocmd User AirlineAfterInit call AirlineInit() < This will create a section with the `mode`, followed by a space, and our `foo` part in section `a`. Section `b` will have two parts with a left-side separator. And section `c` will contain the current path. You may notice that the space and cwd are not defined parts. For convenience, if a part of that key does not exist, it will be inserted as is. The unit tests will be a good resource for possibilities. Note: The use of |VimEnter| is important, because most extensions are lazily loaded, so we must give them a chance to define their parts before we can use them. Note: The `airline#section#create` function and friends will do its best to create a section with the appropriate separators, but it only works for function and text parts. Special 'statusline' items like %f or raw/undefined parts will not work as it is not possible to inspect their widths/contents before rendering to the statusline. ============================================================================== FUNCREFS *airline-funcrefs* vim-airline internally uses funcrefs to integrate with third party plugins, and you can tap into this functionality to extend it for you needs. This is the most powerful way to customize the statusline, and sometimes it may be easier to go this route than the above methods. Every section can have two values. The default value is the global `g:` variable which is used in the absence of a `w:` value. This makes it very easy to override only certain parts of the statusline by only defining window-local variables for a subset of all sections. ------------------------------------- *add_statusline_func* The following is an example of how you can extend vim-airline to support a new plugin. > function! MyPlugin(...) if &filetype == 'MyPluginFileType' let w:airline_section_a = 'MyPlugin' let w:airline_section_b = '%f' let w:airline_section_c = '%{MyPlugin#function()}' let g:airline_variable_referenced_in_statusline = 'foo' endif endfunction call airline#add_statusline_func('MyPlugin') < Notice that only the left side of the statusline is overwritten. This means the right side (the line/column numbers, etc) will be intact. ------------------------------------- *remove_statusline_func* You can also remove a function as well, which is useful for when you want a temporary override. > call airline#remove_statusline_func('MyPlugin') < ============================================================================== PIPELINE *airline-pipeline* Sometimes you want to do more than just use overrides. The statusline funcref is invoked and passed two arguments. The first of these arguments is the statusline builder. You can use this to build completely custom statuslines to your liking. Here is an example: > > function! MyPlugin(...) " first variable is the statusline builder let builder = a:1 " WARNING: the API for the builder is not finalized and may change call builder.add_section('Normal', '%f') call builder.add_section('WarningMsg', '%{getcwd()}') call builder.split() call builder.add_section('airline_z', '%p%%') " tell the core to use the contents of the builder return 1 endfunction < The above example uses various example highlight groups to demonstrate that you can use any combination from the loaded colorscheme. However, if you want colors to change between modes, you should use one of the section highlight groups, e.g. `airline_a` and `airline_b`. The second variable is the context, which is a dictionary containing various values such as whether the statusline is active or not, and the window number. > context = { 'winnr': 'the window number for the statusline', 'active': 'whether the window is active or not', 'bufnr': 'the current buffer for this window', } < ------------------------------------- *airline-pipeline-return-codes* The pipeline accepts various return codes and can be used to determine the next action. The following are the supported codes: > 0 the default, continue on with the next funcref -1 do not modify the statusline 1 modify the statusline with the current contents of the builder < Note: Any value other than 0 will halt the pipeline and prevent the next funcref from executing. ============================================================================== WRITING EXTENSIONS *airline-writing-extensions* For contributions into the plugin, here are the following guidelines: 1. For simple 'filetype' checks, they can be added directly into the `extensions.vim` file. 2. Pretty much everything else should live as a separate file under the `extensions/` directory. a. Inside `extensions.vim`, add a check for some variable or command that is always available (these must be defined in `plugin/`, and _not_ `autoload/` of the other plugin). If it exists, then initialize the extension. This ensures that the extension is loaded if and only if the user has the other plugin installed. Also, a check to `airline#extensions#foo_plugin#enabled` should be performed to allow the user to disable it. b. Configuration variables for the extension should reside in the extension, e.g. `g:airline#extensions#foo_plugin#bar_variable`. See the source of |example.vim| for documented code of how to write one. Looking at the other extensions is also a good resource. ============================================================================== WRITING THEMES *airline-themes* Themes are written "close to the metal" -- you will need to know some basic VimL syntax to write a theme, but if you've written in any programming language before it will be easy to pick up. The |dark.vim| theme fully documents this procedure and will guide you through the process. For other examples, you can visit the official themes repository at . It also includes examples such as |jellybeans.vim| which define colors by extracting highlight groups from the underlying colorscheme. ============================================================================== TROUBLESHOOTING *airline-troubleshooting* Q. There are no colors. A. You need to set up your terminal correctly. For more details, see . Alternatively, if you want to bypass the automatic detection of terminal colors, you can force Vim into 256 color mode with this: > set t_Co=256 < Q. The statusline does not appear until I create a split. A. This is the default setting of 'laststatus'. If you want it to appear all the time, add the following to your vimrc: > set laststatus=2 < Q. Powerline symbols are not showing up. A. First, you must install patched powerline fonts. Second, you must enable unicode in vim. > set encoding=utf-8 < Q. There is a pause when leaving insert mode. A. Add the following to your vimrc. > set ttimeoutlen=50 < Q. The colors look a little off for some themes. A. Certain themes are derived from the active colorscheme by extracting colors from predefined highlight groups. These airline themes will look good for their intended matching colorschemes, but will be hit or miss when loaded with other colorschemes. Q. Themes are missing A. Themes have been extracted into the vim-airlines-themes repository. Simply clone https://github.com/vim-airline/vim-airline-themes and everything should work again. Solutions to other common problems can be found in the Wiki: ============================================================================== CONTRIBUTIONS *airline-contributions* Contributions and pull requests are welcome. ============================================================================== LICENSE *airline-license* MIT License. Copyright © 2013-2016 Bailey Ling. vim:tw=78:ts=8:ft=help:norl: vim-airline-0.8/plugin/000077500000000000000000000000001267015252500151005ustar00rootroot00000000000000vim-airline-0.8/plugin/airline.vim000066400000000000000000000066151267015252500172500ustar00rootroot00000000000000" MIT License. Copyright (c) 2013-2016 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline) finish endif let g:loaded_airline = 1 let s:airline_initialized = 0 function! s:init() if s:airline_initialized return endif let s:airline_initialized = 1 call airline#extensions#load() call airline#init#sections() let s:theme_in_vimrc = exists('g:airline_theme') if s:theme_in_vimrc try let palette = g:airline#themes#{g:airline_theme}#palette catch echom 'Could not resolve airline theme "' . g:airline_theme . '". Themes have been migrated to github.com/vim-airline/vim-airline-themes.' let g:airline_theme = 'dark' endtry silent call airline#switch_theme(g:airline_theme) else let g:airline_theme = 'dark' silent call s:on_colorscheme_changed() endif silent doautocmd User AirlineAfterInit endfunction function! s:on_window_changed() if pumvisible() && (!&previewwindow || g:airline_exclude_preview) return endif call s:init() call airline#update_statusline() endfunction function! s:on_colorscheme_changed() call s:init() let g:airline_gui_mode = airline#init#gui_mode() if !s:theme_in_vimrc call airline#switch_matching_theme() endif " couldn't find a match, or theme was defined, just refresh call airline#load_theme() endfunction function airline#cmdwinenter(...) call airline#extensions#apply_left_override('Command Line', '') endfunction function! s:airline_toggle() if exists("#airline") augroup airline au! augroup END augroup! airline if exists("s:stl") let &stl = s:stl endif silent doautocmd User AirlineToggledOff else let s:stl = &statusline augroup airline autocmd! autocmd CmdwinEnter * \ call airline#add_statusline_func('airline#cmdwinenter') \ | call on_window_changed() autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter') autocmd GUIEnter,ColorScheme * call on_colorscheme_changed() autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload,VimResized * \ call on_window_changed() autocmd TabEnter * :unlet! w:airline_lastmode autocmd BufWritePost */autoload/airline/themes/*.vim \ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0] \ | call airline#load_theme() augroup END if s:airline_initialized call s:on_window_changed() endif silent doautocmd User AirlineToggledOn endif endfunction function! s:get_airline_themes(a, l, p) let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:a.'*'), "\n") return map(files, 'fnamemodify(v:val, ":t:r")') endfunction function! s:airline_theme(...) if a:0 call airline#switch_theme(a:1) else echo g:airline_theme endif endfunction function! s:airline_refresh() silent doautocmd User AirlineBeforeRefresh call airline#load_theme() call airline#update_statusline() endfunction command! -bar -nargs=? -complete=customlist,get_airline_themes AirlineTheme call airline_theme() command! -bar AirlineToggleWhitespace call airline#extensions#whitespace#toggle() command! -bar AirlineToggle call s:airline_toggle() command! -bar AirlineRefresh call s:airline_refresh() call airline#init#bootstrap() call s:airline_toggle() vim-airline-0.8/t/000077500000000000000000000000001267015252500140455ustar00rootroot00000000000000vim-airline-0.8/t/airline.vim000066400000000000000000000045371267015252500162160ustar00rootroot00000000000000let g:airline_theme = 'dark' source plugin/airline.vim doautocmd VimEnter function! MyFuncref(...) call a:1.add_raw('hello world') return 1 endfunction function! MyIgnoreFuncref(...) return -1 endfunction function! MyAppend1(...) call a:1.add_raw('hello') endfunction function! MyAppend2(...) call a:1.add_raw('world') endfunction describe 'airline' before let g:airline_statusline_funcrefs = [] end it 'should run user funcrefs first' call airline#add_statusline_func('MyFuncref') let &statusline = '' call airline#update_statusline() Expect airline#statusline(1) =~ 'hello world' end it 'should not change the statusline with -1' call airline#add_statusline_funcref(function('MyIgnoreFuncref')) let &statusline = 'foo' call airline#update_statusline() Expect &statusline == 'foo' end it 'should support multiple chained funcrefs' call airline#add_statusline_func('MyAppend1') call airline#add_statusline_func('MyAppend2') call airline#update_statusline() Expect airline#statusline(1) =~ 'helloworld' end it 'should allow users to redefine sections' let g:airline_section_a = airline#section#create(['mode', 'mode']) call airline#update_statusline() Expect airline#statusline(1) =~ '%{airline#util#wrap(airline#parts#mode(),0)}%#airline_a#%#airline_a_bold#%{airline#util#wrap(airline#parts#mode(),0)}%#airline_a#' end it 'should remove funcrefs properly' let c = len(g:airline_statusline_funcrefs) call airline#add_statusline_func('MyIgnoreFuncref') call airline#remove_statusline_func('MyIgnoreFuncref') Expect len(g:airline_statusline_funcrefs) == c end it 'should overwrite the statusline with active and inactive splits' wincmd s Expect airline#statusline(1) !~ 'inactive' Expect airline#statusline(2) =~ 'inactive' wincmd c end it 'should collapse the inactive split if the variable is set true' let g:airline_inactive_collapse = 1 wincmd s Expect getwinvar(2, '&statusline') !~ 'airline#parts#mode' wincmd c end it 'should not collapse the inactive split if the variable is set false' let g:airline_inactive_collapse = 0 wincmd s Expect getwinvar(2, '&statusline') != 'airline#parts#mode' wincmd c end it 'should include check_mode' Expect airline#statusline(1) =~ 'airline#check_mode' end end vim-airline-0.8/t/builder.vim000066400000000000000000000065151267015252500162170ustar00rootroot00000000000000let g:airline_theme = 'dark' call airline#init#bootstrap() describe 'active builder' before let s:builder = airline#builder#new({'active': 1}) end it 'should start with an empty statusline' let stl = s:builder.build() Expect stl == '' end it 'should transition colors from one to the next' call s:builder.add_section('Normal', 'hello') call s:builder.add_section('Search', 'world') let stl = s:builder.build() Expect stl =~ '%#Normal#hello%#Normal_to_Search#>%#Search#world' end it 'should reuse highlight group if background colors match' highlight Foo1 ctermfg=1 ctermbg=2 highlight Foo2 ctermfg=1 ctermbg=2 call s:builder.add_section('Foo1', 'hello') call s:builder.add_section('Foo2', 'world') let stl = s:builder.build() Expect stl =~ '%#Foo1#hello>world' end it 'should switch highlight groups if foreground colors differ' highlight Foo1 ctermfg=1 ctermbg=2 highlight Foo2 ctermfg=2 ctermbg=2 call s:builder.add_section('Foo1', 'hello') call s:builder.add_section('Foo2', 'world') let stl = s:builder.build() Expect stl =~ '%#Foo1#hello%#Foo1_to_Foo2#>%#Foo2#world' end it 'should split left/right sections' call s:builder.split() let stl = s:builder.build() Expect stl =~ '%=' end it 'after split, sections use the right separator' call s:builder.split() call s:builder.add_section('Normal', 'hello') call s:builder.add_section('Search', 'world') let stl = s:builder.build() Expect stl =~ 'hello%#Normal_to_Search#<%#Search#world' end it 'should not repeat the same highlight group' call s:builder.add_section('Normal', 'hello') call s:builder.add_section('Normal', 'hello') let stl = s:builder.build() Expect stl == '%#Normal#hello>hello' end it 'should replace accent groups with the specified group' call s:builder.add_section('Normal', '%#__accent_foo#hello') let stl = s:builder.build() Expect stl == '%#Normal#%#Normal_foo#hello' end it 'should replace two accent groups with correct groups' call s:builder.add_section('Normal', '%#__accent_foo#hello%#__accent_bar#world') let stl = s:builder.build() Expect stl =~ '%#Normal_foo#hello%#Normal_bar#world' end it 'should special restore group should go back to previous group' call s:builder.add_section('Normal', '%#__restore__#') let stl = s:builder.build() Expect stl !~ '%#__restore__#' Expect stl =~ '%#Normal#' end it 'should blend colors from the left through the split to the right' call s:builder.add_section('Normal', 'hello') call s:builder.split() call s:builder.add_section('Search', 'world') let stl = s:builder.build() Expect stl =~ 'Normal_to_Search' end end describe 'inactive builder' before let s:builder = airline#builder#new({'active': 0}) end it 'should transition colors from one to the next' call s:builder.add_section('Normal', 'hello') call s:builder.add_section('Search', 'world') let stl = s:builder.build() Expect stl =~ '%#Normal_inactive#hello%#Normal_to_Search_inactive#>%#Search_inactive#world' end it 'should not render accents' call s:builder.add_section('Normal', '%#__accent_foo#hello%#foo#foo%#__accent_bar#world') let stl = s:builder.build() Expect stl == '%#Normal_inactive#hello%#foo_inactive#fooworld' end end vim-airline-0.8/t/commands.vim000066400000000000000000000016511267015252500163660ustar00rootroot00000000000000source plugin/airline.vim doautocmd VimEnter describe 'commands' it 'should toggle off and on' execute 'AirlineToggle' Expect exists('#airline') to_be_false execute 'AirlineToggle' Expect exists('#airline') to_be_true end it 'should toggle whitespace off and on' call airline#extensions#load() execute 'AirlineToggleWhitespace' Expect exists('#airline_whitespace') to_be_false execute 'AirlineToggleWhitespace' Expect exists('#airline_whitespace') to_be_true end it 'should display theme name with no args' execute 'AirlineTheme simple' Expect g:airline_theme == 'simple' execute 'AirlineTheme dark' Expect g:airline_theme == 'dark' execute 'AirlineTheme doesnotexist' Expect g:airline_theme == 'dark' colors molokai Expect g:airline_theme == 'molokai' end it 'should have a refresh command' Expect exists(':AirlineRefresh') to_be_true end end vim-airline-0.8/t/extensions_default.vim000066400000000000000000000014561267015252500204730ustar00rootroot00000000000000let g:airline#extensions#default#layout = [ \ [ 'c', 'a', 'b', 'warning' ], \ [ 'x', 'z', 'y' ] \ ] source plugin/airline.vim doautocmd VimEnter describe 'default' before let s:builder = airline#builder#new({'active': 1}) end it 'should use the layout' call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 }) let stl = s:builder.build() Expect stl =~ 'airline_c_to_airline_a' Expect stl =~ 'airline_a_to_airline_b' Expect stl =~ 'airline_b_to_airline_warning' Expect stl =~ 'airline_x_to_airline_z' Expect stl =~ 'airline_z_to_airline_y' end it 'should only render warning section in active splits' wincmd s Expect airline#statusline(1) =~ 'warning' Expect airline#statusline(2) !~ 'warning' wincmd c end end vim-airline-0.8/t/highlighter.vim000066400000000000000000000013021267015252500170540ustar00rootroot00000000000000let g:airline_theme = 'dark' describe 'highlighter' it 'should create separator highlight groups' hi Foo1 ctermfg=1 ctermbg=2 hi Foo2 ctermfg=3 ctermbg=4 call airline#highlighter#add_separator('Foo1', 'Foo2', 0) let hl = airline#highlighter#get_highlight('Foo1_to_Foo2') Expect hl == [ '', '', '4', '2', '' ] end it 'should populate accent colors' Expect exists('g:airline#themes#dark#palette.normal.airline_c_red') to_be_false Expect hlID('airline_c_red') == 0 call airline#themes#patch(g:airline#themes#dark#palette) call airline#highlighter#add_accent('red') call airline#highlighter#highlight(['normal']) Expect hlID('airline_c_red') != 0 end end vim-airline-0.8/t/init.vim000066400000000000000000000037471267015252500155400ustar00rootroot00000000000000let s:sections = ['a', 'b', 'c', 'gutter', 'x', 'y', 'z', 'warning'] function! s:clear() for key in s:sections unlet! g:airline_section_{key} endfor endfunction call airline#init#bootstrap() describe 'init sections' before call s:clear() call airline#init#sections() end after call s:clear() end it 'section a should have mode, paste, iminsert' Expect g:airline_section_a =~ 'mode' Expect g:airline_section_a =~ 'paste' Expect g:airline_section_a =~ 'iminsert' end it 'section b should be blank because no extensions are installed' Expect g:airline_section_b == '' end it 'section c should be file' Expect g:airline_section_c == '%<%f%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#' end it 'section x should be filetype' Expect g:airline_section_x == '%{airline#util#wrap(airline#parts#filetype(),0)}' end it 'section y should be fenc and ff' Expect g:airline_section_y =~ 'ff' Expect g:airline_section_y =~ 'fenc' end it 'section z should be line numbers' Expect g:airline_section_z =~ '%3p%%' Expect g:airline_section_z =~ '%4l' Expect g:airline_section_z =~ '%3v' end it 'should not redefine sections already defined' for s in s:sections let g:airline_section_{s} = s endfor call airline#init#bootstrap() for s in s:sections Expect g:airline_section_{s} == s endfor end it 'all default statusline extensions should be blank' Expect airline#parts#get('hunks').raw == '' Expect airline#parts#get('branch').raw == '' Expect airline#parts#get('tagbar').raw == '' Expect airline#parts#get('syntastic').raw == '' Expect airline#parts#get('eclim').raw == '' Expect airline#parts#get('whitespace').raw == '' end end describe 'init parts' it 'should not redefine parts already defined' call airline#parts#define_raw('linenr', 'bar') call airline#init#sections() Expect g:airline_section_z =~ 'bar' end end vim-airline-0.8/t/parts.vim000066400000000000000000000021331267015252500157120ustar00rootroot00000000000000describe 'parts' it 'overwrites existing values' call airline#parts#define('foo', { 'test': '123' }) Expect airline#parts#get('foo').test == '123' call airline#parts#define('foo', { 'test': '321' }) Expect airline#parts#get('foo').test == '321' end it 'can define a function part' call airline#parts#define_function('func', 'bar') Expect airline#parts#get('func').function == 'bar' end it 'can define a text part' call airline#parts#define_text('text', 'bar') Expect airline#parts#get('text').text == 'bar' end it 'can define a raw part' call airline#parts#define_raw('raw', 'bar') Expect airline#parts#get('raw').raw == 'bar' end it 'can define a minwidth' call airline#parts#define_minwidth('mw', 123) Expect airline#parts#get('mw').minwidth == 123 end it 'can define a condition' call airline#parts#define_condition('part', '1') Expect airline#parts#get('part').condition == '1' end it 'can define a accent' call airline#parts#define_accent('part', 'red') Expect airline#parts#get('part').accent == 'red' end end vim-airline-0.8/t/section.vim000066400000000000000000000052021267015252500162250ustar00rootroot00000000000000function! SectionSpec() endfunction describe 'section' before call airline#parts#define_text('text', 'text') call airline#parts#define_raw('raw', 'raw') call airline#parts#define_function('func', 'SectionSpec') end it 'should be able to reference default parts' let s = airline#section#create(['paste']) Expect s == '%{airline#util#wrap(airline#parts#paste(),0)}' end it 'should create sections with no separators' let s = airline#section#create(['text', 'raw', 'func']) Expect s == '%{airline#util#wrap("text",0)}raw%{airline#util#wrap(SectionSpec(),0)}' end it 'should create left sections with separators' let s = airline#section#create_left(['text', 'text']) Expect s == '%{airline#util#wrap("text",0)}%{airline#util#append("text",0)}' end it 'should create right sections with separators' let s = airline#section#create_right(['text', 'text']) Expect s == '%{airline#util#prepend("text",0)}%{airline#util#wrap("text",0)}' end it 'should prefix with accent group if provided and restore afterwards' call airline#parts#define('hi', { \ 'raw': 'hello', \ 'accent': 'red', \ }) let s = airline#section#create(['hi']) Expect s == '%#__accent_red#hello%#__restore__#' end it 'should accent functions' call airline#parts#define_function('hi', 'Hello') call airline#parts#define_accent('hi', 'bold') let s = airline#section#create(['hi']) Expect s == '%#__accent_bold#%{airline#util#wrap(Hello(),0)}%#__restore__#' end it 'should parse out a section from the distro' call airline#extensions#load() let s = airline#section#create(['whitespace']) Expect s =~ 'airline#extensions#whitespace#check' end it 'should use parts as is if they are not found' let s = airline#section#create(['asdf', 'func']) Expect s == 'asdf%{airline#util#wrap(SectionSpec(),0)}' end it 'should force add separators for raw and missing keys' let s = airline#section#create_left(['asdf', 'raw']) Expect s == 'asdf > raw' let s = airline#section#create_left(['asdf', 'aaaa', 'raw']) Expect s == 'asdf > aaaa > raw' let s = airline#section#create_right(['raw', '%f']) Expect s == 'raw < %f' let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}']) Expect s == '%t < asdf < %{getcwd()}' end it 'should empty out parts that do not pass their condition' call airline#parts#define_text('conditional', 'conditional') call airline#parts#define_condition('conditional', '0') let s = airline#section#create(['conditional']) Expect s == '%{0 ? airline#util#wrap("conditional",0) : ""}' end end vim-airline-0.8/t/themes.vim000066400000000000000000000037311267015252500160530ustar00rootroot00000000000000describe 'themes' after highlight clear Foo highlight clear Normal end it 'should extract correct colors' highlight Foo ctermfg=1 ctermbg=2 let colors = airline#themes#get_highlight('Foo') Expect colors[2] == '1' Expect colors[3] == '2' end it 'should extract from normal if colors unavailable' highlight Normal ctermfg=100 ctermbg=200 highlight Foo ctermbg=2 let colors = airline#themes#get_highlight('Foo') Expect colors[2] == '100' Expect colors[3] == '2' end it 'should flip target group if it is reversed' highlight Foo ctermbg=222 ctermfg=103 term=reverse let colors = airline#themes#get_highlight('Foo') Expect colors[2] == '222' Expect colors[3] == '103' end it 'should pass args through correctly' let hl = airline#themes#get_highlight('Foo', 'bold', 'italic') Expect hl == ['', '', 'NONE', 'NONE', 'bold,italic'] let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold') Expect hl == ['', '', 'NONE', 'NONE', 'italic,bold'] end it 'should generate color map with mirroring' let map = airline#themes#generate_color_map( \ [ 1, 1, 1, 1, '1' ], \ [ 2, 2, 2, 2, '2' ], \ [ 3, 3, 3, 3, '3' ], \ ) Expect map.airline_a[0] == 1 Expect map.airline_b[0] == 2 Expect map.airline_c[0] == 3 Expect map.airline_x[0] == 3 Expect map.airline_y[0] == 2 Expect map.airline_z[0] == 1 end it 'should generate color map with full set of colors' let map = airline#themes#generate_color_map( \ [ 1, 1, 1, 1, '1' ], \ [ 2, 2, 2, 2, '2' ], \ [ 3, 3, 3, 3, '3' ], \ [ 4, 4, 4, 4, '4' ], \ [ 5, 5, 5, 5, '5' ], \ [ 6, 6, 6, 6, '6' ], \ ) Expect map.airline_a[0] == 1 Expect map.airline_b[0] == 2 Expect map.airline_c[0] == 3 Expect map.airline_x[0] == 4 Expect map.airline_y[0] == 5 Expect map.airline_z[0] == 6 end end vim-airline-0.8/t/util.vim000066400000000000000000000025451267015252500155450ustar00rootroot00000000000000call airline#init#bootstrap() function! Util1() let g:count += 1 endfunction function! Util2() let g:count += 2 endfunction function! Util3(...) let g:count = a:0 endfunction describe 'util' before let g:count = 0 end it 'has append wrapper function' Expect airline#util#append('', 0) == '' Expect airline#util#append('1', 0) == ' > 1' end it 'has prepend wrapper function' Expect airline#util#prepend('', 0) == '' Expect airline#util#prepend('1', 0) == '1 < ' end it 'has getwinvar function' Expect airline#util#getwinvar(1, 'asdf', '123') == '123' call setwinvar(1, 'vspec', 'is cool') Expect airline#util#getwinvar(1, 'vspec', '') == 'is cool' end it 'has exec funcrefs helper functions' call airline#util#exec_funcrefs([function('Util1'), function('Util2')]) Expect g:count == 3 call airline#util#exec_funcrefs([function('Util3')], 1, 2, 3, 4) Expect g:count == 4 end it 'should ignore minwidth if less than 0' Expect airline#util#append('foo', -1) == ' > foo' Expect airline#util#prepend('foo', -1) == 'foo < ' Expect airline#util#wrap('foo', -1) == 'foo' end it 'should return empty if winwidth() > minwidth' Expect airline#util#append('foo', 99999) == '' Expect airline#util#prepend('foo', 99999) == '' Expect airline#util#wrap('foo', 99999) == '' end end