104 Commits
v0.2 ... v0.3

Author SHA1 Message Date
Bailey Ling
d20bdc54e5 Merge pull request #132 from monstermunchkin/master
update tagbar extension
2013-08-12 08:20:04 -07:00
Thomas Hipp
222adbfeaa update tagbar extension
Allow the tagbar extension to be disabled.
2013-08-12 17:03:15 +02:00
Bailey Ling
7524110de9 fix possible undefined variable 2013-08-12 01:40:18 +00:00
Bailey Ling
8d4eb3c574 improve vimshell integration; support interactive modes 2013-08-12 01:15:28 +00:00
Bailey Ling
c7cc63fb62 remove support for inactive modified
statuslines don't actually get evaluated in inactive splits, so this feature never worked properly anyways.
2013-08-11 16:13:04 -04:00
Bailey Ling
14dacaab68 improve bufferline integration; revert to default in inactive splits. 2013-08-11 19:48:14 +00:00
Bailey Ling
2413babe8b remove checks for airline_active, it is always true 2013-08-11 15:24:08 +00:00
Bailey Ling
11e7e67d8d introduce g:airline_inactive_collapse. resolves #129. 2013-08-11 14:30:02 +00:00
Bailey Ling
2a10bfc32f make the mode and branch text window local 2013-08-11 13:42:47 +00:00
Bailey Ling
5d92aaecaa update documentation 2013-08-10 23:22:49 +00:00
Bailey Ling
384150ecd7 extract iminsert out of core into an extension 2013-08-10 17:02:48 -04:00
Bailey Ling
52a4a8ea7b use hack fix for now. resolves #105. 2013-08-10 16:47:17 -04:00
Bailey Ling
3dc55eda4e enable tagbar only for active windows 2013-08-10 16:43:27 +00:00
bling
e1ff1edcf0 Merge branch '127'
Resolves #127.

Conflicts:
	autoload/airline.vim
2013-08-10 12:15:14 -04:00
Bailey Ling
61a39a99ac add ability to override left/right sides independently 2013-08-10 16:05:49 +00:00
Bailey Ling
8539ac46a6 allow extensions to reload when color scheme changes. resolves #128 2013-08-10 15:50:27 +00:00
bling
cf9028df9f fixes error when colorscheme declared in gvimrc. resolves #126. 2013-08-10 11:46:12 -04:00
Bailey Ling
e67fa32fd9 extract matching background colors for file indicator 2013-08-10 13:43:12 +00:00
Bailey Ling
1d46c5874b fix warning separator colors out of sync between modes 2013-08-10 13:17:32 +00:00
Bailey Ling
2ca403053c fix whitespace indent setting changed incorrectly when toggling 2013-08-10 13:09:52 +00:00
Bailey Ling
52b4100a4f reload separator color when colorscheme changes 2013-08-09 20:50:53 -04:00
Bailey Ling
320f50c6f9 extract a line number for mixed indents 2013-08-09 20:23:03 -04:00
Bailey Ling
44db0e0c70 fix newb mistake. resolves #125. 2013-08-09 20:52:18 +00:00
Bailey Ling
aabb061470 temp disable 2013-08-09 20:43:12 +00:00
Bailey Ling
35539b2667 customizable empty branch message. closes #121. 2013-08-09 20:12:56 +00:00
Bailey Ling
2ba7ce02ec add powerline separator for warning section 2013-08-09 20:08:57 +00:00
Bailey Ling
f8b2b7be23 add support for select mode. resolves #123. 2013-08-09 08:05:08 -04:00
Bailey Ling
4485b03e51 add whitespace toggle command 2013-08-08 14:42:27 +00:00
Bailey Ling
57955b3b86 add the most common problems into the documentation (#112). 2013-08-08 00:23:43 -04:00
Bailey Ling
7eaf6281fb fix mode separator colors for ubaryd and laederon 2013-08-08 00:10:08 -04:00
Bailey Ling
edcf79c509 add bitdeli badge 2013-08-07 16:38:50 -04:00
Bailey Ling
f440ad3509 exclude readonly files from whitespace checking 2013-08-06 22:29:03 -04:00
Bailey Ling
6ced8b8ce6 add line number for trailing spaces 2013-08-06 22:02:53 -04:00
Bailey Ling
0a015e5305 use autocmds to detect whitespace, shouldn't need max anymore 2013-08-06 21:48:00 -04:00
Bailey Ling
d2c069b971 make syntastic use the warning section 2013-08-06 21:42:32 -04:00
Bailey Ling
7fb9bcf2c9 improve whitespace detection; add support for mixed indents 2013-08-07 00:48:53 +00:00
Bailey Ling
f86eafb674 reorder so that statusline funcrefs get an up to date active flag 2013-08-07 00:47:31 +00:00
Bailey Ling
528f56472c introduce new warning section, and refactor whitespace into an extension which uses it 2013-08-07 00:17:33 +00:00
Bailey Ling
4d67c802b3 Merge pull request #120 from farseer90718/master
add white space detection
2013-08-06 16:35:24 -07:00
Bailey Ling
26c7c9fca2 move default ctrlp theme to dark. autogenerate for everything else if not already defined. 2013-08-06 23:29:06 +00:00
Bailey Ling
42260bc35f can't forget about solarized 2013-08-06 21:53:14 +00:00
Bailey Ling
ae587c3dcb add ctrlp support for most themes 2013-08-06 20:52:52 +00:00
Bailey Ling
772fbc18e7 indent 2013-08-06 19:23:07 +00:00
farseer90718
164aa6f73c add white space detection 2013-08-07 00:17:57 +08:00
Bailey Ling
df72012e41 fix commandt integration 2013-08-06 15:41:37 +00:00
Bailey Ling
c1e74d72e0 Merge branch 'ext'
Conflicts:
	autoload/airline/extensions.vim
2013-08-06 15:26:32 +00:00
Bailey Ling
40614ef66b Merge pull request #118 from cg433n/master
Reload the solarized airline theme on the Colorscheme event.
2013-08-06 08:17:47 -07:00
Christopher.Green
e0f5bcc06a Reload the solarized airline theme on the Colorscheme event. 2013-08-06 07:25:21 -07:00
Bailey Ling
835f718cb6 reload colors when tomorrow theme changes 2013-08-06 08:31:45 -04:00
Bailey Ling
729f9e8354 use tagbar provided statusline func 2013-08-06 08:12:03 -04:00
Bailey Ling
e858eaa990 fix branch detection 2013-08-06 00:42:59 -04:00
Bailey Ling
990e3fc949 make branch/bufferline default statusline rather than overrides 2013-08-06 00:35:07 -04:00
Bailey Ling
8677fa875b minor optimization 2013-08-06 03:57:02 +00:00
Bailey Ling
ac211a58eb extract all plugin related functionality out of the core 2013-08-06 03:34:45 +00:00
Bailey Ling
98f3d13705 do not overwrite when left only 2013-08-06 03:33:25 +00:00
Bailey Ling
48f0e3652c extract tagbar 2013-08-06 03:16:49 +00:00
Bailey Ling
9c960875fe extract fugitive/lawrencium 2013-08-06 03:07:01 +00:00
Bailey Ling
11fd24b3ef extract syntastic 2013-08-06 02:57:06 +00:00
Bailey Ling
f15ac2146f make bufferline almost entirely self contained 2013-08-06 02:44:34 +00:00
Bailey Ling
41325bd08c extract bufferline into its own file 2013-08-06 00:29:30 +00:00
Bailey Ling
0758e2a88c fix regression, allow statusline funcrefs to execute 2013-08-05 20:31:10 +00:00
Bailey Ling
238ab44489 invoke funcrefs a different way, resolves #115. 2013-08-05 20:16:52 +00:00
Bailey Ling
4ae9484075 Merge pull request #116 from LeszekSwirski/empty-color-fix
Make themes#generate_color_map robust against undefined highlights
2013-08-05 11:03:48 -07:00
Leszek Swirski
216bcf1088 Make themes#generate_color_map robust against undefined highlights 2013-08-05 18:44:12 +01:00
Bailey Ling
61c95d4103 update readme, link to popular colorschemes 2013-08-04 20:06:24 +00:00
Bailey Ling
e84aed79a6 use directory group instead of spell to support gui colors 2013-08-04 19:51:41 +00:00
Bailey Ling
cf3473a8a3 pick highlight groups that are also compatible with the light variant 2013-08-04 19:44:57 +00:00
Bailey Ling
99179d806b tweak tomorrow colors, covers all dark themes pretty well. resolves #67 and #113. 2013-08-04 19:37:30 +00:00
Bailey Ling
a5fe4d9972 extract colors from normal if undefined (#67, #113). 2013-08-04 19:10:44 +00:00
Bailey Ling
2bedd8ef84 first pass at tomorrow themes (#67, #113) 2013-08-04 16:18:47 +00:00
Bailey Ling
d1d65dd41a add modified colors to jellybeans 2013-08-04 16:18:47 +00:00
Bailey Ling
b25dacef44 Merge pull request #114 from p-m-p/master
Add bubblegum theme
2013-08-04 06:54:36 -07:00
Phil Parsons
533a610aa0 Add bubblegum theme 2013-08-04 11:54:46 +01:00
Bailey Ling
926be0bd8a collapse section when it is empty text (#70). 2013-08-04 01:37:34 +00:00
Bailey Ling
e4d5f4cfb1 add jellybeans theme using new highlight group methods 2013-08-04 01:28:20 +00:00
Bailey Ling
9f04ef3170 fix ctrlp statusline getting overwritten via cursormove 2013-08-03 23:44:50 +00:00
Bailey Ling
10fa73996b loop differently so it works in 7.2 2013-08-03 20:56:37 +00:00
Bailey Ling
406fb2164d swap features and rationale in readme 2013-08-03 20:55:58 +00:00
Bailey Ling
e446f6a2fb fix placement of readonly, add support for startify 2013-08-03 16:06:29 +00:00
Bailey Ling
41a739d602 move syntastic implementation out of core 2013-08-03 11:23:45 -04:00
Bailey Ling
94895de8e2 rename window_override_funcrefs to statusline_funcrefs 2013-08-03 11:14:02 -04:00
Bailey Ling
257a9f2ed9 move updating external values into extensions 2013-08-03 10:59:34 -04:00
Bailey Ling
c655bdc233 move helper functions into update statusline, they're not used anywhere else 2013-08-03 10:58:25 -04:00
Bailey Ling
1d07110af3 Merge pull request #111 from bootleq/blank-section
Do not render spare spaces for empty sections.
2013-08-02 20:48:24 -07:00
bootleq
410792ed48 Remove space-padding works outside of get_section. 2013-08-03 10:09:55 +08:00
bootleq
5ebb0daf93 Add prefix/suffix options for s:get_section.
For output format other than default 1 space padding.
Need this to keep original section_c style:

    let sl.=l:status_color.' %<'.s:get_section(a:winnr, 'c').' '
2013-08-03 10:09:55 +08:00
bootleq
dcb7196097 Add padding spaces for section in s:get_section.
When section text is non-empty, pad spaces before/after it.
2013-08-03 10:09:49 +08:00
Bailey Ling
5099fbf1b9 move tagbar definition into predefined section 2013-08-03 00:51:24 +00:00
Bailey Ling
9844f14f66 change license to MIT 2013-08-02 19:43:24 +00:00
Bailey Ling
39e0df4b2d fix typo of typo fix 2013-08-02 17:59:52 +00:00
Bailey Ling
d833ae041d fix typos in readme 2013-08-02 08:21:47 -04:00
Bailey Ling
72852fa665 update readme. resolves #109. 2013-08-02 08:11:53 -04:00
Bailey Ling
577e50d788 first class integration with tagbar 2013-07-31 20:07:14 +00:00
Bailey Ling
6df46d8d22 ensure global variables are always there (#108). 2013-07-31 19:37:35 +00:00
Bailey Ling
d107c4fd5d account for plugins which use eventignore. resolves #82. 2013-07-31 17:37:00 +00:00
Bailey Ling
d56b9bbfcd modify active window algorithm, resolves #106. 2013-07-31 14:31:51 +00:00
Bailey Ling
8f52831cc0 Merge pull request #103 from PhoSor/master
add ctrlp theme for molokai
2013-07-29 05:09:54 -07:00
Andrey Sorokin
72c43838d9 add ctrlp theme for molokai 2013-07-29 17:49:06 +06:00
Bailey Ling
e4558340b0 keep left override styles intact when inactive; use powerline separator for iminsert 2013-07-28 19:25:48 -04:00
Bailey Ling
86ff404748 Merge pull request #101 from PhoSor/master
add molokai theme
2013-07-28 06:12:40 -07:00
Andrey Sorokin
96a9ef87ef add molokai theme 2013-07-28 17:12:45 +06:00
Bailey Ling
240feae0f2 Merge pull request #100 from markstory/solarized-light
Solarized light
2013-07-27 21:08:41 -07:00
Mark Story
200b54bb93 Improve coloring on branch bar & encoding segments.
Make the colors for these segments match the general look and feel of
solarized light.
2013-07-27 23:16:18 -04:00
Mark Story
dadcb3e2c3 Fix typo in blue hex code. 2013-07-27 23:05:24 -04:00
28 changed files with 1052 additions and 417 deletions

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (C) 2013 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.

100
README.md
View File

@@ -4,22 +4,27 @@ Lean &amp; mean statusline for vim that's light as air.
![img](https://github.com/bling/vim-airline/wiki/screenshots/demo.gif)
# Features
* tiny core (under 200 lines), 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], [syntastic][5] and [lawrencium][21].
* 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.
* extensive suite of themes for popular colorschemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [molokai][25], [jellybeans][26] and others; have a look at the [screenshots][14] in the wiki.
* supports 7.2 as the minimum Vim version
# Rationale
There's already [powerline][b], why yet another statusline?
There's already [powerline][2], why yet another statusline?
* 100% vimscript; no python needed.
* small. i want the core plugin to be *less than 200 lines* as a rule (specifically adhering to the [open/closed principle][h]).
* integrates with a variety of plugins: [vim-bufferline][f], [fugitive][d], [unite][i], [ctrlp][j], [minibufexpl][o], [gundo][p], [undotree][q], [nerdtree][r], [tagbar][s], [syntastic][e] and [lawrencium][u].
* looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
* fast to load, taking roughly 1ms. by comparison, powerline needs 60ms on the same machine.
* fully customizable; if you know a little `statusline` syntax you can tweak it to your needs.
* trivial to write colorschemes; for a minimal theme you need to edit 9 lines of colors (please send pull requests).
What about [old powerline][a]?
What about [vim-powerline][1]?
* the old version still works well, but since it's deprecated new features won't get added.
* it uses different font codes, which makes it incompatible with other powerline bindings in the same terminal (e.g. bash, zsh, tmux, etc.).
* the author has been active developing powerline, which was rewritten in python and expands its capabilities to tools outside of Vim, such as bash, zsh, and tmux.
* vim-powerline has been deprecated as a result, and no features will be added to it.
* vim-powerline uses different font codes, so if you want to use it with a powerline themed tmux (for example), it will not work.
# Where did the name come from?
@@ -29,13 +34,13 @@ I wrote the initial version on an airplane, and since it's light as air it turne
This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers:
* [Pathogen][k]
* [Pathogen][11]
* `git clone https://github.com/bling/vim-airline ~/.vim/bundle/vim-airline`
* [NeoBundle][l]
* [NeoBundle][12]
* `NeoBundle 'bling/vim-airline'`
* [Vundle][m]
* [Vundle][13]
* `Bundle 'bling/vim-airline'`
* [VAM][v]
* [VAM][22]
* `call vam#ActivateAddons([ 'vim-airline' ])`
* manual
* copy all of the files into your `~/.vim` directory
@@ -46,25 +51,25 @@ This plugin follows the standard runtime path structure, and as such it can be i
# 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][t]. Prepatched fonts can be found in the [powerline-fonts][c] repository.
For the nice looking powerline symbols to appear, you will need to install a patched font. Instructions can be found in the official powerline [documentation][20]. Prepatched fonts can be found in the [powerline-fonts][3] repository.
Finally, enable them in vim-airline by adding `let g:airline_powerline_fonts = 1` to your vimrc.
# FAQ
Solutions to common problems can be found in the [Wiki](https://github.com/bling/vim-airline/wiki/FAQ).
Solutions to common problems can be found in the [Wiki][27].
# Themes/Screenshots
A full list of screenshots can be found in the [Wiki][n].
A full list of screenshots can be found in the [Wiki][14].
# 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][g] repository to rule out any configuration conflicts.
* include your version of vim, including patches, and operating system (`:version` will contain this information).
* reproduce it with this [minivimrc][7] repository to rule out any configuration conflicts.
* a link to your vimrc or a gist which shows how you configured the plugin(s).
* and so I can reproduce; your `:version` of vim, and the commit of vim-airline you're using.
# Contributions
@@ -72,33 +77,40 @@ Contributions and pull requests are welcome. Please take note of the following
* 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.
* this plugin got a lot more popular than i initially expected, if you make changes to the core, please test on as many versions of vim as possible.
* if you submit a theme, please create a screenshot so it can be added to the [Wiki][n].
* any changes to the core should be tested against Vim 7.2.
* if you submit a theme, please create a screenshot so it can be added to the [Wiki][14].
# License
Distributed under the same terms as the Vim license. See `:help license`.
MIT license. Copyright (c) 2013 Bailey Ling.
[a]: https://github.com/Lokaltog/vim-powerline
[b]: https://github.com/Lokaltog/powerline
[c]: https://github.com/Lokaltog/powerline-fonts
[d]: https://github.com/tpope/vim-fugitive
[e]: https://github.com/scrooloose/syntastic
[f]: https://github.com/bling/vim-bufferline
[g]: https://github.com/bling/minivimrc
[h]: http://en.wikipedia.org/wiki/Open/closed_principle
[i]: https://github.com/Shougo/unite.vim
[j]: https://github.com/kien/ctrlp.vim
[k]: https://github.com/tpope/vim-pathogen
[l]: https://github.com/Shougo/neobundle.vim
[m]: https://github.com/gmarik/vundle
[n]: https://github.com/bling/vim-airline/wiki/Screenshots
[o]: https://github.com/techlivezheng/vim-plugin-minibufexpl
[p]: https://github.com/sjl/gundo.vim
[q]: https://github.com/mbbill/undotree
[r]: https://github.com/scrooloose/nerdtree
[s]: https://github.com/majutsushi/tagbar
[t]: https://powerline.readthedocs.org/en/latest/fontpatching.html
[u]: https://bitbucket.org/ludovicchabant/vim-lawrencium
[v]: https://github.com/MarcWeber/vim-addon-manager
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/bling/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/kien/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/bling/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/latest/fontpatching.html
[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/bling/vim-airline/wiki/FAQ

View File

@@ -1,6 +1,8 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running')
let s:sections = ['a','b','c','gutter','x','y','z']
let s:sections = ['a','b','c','gutter','x','y','z','warning']
let s:airline_highlight_map = {
\ 'mode' : 'Al2',
@@ -22,18 +24,23 @@ function! airline#exec_highlight(group, colors)
\ colors[1] != '' ? 'guibg='.colors[1] : '',
\ colors[2] != '' ? 'ctermfg='.colors[2] : '',
\ colors[3] != '' ? 'ctermbg='.colors[3] : '',
\ colors[4] != '' ? 'gui='.colors[4] : '',
\ colors[4] != '' ? 'cterm='.colors[4] : '',
\ colors[4] != '' ? 'term='.colors[4] : '')
\ len(colors) > 4 && colors[4] != '' ? 'gui='.colors[4] : '',
\ len(colors) > 4 && colors[4] != '' ? 'cterm='.colors[4] : '',
\ len(colors) > 4 && colors[4] != '' ? 'term='.colors[4] : '')
endfunction
function! airline#reload_highlight()
call airline#highlight(['inactive'])
call airline#highlight(['normal'])
call airline#extensions#load_theme()
endfunction
function! airline#load_theme(name)
let g:airline_theme = a:name
let inactive_colors = g:airline#themes#{g:airline_theme}#inactive "also lazy loads the theme
let w:airline_lastmode = ''
call airline#highlight(['inactive'])
call airline#reload_highlight()
call airline#update_highlight()
call airline#extensions#load_theme()
endfunction
function! airline#highlight(modes)
@@ -48,55 +55,22 @@ function! airline#highlight(modes)
endfor
endif
endfor
call airline#themes#exec_highlight_separator('Al2', 'warningmsg')
endfunction
function! s:is_excluded_window()
for Fn in g:airline_exclude_funcrefs
if Fn()
return 1
endif
endfor
return 0
" for 7.2 compatibility
function! s:getwinvar(winnr, key, ...)
let winvals = getwinvar(a:winnr, '')
return get(winvals, a:key, (a:0 ? a:1 : ''))
endfunction
function! s:apply_window_overrides()
unlet! w:airline_left_only
for section in s:sections
unlet! w:airline_section_{section}
endfor
for Fn in g:airline_window_override_funcrefs
call Fn()
endfor
function! s:get_section(winnr, key, ...)
let text = s:getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key})
let [prefix, suffix] = [get(a:000, 0, '%( '), get(a:000, 1, ' %)')]
return empty(text) ? '' : prefix.text.suffix
endfunction
function! airline#update_externals()
let g:airline_externals_bufferline = g:airline_enable_bufferline && exists('*bufferline#get_status_string')
\ ? '%{bufferline#refresh_status()}'.bufferline#get_status_string()
\ : "%f%m"
let g:airline_externals_syntastic = g:airline_enable_syntastic && exists('*SyntasticStatuslineFlag') ? '%{SyntasticStatuslineFlag()}' : ''
let g:airline_externals_branch = g:airline_enable_branch
\ ? (exists('*fugitive#head') && strlen(fugitive#head()) > 0
\ ? g:airline_branch_prefix.fugitive#head()
\ : exists('*lawrencium#statusline') && strlen(lawrencium#statusline()) > 0
\ ? g:airline_branch_prefix.lawrencium#statusline()
\ : '')
\ : ''
endfunction
function! s:get_section(key)
return exists('w:airline_section_{a:key}') ? w:airline_section_{a:key} : g:airline_section_{a:key}
endfunction
function! airline#update_statusline(active)
let w:airline_active = a:active
if s:is_excluded_window()
call setwinvar(winnr(), '&statusline', '')
return
endif
call airline#update_externals()
call s:apply_window_overrides()
function! airline#get_statusline(winnr, active)
let l:mode_color = a:active ? "%#Al2#" : "%#Al2_inactive#"
let l:mode_sep_color = a:active ? "%#Al3#" : "%#Al3_inactive#"
let l:info_color = a:active ? "%#Al4#" : "%#Al4_inactive#"
@@ -105,38 +79,81 @@ function! airline#update_statusline(active)
let l:file_flag_color = a:active ? "%#Al7#" : "%#Al7_inactive#"
let sl = '%{airline#update_highlight()}'
if a:active
let sl.=l:mode_color.' '.s:get_section('a').' '
if s:getwinvar(a:winnr, 'airline_render_left', a:active || (!a:active && !g:airline_inactive_collapse))
let sl.=l:mode_color.s:get_section(a:winnr, 'a')
let sl.='%{g:airline_detect_paste && &paste ? g:airline_paste_symbol." " : ""}'
let sl.=l:mode_sep_color
let sl.=a:active ? g:airline_left_sep : g:airline_left_alt_sep
let sl.=l:info_color
let sl.=' '.s:get_section('b').' '
let sl.=s:get_section(a:winnr, 'b')
let sl.=l:info_sep_color
let sl.=g:airline_left_sep
let sl.=l:status_color.' %<'.s:get_section('c').' '
let gutter = get(w:, 'airline_section_gutter', get(g:, 'airline_section_gutter', ''))
let sl.=gutter != ''
\ ? gutter
\ : '%#warningmsg#'.g:airline_externals_syntastic.l:file_flag_color."%{&ro ? g:airline_readonly_symbol : ''}".l:status_color
let sl.=l:status_color.'%<'.s:get_section(a:winnr, 'c')
let sl.=' '.l:file_flag_color."%(%{&ro ? g:airline_readonly_symbol : ''}%)".l:status_color
let sl.=s:get_section(a:winnr, 'gutter', '', '')
let sl.=l:status_color
else
let sl.=l:status_color.' %f%m'
endif
if !exists('w:airline_left_only')
let sl.='%= '.s:get_section('x').' '
if s:getwinvar(a:winnr, 'airline_render_right', 1)
let sl.='%='
let sl.=s:get_section(a:winnr, 'x')
let sl.=l:info_sep_color
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep
let sl.=l:info_color
let sl.=' '.s:get_section('y').' '
let sl.=s:get_section(a:winnr, 'y')
let sl.=l:mode_sep_color
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep
let sl.=l:mode_color
let sl.=' '.s:get_section('z').' '
let sl.=s:get_section(a:winnr, 'z')
if a:active
let sl.='%(%#Al2_to_warningmsg#'.g:airline_right_sep
let sl.='%#warningmsg#'.s:getwinvar(a:winnr, 'airline_section_warning', '').'%)'
endif
endif
call setwinvar(winnr(), '&statusline', sl)
return sl
endfunction
function! airline#exec_funcrefs(list, break_early)
" for 7.2; we cannot iterate 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]
if a:break_early
if Fn{i}()
return 1
endif
else
call Fn{i}()
endif
endfor
return 0
endfunction
function! airline#update_statusline()
if airline#exec_funcrefs(g:airline_exclude_funcrefs, 1)
call setwinvar(winnr(), '&statusline', '')
return
endif
for nr in filter(range(1, winnr('$')), 'v:val != winnr()')
call setwinvar(nr, 'airline_active', 0)
call setwinvar(nr, '&statusline', airline#get_statusline(nr, 0))
endfor
let w:airline_active = 1
unlet! w:airline_render_left
unlet! w:airline_render_right
for section in s:sections
unlet! w:airline_section_{section}
endfor
call airline#exec_funcrefs(g:airline_statusline_funcrefs, 0)
call setwinvar(winnr(), '&statusline', airline#get_statusline(winnr(), 1))
endfunction
let g:airline_current_mode_text = ''
function! airline#update_highlight()
if get(w:, 'airline_active', 1)
let l:m = mode()
@@ -144,21 +161,15 @@ function! airline#update_highlight()
let l:mode = ['insert']
elseif l:m ==# "R"
let l:mode = ['replace']
elseif l:m ==? "v" || l:m ==# ""
elseif l:m =~# '\v(v|V||s|S|)'
let l:mode = ['visual']
else
let l:mode = ['normal']
endif
let g:airline_current_mode_text = get(g:airline_mode_map, l:m, l:m)
if g:airline_detect_iminsert && &iminsert
if exists('b:keymap_name')
let g:airline_current_mode_text .= ' ' . toupper(b:keymap_name)
else
let g:airline_current_mode_text .= ' LANG'
endif
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

View File

@@ -1,23 +1,52 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
let s:ext = {}
let s:ext._cursormove_funcrefs = []
function! s:ext.add_statusline_funcref(funcref) dict
call add(g:airline_statusline_funcrefs, a:funcref)
endfunction
function! s:ext.add_cursormove_funcref(funcref) dict
call add(self._cursormove_funcrefs, a:funcref)
endfunction
let s:filetype_overrides = {
\ 'netrw': [ 'netrw', '%f' ],
\ 'unite': [ 'Unite', '%{unite#get_status_string()}' ],
\ 'nerdtree': [ 'NERD', '' ],
\ 'undotree': [ 'undotree', '' ],
\ 'gundo': [ 'Gundo', '' ],
\ 'diff': [ 'diff', '' ],
\ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ],
\ 'minibufexpl': [ 'MiniBufExplorer', '' ],
\ 'startify': [ 'startify', '' ],
\ }
let s:filetype_regex_overrides = {}
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 = ''
let w:airline_left_only = 1
let w:airline_section_gutter = ' '
let w:airline_render_left = 1
let w:airline_render_right = 0
endfunction
function! airline#extensions#apply_window_overrides()
let s:active_winnr = -1
function! airline#extensions#update_statusline()
let s:active_winnr = winnr()
if &buftype == 'quickfix'
let w:airline_section_a = 'Quickfix'
let w:airline_section_b = ''
let w:airline_section_c = ''
let w:airline_section_x = ''
elseif &buftype == 'help'
let w:airline_section_a = 'Help'
let w:airline_section_b = '%f'
let w:airline_section_c = ''
let w:airline_section_gutter = ' '
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
@@ -26,27 +55,16 @@ function! airline#extensions#apply_window_overrides()
let w:airline_section_c = bufname(winbufnr(winnr()))
endif
if &ft == 'netrw'
call airline#extensions#apply_left_override('netrw', '%f')
elseif &ft == 'unite'
call airline#extensions#apply_left_override('Unite', '%{unite#get_status_string()}')
elseif &ft == 'nerdtree'
call airline#extensions#apply_left_override('NERD', '')
elseif &ft == 'undotree'
call airline#extensions#apply_left_override('undotree', '')
elseif &ft == 'gundo'
call airline#extensions#apply_left_override('Gundo', '')
elseif &ft == 'diff'
call airline#extensions#apply_left_override('diff', '')
elseif &ft == 'tagbar'
call airline#extensions#apply_left_override('Tagbar', '')
elseif &ft == 'vimshell'
call airline#extensions#apply_left_override('vimshell', '%{vimshell#get_status_string()}')
elseif &ft == 'vimfiler'
call airline#extensions#apply_left_override('vimfiler', '%{vimfiler#get_status_string()}')
elseif &ft == 'minibufexpl'
call airline#extensions#apply_left_override('MiniBufExplorer', '')
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! airline#extensions#is_excluded_window()
@@ -75,36 +93,68 @@ function! airline#extensions#load_theme()
endif
endfunction
function! s:sync_active_winnr()
if winnr() != s:active_winnr
if airline#exec_funcrefs(s:ext._cursormove_funcrefs, 1)
return
endif
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 <sid>sync_active_winnr()
" load core funcrefs
call add(g:airline_exclude_funcrefs, function('airline#extensions#is_excluded_window'))
call add(g:airline_statusline_funcrefs, function('airline#extensions#update_statusline'))
if get(g:, 'loaded_unite', 0)
let g:unite_force_overwrite_statusline = 0
endif
if get(g:, 'loaded_vimfiler', 0)
let g:vimfiler_force_overwrite_statusline = 0
endif
if get(g:, 'loaded_ctrlp', 0)
let g:ctrlp_status_func = {
\ 'main': 'airline#extensions#ctrlp#ctrlp_airline',
\ 'prog': 'airline#extensions#ctrlp#ctrlp_airline_status',
\ }
call airline#extensions#ctrlp#init(s:ext)
endif
if get(g:, 'command_t_loaded', 0)
call add(g:airline_window_override_funcrefs, function('airline#extensions#commandt#apply_window_override'))
call airline#extensions#commandt#init(s:ext)
endif
if g:airline_enable_bufferline && get(g:, 'loaded_bufferline', 0)
highlight AlBl_active gui=bold cterm=bold term=bold
highlight link AlBl_inactive Al6
let g:bufferline_inactive_highlight = 'AlBl_inactive'
let g:bufferline_active_highlight = 'AlBl_active'
let g:bufferline_active_buffer_left = ''
let g:bufferline_active_buffer_right = ''
let g:bufferline_separator = ' '
if g:airline_enable_tagbar && exists(':TagbarToggle')
call airline#extensions#tagbar#init(s:ext)
endif
call add(g:airline_window_override_funcrefs, function('airline#extensions#apply_window_overrides'))
call add(g:airline_exclude_funcrefs, function('airline#extensions#is_excluded_window'))
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 g:airline_enable_branch && (get(g:, 'loaded_fugitive', 0) || get(g:, 'loaded_lawrencium', 0))
call airline#extensions#branch#init(s:ext)
endif
if g:airline_enable_syntastic && get(g:, 'loaded_syntastic_plugin')
call airline#extensions#syntastic#init(s:ext)
endif
if g:airline_enable_bufferline && exists('*bufferline#get_status_string')
call airline#extensions#bufferline#init(s:ext)
endif
if g:airline_detect_whitespace
call airline#extensions#whitespace#init()
endif
if g:airline_detect_iminsert
call airline#extensions#iminsert#init()
endif
call airline#exec_funcrefs(g:airline_statusline_funcrefs, 0)
endfunction

View File

@@ -0,0 +1,15 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
function! airline#extensions#branch#apply()
let w:airline_current_branch = exists('*fugitive#head') && strlen(fugitive#head()) > 0
\ ? g:airline_branch_prefix.fugitive#head()
\ : exists('*lawrencium#statusline') && strlen(lawrencium#statusline()) > 0
\ ? g:airline_branch_prefix.lawrencium#statusline()
\ : g:airline_branch_empty_message
endfunction
function! airline#extensions#branch#init(ext)
call a:ext.add_statusline_funcref(function('airline#extensions#branch#apply'))
endfunction

View File

@@ -0,0 +1,31 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
function! airline#extensions#bufferline#apply()
" revert to default in non-active splits
for nr in filter(range(1, winnr('$')), 'v:val != winnr()')
if matchstr(getwinvar(nr, '&statusline'), '%{bufferline') != ''
call setwinvar(nr, 'airline_section_c', '%f%m')
call setwinvar(nr, '&statusline', airline#get_statusline(nr, 0))
endif
endfor
" check for other plugin overrides first
if !exists('w:airline_section_c')
let w:airline_section_c = '%{bufferline#refresh_status()}'.bufferline#get_status_string()
endif
endfunction
function! airline#extensions#bufferline#init(ext)
highlight AlBl_active gui=bold cterm=bold term=bold
highlight link AlBl_inactive Al6
let g:bufferline_inactive_highlight = 'AlBl_inactive'
let g:bufferline_active_highlight = 'AlBl_active'
let g:bufferline_active_buffer_left = ''
let g:bufferline_active_buffer_right = ''
let g:bufferline_separator = ' '
if g:airline_section_c == '%f%m'
call a:ext.add_statusline_funcref(function('airline#extensions#bufferline#apply'))
endif
endfunction

View File

@@ -1,5 +1,12 @@
function! airline#extensions#commandt#apply_window_override()
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
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_funcref(function('airline#extensions#commandt#apply'))
endfunction

View File

@@ -1,3 +1,6 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
function! airline#extensions#ctrlp#generate_color_map(dark, light, white)
return {
\ 'CtrlPdark' : a:dark,
@@ -14,19 +17,16 @@ function! airline#extensions#ctrlp#load_theme()
let theme = g:airline#themes#{g:airline_theme}#ctrlp
else
let theme = airline#extensions#ctrlp#generate_color_map(
\ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ],
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])
\ g:airline#themes#{g:airline_theme}#insert['statusline'],
\ g:airline#themes#{g:airline_theme}#insert['info'],
\ g:airline#themes#{g:airline_theme}#insert['mode'])
endif
for key in keys(theme)
call airline#exec_highlight(key, theme[key])
endfor
endfunction
" Recreate Ctrl-P status line with some slight modifications
" Arguments: focus, byfname, s:regexp, prv, item, nxt, marked
" a:1 a:2 a:3 a:4 a:5 a:6 a:7
function! airline#extensions#ctrlp#ctrlp_airline(...)
let regex = a:3 ? '%#CtrlPlight# regex %*' : ''
let prv = '%#CtrlPlight# '.a:4.' %#Ctrlparrow1#'.g:airline_left_sep
@@ -36,15 +36,24 @@ function! airline#extensions#ctrlp#ctrlp_airline(...)
let focus = '%=%<%#CtrlPdark# '.a:1.' %*'
let byfname = '%#CtrlParrow3#'.g:airline_right_alt_sep.'%#CtrlPdark# '.a:2.' %*'
let dir = '%#CtrlParrow3#'.g:airline_right_sep.'%#CtrlPlight# '.getcwd().' %*'
" Return the full statusline
return regex.prv.item.nxt.marked.focus.byfname.dir
endfunction
" Argument: len
" a:1
function! airline#extensions#ctrlp#ctrlp_airline_status(...)
let len = '%#CtrlPdark# '.a:1
let dir = '%=%<%#CtrlParrow3#'.g:airline_right_sep.'%#CtrlPlight# '.getcwd().' %*'
" Return the full statusline
return len.dir
endfunction
function! airline#extensions#ctrlp#is_statusline_overwritten()
return match(&statusline, 'CtrlPlight') >= 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_cursormove_funcref(function('airline#extensions#ctrlp#is_statusline_overwritten'))
endfunction

View File

@@ -0,0 +1,14 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
function! airline#extensions#iminsert#get_text()
if &iminsert
return toupper(get(b:, 'keymap_name', 'lang'))
endif
return ''
endfunction
function! airline#extensions#iminsert#init()
let g:airline_section_a .= ' '.g:airline_left_alt_sep.' %{airline#extensions#iminsert#get_text()}'
endfunction

View File

@@ -0,0 +1,10 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
function! airline#extensions#syntastic#apply()
let w:airline_section_warning = ' %#warningmsg#%{SyntasticStatuslineFlag()}'
endfunction
function! airline#extensions#syntastic#init(ext)
call a:ext.add_statusline_funcref(function('airline#extensions#syntastic#apply'))
endfunction

View File

@@ -0,0 +1,31 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
function! airline#extensions#tagbar#apply()
if &ft == 'tagbar'
call airline#extensions#apply_left_override('Tagbar', '%{TagbarGenerateStatusline()}')
endif
endfunction
function! s:check_statusline()
" this is a hack!! unlike most plugins that set eventignore=all, tagbar only
" sets it to BufEnter, so the ordering is off: airline sets the statusline
" first, and then tagbar overwrites it, so this detects that and changes it
" back to the airline statusline.
if match(&statusline, '^%!Tagbar') >= 0
call airline#update_statusline()
endif
endfunction
function! airline#extensions#tagbar#init(ext)
call a:ext.add_statusline_funcref(function('airline#extensions#tagbar#apply'))
let g:airline_section_x = '%(%{get(w:,"airline_active",0) ? tagbar#currenttag("%s","") : ""} '
\ .g:airline_right_alt_sep.' %)'.g:airline_section_x
augroup airline_tagbar
autocmd!
autocmd CursorMoved * call <sid>check_statusline()
augroup END
endfunction

View File

@@ -0,0 +1,64 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
let s:initialized = 0
let s:vimrc_detect_whitespace = g:airline_detect_whitespace
function! airline#extensions#whitespace#check()
if &readonly || g:airline_detect_whitespace <= 0
return ''
endif
if !exists('b:airline_whitespace_check')
let b:airline_whitespace_check = ''
let trailing = search(' $', 'nw')
let indents = [search('^ ', 'nb'), search('^ ', 'n'), search('^\t', 'nb'), search('^\t', 'n')]
let mixed = indents[0] != 0 && indents[1] != 0 && indents[2] != 0 && indents[3] != 0
if trailing != 0 || mixed
let b:airline_whitespace_check = g:airline_whitespace_symbol." "
if g:airline_detect_whitespace == 1
if trailing != 0
let b:airline_whitespace_check .= 'trailing['.trailing.'] '
endif
if mixed
let mixnr = indents[0] == indents[1] ? indents[0] : indents[2]
let b:airline_whitespace_check .= 'mixed-indent['.mixnr.'] '
endif
endif
endif
endif
return b:airline_whitespace_check
endfunction!
function! airline#extensions#whitespace#apply()
if !exists('w:airline_section_warning')
let w:airline_section_warning = ' '
endif
let w:airline_section_warning .= '%{airline#extensions#whitespace#check()}'
endfunction
function! airline#extensions#whitespace#toggle()
if g:airline_detect_whitespace > 0
autocmd! airline_whitespace CursorHold,BufWritePost
let g:airline_detect_whitespace = 0
else
call airline#extensions#whitespace#init()
let g:airline_detect_whitespace = s:vimrc_detect_whitespace
endif
endfunction
function! airline#extensions#whitespace#init()
if !s:initialized
let s:initialized = 1
call add(g:airline_statusline_funcrefs, function('airline#extensions#whitespace#apply'))
endif
augroup airline_whitespace
autocmd!
autocmd CursorHold,BufWritePost * unlet! b:airline_whitespace_check
augroup END
endfunction

View File

@@ -1,12 +1,63 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
" generates a dictionary which defines the colors for each highlight group
function! airline#themes#generate_color_map(section1, section2, section3, file)
" provide matching background colors if not provided
let file = copy(a:file)
if file[1] == '' | let file[1] = a:section3[1] | endif
if file[3] == '' | let file[3] = a:section3[3] | endif
" guifg guibg ctermfg ctermbg gui/term
return {
\ 'mode': [ a:section1[0] , a:section1[1] , a:section1[2] , a:section1[3] , get(a:section1, 4, 'bold') ] ,
\ 'mode_separator': [ a:section1[1] , a:section2[1] , a:section1[3] , a:section2[3] , '' ] ,
\ 'info': [ a:section2[0] , a:section2[1] , a:section2[2] , a:section2[3] , get(a:section2, 4, '' ) ] ,
\ 'info_separator': [ a:section2[1] , a:section3[1] , a:section2[3] , a:section3[3] , '' ] ,
\ 'statusline': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3, 4, '' ) ] ,
\ 'file': [ a:file[0] , a:file[1] , a:file[2] , a:file[3] , get(a:file , 4, '' ) ] ,
\ 'statusline': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3 , 4 , '' ) ] ,
\ 'file': [ file[0] , file[1] , file[2] , file[3] , get(file , 4 , '' ) ] ,
\ }
endfunction
function! s:get_syn(group, what)
let color = synIDattr(synIDtrans(hlID(a:group)), a:what)
if empty(color) || color == -1
let color = synIDattr(synIDtrans(hlID('Normal')), a:what)
endif
if empty(color) || color == -1
if has('gui_running')
let color = a:what ==# 'fg' ? '#000000' : '#FFFFFF'
else
let color = a:what ==# 'fg' ? 0 : 1
endif
endif
return color
endfunction
function! s:get_array(fg, bg, opts)
let fg = a:fg
let bg = a:bg
return has('gui_running')
\ ? [ fg, bg, '', '', join(a:opts, ',') ]
\ : [ '', '', fg, bg, join(a:opts, ',') ]
endfunction
function! airline#themes#get_highlight(group, ...)
let fg = s:get_syn(a:group, 'fg')
let bg = s:get_syn(a:group, 'bg')
return s:get_array(fg, bg, a:000)
endfunction
function! airline#themes#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#themes#exec_highlight_separator(from, to)
let l:from = airline#themes#get_highlight(a:from)
let l:to = airline#themes#get_highlight(a:to)
let group = a:from.'_to_'.a:to
call airline#exec_highlight(group, [ l:to[1], l:from[1], l:to[3], l:from[3] ])
return group
endfunction

View File

@@ -15,7 +15,7 @@ let s:V4 = [ '#c7915b' , 173 ] " coffee
let s:PA = [ '#f4cf86' , 222 ] " dirtyblonde
let s:RE = [ '#ff9eb8' , 211 ] " dress
let s:file = [ '#ff2c4b' , s:N3[1] , 196 , s:N3[3] , '' ]
let s:file = [ '#ff2c4b' , '' , 196 , '' , '' ]
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ]
@@ -49,5 +49,4 @@ let g:airline#themes#badwolf#visual_modified = {
let g:airline#themes#badwolf#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
let g:airline#themes#badwolf#inactive_modified = {
\ 'statusline' : [ s:V1[1] , '' , s:V1[3] , '' , '' ] }

View File

@@ -0,0 +1,61 @@
" Color palette
let s:gui_dark_gray = '#303030'
let s:cterm_dark_gray = 236
let s:gui_med_gray_hi = '#444444'
let s:cterm_med_gray_hi = 238
let s:gui_med_gray_lo = '#3a3a3a'
let s:cterm_med_gray_lo = 237
let s:gui_light_gray = '#b2b2b2'
let s:cterm_light_gray = 249
let s:gui_green = '#afd787'
let s:cterm_green = 150
let s:gui_blue = '#87afd7'
let s:cterm_blue = 110
let s:gui_purple = '#afafd7'
let s:cterm_purple = 146
let s:gui_orange = '#d7af5f'
let s:cterm_orange = 179
let s:gui_red = '#d78787'
let s:cterm_red = 174
let s:gui_pink = '#d7afd7'
let s:cterm_pink = 182
let s:file = ['#ff0000', '', 160, '', '']
" Normal mode
let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green]
let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo]
let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi]
let g:airline#themes#bubblegum#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#bubblegum#normal_modified = {
\ 'statusline': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''],
\ }
" Insert mode
let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue]
let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi]
let g:airline#themes#bubblegum#insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3, s:file)
let g:airline#themes#bubblegum#insert_modified = copy(g:airline#themes#bubblegum#normal_modified)
let g:airline#themes#bubblegum#insert_paste = {
\ 'mode': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''],
\ 'mode_separator': [s:gui_orange, s:gui_med_gray_lo, s:cterm_orange, s:cterm_med_gray_lo, ''],
\ }
" Replace mode
let g:airline#themes#bubblegum#replace = {
\ 'mode': [s:gui_dark_gray, s:gui_red, s:cterm_dark_gray, s:cterm_red, ''],
\ 'mode_separator': [s:gui_red, s:N2[1], s:cterm_red, s:N2[3], ''],
\ 'statusline': [s:gui_red, s:gui_med_gray_hi, s:cterm_red, s:cterm_med_gray_hi, ''],
\ }
let g:airline#themes#bubblegum#replace_modified = copy(g:airline#themes#bubblegum#insert_modified)
" Visual mode
let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink]
let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi]
let g:airline#themes#bubblegum#visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3, s:file)
let g:airline#themes#bubblegum#visual_modified = copy(g:airline#themes#bubblegum#insert_modified)
" Inactive window
let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, '']
let g:airline#themes#bubblegum#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)

View File

@@ -1,44 +1,48 @@
" 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 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.
" 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.
" 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 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. The array is in the format [ guifg, guibg, ctermfg, ctermbg, opts ].
" variables to the current script. Without this, these variables would be
" declared globally.
"
" The array is in the format [ guifg, guibg, ctermfg, ctermbg, opts ].
" The opts takes in values from ":help attr-list".
let s:file = [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ]
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
let s:file = [ '#ff0000' , '' , 160 , '' , '' ]
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
" vim-airline is made up of multiple sections, but for theming purposes there is
" only 3 sections: the mode, the branch indicator, and the gutter (which then get
" mirrored on the right side). generate_color_map is a helper function which
" generates a dictionary which declares the full colorscheme for the statusline.
" See the source code of "autoload/airline/themes.vim" for the full set of keys
" available for theming.
" vim-airline is made up of multiple sections, but for theming purposes there
" is only 3 sections: the mode, the branch indicator, and the gutter (which
" then get mirrored on the right side). generate_color_map is a helper
" function which generates a dictionary which declares the full colorscheme
" for the statusline. See the source code of "autoload/airline/themes.vim"
" for the full set of keys available for theming.
" Now let's define the global g: variable that declares the colors used for
" normal mode. The # is a separator that maps with the directory structure
" normal mode. The # is a separator that maps with the directory structure.
" If you get this wrong, Vim will complain loudly.
let g:airline#themes#dark#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
" Here we define overrides for when the buffer is modified. This will be applied
" after g:airline#themes#dark#normal, hence why only certain keys are declared.
" Here we define overrides for when the buffer is modified. This will be
" applied after g:airline#themes#dark#normal, hence why only certain keys are
" declared.
let g:airline#themes#dark#normal_modified = {
\ 'info_separator': [ '#444444' , '#5f005f' , 238 , 53 , '' ] ,
\ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
@@ -77,7 +81,15 @@ let g:airline#themes#dark#visual_modified = {
let s:IA = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
let g:airline#themes#dark#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
let g:airline#themes#dark#inactive_modified = {
\ 'statusline': [ '#5f005f' , '' , '53' , '' , '' ] ,
\ }
" 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)
let g:airline#themes#dark#ctrlp = airline#extensions#ctrlp#generate_color_map(
\ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ],
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])
endif

View File

@@ -0,0 +1,53 @@
function! s:generate()
" This theme is an example of how to use helper functions to extract highlight
" values from the corresponding colorscheme. It was written in a hurry, so it
" is very minimalistic. If you are a jellybeans user and want to make updates,
" please send pull requests.
" Here are examples where the entire highlight group is copied and an airline
" compatible color array is generated.
let s:N1 = airline#themes#get_highlight('DbgCurrent', 'bold')
let s:N2 = airline#themes#get_highlight('Folded')
let s:N3 = airline#themes#get_highlight('NonText')
" The file indicator is a special case where if the background values are
" empty the generate_color_map function will extract a matching color.
let s:file = airline#themes#get_highlight('Constant')
let s:file[1] = ''
let s:file[3] = ''
let g:airline#themes#jellybeans#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#jellybeans#normal_modified = {
\ 'statusline': [ '#ffb964', '', 215, '', '' ]
\ }
let s:I1 = airline#themes#get_highlight('DiffAdd', 'bold')
let s:I2 = s:N2
let s:I3 = s:N3
let g:airline#themes#jellybeans#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file)
let g:airline#themes#jellybeans#insert_modified = g:airline#themes#jellybeans#normal_modified
let s:R1 = airline#themes#get_highlight('WildMenu', 'bold')
let s:R2 = s:N2
let s:R3 = s:N3
let g:airline#themes#jellybeans#replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3, s:file)
let g:airline#themes#jellybeans#replace_modified = g:airline#themes#jellybeans#normal_modified
" Sometimes you want to mix and match colors from different groups, you can do
" that with this method.
let s:V1 = airline#themes#get_highlight2(['TabLineSel', 'bg'], ['DiffDelete', 'bg'], 'bold')
let s:V2 = s:N2
let s:V3 = s:N3
let g:airline#themes#jellybeans#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file)
let g:airline#themes#jellybeans#visual_modified = g:airline#themes#jellybeans#normal_modified
" And of course, you can always do it manually as well.
let s:IA = [ '#444444', '#1c1c1c', 237, 234 ]
let g:airline#themes#jellybeans#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
endfunction
call s:generate()
augroup airline_jellybeans
autocmd!
autocmd ColorScheme * call <sid>generate()
augroup END

View File

@@ -1,4 +1,4 @@
" vim-airline companion theme of Laederon
" vim-airline companion theme of Laederon
" (https://github.com/Donearm/Laederon)
" Normal mode
@@ -8,7 +8,7 @@ let s:N3 = [ '#90a680' , '#2e2d2a' , 64, 235 ] " dilutedpaint & darkgravel
let s:N4 = [ '#777470' , 240 ] " gravel
" Insert mode
let s:I1 = [ '#1a1a18' , '#1693a5' , 232 , 62 ] " blackestgravel & crystallake
let s:I1 = [ '#1a1a18' , '#1693a5' , 232 , 62 ] " blackestgravel & crystallake
let s:I2 = [ '#515744' , '#44403a' , 101 , 238 ] " lichen & deepgravel
let s:I3 = [ '#1693a5' , '#2e2d2a' , 39 , 235 ] " crystallake & darkgravel
@@ -24,7 +24,7 @@ let s:RE = [ '#233e09' , 22 ] " oakleaf
" Paste mode
let s:PA = [ '#ab3e5d' , 161 ] " raspberry
let s:file = [ '#ef393d' , s:N3[1] , 196 , s:N3[3] , '' ]
let s:file = [ '#ef393d' , '' , 196 , '' , '' ]
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3], s:N3[3] , '' ]
@@ -46,8 +46,8 @@ let g:airline#themes#laederon#insert_paste = {
let g:airline#themes#laederon#replace = copy(airline#themes#laederon#insert)
let g:airline#themes#laederon#replace.mode = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ]
let g:airline#themes#laederon#replace.mode_separator = [ s:RE[0] , s:I2[1] , s:RE[1] , s:V4[1] , '' ]
let g:airline#themes#laederon#replace.mode = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ]
let g:airline#themes#laederon#replace.mode_separator = [ s:RE[0] , s:I2[1] , s:RE[1] , s:I2[3] , '' ]
let g:airline#themes#laederon#replace_modified = g:airline#themes#laederon#insert_modified
@@ -58,5 +58,4 @@ let g:airline#themes#laederon#visual_modified = {
let g:airline#themes#laederon#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
let g:airline#themes#laederon#inactive_modified = {
\ 'statusline' : [ s:V1[1] , '', s:V1[3] , '', '' ] }

View File

@@ -1,5 +1,4 @@
let s:file = [ '#df0000' , '#ffffff' , 160 , 255 ]
let s:file = [ '#df0000' , '' , 160 , '' ]
let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ]
let s:N2 = [ '#000087' , '#00dfff' , 18 , 45 ]
let s:N3 = [ '#005fff' , '#afffff' , 27 , 159 ]
@@ -42,6 +41,4 @@ let g:airline#themes#light#visual_modified = {
let s:IA = [ '#9e9e9e' , '#ffffff' , 247 , 255 , '' ]
let g:airline#themes#light#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
let g:airline#themes#light#inactive_modified = {
\ 'statusline': [ '#df0000' , '' , '160' , '', '' ]
\ }

View File

@@ -44,9 +44,7 @@ let g:airline#themes#luna#visual_modified = {
let s:IA = [ '#4e4e4e' , '#002b2b' , 59 , 23 , '' ]
let g:airline#themes#luna#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
let g:airline#themes#luna#inactive_modified = {
\ 'statusline': [ '#f88379' , '' , '210' , '' , '' ] ,
\ }
if get(g:, 'loaded_ctrlp', 0)
let g:airline#themes#luna#ctrlp = airline#extensions#ctrlp#generate_color_map(

View File

@@ -0,0 +1,61 @@
let s:file = [ '#66d9ef' , '#465457' , 81 , 67 , 'bold' ]
" Normal mode
let s:N1 = [ '#080808' , '#e6db74' , 232 , 144 ] " mode
let s:N2 = [ '#f8f8f0' , '#232526' , 253 , 16 ] " info
let s:N3 = [ '#f8f8f0' , '#465457' , 253 , 67 ] " statusline
let g:airline#themes#molokai#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#molokai#normal_modified = {
\ 'info_separator': [ '#232526' , '#e6db74' , 16 , 144 , '' ] ,
\ 'statusline': [ '#080808' , '#e6db74' , 232 , 144 , '' ] ,
\ }
" Insert mode
let s:I1 = [ '#080808' , '#66d9ef' , 232 , 81 ]
let s:I2 = [ '#f8f8f0' , '#232526' , 253 , 16 ]
let s:I3 = [ '#f8f8f0' , '#465457' , 253 , 67 ]
let g:airline#themes#molokai#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file)
let g:airline#themes#molokai#insert_modified = {
\ 'info_separator': [ '#232526' , '#66d9ef' , 16 , 81 , '' ] ,
\ 'statusline': [ '#080808' , '#66d9ef' , 232 , 81 , '' ] ,
\ }
" Replace mode
let g:airline#themes#molokai#replace = copy(g:airline#themes#molokai#insert)
let g:airline#themes#molokai#replace.mode = [ s:I1[0] , '#ef5939' , s:I1[2] , 166 , '' ]
let g:airline#themes#molokai#replace.mode_separator = [ '#ef5939' , s:I2[1] , 166 , s:I2[3] , '' ]
let g:airline#themes#molokai#replace_modified = {
\ 'info_separator': [ '#232526' , '#ef5939' , 16 , 166 , '' ] ,
\ 'statusline': [ '#080808' , '#ef5939' , 232 , 166 , '' ] ,
\ }
" Visual mode
let s:V1 = [ '#080808' , '#fd971f' , 232 , 208 ]
let s:V2 = [ '#f8f8f0' , '#232526' , 253 , 16 ]
let s:V3 = [ '#f8f8f0' , '#465457' , 253 , 67 ]
let g:airline#themes#molokai#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file)
let g:airline#themes#molokai#visual_modified = {
\ 'info_separator': [ '#232526' , '#fd971f' , 16 , 208 , '' ] ,
\ 'statusline': [ '#080808' , '#fd971f' , 232 , 208 , '' ] ,
\ }
" Inactive
let s:IA = [ '#1b1d1e' , '#465457' , 233 , 67 , '' ]
let g:airline#themes#molokai#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
" CtrlP
if get(g:, 'loaded_ctrlp', 0)
let g:airline#themes#molokai#ctrlp = airline#extensions#ctrlp#generate_color_map(
\ [ '#f8f8f0' , '#465457' , 253 , 67 , '' ] ,
\ [ '#f8f8f0' , '#232526' , 253 , 16 , '' ] ,
\ [ '#080808' , '#e6db74' , 232 , 144 , 'bold' ] )
endif

View File

@@ -36,7 +36,7 @@ let s:termbg = 232
let s:termsep = 236
let s:guisep = '#303030'
let s:file = [ '#ff0000' , s:guibg , 160 , s:termbg , '' ]
let s:file = [ '#ff0000' , '' , 160 , '' , '' ]
let s:N1 = s:swap ? [ s:guibg , '#00dfff' , s:termbg , 45 ] : [ '#00dfff' , s:guibg , 45 , s:termbg ]
let s:N2 = [ '#ff5f00' , s:guibg, 202 , s:termbg ]
let s:N3 = [ '#767676' , s:guibg, 243 , s:termbg ]
@@ -98,5 +98,4 @@ let g:airline#themes#simple#visual_modified = copy(g:airline#themes#simple#norma
let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ]
let g:airline#themes#simple#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
let g:airline#themes#simple#inactive_modified = copy(g:airline#themes#simple#normal_modified)

View File

@@ -1,163 +1,169 @@
""""""""""""""""""""""""""""""""""""""""""""""""
" Options
""""""""""""""""""""""""""""""""""""""""""""""""
let s:reduced = get(g:, 'airline_solarized_reduced', 1)
let s:background = get(g:, 'airline_solarized_bg', &background)
function! s:generate()
""""""""""""""""""""""""""""""""""""""""""""""""
" Options
""""""""""""""""""""""""""""""""""""""""""""""""
let s:reduced = get(g:, 'airline_solarized_reduced', 1)
let s:background = get(g:, 'airline_solarized_bg', &background)
""""""""""""""""""""""""""""""""""""""""""""""""
" Colors
""""""""""""""""""""""""""""""""""""""""""""""""
" Base colors
let s:base03 = {'t': 234, 'g': '#002b36'}
let s:base02 = {'t': 235, 'g': '#073642'}
let s:base01 = {'t': 240, 'g': '#586e75'}
let s:base00 = {'t': 241, 'g': '#657b83'}
let s:base0 = {'t': 244, 'g': '#839496'}
let s:base1 = {'t': 245, 'g': '#93a1a1'}
let s:base2 = {'t': 254, 'g': '#eee8d5'}
let s:base3 = {'t': 230, 'g': '#fdf6e3'}
let s:yellow = {'t': 136, 'g': '#b58900'}
let s:orange = {'t': 166, 'g': '#cb4b16'}
let s:red = {'t': 160, 'g': '#dc322f'}
let s:magenta = {'t': 125, 'g': '#d33682'}
let s:violet = {'t': 61, 'g': '#6c71c4'}
let s:blue = {'t': 33, 'g': '#267bd2'}
let s:cyan = {'t': 37, 'g': '#2aa198'}
let s:green = {'t': 64, 'g': '#859900'}
let s:c218 = {'t': 218, 'g': '#ffafd7'}
let s:c52 = {'t': 52, 'g': '#5f0000'}
""""""""""""""""""""""""""""""""""""""""""""""""
" Colors
""""""""""""""""""""""""""""""""""""""""""""""""
" Base colors
let s:base03 = {'t': 234, 'g': '#002b36'}
let s:base02 = {'t': 235, 'g': '#073642'}
let s:base01 = {'t': 240, 'g': '#586e75'}
let s:base00 = {'t': 241, 'g': '#657b83'}
let s:base0 = {'t': 244, 'g': '#839496'}
let s:base1 = {'t': 245, 'g': '#93a1a1'}
let s:base2 = {'t': 254, 'g': '#eee8d5'}
let s:base3 = {'t': 230, 'g': '#fdf6e3'}
let s:yellow = {'t': 136, 'g': '#b58900'}
let s:orange = {'t': 166, 'g': '#cb4b16'}
let s:red = {'t': 160, 'g': '#dc322f'}
let s:magenta = {'t': 125, 'g': '#d33682'}
let s:violet = {'t': 61, 'g': '#6c71c4'}
let s:blue = {'t': 33, 'g': '#268bd2'}
let s:cyan = {'t': 37, 'g': '#2aa198'}
let s:green = {'t': 64, 'g': '#859900'}
let s:c218 = {'t': 218, 'g': '#ffafd7'}
let s:c52 = {'t': 52, 'g': '#5f0000'}
""""""""""""""""""""""""""""""""""""""""""""""""
" Simple mappings
" NOTE: These are easily tweakable mappings. The actual mappings get
" the specific gui and terminal colors from the base color dicts.
""""""""""""""""""""""""""""""""""""""""""""""""
" Normal mode
let s:N1 = [s:base2, s:blue, 'bold']
let s:N2 = [s:base2, s:base01, '']
if s:background == 'dark'
""""""""""""""""""""""""""""""""""""""""""""""""
" Simple mappings
" NOTE: These are easily tweakable mappings. The actual mappings get
" the specific gui and terminal colors from the base color dicts.
""""""""""""""""""""""""""""""""""""""""""""""""
" Normal mode
let s:N1 = [s:base2, s:blue, 'bold']
if s:background == 'dark'
let s:N2 = [s:base2, s:base01, '']
let s:N3 = [s:base1, s:base02, '']
else
else
let s:N2 = [s:base2, s:base1, '']
let s:N3 = [s:base00, s:base2, '']
endif
let s:NF = [s:orange, s:N3[1], '']
if s:reduced
endif
let s:NF = [s:orange, s:N3[1], '']
if s:reduced
if s:background == 'dark'
let s:NM = {
\ 'info_separator': [s:N2[1], s:N3[1], ''],
\ 'statusline': [s:magenta, s:N3[1], ''],
\ }
let s:NM = {
\ 'info_separator': [s:N2[1], s:N3[1], ''],
\ 'statusline': [s:magenta, s:N3[1], ''],
\ }
else
let s:NM = {
\ 'info_separator': [s:N2[1], s:N3[1], ''],
\ 'statusline': [s:magenta, s:N3[1], ''],
\ }
let s:NM = {
\ 'info_separator': [s:N2[1], s:N3[1], ''],
\ 'statusline': [s:magenta, s:N3[1], ''],
\ }
endif
else
else
if s:background == 'dark'
let s:NM = {
\ 'info_separator': [s:N2[1], s:c52, ''],
\ 'statusline': [s:c218, s:c52, '']
\ }
let s:NM = {
\ 'info_separator': [s:N2[1], s:c52, ''],
\ 'statusline': [s:c218, s:c52, '']
\ }
else
let s:NM = {
\ 'info_separator': [s:N2[1], s:c218, ''],
\ 'statusline': [s:red, s:c218, '']
\ }
let s:NM = {
\ 'info_separator': [s:N2[1], s:c218, ''],
\ 'statusline': [s:red, s:c218, '']
\ }
endif
endif
endif
" Insert mode
let s:I1 = [s:N1[0], s:green, 'bold']
if s:reduced
" Insert mode
let s:I1 = [s:N1[0], s:green, 'bold']
if s:reduced
let s:I2 = s:N2
else
else
let s:I2 = [s:base3, s:base1, '']
endif
let s:I3 = s:N3
let s:IF = s:NF
if s:reduced
endif
let s:I3 = s:N3
let s:IF = s:NF
if s:reduced
let s:IM = s:NM
else
else
let s:IM = {
\ 'info_separator': [s:I2[1], s:NM.statusline[1], ''],
\ 'statusline': s:NM.statusline
\ }
endif
\ 'info_separator': [s:I2[1], s:NM.statusline[1], ''],
\ 'statusline': s:NM.statusline
\ }
endif
" Visual mode
let s:V1 = [s:N1[0], s:orange, 'bold']
if s:reduced
" Visual mode
let s:V1 = [s:N1[0], s:orange, 'bold']
if s:reduced
let s:V2 = s:N2
let s:V3 = s:N3
else
else
let s:V2 = s:I2
let s:V3 = s:I3
endif
let s:VF = s:NF
if s:reduced
endif
let s:VF = s:NF
if s:reduced
let s:VM = s:NM
else
else
let s:VM = s:IM
endif
endif
" Inactive
if s:background == 'dark'
" Inactive
if s:background == 'dark'
let s:IA = [s:base00, s:base02, '']
else
else
let s:IA = [s:base1, s:base2, '']
endif
endif
""""""""""""""""""""""""""""""""""""""""""""""""
" Actual mappings
" WARNING: Don't modify this section unless necessary.
""""""""""""""""""""""""""""""""""""""""""""""""
let s:NFa = [s:NF[0].g, s:NF[1].g, s:NF[0].t, s:NF[1].t, s:NF[2]]
let s:IFa = [s:IF[0].g, s:IF[1].g, s:IF[0].t, s:IF[1].t, s:IF[2]]
let s:VFa = [s:VF[0].g, s:VF[1].g, s:VF[0].t, s:VF[1].t, s:VF[2]]
""""""""""""""""""""""""""""""""""""""""""""""""
" Actual mappings
" WARNING: Don't modify this section unless necessary.
""""""""""""""""""""""""""""""""""""""""""""""""
let s:NFa = [s:NF[0].g, s:NF[1].g, s:NF[0].t, s:NF[1].t, s:NF[2]]
let s:IFa = [s:IF[0].g, s:IF[1].g, s:IF[0].t, s:IF[1].t, s:IF[2]]
let s:VFa = [s:VF[0].g, s:VF[1].g, s:VF[0].t, s:VF[1].t, s:VF[2]]
let g:airline#themes#solarized#inactive = airline#themes#generate_color_map(
\ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]],
\ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]],
\ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]],
\ s:NFa)
let g:airline#themes#solarized#inactive = airline#themes#generate_color_map(
\ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]],
\ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]],
\ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]],
\ s:NFa)
let g:airline#themes#solarized#inactive_modified = {
\ 'statusline': [s:NM.statusline[0].g, '', s:NM.statusline[0].t, '', ''] }
let g:airline#themes#solarized#normal = airline#themes#generate_color_map(
\ [s:N1[0].g, s:N1[1].g, s:N1[0].t, s:N1[1].t, s:N1[2]],
\ [s:N2[0].g, s:N2[1].g, s:N2[0].t, s:N2[1].t, s:N2[2]],
\ [s:N3[0].g, s:N3[1].g, s:N3[0].t, s:N3[1].t, s:N3[2]],
\ s:NFa)
let g:airline#themes#solarized#normal = airline#themes#generate_color_map(
\ [s:N1[0].g, s:N1[1].g, s:N1[0].t, s:N1[1].t, s:N1[2]],
\ [s:N2[0].g, s:N2[1].g, s:N2[0].t, s:N2[1].t, s:N2[2]],
\ [s:N3[0].g, s:N3[1].g, s:N3[0].t, s:N3[1].t, s:N3[2]],
\ s:NFa)
let g:airline#themes#solarized#normal_modified = {
\ 'info_separator': [s:NM.info_separator[0].g, s:NM.info_separator[1].g,
\ s:NM.info_separator[0].t, s:NM.info_separator[1].t, s:NM.info_separator[2]],
\ 'statusline': [s:NM.statusline[0].g, s:NM.statusline[1].g,
\ s:NM.statusline[0].t, s:NM.statusline[1].t, s:NM.statusline[2]]}
let g:airline#themes#solarized#normal_modified = {
\ 'info_separator': [s:NM.info_separator[0].g, s:NM.info_separator[1].g,
\ s:NM.info_separator[0].t, s:NM.info_separator[1].t, s:NM.info_separator[2]],
\ 'statusline': [s:NM.statusline[0].g, s:NM.statusline[1].g,
\ s:NM.statusline[0].t, s:NM.statusline[1].t, s:NM.statusline[2]]}
let g:airline#themes#solarized#insert = airline#themes#generate_color_map(
\ [s:I1[0].g, s:I1[1].g, s:I1[0].t, s:I1[1].t, s:I1[2]],
\ [s:I2[0].g, s:I2[1].g, s:I2[0].t, s:I2[1].t, s:I2[2]],
\ [s:I3[0].g, s:I3[1].g, s:I3[0].t, s:I3[1].t, s:I3[2]],
\ s:IFa)
let g:airline#themes#solarized#insert = airline#themes#generate_color_map(
\ [s:I1[0].g, s:I1[1].g, s:I1[0].t, s:I1[1].t, s:I1[2]],
\ [s:I2[0].g, s:I2[1].g, s:I2[0].t, s:I2[1].t, s:I2[2]],
\ [s:I3[0].g, s:I3[1].g, s:I3[0].t, s:I3[1].t, s:I3[2]],
\ s:IFa)
let g:airline#themes#solarized#insert_modified = {
\ 'info_separator': [s:IM.info_separator[0].g, s:IM.info_separator[1].g,
\ s:IM.info_separator[0].t, s:IM.info_separator[1].t, s:IM.info_separator[2]],
\ 'statusline': [s:IM.statusline[0].g, s:IM.statusline[1].g,
\ s:IM.statusline[0].t, s:IM.statusline[1].t, s:IM.statusline[2]]}
let g:airline#themes#solarized#insert_modified = {
\ 'info_separator': [s:IM.info_separator[0].g, s:IM.info_separator[1].g,
\ s:IM.info_separator[0].t, s:IM.info_separator[1].t, s:IM.info_separator[2]],
\ 'statusline': [s:IM.statusline[0].g, s:IM.statusline[1].g,
\ s:IM.statusline[0].t, s:IM.statusline[1].t, s:IM.statusline[2]]}
let g:airline#themes#solarized#visual = airline#themes#generate_color_map(
\ [s:V1[0].g, s:V1[1].g, s:V1[0].t, s:V1[1].t, s:V1[2]],
\ [s:V2[0].g, s:V2[1].g, s:V2[0].t, s:V2[1].t, s:V2[2]],
\ [s:V3[0].g, s:V3[1].g, s:V3[0].t, s:V3[1].t, s:V3[2]],
\ s:VFa)
let g:airline#themes#solarized#visual = airline#themes#generate_color_map(
\ [s:V1[0].g, s:V1[1].g, s:V1[0].t, s:V1[1].t, s:V1[2]],
\ [s:V2[0].g, s:V2[1].g, s:V2[0].t, s:V2[1].t, s:V2[2]],
\ [s:V3[0].g, s:V3[1].g, s:V3[0].t, s:V3[1].t, s:V3[2]],
\ s:VFa)
let g:airline#themes#solarized#visual_modified = {
\ 'info_separator': [s:VM.info_separator[0].g, s:VM.info_separator[1].g,
\ s:VM.info_separator[0].t, s:VM.info_separator[1].t, s:VM.info_separator[2]],
\ 'statusline': [s:VM.statusline[0].g, s:VM.statusline[1].g,
\ s:VM.statusline[0].t, s:VM.statusline[1].t, s:VM.statusline[2]]}
endfunction
let g:airline#themes#solarized#visual_modified = {
\ 'info_separator': [s:VM.info_separator[0].g, s:VM.info_separator[1].g,
\ s:VM.info_separator[0].t, s:VM.info_separator[1].t, s:VM.info_separator[2]],
\ 'statusline': [s:VM.statusline[0].g, s:VM.statusline[1].g,
\ s:VM.statusline[0].t, s:VM.statusline[1].t, s:VM.statusline[2]]}
call s:generate()
augroup airline_solarized
autocmd!
autocmd ColorScheme * call <sid>generate() | call airline#reload_highlight()
augroup END

View File

@@ -0,0 +1,43 @@
function! s:generate()
let s:file = airline#themes#get_highlight('Constant')
" clear out backgrounds so generate_color_map will fill them in
let s:file[1] = ''
let s:file[3] = ''
let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Directory', 'fg'], 'bold')
let s:N2 = airline#themes#get_highlight('Pmenu')
let s:N3 = airline#themes#get_highlight('CursorLine')
let g:airline#themes#tomorrow#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let group = airline#themes#get_highlight('vimCommand')
let g:airline#themes#tomorrow#normal_modified = {
\ 'statusline': [ group[0], '', group[2], '', '' ]
\ }
let s:I1 = airline#themes#get_highlight2(['Normal', 'bg'], ['MoreMsg', 'fg'], 'bold')
let s:I2 = airline#themes#get_highlight2(['MoreMsg', 'fg'], ['Normal', 'bg'])
let s:I3 = s:N3
let g:airline#themes#tomorrow#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file)
let g:airline#themes#tomorrow#insert_modified = g:airline#themes#tomorrow#normal_modified
let s:R1 = airline#themes#get_highlight('Error', 'bold')
let s:R2 = s:N2
let s:R3 = s:N3
let g:airline#themes#tomorrow#replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3, s:file)
let g:airline#themes#tomorrow#replace_modified = g:airline#themes#tomorrow#normal_modified
let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold')
let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg'])
let s:V3 = s:N3
let g:airline#themes#tomorrow#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file)
let g:airline#themes#tomorrow#visual_modified = g:airline#themes#tomorrow#normal_modified
let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg'])
let g:airline#themes#tomorrow#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
endfunction
call s:generate()
augroup airline_tomorrow
autocmd!
autocmd ColorScheme * call <sid>generate() | call airline#reload_highlight()
augroup END

View File

@@ -11,7 +11,7 @@ let s:N4 = [ '#857f78' , 243 ] " gravel
let s:I1 = [ '#1a1a18' , '#fade3e' , 232 , 221 ] " blackestgravel & warmcorn
let s:I2 = [ '#c7b386' , '#45413b' , 252 , 238 ] " bleaksand & deepgravel
let s:I3 = [ '#f4cf86' , '#242321' , 222 , 235 ] " lighttannedskin & darkgravel
" Visual mode
let s:V1 = [ '#1c1b1a' , '#9a4820' , 233 , 88 ] " blackgravel & warmadobe
let s:V2 = [ '#000000' , '#88633f' , 16 , 95 ] " coal & cappuccino
@@ -21,10 +21,10 @@ let s:V4 = [ '#c14c3d' , 160 ] " tannedumbrella
" Replace mode
let s:RE = [ '#c7915b' , 173 ] " nut
" Paste mode
" Paste mode
let s:PA = [ '#f9ef6d' , 154 ] " bleaklemon
let s:file = [ '#ff7400' , s:N3[1] , 196 , s:N3[3] , '' ]
let s:file = [ '#ff7400' , '' , 196 , '' , '' ]
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3], s:N3[3] , '' ]
@@ -48,8 +48,8 @@ let g:airline#themes#ubaryd#insert_paste = {
let g:airline#themes#ubaryd#replace = copy(airline#themes#ubaryd#insert)
let g:airline#themes#ubaryd#replace.mode = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ]
let g:airline#themes#ubaryd#replace.mode_separator = [ s:RE[0] , s:I2[1] , s:RE[1] , s:V4[1] , '' ]
let g:airline#themes#ubaryd#replace.mode = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ]
let g:airline#themes#ubaryd#replace.mode_separator = [ s:RE[0] , s:I2[1] , s:RE[1] , s:I2[3] , '' ]
let g:airline#themes#ubaryd#replace_modified = g:airline#themes#ubaryd#insert_modified
@@ -59,6 +59,4 @@ let g:airline#themes#ubaryd#visual_modified = {
\ 'statusline' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] }
let g:airline#themes#ubaryd#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
let g:airline#themes#ubaryd#inactive_modified = {
\ 'statusline' : [ s:V1[1] , '', s:V1[3], '', '']
\ }

View File

@@ -33,7 +33,7 @@ let s:PA = [ '#94E42C' , 47 ]
let s:IM = [ '#40403C' , 238 ]
" File permissions (RO, etc)
let s:file = [ '#E5786D' , s:N3[1] , 203 , s:N3[3] , '' ]
let s:file = [ '#E5786D' , '' , 203 , '' , '' ]
" Inactive mode
let s:IA = [ '#767676' , s:N3[1] , 243 , s:N3[3] , '' ]
@@ -84,8 +84,6 @@ let g:airline#themes#wombat#insert_paste = {
let g:airline#themes#wombat#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
let g:airline#themes#wombat#inactive_modified = {
\ 'statusline' : [ '#BCBCBC' , '' , 250 , '' , '' ] }
if get(g:, 'loaded_ctrlp', 0)

View File

@@ -1,29 +1,27 @@
*airline.txt* Lean and mean statusline that's light as air
_ _ _ _ ~
__ _(_)_ __ ___ __ _(_)_ __| (_)_ __ ___ ~
\ \ / / | '_ ` _ \ _____ / _` | | '__| | | '_ \ / _ \ ~
\ V /| | | | | | |_____| (_| | | | | | | | | | __/ ~
\_/ |_|_| |_| |_| \__,_|_|_| |_|_|_| |_|\___| ~
~
==============================================================================
INTRODUCTION *airline*
There's already powerline <https://github.com/Lokaltog/powerline>, why yet
another statusline?
vim-airline is a fast and lightweight alternative to powerline, written
in 100% vimscript with no outside dependencies.
* it's 100% vimscript; no python needed.
* it's small. i want the core plugin to be less than 200 lines as a rule.
* it gets you 90% of the way there; in addition to all the standard goodies,
it integrates with a variety of popular plugins, including:
* fugitve <https://github.com/tpope/vim-fugitive>
* syntastic <https://github.com/scrooloose/syntastic>
* vim-bufferline <https://github.com/bling/vim-bufferline>
* unite <https://github.com/Shougo/unite.vim>
* ctrlp <https://github.com/kien/ctrlp.vim>
* lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
* it looks good with regular fonts, and provides configuration points so you
==============================================================================
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.
* it's fast to load, taking roughly 1ms. by comparison, powerline needs
60ms on the same machine.
* it's fully customizable; if you know a little |statusline| syntax you can
* 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.
* it's trivial to write colorschemes; for a minimal theme you need to edit
9 lines of colors. (please send pull requests if you create new themes!)
* extremely easy to write themes.
==============================================================================
NAME *airline-name*
@@ -52,6 +50,7 @@ values):
* enable/disable fugitive/lawrencium integration
>
let g:airline_enable_branch=1
let g:airline_branch_empty_message=''
<
* enable/disable syntastic integration
@@ -59,6 +58,11 @@ values):
let g:airline_enable_syntastic=1
<
* enable/disable tagbar integration
>
let g:airline_enable_tagbar=1
<
* enable modified detection
>
let g:airline_detect_modified=1
@@ -68,9 +72,24 @@ values):
>
let g:airline_detect_paste=1
<
* enable iminsert detection
>
let g:airline_detect_iminsert=1
<
* enable whitespace detection
>
let g:airline_detect_whitespace=0 "disabled
let g:airline_detect_whitespace=1 "icon and message (default)
let g:airline_detect_whitespace=2 "icon only
<
* determine whether inactive windows should have the left section collapsed to
only the filename of that buffer.
>
let g:airline_inactive_collapse=1
<
* change the default theme
>
@@ -112,6 +131,9 @@ COMMANDS *airline-commands*
:AirlineTheme {theme-name} *:AirlineTheme*
Displays or changes the current theme.
:AirlineToggleWhitespace *:AirlineToggleWhitespace*
Toggles whitespace detection.
==============================================================================
CUSTOMIZATION *airline-customization*
@@ -131,6 +153,7 @@ separators, as well as the powerline font glyths.
let g:airline_paste_symbol = 'ρ'
let g:airline_paste_symbol = 'Þ'
let g:airline_paste_symbol = '∥'
let g:airline_whitespace_symbol = 'Ξ'
" powerline symbols
let g:airline_left_sep = ''
@@ -156,13 +179,14 @@ with the usual statusline syntax.
>
" here are the the default values
let g:airline_section_a (the mode/paste indicator)
let g:airline_section_b (the fugitive/lawrencium branch indicator)
let g:airline_section_c (bufferline or filename)
let g:airline_section_gutter (syntastic and readonly flag)
let g:airline_section_x (filetype)
let g:airline_section_y (fileencoding, fileformat)
let g:airline_section_z (percentage, line number, column number)
let g:airline_section_a (the mode/paste indicator)
let g:airline_section_b (the fugitive/lawrencium branch indicator)
let g:airline_section_c (bufferline or filename)
let g:airline_section_gutter
let g:airline_section_x (tagbar, filetype)
let g:airline_section_y (fileencoding, fileformat)
let g:airline_section_z (percentage, line number, column number)
let g:airline_section_warning (syntastic, whitespace)
" here is an example of how you could replace the branch indicator with
" the current working directory, followed by the filename.
@@ -170,22 +194,31 @@ with the usual statusline syntax.
let g:airline_section_c = '%t'
<
If there is a particular plugin or filetype that is not supported, you can
extend it by adding a function reference to the global array. Here is an
example that you could add to your vimrc:
==============================================================================
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.
*g:airline_statusline_funcrefs*
The g:airline_statusline_funcrefs variable is an array of funcrefs that get
invoked before the statusline gets overwritten for each window. 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 add(g:airline_window_override_funcrefs, function('MyPlugin'))
call add(g:airline_statusline_funcrefs, function('MyPlugin'))
<
In a similar fashion, you can define a function to exclude a window from
having its statusline modified.
*g:airline_exclude_funcrefs*
The g:airline_exclude_funcrefs variable is an array that's returns 1 or 0 to
determine whether that particular window should be excluded from having its
statusline modified. Here is an example:
>
function! ExcludeFoo()
return &filetype == 'FooType'
@@ -197,14 +230,54 @@ having its statusline modified.
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're written in any programming
language it will be easy to pick up. Have a look at the dark.vim theme
where it is fully documented.
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. The |jellybeans.vim| theme is another example of how to write a
theme, but instead of manually declaring colors, it extracts the values from
highlight groups.
==============================================================================
TROUBLESHOOTING *airline-troubleshooting*
Solutions to common problems can be found FAQ section in the Wiki:
Q. There are no colors.
A. You need to set up your terminal correctly. For more details, see
<http://vim.wikia.com/wiki/256_colors_in_vim>. 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.
Solutions to other common problems can be found in the Wiki:
<https://github.com/bling/vim-airline/wiki/FAQ>
==============================================================================
@@ -215,10 +288,7 @@ Contributions and pull requests are welcome.
==============================================================================
LICENSE *airline-license*
Copyright © Bailey Ling.
Distributed under the same terms as the vim |license|.
MIT license. Copyright © 2013 Bailey Ling.
vim:tw=78:ts=8:ft=help:norl:

View File

@@ -1,4 +1,6 @@
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline)
finish
endif
@@ -11,6 +13,9 @@ endfunction
if exists('g:airline_enable_fugitive') || exists('g:airline_fugitive_prefix')
echom 'The g:airline_enable_fugitive and g:airline_fugitive_prefix variables have been deprecated and renamed to g:airline_enable_branch and g:airline_branch_prefix respectively. Please update your vimrc.'
endif
if exists('g:airline_window_override_funcrefs')
echom 'The g:airline_window_override_funcrefs variable has been deprecated. Please use g:airline_statusline_funcrefs instead.'
endif
call s:check_defined('g:airline_left_sep', exists('g:airline_powerline_fonts')?"":">")
call s:check_defined('g:airline_left_alt_sep', exists('g:airline_powerline_fonts')?"":">")
call s:check_defined('g:airline_right_sep', exists('g:airline_powerline_fonts')?"":"<")
@@ -18,21 +23,27 @@ call s:check_defined('g:airline_right_alt_sep', exists('g:airline_powerline_font
call s:check_defined('g:airline_enable_bufferline', 1)
call s:check_defined('g:airline_enable_branch', 1)
call s:check_defined('g:airline_enable_syntastic', 1)
call s:check_defined('g:airline_enable_tagbar', 1)
call s:check_defined('g:airline_detect_iminsert', 0)
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_whitespace', 1)
call s:check_defined('g:airline_whitespace_symbol', '✹')
call s:check_defined('g:airline_branch_empty_message', '')
call s:check_defined('g:airline_branch_prefix', exists('g:airline_powerline_fonts')?' ':'')
call s:check_defined('g:airline_readonly_symbol', exists('g:airline_powerline_fonts')?'':'RO')
call s:check_defined('g:airline_linecolumn_prefix', exists('g:airline_powerline_fonts')?' ':':')
call s:check_defined('g:airline_paste_symbol', (exists('g:airline_powerline_fonts') ? ' ' : '').'PASTE')
call s:check_defined('g:airline_theme', 'dark')
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_window_override_funcrefs', [])
call s:check_defined('g:airline_statusline_funcrefs', [])
call s:check_defined('g:airline_exclude_funcrefs', [])
call s:check_defined('g:airline_mode_map', {
\ '__' : '------',
\ 'n' : 'NORMAL',
\ 'i' : 'INSERT',
\ 'R' : 'REPLACE',
@@ -40,23 +51,27 @@ call s:check_defined('g:airline_mode_map', {
\ 'V' : 'V-LINE',
\ 'c' : 'CMD ',
\ '' : 'V-BLOCK',
\ 's' : 'SELECT',
\ 'S' : 'S-LINE',
\ '' : 'S-BLOCK',
\ })
call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}')
call s:check_defined('g:airline_section_b', '%{get(w:, "airline_current_branch", "")}')
call s:check_defined('g:airline_section_c', '%f%m')
call s:check_defined('g:airline_section_gutter', '')
call s:check_defined('g:airline_section_x', "%{strlen(&filetype)>0?&filetype:''}")
call s:check_defined('g:airline_section_y', "%{strlen(&fenc)>0?&fenc:''}%{strlen(&ff)>0?'['.&ff.']':''}")
call s:check_defined('g:airline_section_z', '%3p%% '.g:airline_linecolumn_prefix.'%3l:%3c')
let s:airline_initialized = 0
function! s:init()
function! s:on_window_changed()
if !s:airline_initialized
call airline#extensions#load()
call airline#update_externals()
call airline#load_theme(g:airline_theme)
call s:check_defined('g:airline_section_a', '%{g:airline_current_mode_text}')
call s:check_defined('g:airline_section_b', '%{g:airline_externals_branch}')
call s:check_defined('g:airline_section_c', g:airline_externals_bufferline)
call s:check_defined('g:airline_section_gutter', '')
call s:check_defined('g:airline_section_x', "%{strlen(&filetype)>0?&filetype:''}")
call s:check_defined('g:airline_section_y', "%{strlen(&fenc)>0?&fenc:''}%{strlen(&ff)>0?'['.&ff.']':''}")
call s:check_defined('g:airline_section_z', '%3p%% '.g:airline_linecolumn_prefix.'%3l:%3c')
let s:airline_initialized = 1
endif
call airline#update_statusline()
endfunction
function! s:get_airline_themes(a, l, p)
@@ -71,11 +86,11 @@ function! s:airline_theme(...)
endif
endfunction
command! -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
augroup airline
au!
autocmd ColorScheme * call airline#highlight(['normal'])
autocmd WinLeave * call airline#update_statusline(0)
autocmd WinEnter,BufWinEnter,FileType,BufUnload * call <sid>init() | call airline#update_statusline(1)
autocmd ShellCmdPost * call airline#update_externals()
autocmd!
autocmd ColorScheme * call airline#reload_highlight()
autocmd WinEnter,BufWinEnter,FileType,BufUnload,ShellCmdPost *
\ call <sid>on_window_changed()
augroup END