David Blume commited on 2018-04-26 21:10:19
Showing 126 changed files, with 9009 additions and 3917 deletions.
... | ... |
@@ -0,0 +1,8 @@ |
1 |
+language: ruby |
|
2 |
+before_install: |
|
3 |
+ - curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/simple.vim" -o autoload/airline/themes/simple.vim |
|
4 |
+ - curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/molokai.vim" -o autoload/airline/themes/molokai.vim |
|
5 |
+ - mkdir colors && curl -f -L 'https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim' -o colors/molokai.vim |
|
6 |
+rvm: |
|
7 |
+ - 1.9.3 |
|
8 |
+script: rake ci |
... | ... |
@@ -0,0 +1,165 @@ |
1 |
+# Change Log |
|
2 |
+ |
|
3 |
+This is the Changelog for the vim-airline project. |
|
4 |
+ |
|
5 |
+## [Unreleased] |
|
6 |
+ |
|
7 |
+## [0.9] - 2018-01-15 |
|
8 |
+- Changes |
|
9 |
+ - Look of default Airline Symbols has been improved [#1397](https://github.com/vim-airline/vim-airline/issues/1397) |
|
10 |
+ - Airline does now set `laststatus=2` if needed |
|
11 |
+ - Syntastic extension now displays warnings and errors separately |
|
12 |
+ - Updates on Resize and SessionLoad events |
|
13 |
+ - Add `maxlinenr` symbol to `airline_section_z` |
|
14 |
+ - Add quickfix title to inactive windows |
|
15 |
+- Improvements |
|
16 |
+ - Many performance improvements (using caching and async feature when possible) |
|
17 |
+ - Cache changes to highlighting groups if `g:airline_highlighting_cache = 1` is set |
|
18 |
+ - Allow to skip empty sections by setting `g:airline_skip_empty_sections` variable |
|
19 |
+ - Make use of improved Vim Script API, if available (e.g. getwininfo()) |
|
20 |
+ - Support for Vims terminal feature (very experimental since it hasn't been stabilized yet) |
|
21 |
+ - More configuration for the tabline extension (with clickable buffers for Neovim) |
|
22 |
+ - Works better on smaller window sizes |
|
23 |
+ - Make airline aware of git worktrees |
|
24 |
+ - Improvements to the fugitive extension [#1603](https://github.com/vim-airline/vim-airline/issues/1603) |
|
25 |
+ - Allows for configurable fileformat output if `g:airline#parts#ffenc#skip_expected_string` is set |
|
26 |
+ - Improvements to the documentation |
|
27 |
+- New features |
|
28 |
+ - Full async support for Vim 8 and Neovim |
|
29 |
+ - Extensions: |
|
30 |
+ - [vim-bufmru](https://github.com/mildred/vim-bufmru) |
|
31 |
+ - [xkb-switch](https://github.com/ierton/xkb-switch) |
|
32 |
+ - [input-source-switcher](https://github.com/vovkasm/input-source-switcher) |
|
33 |
+ - [vimagit](https://github.com/jreybert/vimagit) |
|
34 |
+ - [denite](https://github.com/Shougo/denite.nvim) |
|
35 |
+ - [dein](https://github.com/Shougo/dein.vim) |
|
36 |
+ - [vimtex](https://github.com/lervag/vimtex) |
|
37 |
+ - [minpac](https://github.com/k-takata/minpac/) |
|
38 |
+ - [vim-cursormode](https://github.com/vheon/vim-cursormode) |
|
39 |
+ - [Neomake](https://github.com/neomake/neomake) |
|
40 |
+ - [Ale](https://github.com/w0rp/ale) |
|
41 |
+ - [vim-obsession](https://github.com/tpope/vim-obsession) |
|
42 |
+ - spell (can also display Spell language) |
|
43 |
+ - keymap |
|
44 |
+ - Formatters: |
|
45 |
+ - Formatters for JavaScript [#1617](https://github.com/vim-airline/vim-airline/issues/1617) |
|
46 |
+ - Tabline: Allow for custom formatter for `tab_nr_type` [#1418](https://github.com/vim-airline/vim-airline/issues/1418) |
|
47 |
+ - Customizable wordcount formatter [#1584](https://github.com/vim-airline/vim-airline/issues/1584) |
|
48 |
+ - Add User autocommand for Theme changing [#1226](https://github.com/vim-airline/vim-airline/issues/1226) |
|
49 |
+ - Shows mercurial mq status if hg mq extension is enabled |
|
50 |
+ |
|
51 |
+## [0.8] - 2016-03-09 |
|
52 |
+- Changes |
|
53 |
+ - Airline converted to an organization and moved to new [repository](https://github.com/vim-airline/vim-airline) |
|
54 |
+ - Themes have been split into an separate repository [vim-airline-themes](https://github.com/vim-airline/vim-airline-themes) |
|
55 |
+- Improvements |
|
56 |
+ - Extensions |
|
57 |
+ - branch: support Git and Mercurial simultaneously, untracked files |
|
58 |
+ - whitespace: new mixed-indent rule |
|
59 |
+ - Windows support |
|
60 |
+ - Many bug fixes |
|
61 |
+ - Support for Neovim |
|
62 |
+- New features |
|
63 |
+ - Many new themes |
|
64 |
+ - Extensions/integration |
|
65 |
+ - [taboo](https://github.com/gcmt/taboo.vim) |
|
66 |
+ - [vim-ctrlspace](https://github.com/szw/vim-ctrlspace) |
|
67 |
+ - [quickfixsigns](https://github.com/tomtom/quickfixsigns_vim) |
|
68 |
+ - [YouCompleteMe](https://github.com/Valloric/YouCompleteMe) |
|
69 |
+ - [po.vim](http://www.vim.org/scripts/script.php?script_id=695) |
|
70 |
+ - [unicode.vim](https://github.com/chrisbra/unicode.vim) |
|
71 |
+ - wordcount |
|
72 |
+ - crypt indicator |
|
73 |
+ - byte order mark indicator |
|
74 |
+ - Tabline's tab mode can display splits simultaneously |
|
75 |
+ |
|
76 |
+## [0.7] - 2014-12-10 |
|
77 |
+- New features |
|
78 |
+ - accents support; allowing multiple colors/styles in the same section |
|
79 |
+ - extensions: eclim |
|
80 |
+ - themes: understated, monochrome, murmur, sol, lucius |
|
81 |
+- Improvements |
|
82 |
+ - solarized theme; support for 8 color terminals |
|
83 |
+ - tabline resizes dynamically based on number of open buffers |
|
84 |
+ - miscellaneous bug fixes |
|
85 |
+ |
|
86 |
+## [0.6] - 2013-10-08 |
|
87 |
+ |
|
88 |
+- New features |
|
89 |
+ - accents support; allowing multiple colors/styles in the same section |
|
90 |
+ - extensions: eclim |
|
91 |
+ - themes: understated, monochrome, murmur, sol, lucius |
|
92 |
+- Improvements |
|
93 |
+ - solarized theme; support for 8 color terminals |
|
94 |
+ - tabline resizes dynamically based on number of open buffers |
|
95 |
+ - miscellaneous bug fixes |
|
96 |
+ |
|
97 |
+## [0.5] - 2013-09-13 |
|
98 |
+ |
|
99 |
+- New features |
|
100 |
+ - smart tabline extension which displays all buffers when only one tab is visible |
|
101 |
+ - automatic section truncation when the window resizes |
|
102 |
+ - support for a declarative style of configuration, allowing parts to contain metadata such as minimum window width or conditional visibility |
|
103 |
+ - themes: zenburn, serene |
|
104 |
+- Other |
|
105 |
+ - a sizable chunk of vim-airline is now running through a unit testing suite, automated via Travis CI |
|
106 |
+ |
|
107 |
+## [0.4] - 2013-08-26 |
|
108 |
+ |
|
109 |
+ - New features |
|
110 |
+ - integration with csv.vim and vim-virtualenv |
|
111 |
+ - hunks extension for vim-gitgutter and vim-signify |
|
112 |
+ - automatic theme switching with matching colorschemes |
|
113 |
+ - commands: AirlineToggle |
|
114 |
+ - themes: base16 (all variants) |
|
115 |
+ - Improvements |
|
116 |
+ - integration with undotree, tagbar, and unite |
|
117 |
+ - Other |
|
118 |
+ - refactored core and exposed statusline builder and pipeline |
|
119 |
+ - all extension related g:airline_variables have been deprecated in favor of g:airline#extensions# variables |
|
120 |
+ - extensions found in the runtimepath outside of the default distribution will be automatically loaded |
|
121 |
+ |
|
122 |
+## [0.3] - 2013-08-12 |
|
123 |
+ |
|
124 |
+- New features |
|
125 |
+ - first-class integration with tagbar |
|
126 |
+ - white space detection for trailing spaces and mixed indentation |
|
127 |
+ - introduced warning section for syntastic and white space detection |
|
128 |
+ - improved ctrlp integration: colors are automatically selected based on the current airline theme |
|
129 |
+ - new themes: molokai, bubblegum, jellybeans, tomorrow |
|
130 |
+- Bug fixes |
|
131 |
+ - improved handling of eventignore used by other plugins |
|
132 |
+- Other |
|
133 |
+ - code cleaned up for clearer separation between core functionality and extensions |
|
134 |
+ - introduced color extraction from highlight groups, allowing themes to be generated off of the active colorscheme (e.g. jellybeans and tomorrow) |
|
135 |
+ - License changed to MIT |
|
136 |
+ |
|
137 |
+## [0.2] - 2013-07-28 |
|
138 |
+ |
|
139 |
+- New features |
|
140 |
+ - iminsert detection |
|
141 |
+ - integration with vimshell, vimfiler, commandt, lawrencium |
|
142 |
+ - enhanced bufferline theming |
|
143 |
+ - support for ctrlp theming |
|
144 |
+ - support for custom window excludes |
|
145 |
+- New themes |
|
146 |
+ - luna and wombat |
|
147 |
+- Bug fixes |
|
148 |
+ - refresh branch name after switching with a shell command |
|
149 |
+ |
|
150 |
+## [0.1] - 2013-07-17 |
|
151 |
+ |
|
152 |
+- Initial release |
|
153 |
+ - integration with other plugins: netrw, unite, nerdtree, undotree, gundo, tagbar, minibufexplr, ctrlp |
|
154 |
+ - support for themes: 8 included |
|
155 |
+ |
|
156 |
+[Unreleased]: https://github.com/vim-airline/vim-airline/compare/v0.9...HEAD |
|
157 |
+[0.9]: https://github.com/vim-airline/vim-airline/compare/v0.8...v0.9 |
|
158 |
+[0.8]: https://github.com/vim-airline/vim-airline/compare/v0.7...v0.8 |
|
159 |
+[0.7]: https://github.com/vim-airline/vim-airline/compare/v0.6...v0.7 |
|
160 |
+[0.6]: https://github.com/vim-airline/vim-airline/compare/v0.5...v0.6 |
|
161 |
+[0.5]: https://github.com/vim-airline/vim-airline/compare/v0.4...v0.5 |
|
162 |
+[0.4]: https://github.com/vim-airline/vim-airline/compare/v0.3...v0.4 |
|
163 |
+[0.3]: https://github.com/vim-airline/vim-airline/compare/v0.2...v0.3 |
|
164 |
+[0.2]: https://github.com/vim-airline/vim-airline/compare/v0.1...v0.2 |
|
165 |
+[0.1]: https://github.com/vim-airline/vim-airline/releases/tag/v0.1 |
... | ... |
@@ -0,0 +1,32 @@ |
1 |
+# Contributions |
|
2 |
+ |
|
3 |
+Contributions and pull requests are welcome. Please take note of the following guidelines: |
|
4 |
+ |
|
5 |
+* Adhere to the existing style as much as possible; notably, 2 space indents and long-form keywords. |
|
6 |
+* Keep the history clean! Squash your branches before you submit a pull request. `pull --rebase` is your friend. |
|
7 |
+* Any changes to the core should be tested against Vim 7.2. |
|
8 |
+ |
|
9 |
+# Bugs |
|
10 |
+ |
|
11 |
+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: |
|
12 |
+ |
|
13 |
+* 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]. |
|
14 |
+* And to make it easier to reproduce, please supply the following: |
|
15 |
+ * the `:version` of vim |
|
16 |
+ * the commit of vim-airline you're using |
|
17 |
+ * the OS that you're using, including terminal emulator, GUI vs non-GUI |
|
18 |
+ |
|
19 |
+# Themes |
|
20 |
+ |
|
21 |
+* If you submit a theme, please create a screenshot so it can be added to the [Wiki][14]. |
|
22 |
+* 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. |
|
23 |
+ |
|
24 |
+# Maintenance |
|
25 |
+ |
|
26 |
+If you would like to take a more active role in improving vim-airline, please consider [becoming a maintainer][43]. |
|
27 |
+ |
|
28 |
+ |
|
29 |
+[7]: https://github.com/bling/minivimrc |
|
30 |
+[11]: https://github.com/tpope/vim-pathogen |
|
31 |
+[14]: https://github.com/vim-airline/vim-airline/wiki/Screenshots |
|
32 |
+[43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+#### environment |
|
2 |
+ |
|
3 |
+- vim: ???? |
|
4 |
+- vim-airline: ???? |
|
5 |
+- OS: ???? |
|
6 |
+- Have you reproduced with a minimal vimrc: ??? |
|
7 |
+- What is your airline configuration: ??? |
|
8 |
+if you are using terminal: |
|
9 |
+- terminal: ???? |
|
10 |
+- $TERM variable: ??? |
|
11 |
+- color configuration (:set t_Co?): |
|
12 |
+if you are using Neovim: |
|
13 |
+- does it happen in Vim: ??? |
|
14 |
+ |
|
15 |
+#### actual behavior |
|
16 |
+ |
|
17 |
+???? |
|
18 |
+ |
|
19 |
+#### expected behavior |
|
20 |
+ |
|
21 |
+???? |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+The MIT License (MIT) |
|
2 |
+ |
|
3 |
+Copyright (C) 2013-2016 Bailey Ling |
|
4 |
+ |
|
5 |
+Permission is hereby granted, free of charge, to any person obtaining |
|
6 |
+a copy of this software and associated documentation files (the "Software"), |
|
7 |
+to deal in the Software without restriction, including without limitation |
|
8 |
+the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
9 |
+and/or sell copies of the Software, and to permit persons to whom the |
|
10 |
+Software is furnished to do so, subject to the following conditions: |
|
11 |
+ |
|
12 |
+The above copyright notice and this permission notice shall be included |
|
13 |
+in all copies or substantial portions of the Software. |
|
14 |
+ |
|
15 |
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
16 |
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
17 |
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
18 |
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
19 |
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
20 |
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE |
|
21 |
+OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
... | ... |
@@ -0,0 +1,342 @@ |
1 |
+# vim-airline [![Build Status](https://travis-ci.org/vim-airline/vim-airline.png)](https://travis-ci.org/vim-airline/vim-airline) |
|
2 |
+ |
|
3 |
+Lean & mean status/tabline for vim that's light as air. |
|
4 |
+ |
|
5 |
+![img](https://github.com/vim-airline/vim-airline/wiki/screenshots/demo.gif) |
|
6 |
+ |
|
7 |
+When the plugin is correctly loaded, Vim will draw a nice statusline at the |
|
8 |
+bottom of each window. |
|
9 |
+ |
|
10 |
+That line consists of several sections, each one displaying some piece of |
|
11 |
+information. By default (without configuration) this line will look like this: |
|
12 |
+ |
|
13 |
+``` |
|
14 |
++-----------------------------------------------------------------------------+ |
|
15 |
+|~ | |
|
16 |
+|~ | |
|
17 |
+|~ VIM - Vi IMproved | |
|
18 |
+|~ | |
|
19 |
+|~ version 8.0 | |
|
20 |
+|~ by Bram Moolenaar et al. | |
|
21 |
+|~ Vim is open source and freely distributable | |
|
22 |
+|~ | |
|
23 |
+|~ type :h :q<Enter> to exit | |
|
24 |
+|~ type :help<Enter> or <F1> for on-line help | |
|
25 |
+|~ type :help version8<Enter> for version info | |
|
26 |
+|~ | |
|
27 |
+|~ | |
|
28 |
++-----------------------------------------------------------------------------+ |
|
29 |
+| A | B | C X | Y | Z | [...] | |
|
30 |
++-----------------------------------------------------------------------------+ |
|
31 |
+``` |
|
32 |
+ |
|
33 |
+The statusline is the colored line at the bottom, which contains the sections |
|
34 |
+(possibly in different colors): |
|
35 |
+ |
|
36 |
+section|meaning (example) |
|
37 |
+-------|------------------ |
|
38 |
+ A | displays the mode + additional flags like crypt/spell/paste (INSERT) |
|
39 |
+ B | VCS information (branch, hunk summary) (master) |
|
40 |
+ C | filename + read-only flag (~/.vim/vimrc RO) |
|
41 |
+ X | filetype (vim) |
|
42 |
+ Y | file encoding[fileformat] (utf-8[unix]) |
|
43 |
+ Z | current position in the file |
|
44 |
+ [...] | additional sections (warning/errors/statistics) from external plugins (e.g. YCM, syntastic, ...) |
|
45 |
+ |
|
46 |
+The information in Section Z looks like this: |
|
47 |
+ |
|
48 |
+`10% ☰ 10/100 ln : 20` |
|
49 |
+ |
|
50 |
+This means: |
|
51 |
+``` |
|
52 |
+10% - 10 percent down the top of the file |
|
53 |
+☰ 10 - current line 10 |
|
54 |
+/100 ln - of 100 lines |
|
55 |
+: 20 - current column 20 |
|
56 |
+``` |
|
57 |
+ |
|
58 |
+For a better look, those sections can be colored differently, depending on various conditions |
|
59 |
+(e.g. the mode or whether the current file is 'modified') |
|
60 |
+ |
|
61 |
+# Features |
|
62 |
+ |
|
63 |
+* Tiny core written with extensibility in mind ([open/closed principle][8]). |
|
64 |
+* Integrates with a variety of plugins, including: [vim-bufferline][6], |
|
65 |
+ [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], |
|
66 |
+ [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], |
|
67 |
+ [vim-signify][30], [quickfixsigns][39], [syntastic][5], [eclim][34], |
|
68 |
+ [lawrencium][21], [virtualenv][31], [tmuxline][35], [taboo.vim][37], |
|
69 |
+ [ctrlspace][38], [vim-bufmru][47], [vimagit][50], [denite][51] and more. |
|
70 |
+* Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols. |
|
71 |
+* Optimized for speed; it loads in under a millisecond. |
|
72 |
+* 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. |
|
73 |
+ Note these are now external to this plugin. See [below][46] for detail. |
|
74 |
+* Supports 7.2 as the minimum Vim version. |
|
75 |
+* 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]. |
|
76 |
+* Unit testing suite. |
|
77 |
+ |
|
78 |
+## Straightforward customization |
|
79 |
+ |
|
80 |
+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. |
|
81 |
+ |
|
82 |
+![image](https://f.cloud.github.com/assets/306502/1009429/d69306da-0b38-11e3-94bf-7c6e3eef41e9.png) |
|
83 |
+ |
|
84 |
+## Themes |
|
85 |
+ |
|
86 |
+Themes have moved to |
|
87 |
+another repository as of [this commit][45]. |
|
88 |
+ |
|
89 |
+Install the themes as you would this plugin (Vundle example): |
|
90 |
+ |
|
91 |
+```vim |
|
92 |
+Plugin 'vim-airline/vim-airline' |
|
93 |
+Plugin 'vim-airline/vim-airline-themes' |
|
94 |
+``` |
|
95 |
+ |
|
96 |
+See https://github.com/vim-airline/vim-airline-themes for more. |
|
97 |
+ |
|
98 |
+## Automatic truncation |
|
99 |
+ |
|
100 |
+Sections and parts within sections can be configured to automatically hide when the window size shrinks. |
|
101 |
+ |
|
102 |
+![image](https://f.cloud.github.com/assets/306502/1060831/05c08aac-11bc-11e3-8470-a506a3037f45.png) |
|
103 |
+ |
|
104 |
+## Smarter tab line |
|
105 |
+ |
|
106 |
+Automatically displays all buffers when there's only one tab open. |
|
107 |
+ |
|
108 |
+![tabline](https://f.cloud.github.com/assets/306502/1072623/44c292a0-1495-11e3-9ce6-dcada3f1c536.gif) |
|
109 |
+ |
|
110 |
+This is disabled by default; add the following to your vimrc to enable the extension: |
|
111 |
+ |
|
112 |
+ let g:airline#extensions#tabline#enabled = 1 |
|
113 |
+ |
|
114 |
+Separators can be configured independently for the tabline, so here is how you can define "straight" tabs: |
|
115 |
+ |
|
116 |
+ let g:airline#extensions#tabline#left_sep = ' ' |
|
117 |
+ let g:airline#extensions#tabline#left_alt_sep = '|' |
|
118 |
+ |
|
119 |
+In addition, you can also choose which path formatter airline uses. This affects how file paths are |
|
120 |
+displayed in each individual tab as well as the current buffer indicator in the upper right. |
|
121 |
+To do so, set the `formatter` field with: |
|
122 |
+ |
|
123 |
+ let g:airline#extensions#tabline#formatter = 'default' |
|
124 |
+ |
|
125 |
+Here is a complete list of formatters with screenshots: |
|
126 |
+ |
|
127 |
+#### `default` |
|
128 |
+![image](https://user-images.githubusercontent.com/2652762/34422844-1d005efa-ebe6-11e7-8053-c784c0da7ba7.png) |
|
129 |
+ |
|
130 |
+#### `jsformatter` |
|
131 |
+![image](https://user-images.githubusercontent.com/2652762/34422843-1cf6a4d2-ebe6-11e7-810a-07e6eb08de24.png) |
|
132 |
+ |
|
133 |
+#### `unique_tail` |
|
134 |
+![image](https://user-images.githubusercontent.com/2652762/34422841-1ce5b4ec-ebe6-11e7-86e9-3d45c876068b.png) |
|
135 |
+ |
|
136 |
+#### `unique_tail_improved` |
|
137 |
+![image](https://user-images.githubusercontent.com/2652762/34422842-1cee23f2-ebe6-11e7-962d-97e068873077.png) |
|
138 |
+ |
|
139 |
+## Seamless integration |
|
140 |
+ |
|
141 |
+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). |
|
142 |
+ |
|
143 |
+#### [ctrlp.vim][10] |
|
144 |
+![image](https://f.cloud.github.com/assets/306502/962258/7345a224-04ec-11e3-8b5a-f11724a47437.png) |
|
145 |
+ |
|
146 |
+#### [unite.vim][9] |
|
147 |
+![image](https://f.cloud.github.com/assets/306502/962319/4d7d3a7e-04ed-11e3-9d59-ab29cb310ff8.png) |
|
148 |
+ |
|
149 |
+#### [denite.nvim][51] |
|
150 |
+![image](https://cloud.githubusercontent.com/assets/246230/23939717/f65bce6e-099c-11e7-85c3-918dbc839392.png) |
|
151 |
+ |
|
152 |
+#### [tagbar][19] |
|
153 |
+![image](https://f.cloud.github.com/assets/306502/962150/7e7bfae6-04ea-11e3-9e28-32af206aed80.png) |
|
154 |
+ |
|
155 |
+#### [csv.vim][28] |
|
156 |
+![image](https://f.cloud.github.com/assets/306502/962204/cfc1210a-04eb-11e3-8a93-42e6bcd21efa.png) |
|
157 |
+ |
|
158 |
+#### [syntastic][5] |
|
159 |
+![image](https://f.cloud.github.com/assets/306502/962864/9824c484-04f7-11e3-9928-da94f8c7da5a.png) |
|
160 |
+ |
|
161 |
+#### hunks ([vim-gitgutter][29] & [vim-signify][30]) |
|
162 |
+![image](https://f.cloud.github.com/assets/306502/995185/73fc7054-09b9-11e3-9d45-618406c6ed98.png) |
|
163 |
+ |
|
164 |
+#### [vimagit][50] |
|
165 |
+![vim-airline-vimagit-demo](https://cloud.githubusercontent.com/assets/533068/22107273/2ea85ba0-de4d-11e6-9fa8-331103b88df4.gif) |
|
166 |
+ |
|
167 |
+#### [virtualenv][31] |
|
168 |
+![image](https://f.cloud.github.com/assets/390964/1022566/cf81f830-0d98-11e3-904f-cf4fe3ce201e.png) |
|
169 |
+ |
|
170 |
+#### [tmuxline][35] |
|
171 |
+![image](https://f.cloud.github.com/assets/1532071/1559276/4c28fbac-4fc7-11e3-90ef-7e833d980f98.gif) |
|
172 |
+ |
|
173 |
+#### [promptline][36] |
|
174 |
+![airline-promptline-sc](https://f.cloud.github.com/assets/1532071/1871900/7d4b28a0-789d-11e3-90e4-16f37269981b.gif) |
|
175 |
+ |
|
176 |
+#### [ctrlspace][38] |
|
177 |
+![papercolor_with_ctrlspace](https://cloud.githubusercontent.com/assets/493242/12912041/7fc3c6ec-cf16-11e5-8775-8492b9c64ebf.png) |
|
178 |
+ |
|
179 |
+#### [xkb-switch][48]/[xkb-layout][49] |
|
180 |
+![image](https://cloud.githubusercontent.com/assets/5715281/22061422/347e7842-ddb8-11e6-8bdb-7abbd418653c.gif) |
|
181 |
+ |
|
182 |
+#### [vimtex][53] |
|
183 |
+![image](https://cloud.githubusercontent.com/assets/1798172/25799740/e77d5c2e-33ee-11e7-8660-d34ce4c5f13f.png) |
|
184 |
+ |
|
185 |
+#### [localsearch][54] |
|
186 |
+![image](https://raw.githubusercontent.com/mox-mox/vim-localsearch/master/vim-airline-localsearch-indicator.png) |
|
187 |
+ |
|
188 |
+## Extras |
|
189 |
+ |
|
190 |
+vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also: |
|
191 |
+ |
|
192 |
+#### whitespace |
|
193 |
+![image](https://f.cloud.github.com/assets/306502/962401/2a75385e-04ef-11e3-935c-e3b9f0e954cc.png) |
|
194 |
+ |
|
195 |
+## Configurable and extensible |
|
196 |
+ |
|
197 |
+#### Fine-tuned configuration |
|
198 |
+ |
|
199 |
+Every section is composed of parts, and you can reorder and reconfigure them at will. |
|
200 |
+ |
|
201 |
+![image](https://f.cloud.github.com/assets/306502/1073278/f291dd4c-14a3-11e3-8a83-268e2753f97d.png) |
|
202 |
+ |
|
203 |
+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)). |
|
204 |
+ |
|
205 |
+![image](https://f.cloud.github.com/assets/306502/1195815/4bfa38d0-249d-11e3-823e-773cfc2ca894.png) |
|
206 |
+ |
|
207 |
+#### Extensible pipeline |
|
208 |
+ |
|
209 |
+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. |
|
210 |
+ |
|
211 |
+![allyourbase](https://f.cloud.github.com/assets/306502/1022714/e150034a-0da7-11e3-94a5-ca9d58a297e8.png) |
|
212 |
+ |
|
213 |
+# Rationale |
|
214 |
+ |
|
215 |
+There's already [powerline][2], why yet another statusline? |
|
216 |
+ |
|
217 |
+* 100% vimscript; no python needed. |
|
218 |
+ |
|
219 |
+What about [vim-powerline][1]? |
|
220 |
+ |
|
221 |
+* 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. |
|
222 |
+ |
|
223 |
+# Where did the name come from? |
|
224 |
+ |
|
225 |
+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! |
|
226 |
+ |
|
227 |
+# Installation |
|
228 |
+ |
|
229 |
+This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers: |
|
230 |
+ |
|
231 |
+| Plugin Manager | Install with... | |
|
232 |
+| ------------- | ------------- | |
|
233 |
+| [Pathogen][11] | `git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline`<br/>Remember to run `:Helptags` to generate help tags | |
|
234 |
+| [NeoBundle][12] | `NeoBundle 'vim-airline/vim-airline'` | |
|
235 |
+| [Vundle][13] | `Plugin 'vim-airline/vim-airline'` | |
|
236 |
+| [Plug][40] | `Plug 'vim-airline/vim-airline'` | |
|
237 |
+| [VAM][22] | `call vam#ActivateAddons([ 'vim-airline' ])` | |
|
238 |
+| [Dein][52] | `call dein#add('vim-airline/vim-airline')` | |
|
239 |
+| [minpac][55] | `call minpac#add('vim-airline/vim-airline')` | |
|
240 |
+| pack feature (native Vim 8 package feature)| `git clone https://github.com/vim-airline/vim-airline ~/.vim/pack/dist/start/vim-airline`<br/>Remember to run `:helptags` to generate help tags | |
|
241 |
+| manual | copy all of the files into your `~/.vim` directory | |
|
242 |
+ |
|
243 |
+# Documentation |
|
244 |
+ |
|
245 |
+`:help airline` |
|
246 |
+ |
|
247 |
+# Integrating with powerline fonts |
|
248 |
+ |
|
249 |
+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. |
|
250 |
+ |
|
251 |
+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. |
|
252 |
+ |
|
253 |
+# FAQ |
|
254 |
+ |
|
255 |
+Solutions to common problems can be found in the [Wiki][27]. |
|
256 |
+ |
|
257 |
+# Performance |
|
258 |
+ |
|
259 |
+Whoa! Everything got slow all of a sudden... |
|
260 |
+ |
|
261 |
+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. |
|
262 |
+ |
|
263 |
+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. |
|
264 |
+ |
|
265 |
+The [minivimrc][7] project has some helper mappings to troubleshoot performance related issues. |
|
266 |
+ |
|
267 |
+If you don't want all the bells and whistles enabled by default, you can define a value for `g:airline_extensions`. When this variable is defined, only the extensions listed will be loaded; an empty array would effectively disable all extensions (e.g. `:let g:airline_extensions = []`). |
|
268 |
+ |
|
269 |
+Also, you can enable caching of the various syntax highlighting groups. This will try to prevent some of the more expensive `:hi` calls in Vim, which seem to be expensive in the Vim core at the expense of possibly not being hunderet percent correct all the times (especially if you often change highlighting groups yourself using `:hi` commands). To set this up do `:let g:airline_highlighting_cache = 1`. A `:AirlineRefresh` will however clear the cache. |
|
270 |
+ |
|
271 |
+In addition you might want to check out the [dark_minimal theme][56], which does not change highlighting groups once they are defined. Also please check the [FAQ][27] for more information on how to diagnose and fix the problem. |
|
272 |
+ |
|
273 |
+# Screenshots |
|
274 |
+ |
|
275 |
+A full list of screenshots for various themes can be found in the [Wiki][14]. |
|
276 |
+ |
|
277 |
+# Maintainers |
|
278 |
+ |
|
279 |
+The project is currently being maintained by [Bailey Ling][41], [Christian Brabandt][42], and [Mike Hartington][44]. |
|
280 |
+ |
|
281 |
+If you are interested in becoming a maintainer (we always welcome more maintainers), please [go here][43]. |
|
282 |
+ |
|
283 |
+# License |
|
284 |
+ |
|
285 |
+MIT License. Copyright (c) 2013-2017 Bailey Ling & Contributors. |
|
286 |
+ |
|
287 |
+[1]: https://github.com/Lokaltog/vim-powerline |
|
288 |
+[2]: https://github.com/Lokaltog/powerline |
|
289 |
+[3]: https://github.com/Lokaltog/powerline-fonts |
|
290 |
+[4]: https://github.com/tpope/vim-fugitive |
|
291 |
+[5]: https://github.com/scrooloose/syntastic |
|
292 |
+[6]: https://github.com/bling/vim-bufferline |
|
293 |
+[7]: https://github.com/bling/minivimrc |
|
294 |
+[8]: http://en.wikipedia.org/wiki/Open/closed_principle |
|
295 |
+[9]: https://github.com/Shougo/unite.vim |
|
296 |
+[10]: https://github.com/ctrlpvim/ctrlp.vim |
|
297 |
+[11]: https://github.com/tpope/vim-pathogen |
|
298 |
+[12]: https://github.com/Shougo/neobundle.vim |
|
299 |
+[13]: https://github.com/VundleVim/Vundle.vim |
|
300 |
+[14]: https://github.com/vim-airline/vim-airline/wiki/Screenshots |
|
301 |
+[15]: https://github.com/techlivezheng/vim-plugin-minibufexpl |
|
302 |
+[16]: https://github.com/sjl/gundo.vim |
|
303 |
+[17]: https://github.com/mbbill/undotree |
|
304 |
+[18]: https://github.com/scrooloose/nerdtree |
|
305 |
+[19]: https://github.com/majutsushi/tagbar |
|
306 |
+[20]: https://powerline.readthedocs.org/en/master/installation.html#patched-fonts |
|
307 |
+[21]: https://bitbucket.org/ludovicchabant/vim-lawrencium |
|
308 |
+[22]: https://github.com/MarcWeber/vim-addon-manager |
|
309 |
+[23]: https://github.com/altercation/solarized |
|
310 |
+[24]: https://github.com/chriskempson/tomorrow-theme |
|
311 |
+[25]: https://github.com/tomasr/molokai |
|
312 |
+[26]: https://github.com/nanotech/jellybeans.vim |
|
313 |
+[27]: https://github.com/vim-airline/vim-airline/wiki/FAQ |
|
314 |
+[28]: https://github.com/chrisbra/csv.vim |
|
315 |
+[29]: https://github.com/airblade/vim-gitgutter |
|
316 |
+[30]: https://github.com/mhinz/vim-signify |
|
317 |
+[31]: https://github.com/jmcantrell/vim-virtualenv |
|
318 |
+[32]: https://github.com/chriskempson/base16-vim |
|
319 |
+[33]: https://github.com/vim-airline/vim-airline/wiki/Test-Plan |
|
320 |
+[34]: http://eclim.org |
|
321 |
+[35]: https://github.com/edkolev/tmuxline.vim |
|
322 |
+[36]: https://github.com/edkolev/promptline.vim |
|
323 |
+[37]: https://github.com/gcmt/taboo.vim |
|
324 |
+[38]: https://github.com/szw/vim-ctrlspace |
|
325 |
+[39]: https://github.com/tomtom/quickfixsigns_vim |
|
326 |
+[40]: https://github.com/junegunn/vim-plug |
|
327 |
+[41]: https://github.com/bling |
|
328 |
+[42]: https://github.com/chrisbra |
|
329 |
+[43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer |
|
330 |
+[44]: https://github.com/mhartington |
|
331 |
+[45]: https://github.com/vim-airline/vim-airline/commit/d7fd8ca649e441b3865551a325b10504cdf0711b |
|
332 |
+[46]: https://github.com/vim-airline/vim-airline#themes |
|
333 |
+[47]: https://github.com/mildred/vim-bufmru |
|
334 |
+[48]: https://github.com/ierton/xkb-switch |
|
335 |
+[49]: https://github.com/vovkasm/input-source-switcher |
|
336 |
+[50]: https://github.com/jreybert/vimagit |
|
337 |
+[51]: https://github.com/Shougo/denite.nvim |
|
338 |
+[52]: https://github.com/Shougo/dein.vim |
|
339 |
+[53]: https://github.com/lervag/vimtex |
|
340 |
+[54]: https://github.com/mox-mox/vim-localsearch |
|
341 |
+[55]: https://github.com/k-takata/minpac/ |
|
342 |
+[56]: https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/dark_minimal.vim |
... | ... |
@@ -0,0 +1,196 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', []) |
|
7 |
+ |
|
8 |
+let s:sections = ['a','b','c','gutter','x','y','z', 'error', 'warning'] |
|
9 |
+let s:inactive_funcrefs = [] |
|
10 |
+ |
|
11 |
+function! airline#add_statusline_func(name) |
|
12 |
+ call airline#add_statusline_funcref(function(a:name)) |
|
13 |
+endfunction |
|
14 |
+ |
|
15 |
+function! airline#add_statusline_funcref(function) |
|
16 |
+ if index(g:airline_statusline_funcrefs, a:function) >= 0 |
|
17 |
+ echohl WarningMsg |
|
18 |
+ echo 'The airline statusline funcref '.string(a:function).' has already been added.' |
|
19 |
+ echohl NONE |
|
20 |
+ return |
|
21 |
+ endif |
|
22 |
+ call add(g:airline_statusline_funcrefs, a:function) |
|
23 |
+endfunction |
|
24 |
+ |
|
25 |
+function! airline#remove_statusline_func(name) |
|
26 |
+ let i = index(g:airline_statusline_funcrefs, function(a:name)) |
|
27 |
+ if i > -1 |
|
28 |
+ call remove(g:airline_statusline_funcrefs, i) |
|
29 |
+ endif |
|
30 |
+endfunction |
|
31 |
+ |
|
32 |
+function! airline#add_inactive_statusline_func(name) |
|
33 |
+ call add(s:inactive_funcrefs, function(a:name)) |
|
34 |
+endfunction |
|
35 |
+ |
|
36 |
+function! airline#load_theme() |
|
37 |
+ let g:airline_theme = get(g:, 'airline_theme', 'dark') |
|
38 |
+ if exists('*airline#themes#{g:airline_theme}#refresh') |
|
39 |
+ call airline#themes#{g:airline_theme}#refresh() |
|
40 |
+ endif |
|
41 |
+ |
|
42 |
+ let palette = g:airline#themes#{g:airline_theme}#palette |
|
43 |
+ call airline#themes#patch(palette) |
|
44 |
+ |
|
45 |
+ if exists('g:airline_theme_patch_func') |
|
46 |
+ let Fn = function(g:airline_theme_patch_func) |
|
47 |
+ call Fn(palette) |
|
48 |
+ endif |
|
49 |
+ |
|
50 |
+ call airline#highlighter#load_theme() |
|
51 |
+ call airline#extensions#load_theme() |
|
52 |
+ call airline#update_statusline() |
|
53 |
+endfunction |
|
54 |
+ |
|
55 |
+function! airline#switch_theme(name) |
|
56 |
+ try |
|
57 |
+ let palette = g:airline#themes#{a:name}#palette "also lazy loads the theme |
|
58 |
+ let g:airline_theme = a:name |
|
59 |
+ catch |
|
60 |
+ echohl WarningMsg | echo 'The specified theme cannot be found.' | echohl NONE |
|
61 |
+ if exists('g:airline_theme') |
|
62 |
+ return |
|
63 |
+ else |
|
64 |
+ let g:airline_theme = 'dark' |
|
65 |
+ endif |
|
66 |
+ endtry |
|
67 |
+ |
|
68 |
+ let w:airline_lastmode = '' |
|
69 |
+ call airline#load_theme() |
|
70 |
+ |
|
71 |
+ silent doautocmd User AirlineAfterTheme |
|
72 |
+ |
|
73 |
+ " this is required to prevent clobbering the startup info message, i don't know why... |
|
74 |
+ call airline#check_mode(winnr()) |
|
75 |
+endfunction |
|
76 |
+ |
|
77 |
+function! airline#switch_matching_theme() |
|
78 |
+ if exists('g:colors_name') |
|
79 |
+ let existing = g:airline_theme |
|
80 |
+ let theme = substitute(tolower(g:colors_name), '-', '_', 'g') |
|
81 |
+ try |
|
82 |
+ let palette = g:airline#themes#{theme}#palette |
|
83 |
+ call airline#switch_theme(theme) |
|
84 |
+ return 1 |
|
85 |
+ catch |
|
86 |
+ for map in items(g:airline_theme_map) |
|
87 |
+ if match(g:colors_name, map[0]) > -1 |
|
88 |
+ try |
|
89 |
+ let palette = g:airline#themes#{map[1]}#palette |
|
90 |
+ call airline#switch_theme(map[1]) |
|
91 |
+ catch |
|
92 |
+ call airline#switch_theme(existing) |
|
93 |
+ endtry |
|
94 |
+ return 1 |
|
95 |
+ endif |
|
96 |
+ endfor |
|
97 |
+ endtry |
|
98 |
+ endif |
|
99 |
+ return 0 |
|
100 |
+endfunction |
|
101 |
+ |
|
102 |
+function! airline#update_statusline() |
|
103 |
+ if airline#util#getwinvar(winnr(), 'airline_disabled', 0) |
|
104 |
+ return |
|
105 |
+ endif |
|
106 |
+ for nr in filter(range(1, winnr('$')), 'v:val != winnr()') |
|
107 |
+ if airline#util#getwinvar(nr, 'airline_disabled', 0) |
|
108 |
+ continue |
|
109 |
+ endif |
|
110 |
+ call setwinvar(nr, 'airline_active', 0) |
|
111 |
+ let context = { 'winnr': nr, 'active': 0, 'bufnr': winbufnr(nr) } |
|
112 |
+ call s:invoke_funcrefs(context, s:inactive_funcrefs) |
|
113 |
+ endfor |
|
114 |
+ |
|
115 |
+ unlet! w:airline_render_left w:airline_render_right |
|
116 |
+ exe 'unlet! ' 'w:airline_section_'. join(s:sections, ' w:airline_section_') |
|
117 |
+ |
|
118 |
+ let w:airline_active = 1 |
|
119 |
+ let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) } |
|
120 |
+ call s:invoke_funcrefs(context, g:airline_statusline_funcrefs) |
|
121 |
+endfunction |
|
122 |
+ |
|
123 |
+let s:contexts = {} |
|
124 |
+let s:core_funcrefs = [ |
|
125 |
+ \ function('airline#extensions#apply'), |
|
126 |
+ \ function('airline#extensions#default#apply') ] |
|
127 |
+function! s:invoke_funcrefs(context, funcrefs) |
|
128 |
+ let builder = airline#builder#new(a:context) |
|
129 |
+ let err = airline#util#exec_funcrefs(a:funcrefs + s:core_funcrefs, builder, a:context) |
|
130 |
+ if err == 1 |
|
131 |
+ let a:context.line = builder.build() |
|
132 |
+ let s:contexts[a:context.winnr] = a:context |
|
133 |
+ call setwinvar(a:context.winnr, '&statusline', '%!airline#statusline('.a:context.winnr.')') |
|
134 |
+ endif |
|
135 |
+endfunction |
|
136 |
+ |
|
137 |
+function! airline#statusline(winnr) |
|
138 |
+ if has_key(s:contexts, a:winnr) |
|
139 |
+ return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line |
|
140 |
+ endif |
|
141 |
+ |
|
142 |
+ " in rare circumstances this happens...see #276 |
|
143 |
+ return '' |
|
144 |
+endfunction |
|
145 |
+ |
|
146 |
+function! airline#check_mode(winnr) |
|
147 |
+ let context = s:contexts[a:winnr] |
|
148 |
+ |
|
149 |
+ if get(w:, 'airline_active', 1) |
|
150 |
+ let l:m = mode() |
|
151 |
+ if l:m ==# "i" |
|
152 |
+ let l:mode = ['insert'] |
|
153 |
+ elseif l:m ==# "R" |
|
154 |
+ let l:mode = ['replace'] |
|
155 |
+ elseif l:m =~# '\v(v|V||s|S|)' |
|
156 |
+ let l:mode = ['visual'] |
|
157 |
+ elseif l:m ==# "t" |
|
158 |
+ let l:mode = ['terminal'] |
|
159 |
+ else |
|
160 |
+ let l:mode = ['normal'] |
|
161 |
+ endif |
|
162 |
+ let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m) |
|
163 |
+ else |
|
164 |
+ let l:mode = ['inactive'] |
|
165 |
+ let w:airline_current_mode = get(g:airline_mode_map, '__') |
|
166 |
+ endif |
|
167 |
+ |
|
168 |
+ if g:airline_detect_modified && &modified |
|
169 |
+ call add(l:mode, 'modified') |
|
170 |
+ endif |
|
171 |
+ |
|
172 |
+ if g:airline_detect_paste && &paste |
|
173 |
+ call add(l:mode, 'paste') |
|
174 |
+ endif |
|
175 |
+ |
|
176 |
+ if g:airline_detect_crypt && exists("+key") && !empty(&key) |
|
177 |
+ call add(l:mode, 'crypt') |
|
178 |
+ endif |
|
179 |
+ |
|
180 |
+ if g:airline_detect_spell && &spell |
|
181 |
+ call add(l:mode, 'spell') |
|
182 |
+ endif |
|
183 |
+ |
|
184 |
+ if &readonly || ! &modifiable |
|
185 |
+ call add(l:mode, 'readonly') |
|
186 |
+ endif |
|
187 |
+ |
|
188 |
+ let mode_string = join(l:mode) |
|
189 |
+ if get(w:, 'airline_lastmode', '') != mode_string |
|
190 |
+ call airline#highlighter#highlight_modified_inactive(context.bufnr) |
|
191 |
+ call airline#highlighter#highlight(l:mode, context.bufnr) |
|
192 |
+ let w:airline_lastmode = mode_string |
|
193 |
+ endif |
|
194 |
+ |
|
195 |
+ return '' |
|
196 |
+endfunction |
... | ... |
@@ -0,0 +1,259 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 C.Brabandt et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:untracked_jobs = {} |
|
7 |
+let s:mq_jobs = {} |
|
8 |
+let s:po_jobs = {} |
|
9 |
+ |
|
10 |
+" Generic functions handling on exit event of the various async functions |
|
11 |
+function! s:untracked_output(dict, buf) |
|
12 |
+ if a:buf =~? ('^'. a:dict.cfg['untracked_mark']) |
|
13 |
+ let a:dict.cfg.untracked[a:dict.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) |
|
14 |
+ else |
|
15 |
+ let a:dict.cfg.untracked[a:dict.file] = '' |
|
16 |
+ endif |
|
17 |
+endfunction |
|
18 |
+ |
|
19 |
+" also called from branch extension (for non-async vims) |
|
20 |
+function! airline#async#mq_output(buf, file) |
|
21 |
+ let buf=a:buf |
|
22 |
+ if !empty(a:buf) |
|
23 |
+ if a:buf =~# 'no patches applied' || |
|
24 |
+ \ a:buf =~# "unknown command 'qtop'" || |
|
25 |
+ \ a:buf =~# "abort" |
|
26 |
+ let buf = '' |
|
27 |
+ elseif exists("b:mq") && b:mq isnot# buf |
|
28 |
+ " make sure, statusline is updated |
|
29 |
+ unlet! b:airline_head |
|
30 |
+ endif |
|
31 |
+ let b:mq = buf |
|
32 |
+ endif |
|
33 |
+ if has_key(s:mq_jobs, a:file) |
|
34 |
+ call remove(s:mq_jobs, a:file) |
|
35 |
+ endif |
|
36 |
+endfunction |
|
37 |
+ |
|
38 |
+function! s:po_output(buf, file) |
|
39 |
+ if !empty(a:buf) |
|
40 |
+ let b:airline_po_stats = printf("[%s]", a:buf) |
|
41 |
+ else |
|
42 |
+ let b:airline_po_stats = '' |
|
43 |
+ endif |
|
44 |
+ if has_key(s:po_jobs, a:file) |
|
45 |
+ call remove(s:po_jobs, a:file) |
|
46 |
+ endif |
|
47 |
+endfunction |
|
48 |
+ |
|
49 |
+function! s:valid_dir(dir) |
|
50 |
+ if empty(a:dir) || !isdirectory(a:dir) |
|
51 |
+ return getcwd() |
|
52 |
+ endif |
|
53 |
+ return a:dir |
|
54 |
+endfunction |
|
55 |
+ |
|
56 |
+if v:version >= 800 && has("job") |
|
57 |
+ " Vim 8.0 with Job feature |
|
58 |
+ " TODO: Check if we need the cwd option for the job_start() functions |
|
59 |
+ " (only works starting with Vim 8.0.0902) |
|
60 |
+ |
|
61 |
+ function! s:on_stdout(channel, msg) dict abort |
|
62 |
+ let self.buf .= a:msg |
|
63 |
+ endfunction |
|
64 |
+ |
|
65 |
+ function! s:on_exit_mq(channel) dict abort |
|
66 |
+ call airline#async#mq_output(self.buf, self.file) |
|
67 |
+ endfunction |
|
68 |
+ |
|
69 |
+ function! s:on_exit_untracked(channel) dict abort |
|
70 |
+ call s:untracked_output(self, self.buf) |
|
71 |
+ if has_key(s:untracked_jobs, self.file) |
|
72 |
+ call remove(s:untracked_jobs, self.file) |
|
73 |
+ endif |
|
74 |
+ endfunction |
|
75 |
+ |
|
76 |
+ function! s:on_exit_po(channel) dict abort |
|
77 |
+ call s:po_output(self.buf, self.file) |
|
78 |
+ call airline#extensions#po#shorten() |
|
79 |
+ endfunction |
|
80 |
+ |
|
81 |
+ function! airline#async#get_mq_async(cmd, file) |
|
82 |
+ if g:airline#init#is_windows && &shell =~ 'cmd' |
|
83 |
+ let cmd = a:cmd |
|
84 |
+ else |
|
85 |
+ let cmd = ['sh', '-c', a:cmd] |
|
86 |
+ endif |
|
87 |
+ |
|
88 |
+ let options = {'cmd': a:cmd, 'buf': '', 'file': a:file} |
|
89 |
+ if has_key(s:mq_jobs, a:file) |
|
90 |
+ if job_status(get(s:mq_jobs, a:file)) == 'run' |
|
91 |
+ return |
|
92 |
+ elseif has_key(s:mq_jobs, a:file) |
|
93 |
+ call remove(s:mq_jobs, a:file) |
|
94 |
+ endif |
|
95 |
+ endif |
|
96 |
+ let id = job_start(cmd, { |
|
97 |
+ \ 'err_io': 'out', |
|
98 |
+ \ 'out_cb': function('s:on_stdout', options), |
|
99 |
+ \ 'close_cb': function('s:on_exit_mq', options)}) |
|
100 |
+ let s:mq_jobs[a:file] = id |
|
101 |
+ endfunction |
|
102 |
+ |
|
103 |
+ function! airline#async#get_msgfmt_stat(cmd, file) |
|
104 |
+ if g:airline#init#is_windows || !executable('msgfmt') |
|
105 |
+ " no msgfmt on windows? |
|
106 |
+ return |
|
107 |
+ else |
|
108 |
+ let cmd = ['sh', '-c', a:cmd. shellescape(a:file)] |
|
109 |
+ endif |
|
110 |
+ |
|
111 |
+ let options = {'buf': '', 'file': a:file} |
|
112 |
+ if has_key(s:po_jobs, a:file) |
|
113 |
+ if job_status(get(s:po_jobs, a:file)) == 'run' |
|
114 |
+ return |
|
115 |
+ elseif has_key(s:po_jobs, a:file) |
|
116 |
+ call remove(s:po_jobs, a:file) |
|
117 |
+ endif |
|
118 |
+ endif |
|
119 |
+ let id = job_start(cmd, { |
|
120 |
+ \ 'err_io': 'out', |
|
121 |
+ \ 'out_cb': function('s:on_stdout', options), |
|
122 |
+ \ 'close_cb': function('s:on_exit_po', options)}) |
|
123 |
+ let s:po_jobs[a:file] = id |
|
124 |
+ endfunction |
|
125 |
+ |
|
126 |
+ function airline#async#vim_vcs_untracked(config, file) |
|
127 |
+ if g:airline#init#is_windows && &shell =~ 'cmd' |
|
128 |
+ let cmd = a:config['cmd'] . shellescape(a:file) |
|
129 |
+ else |
|
130 |
+ let cmd = ['sh', '-c', a:config['cmd'] . shellescape(a:file)] |
|
131 |
+ endif |
|
132 |
+ |
|
133 |
+ let options = {'cfg': a:config, 'buf': '', 'file': a:file} |
|
134 |
+ if has_key(s:untracked_jobs, a:file) |
|
135 |
+ if job_status(get(s:untracked_jobs, a:file)) == 'run' |
|
136 |
+ return |
|
137 |
+ elseif has_key(s:untracked_jobs, a:file) |
|
138 |
+ call remove(s:untracked_jobs, a:file) |
|
139 |
+ endif |
|
140 |
+ endif |
|
141 |
+ let id = job_start(cmd, { |
|
142 |
+ \ 'err_io': 'out', |
|
143 |
+ \ 'out_cb': function('s:on_stdout', options), |
|
144 |
+ \ 'close_cb': function('s:on_exit_untracked', options)}) |
|
145 |
+ let s:untracked_jobs[a:file] = id |
|
146 |
+ endfunction |
|
147 |
+ |
|
148 |
+elseif has("nvim") |
|
149 |
+ " NVim specific functions |
|
150 |
+ |
|
151 |
+ function! s:nvim_output_handler(job_id, data, event) dict |
|
152 |
+ if a:event == 'stdout' || a:event == 'stderr' |
|
153 |
+ let self.buf .= join(a:data) |
|
154 |
+ endif |
|
155 |
+ endfunction |
|
156 |
+ |
|
157 |
+ function! s:nvim_untracked_job_handler(job_id, data, event) dict |
|
158 |
+ if a:event == 'exit' |
|
159 |
+ call s:untracked_output(self, self.buf) |
|
160 |
+ if has_key(s:untracked_jobs, self.file) |
|
161 |
+ call remove(s:untracked_jobs, self.file) |
|
162 |
+ endif |
|
163 |
+ endif |
|
164 |
+ endfunction |
|
165 |
+ |
|
166 |
+ function! s:nvim_mq_job_handler(job_id, data, event) dict |
|
167 |
+ if a:event == 'exit' |
|
168 |
+ call airline#async#mq_output(self.buf, self.file) |
|
169 |
+ endif |
|
170 |
+ endfunction |
|
171 |
+ |
|
172 |
+ function! s:nvim_po_job_handler(job_id, data, event) dict |
|
173 |
+ if a:event == 'exit' |
|
174 |
+ call s:po_output(self.buf, self.file) |
|
175 |
+ call airline#extensions#po#shorten() |
|
176 |
+ endif |
|
177 |
+ endfunction |
|
178 |
+ |
|
179 |
+ function! airline#async#nvim_get_mq_async(cmd, file) |
|
180 |
+ let config = { |
|
181 |
+ \ 'buf': '', |
|
182 |
+ \ 'file': a:file, |
|
183 |
+ \ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')), |
|
184 |
+ \ 'on_stdout': function('s:nvim_output_handler'), |
|
185 |
+ \ 'on_stderr': function('s:nvim_output_handler'), |
|
186 |
+ \ 'on_exit': function('s:nvim_mq_job_handler') |
|
187 |
+ \ } |
|
188 |
+ if g:airline#init#is_windows && &shell =~ 'cmd' |
|
189 |
+ let cmd = a:cmd |
|
190 |
+ else |
|
191 |
+ let cmd = ['sh', '-c', a:cmd] |
|
192 |
+ endif |
|
193 |
+ |
|
194 |
+ if has_key(s:mq_jobs, a:file) |
|
195 |
+ call remove(s:mq_jobs, a:file) |
|
196 |
+ endif |
|
197 |
+ let id = jobstart(cmd, config) |
|
198 |
+ let s:mq_jobs[a:file] = id |
|
199 |
+ endfunction |
|
200 |
+ |
|
201 |
+ function! airline#async#nvim_get_msgfmt_stat(cmd, file) |
|
202 |
+ let config = { |
|
203 |
+ \ 'buf': '', |
|
204 |
+ \ 'file': a:file, |
|
205 |
+ \ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')), |
|
206 |
+ \ 'on_stdout': function('s:nvim_output_handler'), |
|
207 |
+ \ 'on_stderr': function('s:nvim_output_handler'), |
|
208 |
+ \ 'on_exit': function('s:nvim_po_job_handler') |
|
209 |
+ \ } |
|
210 |
+ if g:airline#init#is_windows && &shell =~ 'cmd' |
|
211 |
+ " no msgfmt on windows? |
|
212 |
+ return |
|
213 |
+ else |
|
214 |
+ let cmd = ['sh', '-c', a:cmd. shellescape(a:file)] |
|
215 |
+ endif |
|
216 |
+ |
|
217 |
+ if has_key(s:po_jobs, a:file) |
|
218 |
+ call remove(s:po_jobs, a:file) |
|
219 |
+ endif |
|
220 |
+ let id = jobstart(cmd, config) |
|
221 |
+ let s:po_jobs[a:file] = id |
|
222 |
+ endfunction |
|
223 |
+ |
|
224 |
+endif |
|
225 |
+ |
|
226 |
+" Should work in either Vim pre 8 or Nvim |
|
227 |
+function! airline#async#nvim_vcs_untracked(cfg, file, vcs) |
|
228 |
+ let cmd = a:cfg.cmd . shellescape(a:file) |
|
229 |
+ let id = -1 |
|
230 |
+ let config = { |
|
231 |
+ \ 'buf': '', |
|
232 |
+ \ 'vcs': a:vcs, |
|
233 |
+ \ 'cfg': a:cfg, |
|
234 |
+ \ 'file': a:file, |
|
235 |
+ \ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')) |
|
236 |
+ \ } |
|
237 |
+ if has("nvim") |
|
238 |
+ call extend(config, { |
|
239 |
+ \ 'on_stdout': function('s:nvim_output_handler'), |
|
240 |
+ \ 'on_exit': function('s:nvim_untracked_job_handler')}) |
|
241 |
+ if has_key(s:untracked_jobs, config.file) |
|
242 |
+ " still running |
|
243 |
+ return |
|
244 |
+ endif |
|
245 |
+ try |
|
246 |
+ let id = jobstart(cmd, config) |
|
247 |
+ catch |
|
248 |
+ " catch-all, jobstart() failed, fall back to system() |
|
249 |
+ let id=-1 |
|
250 |
+ endtry |
|
251 |
+ let s:untracked_jobs[a:file] = id |
|
252 |
+ endif |
|
253 |
+ " vim without job feature or nvim jobstart failed |
|
254 |
+ if id < 1 |
|
255 |
+ let output=system(cmd) |
|
256 |
+ call s:untracked_output(config, output) |
|
257 |
+ call airline#extensions#branch#update_untracked_config(a:file, a:vcs) |
|
258 |
+ endif |
|
259 |
+endfunction |
... | ... |
@@ -0,0 +1,243 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:prototype = {} |
|
7 |
+ |
|
8 |
+function! s:prototype.split(...) dict |
|
9 |
+ call add(self._sections, ['|', a:0 ? a:1 : '%=']) |
|
10 |
+endfunction |
|
11 |
+ |
|
12 |
+function! s:prototype.add_section_spaced(group, contents) dict |
|
13 |
+ let spc = empty(a:contents) ? '' : g:airline_symbols.space |
|
14 |
+ call self.add_section(a:group, spc.a:contents.spc) |
|
15 |
+endfunction |
|
16 |
+ |
|
17 |
+function! s:prototype.add_section(group, contents) dict |
|
18 |
+ call add(self._sections, [a:group, a:contents]) |
|
19 |
+endfunction |
|
20 |
+ |
|
21 |
+function! s:prototype.add_raw(text) dict |
|
22 |
+ call add(self._sections, ['', a:text]) |
|
23 |
+endfunction |
|
24 |
+ |
|
25 |
+function! s:prototype.insert_section(group, contents, position) dict |
|
26 |
+ call insert(self._sections, [a:group, a:contents], a:position) |
|
27 |
+endfunction |
|
28 |
+ |
|
29 |
+function! s:prototype.insert_raw(text, position) dict |
|
30 |
+ call insert(self._sections, ['', a:text], a:position) |
|
31 |
+endfunction |
|
32 |
+ |
|
33 |
+function! s:prototype.get_position() dict |
|
34 |
+ return len(self._sections) |
|
35 |
+endfunction |
|
36 |
+ |
|
37 |
+function! airline#builder#get_prev_group(sections, i) |
|
38 |
+ let x = a:i - 1 |
|
39 |
+ while x >= 0 |
|
40 |
+ let group = a:sections[x][0] |
|
41 |
+ if group != '' && group != '|' |
|
42 |
+ return group |
|
43 |
+ endif |
|
44 |
+ let x = x - 1 |
|
45 |
+ endwhile |
|
46 |
+ return '' |
|
47 |
+endfunction |
|
48 |
+ |
|
49 |
+function! airline#builder#get_next_group(sections, i) |
|
50 |
+ let x = a:i + 1 |
|
51 |
+ let l = len(a:sections) |
|
52 |
+ while x < l |
|
53 |
+ let group = a:sections[x][0] |
|
54 |
+ if group != '' && group != '|' |
|
55 |
+ return group |
|
56 |
+ endif |
|
57 |
+ let x = x + 1 |
|
58 |
+ endwhile |
|
59 |
+ return '' |
|
60 |
+endfunction |
|
61 |
+ |
|
62 |
+function! s:prototype.build() dict |
|
63 |
+ let side = 1 |
|
64 |
+ let line = '' |
|
65 |
+ let i = 0 |
|
66 |
+ let length = len(self._sections) |
|
67 |
+ let split = 0 |
|
68 |
+ let is_empty = 0 |
|
69 |
+ let prev_group = '' |
|
70 |
+ |
|
71 |
+ while i < length |
|
72 |
+ let section = self._sections[i] |
|
73 |
+ let group = section[0] |
|
74 |
+ let contents = section[1] |
|
75 |
+ let pgroup = prev_group |
|
76 |
+ let prev_group = airline#builder#get_prev_group(self._sections, i) |
|
77 |
+ if group ==# 'airline_c' && &buftype ==# 'terminal' && self._context.active |
|
78 |
+ let group = 'airline_term' |
|
79 |
+ elseif group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr') |
|
80 |
+ let group = 'airline_c'. self._context.bufnr |
|
81 |
+ elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr') |
|
82 |
+ let prev_group = 'airline_c'. self._context.bufnr |
|
83 |
+ endif |
|
84 |
+ if is_empty |
|
85 |
+ let prev_group = pgroup |
|
86 |
+ endif |
|
87 |
+ let is_empty = s:section_is_empty(self, contents) |
|
88 |
+ |
|
89 |
+ if is_empty |
|
90 |
+ " need to fix highlighting groups, since we |
|
91 |
+ " have skipped a section, we actually need |
|
92 |
+ " the previous previous group and so the |
|
93 |
+ " seperator goes from the previous previous group |
|
94 |
+ " to the current group |
|
95 |
+ let pgroup = group |
|
96 |
+ endif |
|
97 |
+ |
|
98 |
+ if group == '' |
|
99 |
+ let line .= contents |
|
100 |
+ elseif group == '|' |
|
101 |
+ let side = 0 |
|
102 |
+ let line .= contents |
|
103 |
+ let split = 1 |
|
104 |
+ else |
|
105 |
+ if prev_group == '' |
|
106 |
+ let line .= '%#'.group.'#' |
|
107 |
+ elseif split |
|
108 |
+ if !is_empty |
|
109 |
+ let line .= s:get_transitioned_seperator(self, prev_group, group, side) |
|
110 |
+ endif |
|
111 |
+ let split = 0 |
|
112 |
+ else |
|
113 |
+ if !is_empty |
|
114 |
+ let line .= s:get_seperator(self, prev_group, group, side) |
|
115 |
+ endif |
|
116 |
+ endif |
|
117 |
+ let line .= is_empty ? '' : s:get_accented_line(self, group, contents) |
|
118 |
+ endif |
|
119 |
+ |
|
120 |
+ let i = i + 1 |
|
121 |
+ endwhile |
|
122 |
+ |
|
123 |
+ if !self._context.active |
|
124 |
+ "let line = substitute(line, '%#airline_c#', '%#airline_c'.self._context.bufnr.'#', '') |
|
125 |
+ let line = substitute(line, '%#.\{-}\ze#', '\0_inactive', 'g') |
|
126 |
+ endif |
|
127 |
+ return line |
|
128 |
+endfunction |
|
129 |
+ |
|
130 |
+function! airline#builder#should_change_group(group1, group2) |
|
131 |
+ if a:group1 == a:group2 |
|
132 |
+ return 0 |
|
133 |
+ endif |
|
134 |
+ let color1 = airline#highlighter#get_highlight(a:group1) |
|
135 |
+ let color2 = airline#highlighter#get_highlight(a:group2) |
|
136 |
+ if g:airline_gui_mode ==# 'gui' |
|
137 |
+ return color1[1] != color2[1] || color1[0] != color2[0] |
|
138 |
+ else |
|
139 |
+ return color1[3] != color2[3] || color1[2] != color2[2] |
|
140 |
+ endif |
|
141 |
+endfunction |
|
142 |
+ |
|
143 |
+function! s:get_transitioned_seperator(self, prev_group, group, side) |
|
144 |
+ let line = '' |
|
145 |
+ call airline#highlighter#add_separator(a:prev_group, a:group, a:side) |
|
146 |
+ if get(a:self._context, 'tabline', 0) && get(g:, 'airline#extensions#tabline#alt_sep', 0) && a:group ==# 'airline_tabsel' && a:side |
|
147 |
+ call airline#highlighter#add_separator(a:prev_group, a:group, 0) |
|
148 |
+ let line .= '%#'.a:prev_group.'_to_'.a:group.'#' |
|
149 |
+ let line .= a:self._context.right_sep.'%#'.a:group.'#' |
|
150 |
+ else |
|
151 |
+ call airline#highlighter#add_separator(a:prev_group, a:group, a:side) |
|
152 |
+ let line .= '%#'.a:prev_group.'_to_'.a:group.'#' |
|
153 |
+ let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep |
|
154 |
+ let line .= '%#'.a:group.'#' |
|
155 |
+ endif |
|
156 |
+ return line |
|
157 |
+endfunction |
|
158 |
+ |
|
159 |
+function! s:get_seperator(self, prev_group, group, side) |
|
160 |
+ if airline#builder#should_change_group(a:prev_group, a:group) |
|
161 |
+ return s:get_transitioned_seperator(a:self, a:prev_group, a:group, a:side) |
|
162 |
+ else |
|
163 |
+ return a:side ? a:self._context.left_alt_sep : a:self._context.right_alt_sep |
|
164 |
+ endif |
|
165 |
+endfunction |
|
166 |
+ |
|
167 |
+function! s:get_accented_line(self, group, contents) |
|
168 |
+ if a:self._context.active |
|
169 |
+ let contents = [] |
|
170 |
+ let content_parts = split(a:contents, '__accent') |
|
171 |
+ for cpart in content_parts |
|
172 |
+ let accent = matchstr(cpart, '_\zs[^#]*\ze') |
|
173 |
+ call add(contents, cpart) |
|
174 |
+ endfor |
|
175 |
+ let line = join(contents, a:group) |
|
176 |
+ let line = substitute(line, '__restore__', a:group, 'g') |
|
177 |
+ else |
|
178 |
+ let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g') |
|
179 |
+ let line = substitute(line, '%#__restore__#', '', 'g') |
|
180 |
+ endif |
|
181 |
+ return line |
|
182 |
+endfunction |
|
183 |
+ |
|
184 |
+function! s:section_is_empty(self, content) |
|
185 |
+ let start=1 |
|
186 |
+ |
|
187 |
+ " do not check for inactive windows or the tabline |
|
188 |
+ if a:self._context.active == 0 |
|
189 |
+ return 0 |
|
190 |
+ elseif get(a:self._context, 'tabline', 0) |
|
191 |
+ return 0 |
|
192 |
+ endif |
|
193 |
+ |
|
194 |
+ " only check, if airline#skip_empty_sections == 1 |
|
195 |
+ if get(g:, 'airline_skip_empty_sections', 0) == 0 |
|
196 |
+ return 0 |
|
197 |
+ endif |
|
198 |
+ |
|
199 |
+ " only check, if airline#skip_empty_sections == 1 |
|
200 |
+ if get(w:, 'airline_skip_empty_sections', -1) == 0 |
|
201 |
+ return 0 |
|
202 |
+ endif |
|
203 |
+ " assume accents sections to be never empty |
|
204 |
+ " (avoides, that on startup the mode message becomes empty) |
|
205 |
+ if match(a:content, '%#__accent_[^#]*#.*__restore__#') > -1 |
|
206 |
+ return 0 |
|
207 |
+ endif |
|
208 |
+ if empty(a:content) |
|
209 |
+ return 1 |
|
210 |
+ endif |
|
211 |
+ let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start) |
|
212 |
+ if empty(list) |
|
213 |
+ return 0 " no function in statusline text |
|
214 |
+ endif |
|
215 |
+ while len(list) > 0 |
|
216 |
+ let expr = list[0] |
|
217 |
+ try |
|
218 |
+ " catch all exceptions, just in case |
|
219 |
+ if !empty(eval(expr)) |
|
220 |
+ return 0 |
|
221 |
+ endif |
|
222 |
+ catch |
|
223 |
+ return 0 |
|
224 |
+ endtry |
|
225 |
+ let start += 1 |
|
226 |
+ let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start) |
|
227 |
+ endw |
|
228 |
+ return 1 |
|
229 |
+endfunction |
|
230 |
+ |
|
231 |
+function! airline#builder#new(context) |
|
232 |
+ let builder = copy(s:prototype) |
|
233 |
+ let builder._context = a:context |
|
234 |
+ let builder._sections = [] |
|
235 |
+ |
|
236 |
+ call extend(builder._context, { |
|
237 |
+ \ 'left_sep': g:airline_left_sep, |
|
238 |
+ \ 'left_alt_sep': g:airline_left_alt_sep, |
|
239 |
+ \ 'right_sep': g:airline_right_sep, |
|
240 |
+ \ 'right_alt_sep': g:airline_right_alt_sep, |
|
241 |
+ \ }, 'keep') |
|
242 |
+ return builder |
|
243 |
+endfunction |
... | ... |
@@ -0,0 +1,51 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+function! airline#debug#profile1() |
|
7 |
+ profile start airline-profile-switch.log |
|
8 |
+ profile func * |
|
9 |
+ profile file * |
|
10 |
+ split |
|
11 |
+ for i in range(1, 1000) |
|
12 |
+ wincmd w |
|
13 |
+ redrawstatus |
|
14 |
+ endfor |
|
15 |
+ profile pause |
|
16 |
+ noautocmd qall! |
|
17 |
+endfunction |
|
18 |
+ |
|
19 |
+function! airline#debug#profile2() |
|
20 |
+ profile start airline-profile-cursor.log |
|
21 |
+ profile func * |
|
22 |
+ profile file * |
|
23 |
+ edit blank |
|
24 |
+ call setline(1, 'all your base are belong to us') |
|
25 |
+ call setline(2, 'all your base are belong to us') |
|
26 |
+ let positions = [[1,2], [2,2], [1,2], [1,1]] |
|
27 |
+ for i in range(1, 1000) |
|
28 |
+ for pos in positions |
|
29 |
+ call cursor(pos[0], pos[1]) |
|
30 |
+ redrawstatus |
|
31 |
+ endfor |
|
32 |
+ endfor |
|
33 |
+ profile pause |
|
34 |
+ noautocmd qall! |
|
35 |
+endfunction |
|
36 |
+ |
|
37 |
+function! airline#debug#profile3() |
|
38 |
+ profile start airline-profile-mode.log |
|
39 |
+ profile func * |
|
40 |
+ profile file * |
|
41 |
+ |
|
42 |
+ for i in range(1000) |
|
43 |
+ startinsert |
|
44 |
+ redrawstatus |
|
45 |
+ stopinsert |
|
46 |
+ redrawstatus |
|
47 |
+ endfor |
|
48 |
+ |
|
49 |
+ profile pause |
|
50 |
+ noautocmd qall! |
|
51 |
+endfunction |
... | ... |
@@ -0,0 +1,371 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:ext = {} |
|
7 |
+let s:ext._theme_funcrefs = [] |
|
8 |
+ |
|
9 |
+function! s:ext.add_statusline_func(name) dict |
|
10 |
+ call airline#add_statusline_func(a:name) |
|
11 |
+endfunction |
|
12 |
+function! s:ext.add_statusline_funcref(function) dict |
|
13 |
+ call airline#add_statusline_funcref(a:function) |
|
14 |
+endfunction |
|
15 |
+function! s:ext.add_inactive_statusline_func(name) dict |
|
16 |
+ call airline#add_inactive_statusline_func(a:name) |
|
17 |
+endfunction |
|
18 |
+function! s:ext.add_theme_func(name) dict |
|
19 |
+ call add(self._theme_funcrefs, function(a:name)) |
|
20 |
+endfunction |
|
21 |
+ |
|
22 |
+let s:script_path = tolower(resolve(expand('<sfile>:p:h'))) |
|
23 |
+ |
|
24 |
+let s:filetype_overrides = { |
|
25 |
+ \ 'nerdtree': [ get(g:, 'NERDTreeStatusline', 'NERD'), '' ], |
|
26 |
+ \ 'gundo': [ 'Gundo', '' ], |
|
27 |
+ \ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ], |
|
28 |
+ \ 'minibufexpl': [ 'MiniBufExplorer', '' ], |
|
29 |
+ \ 'startify': [ 'startify', '' ], |
|
30 |
+ \ 'vim-plug': [ 'Plugins', '' ], |
|
31 |
+ \ } |
|
32 |
+ |
|
33 |
+let s:filetype_regex_overrides = {} |
|
34 |
+ |
|
35 |
+function! s:check_defined_section(name) |
|
36 |
+ if !exists('w:airline_section_{a:name}') |
|
37 |
+ let w:airline_section_{a:name} = g:airline_section_{a:name} |
|
38 |
+ endif |
|
39 |
+endfunction |
|
40 |
+ |
|
41 |
+function! airline#extensions#append_to_section(name, value) |
|
42 |
+ call <sid>check_defined_section(a:name) |
|
43 |
+ let w:airline_section_{a:name} .= a:value |
|
44 |
+endfunction |
|
45 |
+ |
|
46 |
+function! airline#extensions#prepend_to_section(name, value) |
|
47 |
+ call <sid>check_defined_section(a:name) |
|
48 |
+ let w:airline_section_{a:name} = a:value . w:airline_section_{a:name} |
|
49 |
+endfunction |
|
50 |
+ |
|
51 |
+function! airline#extensions#apply_left_override(section1, section2) |
|
52 |
+ let w:airline_section_a = a:section1 |
|
53 |
+ let w:airline_section_b = a:section2 |
|
54 |
+ let w:airline_section_c = airline#section#create(['readonly']) |
|
55 |
+ let w:airline_render_left = 1 |
|
56 |
+ let w:airline_render_right = 0 |
|
57 |
+endfunction |
|
58 |
+ |
|
59 |
+let s:active_winnr = -1 |
|
60 |
+function! airline#extensions#apply(...) |
|
61 |
+ let s:active_winnr = winnr() |
|
62 |
+ |
|
63 |
+ if s:is_excluded_window() |
|
64 |
+ return -1 |
|
65 |
+ endif |
|
66 |
+ |
|
67 |
+ if &buftype == 'help' |
|
68 |
+ call airline#extensions#apply_left_override('Help', '%f') |
|
69 |
+ let w:airline_section_x = '' |
|
70 |
+ let w:airline_section_y = '' |
|
71 |
+ let w:airline_render_right = 1 |
|
72 |
+ endif |
|
73 |
+ |
|
74 |
+ if &previewwindow |
|
75 |
+ let w:airline_section_a = 'Preview' |
|
76 |
+ let w:airline_section_b = '' |
|
77 |
+ let w:airline_section_c = bufname(winbufnr(winnr())) |
|
78 |
+ endif |
|
79 |
+ |
|
80 |
+ if has_key(s:filetype_overrides, &ft) |
|
81 |
+ let args = s:filetype_overrides[&ft] |
|
82 |
+ call airline#extensions#apply_left_override(args[0], args[1]) |
|
83 |
+ endif |
|
84 |
+ |
|
85 |
+ for item in items(s:filetype_regex_overrides) |
|
86 |
+ if match(&ft, item[0]) >= 0 |
|
87 |
+ call airline#extensions#apply_left_override(item[1][0], item[1][1]) |
|
88 |
+ endif |
|
89 |
+ endfor |
|
90 |
+endfunction |
|
91 |
+ |
|
92 |
+function! s:is_excluded_window() |
|
93 |
+ for matchft in g:airline_exclude_filetypes |
|
94 |
+ if matchft ==# &ft |
|
95 |
+ return 1 |
|
96 |
+ endif |
|
97 |
+ endfor |
|
98 |
+ |
|
99 |
+ for matchw in g:airline_exclude_filenames |
|
100 |
+ if matchstr(expand('%'), matchw) ==# matchw |
|
101 |
+ return 1 |
|
102 |
+ endif |
|
103 |
+ endfor |
|
104 |
+ |
|
105 |
+ if g:airline_exclude_preview && &previewwindow |
|
106 |
+ return 1 |
|
107 |
+ endif |
|
108 |
+ |
|
109 |
+ return 0 |
|
110 |
+endfunction |
|
111 |
+ |
|
112 |
+function! airline#extensions#load_theme() |
|
113 |
+ call airline#util#exec_funcrefs(s:ext._theme_funcrefs, g:airline#themes#{g:airline_theme}#palette) |
|
114 |
+endfunction |
|
115 |
+ |
|
116 |
+function! s:sync_active_winnr() |
|
117 |
+ if exists('#airline') && winnr() != s:active_winnr |
|
118 |
+ call airline#update_statusline() |
|
119 |
+ endif |
|
120 |
+endfunction |
|
121 |
+ |
|
122 |
+function! airline#extensions#load() |
|
123 |
+ let loaded_ext = [] |
|
124 |
+ " non-trivial number of external plugins use eventignore=all, so we need to account for that |
|
125 |
+ autocmd CursorMoved * call <sid>sync_active_winnr() |
|
126 |
+ |
|
127 |
+ if exists('g:airline_extensions') |
|
128 |
+ for ext in g:airline_extensions |
|
129 |
+ try |
|
130 |
+ call airline#extensions#{ext}#init(s:ext) |
|
131 |
+ catch /^Vim\%((\a\+)\)\=:E117/ " E117, function does not exist |
|
132 |
+ call airline#util#warning("Extension '".ext."' not installed, ignoring!") |
|
133 |
+ endtry |
|
134 |
+ endfor |
|
135 |
+ return |
|
136 |
+ endif |
|
137 |
+ |
|
138 |
+ call airline#extensions#quickfix#init(s:ext) |
|
139 |
+ call add(loaded_ext, 'quickfix') |
|
140 |
+ |
|
141 |
+ if get(g:, 'loaded_unite', 0) |
|
142 |
+ call airline#extensions#unite#init(s:ext) |
|
143 |
+ call add(loaded_ext, 'unite') |
|
144 |
+ endif |
|
145 |
+ |
|
146 |
+ if get(g:, 'loaded_denite', 0) |
|
147 |
+ call airline#extensions#denite#init(s:ext) |
|
148 |
+ call add(loaded_ext, 'denite') |
|
149 |
+ endif |
|
150 |
+ |
|
151 |
+ if exists(':NetrwSettings') |
|
152 |
+ call airline#extensions#netrw#init(s:ext) |
|
153 |
+ call add(loaded_ext, 'netrw') |
|
154 |
+ endif |
|
155 |
+ |
|
156 |
+ if has("terminal") |
|
157 |
+ call airline#extensions#term#init(s:ext) |
|
158 |
+ call add(loaded_ext, 'term') |
|
159 |
+ endif |
|
160 |
+ |
|
161 |
+ if get(g:, 'airline#extensions#ycm#enabled', 0) |
|
162 |
+ call airline#extensions#ycm#init(s:ext) |
|
163 |
+ call add(loaded_ext, 'ycm') |
|
164 |
+ endif |
|
165 |
+ |
|
166 |
+ if get(g:, 'loaded_vimfiler', 0) |
|
167 |
+ let g:vimfiler_force_overwrite_statusline = 0 |
|
168 |
+ endif |
|
169 |
+ |
|
170 |
+ if get(g:, 'loaded_ctrlp', 0) |
|
171 |
+ call airline#extensions#ctrlp#init(s:ext) |
|
172 |
+ call add(loaded_ext, 'ctrlp') |
|
173 |
+ endif |
|
174 |
+ |
|
175 |
+ if get(g:, 'loaded_localsearch', 0) |
|
176 |
+ call airline#extensions#localsearch#init(s:ext) |
|
177 |
+ call add(loaded_ext, 'localsearch') |
|
178 |
+ endif |
|
179 |
+ |
|
180 |
+ if get(g:, 'CtrlSpaceLoaded', 0) |
|
181 |
+ call airline#extensions#ctrlspace#init(s:ext) |
|
182 |
+ call add(loaded_ext, 'ctrlspace') |
|
183 |
+ endif |
|
184 |
+ |
|
185 |
+ if get(g:, 'command_t_loaded', 0) |
|
186 |
+ call airline#extensions#commandt#init(s:ext) |
|
187 |
+ call add(loaded_ext, 'commandt') |
|
188 |
+ endif |
|
189 |
+ |
|
190 |
+ if exists(':UndotreeToggle') |
|
191 |
+ call airline#extensions#undotree#init(s:ext) |
|
192 |
+ call add(loaded_ext, 'undotree') |
|
193 |
+ endif |
|
194 |
+ |
|
195 |
+ if get(g:, 'airline#extensions#hunks#enabled', 1) |
|
196 |
+ \ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes') || exists('g:loaded_quickfixsigns')) |
|
197 |
+ call airline#extensions#hunks#init(s:ext) |
|
198 |
+ call add(loaded_ext, 'hunks') |
|
199 |
+ endif |
|
200 |
+ |
|
201 |
+ if get(g:, 'airline#extensions#vimagit#enabled', 1) |
|
202 |
+ \ && (exists('g:loaded_magit')) |
|
203 |
+ call airline#extensions#vimagit#init(s:ext) |
|
204 |
+ call add(loaded_ext, 'vimagit') |
|
205 |
+ endif |
|
206 |
+ |
|
207 |
+ if get(g:, 'airline#extensions#tagbar#enabled', 1) |
|
208 |
+ \ && exists(':TagbarToggle') |
|
209 |
+ call airline#extensions#tagbar#init(s:ext) |
|
210 |
+ call add(loaded_ext, 'tagbar') |
|
211 |
+ endif |
|
212 |
+ |
|
213 |
+ if get(g:, 'airline#extensions#csv#enabled', 1) |
|
214 |
+ \ && (get(g:, 'loaded_csv', 0) || exists(':Table')) |
|
215 |
+ call airline#extensions#csv#init(s:ext) |
|
216 |
+ call add(loaded_ext, 'csv') |
|
217 |
+ endif |
|
218 |
+ |
|
219 |
+ if exists(':VimShell') |
|
220 |
+ let s:filetype_overrides['vimshell'] = ['vimshell','%{vimshell#get_status_string()}'] |
|
221 |
+ let s:filetype_regex_overrides['^int-'] = ['vimshell','%{substitute(&ft, "int-", "", "")}'] |
|
222 |
+ endif |
|
223 |
+ |
|
224 |
+ if get(g:, 'airline#extensions#branch#enabled', 1) |
|
225 |
+ \ && (exists('*fugitive#head') || exists('*lawrencium#statusline') || |
|
226 |
+ \ (get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine'))) |
|
227 |
+ call airline#extensions#branch#init(s:ext) |
|
228 |
+ call add(loaded_ext, 'branch') |
|
229 |
+ endif |
|
230 |
+ |
|
231 |
+ if get(g:, 'airline#extensions#bufferline#enabled', 1) |
|
232 |
+ \ && exists('*bufferline#get_status_string') |
|
233 |
+ call airline#extensions#bufferline#init(s:ext) |
|
234 |
+ call add(loaded_ext, 'bufferline') |
|
235 |
+ endif |
|
236 |
+ |
|
237 |
+ if get(g:, 'airline#extensions#fugitiveline#enabled', 1) |
|
238 |
+ \ && exists('*fugitive#head') |
|
239 |
+ \ && index(loaded_ext, 'bufferline') == -1 |
|
240 |
+ call airline#extensions#fugitiveline#init(s:ext) |
|
241 |
+ call add(loaded_ext, 'fugitiveline') |
|
242 |
+ endif |
|
243 |
+ |
|
244 |
+ if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV))) |
|
245 |
+ call airline#extensions#virtualenv#init(s:ext) |
|
246 |
+ call add(loaded_ext, 'virtualenv') |
|
247 |
+ endif |
|
248 |
+ |
|
249 |
+ if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate')) |
|
250 |
+ call airline#extensions#eclim#init(s:ext) |
|
251 |
+ call add(loaded_ext, 'eclim') |
|
252 |
+ endif |
|
253 |
+ |
|
254 |
+ if get(g:, 'airline#extensions#syntastic#enabled', 1) |
|
255 |
+ \ && exists(':SyntasticCheck') |
|
256 |
+ call airline#extensions#syntastic#init(s:ext) |
|
257 |
+ call add(loaded_ext, 'syntastic') |
|
258 |
+ endif |
|
259 |
+ |
|
260 |
+ if (get(g:, 'airline#extensions#ale#enabled', 1) && exists(':ALELint')) |
|
261 |
+ call airline#extensions#ale#init(s:ext) |
|
262 |
+ call add(loaded_ext, 'ale') |
|
263 |
+ endif |
|
264 |
+ |
|
265 |
+ if get(g:, 'airline#extensions#whitespace#enabled', 1) |
|
266 |
+ call airline#extensions#whitespace#init(s:ext) |
|
267 |
+ call add(loaded_ext, 'whitespace') |
|
268 |
+ endif |
|
269 |
+ |
|
270 |
+ if (get(g:, 'airline#extensions#neomake#enabled', 1) && exists(':Neomake')) |
|
271 |
+ call airline#extensions#neomake#init(s:ext) |
|
272 |
+ call add(loaded_ext, 'neomake') |
|
273 |
+ endif |
|
274 |
+ |
|
275 |
+ if get(g:, 'airline#extensions#po#enabled', 1) && executable('msgfmt') |
|
276 |
+ call airline#extensions#po#init(s:ext) |
|
277 |
+ call add(loaded_ext, 'po') |
|
278 |
+ endif |
|
279 |
+ |
|
280 |
+ if get(g:, 'airline#extensions#wordcount#enabled', 1) |
|
281 |
+ call airline#extensions#wordcount#init(s:ext) |
|
282 |
+ call add(loaded_ext, 'wordcount') |
|
283 |
+ endif |
|
284 |
+ |
|
285 |
+ if get(g:, 'airline#extensions#tabline#enabled', 0) |
|
286 |
+ call airline#extensions#tabline#init(s:ext) |
|
287 |
+ call add(loaded_ext, 'tabline') |
|
288 |
+ endif |
|
289 |
+ |
|
290 |
+ if get(g:, 'airline#extensions#tmuxline#enabled', 1) && exists(':Tmuxline') |
|
291 |
+ call airline#extensions#tmuxline#init(s:ext) |
|
292 |
+ call add(loaded_ext, 'tmuxline') |
|
293 |
+ endif |
|
294 |
+ |
|
295 |
+ if get(g:, 'airline#extensions#promptline#enabled', 1) && exists(':PromptlineSnapshot') && len(get(g:, 'airline#extensions#promptline#snapshot_file', '')) |
|
296 |
+ call airline#extensions#promptline#init(s:ext) |
|
297 |
+ call add(loaded_ext, 'promptline') |
|
298 |
+ endif |
|
299 |
+ |
|
300 |
+ if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2 |
|
301 |
+ call airline#extensions#nrrwrgn#init(s:ext) |
|
302 |
+ call add(loaded_ext, 'nrrwrgn') |
|
303 |
+ endif |
|
304 |
+ |
|
305 |
+ if get(g:, 'airline#extensions#unicode#enabled', 1) && exists(':UnicodeTable') == 2 |
|
306 |
+ call airline#extensions#unicode#init(s:ext) |
|
307 |
+ call add(loaded_ext, 'nrrwrgn') |
|
308 |
+ endif |
|
309 |
+ |
|
310 |
+ if (get(g:, 'airline#extensions#capslock#enabled', 1) && exists('*CapsLockStatusline')) |
|
311 |
+ call airline#extensions#capslock#init(s:ext) |
|
312 |
+ call add(loaded_ext, 'capslock') |
|
313 |
+ endif |
|
314 |
+ |
|
315 |
+ if (get(g:, 'airline#extensions#gutentags#enabled', 1) && get(g:, 'loaded_gutentags', 0)) |
|
316 |
+ call airline#extensions#gutentags#init(s:ext) |
|
317 |
+ call add(loaded_ext, 'gutentags') |
|
318 |
+ endif |
|
319 |
+ |
|
320 |
+ if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib')) |
|
321 |
+ call airline#extensions#xkblayout#init(s:ext) |
|
322 |
+ call add(loaded_ext, 'xkblayout') |
|
323 |
+ endif |
|
324 |
+ |
|
325 |
+ if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap')) |
|
326 |
+ call airline#extensions#keymap#init(s:ext) |
|
327 |
+ call add(loaded_ext, 'keymap') |
|
328 |
+ endif |
|
329 |
+ |
|
330 |
+ if (get(g:, 'airline#extensions#windowswap#enabled', 1) && get(g:, 'loaded_windowswap', 0)) |
|
331 |
+ call airline#extensions#windowswap#init(s:ext) |
|
332 |
+ call add(loaded_ext, 'windowswap') |
|
333 |
+ endif |
|
334 |
+ |
|
335 |
+ if (get(g:, 'airline#extensions#obsession#enabled', 1) && exists('*ObsessionStatus')) |
|
336 |
+ call airline#extensions#obsession#init(s:ext) |
|
337 |
+ call add(loaded_ext, 'obsession') |
|
338 |
+ endif |
|
339 |
+ |
|
340 |
+ runtime autoload/vimtex.vim |
|
341 |
+ if (get(g:, 'airline#extensions#vimtex#enabled', 1)) && exists('*vimtex#init') |
|
342 |
+ call airline#extensions#vimtex#init(s:ext) |
|
343 |
+ call add(loaded_ext, 'vimtex') |
|
344 |
+ endif |
|
345 |
+ |
|
346 |
+ if (get(g:, 'airline#extensions#cursormode#enabled', 0)) |
|
347 |
+ call airline#extensions#cursormode#init(s:ext) |
|
348 |
+ call add(loaded_ext, 'cursormode') |
|
349 |
+ endif |
|
350 |
+ |
|
351 |
+ if !get(g:, 'airline#extensions#disable_rtp_load', 0) |
|
352 |
+ " load all other extensions, which are not part of the default distribution. |
|
353 |
+ " (autoload/airline/extensions/*.vim outside of our s:script_path). |
|
354 |
+ for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n") |
|
355 |
+ " we have to check both resolved and unresolved paths, since it's possible |
|
356 |
+ " that they might not get resolved properly (see #187) |
|
357 |
+ if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0 |
|
358 |
+ \ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0 |
|
359 |
+ let name = fnamemodify(file, ':t:r') |
|
360 |
+ if !get(g:, 'airline#extensions#'.name.'#enabled', 1) || |
|
361 |
+ \ index(loaded_ext, name) > -1 |
|
362 |
+ continue |
|
363 |
+ endif |
|
364 |
+ try |
|
365 |
+ call airline#extensions#{name}#init(s:ext) |
|
366 |
+ catch |
|
367 |
+ endtry |
|
368 |
+ endif |
|
369 |
+ endfor |
|
370 |
+ endif |
|
371 |
+endfunction |
... | ... |
@@ -0,0 +1,84 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bjorn Neergaard, w0rp et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:') |
|
7 |
+let s:warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:') |
|
8 |
+let s:show_line_numbers = get(g:, 'airline#extensions#ale#show_line_numbers', 1) |
|
9 |
+ |
|
10 |
+function! s:airline_ale_count(cnt, symbol) |
|
11 |
+ return a:cnt ? a:symbol. a:cnt : '' |
|
12 |
+endfunction |
|
13 |
+ |
|
14 |
+function! s:airline_ale_get_line_number(cnt, type) abort |
|
15 |
+ if a:cnt == 0 |
|
16 |
+ return '' |
|
17 |
+ endif |
|
18 |
+ |
|
19 |
+ let buffer = bufnr('') |
|
20 |
+ let problem_type = (a:type ==# 'error') ? 'E' : 'W' |
|
21 |
+ let problems = copy(ale#engine#GetLoclist(buffer)) |
|
22 |
+ |
|
23 |
+ call filter(problems, 'v:val.bufnr is buffer && v:val.type is# problem_type') |
|
24 |
+ |
|
25 |
+ if empty(problems) |
|
26 |
+ return '' |
|
27 |
+ endif |
|
28 |
+ |
|
29 |
+ let open_lnum_symbol = get(g:, 'airline#extensions#ale#open_lnum_symbol', '(L') |
|
30 |
+ let close_lnum_symbol = get(g:, 'airline#extensions#ale#close_lnum_symbol', ')') |
|
31 |
+ |
|
32 |
+ return open_lnum_symbol . problems[0].lnum . close_lnum_symbol |
|
33 |
+endfunction |
|
34 |
+ |
|
35 |
+function! airline#extensions#ale#get(type) |
|
36 |
+ if !exists(':ALELint') |
|
37 |
+ return '' |
|
38 |
+ endif |
|
39 |
+ |
|
40 |
+ let is_err = a:type ==# 'error' |
|
41 |
+ let symbol = is_err ? s:error_symbol : s:warning_symbol |
|
42 |
+ |
|
43 |
+ let is_err = a:type ==# 'error' |
|
44 |
+ let counts = ale#statusline#Count(bufnr('')) |
|
45 |
+ let symbol = is_err ? s:error_symbol : s:warning_symbol |
|
46 |
+ |
|
47 |
+ if type(counts) == type({}) && has_key(counts, 'error') |
|
48 |
+ " Use the current Dictionary format. |
|
49 |
+ let errors = counts.error + counts.style_error |
|
50 |
+ let num = is_err ? errors : counts.total - errors |
|
51 |
+ else |
|
52 |
+ " Use the old List format. |
|
53 |
+ let num = is_err ? counts[0] : counts[1] |
|
54 |
+ endif |
|
55 |
+ |
|
56 |
+ if s:show_line_numbers == 1 |
|
57 |
+ return s:airline_ale_count(num, symbol) . <sid>airline_ale_get_line_number(num, a:type) |
|
58 |
+ else |
|
59 |
+ return s:airline_ale_count(num, symbol) |
|
60 |
+ endif |
|
61 |
+endfunction |
|
62 |
+ |
|
63 |
+function! airline#extensions#ale#get_warning() |
|
64 |
+ return airline#extensions#ale#get('warning') |
|
65 |
+endfunction |
|
66 |
+ |
|
67 |
+function! airline#extensions#ale#get_error() |
|
68 |
+ return airline#extensions#ale#get('error') |
|
69 |
+endfunction |
|
70 |
+ |
|
71 |
+function! airline#extensions#ale#init(ext) |
|
72 |
+ call airline#parts#define_function('ale_error_count', 'airline#extensions#ale#get_error') |
|
73 |
+ call airline#parts#define_function('ale_warning_count', 'airline#extensions#ale#get_warning') |
|
74 |
+ augroup airline_ale |
|
75 |
+ autocmd! |
|
76 |
+ autocmd CursorHold,BufWritePost * call <sid>ale_refresh() |
|
77 |
+ augroup END |
|
78 |
+endfunction |
|
79 |
+ |
|
80 |
+function! s:ale_refresh() |
|
81 |
+ if get(g:, 'airline_skip_empty_sections', 0) |
|
82 |
+ exe ':AirlineRefresh' |
|
83 |
+ endif |
|
84 |
+endfunction |
... | ... |
@@ -0,0 +1,324 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+function! s:has_fugitive() |
|
7 |
+ return exists('*fugitive#head') |
|
8 |
+endfunction |
|
9 |
+function! s:has_lawrencium() |
|
10 |
+ return exists('*lawrencium#statusline') |
|
11 |
+endfunction |
|
12 |
+function! s:has_vcscommand() |
|
13 |
+ return get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine') |
|
14 |
+endfunction |
|
15 |
+function! s:has_custom_scm() |
|
16 |
+ return !empty(get(g:, 'airline#extensions#branch#custom_head', '')) |
|
17 |
+endfunction |
|
18 |
+ |
|
19 |
+" s:vcs_config contains static configuration of VCSes and their status relative |
|
20 |
+" to the active file. |
|
21 |
+" 'branch' - The name of currently active branch. This field is empty iff it |
|
22 |
+" has not been initialized yet or the current file is not in |
|
23 |
+" an active branch. |
|
24 |
+" 'untracked' - Cache of untracked files represented as a dictionary with files |
|
25 |
+" as keys. A file has a not exists symbol set as its value if it |
|
26 |
+" is untracked. A file is present in this dictionary iff its |
|
27 |
+" status is considered up to date. |
|
28 |
+" 'untracked_mark' - used as regexp to test against the output of 'cmd' |
|
29 |
+let s:vcs_config = { |
|
30 |
+\ 'git': { |
|
31 |
+\ 'exe': 'git', |
|
32 |
+\ 'cmd': 'git status --porcelain -- ', |
|
33 |
+\ 'untracked_mark': '??', |
|
34 |
+\ 'exclude': '\.git', |
|
35 |
+\ 'update_branch': 's:update_git_branch', |
|
36 |
+\ 'display_branch': 's:display_git_branch', |
|
37 |
+\ 'branch': '', |
|
38 |
+\ 'untracked': {}, |
|
39 |
+\ }, |
|
40 |
+\ 'mercurial': { |
|
41 |
+\ 'exe': 'hg', |
|
42 |
+\ 'cmd': 'hg status -u -- ', |
|
43 |
+\ 'untracked_mark': '?', |
|
44 |
+\ 'exclude': '\.hg', |
|
45 |
+\ 'update_branch': 's:update_hg_branch', |
|
46 |
+\ 'display_branch': 's:display_hg_branch', |
|
47 |
+\ 'branch': '', |
|
48 |
+\ 'untracked': {}, |
|
49 |
+\ }, |
|
50 |
+\} |
|
51 |
+ |
|
52 |
+" Initializes b:buffer_vcs_config. b:buffer_vcs_config caches the branch and |
|
53 |
+" untracked status of the file in the buffer. Caching those fields is necessary, |
|
54 |
+" because s:vcs_config may be updated asynchronously and s:vcs_config fields may |
|
55 |
+" be invalid during those updates. b:buffer_vcs_config fields are updated |
|
56 |
+" whenever corresponding fields in s:vcs_config are updated or an inconsistency |
|
57 |
+" is detected during update_* operation. |
|
58 |
+" |
|
59 |
+" b:airline_head caches the head string it is empty iff it needs to be |
|
60 |
+" recalculated. b:airline_head is recalculated based on b:buffer_vcs_config. |
|
61 |
+function! s:init_buffer() |
|
62 |
+ let b:buffer_vcs_config = {} |
|
63 |
+ for vcs in keys(s:vcs_config) |
|
64 |
+ let b:buffer_vcs_config[vcs] = { |
|
65 |
+ \ 'branch': '', |
|
66 |
+ \ 'untracked': '', |
|
67 |
+ \ } |
|
68 |
+ endfor |
|
69 |
+ unlet! b:airline_head |
|
70 |
+endfunction |
|
71 |
+ |
|
72 |
+let s:head_format = get(g:, 'airline#extensions#branch#format', 0) |
|
73 |
+if s:head_format == 1 |
|
74 |
+ function! s:format_name(name) |
|
75 |
+ return fnamemodify(a:name, ':t') |
|
76 |
+ endfunction |
|
77 |
+elseif s:head_format == 2 |
|
78 |
+ function! s:format_name(name) |
|
79 |
+ return pathshorten(a:name) |
|
80 |
+ endfunction |
|
81 |
+elseif type(s:head_format) == type('') |
|
82 |
+ function! s:format_name(name) |
|
83 |
+ return call(s:head_format, [a:name]) |
|
84 |
+ endfunction |
|
85 |
+else |
|
86 |
+ function! s:format_name(name) |
|
87 |
+ return a:name |
|
88 |
+ endfunction |
|
89 |
+endif |
|
90 |
+ |
|
91 |
+ |
|
92 |
+" Fugitive special revisions. call '0' "staging" ? |
|
93 |
+let s:names = {'0': 'index', '1': 'orig', '2':'fetch', '3':'merge'} |
|
94 |
+let s:sha1size = get(g:, 'airline#extensions#branch#sha1_len', 7) |
|
95 |
+ |
|
96 |
+function! s:update_git_branch() |
|
97 |
+ if !s:has_fugitive() |
|
98 |
+ let s:vcs_config['git'].branch = '' |
|
99 |
+ return |
|
100 |
+ endif |
|
101 |
+ |
|
102 |
+ let s:vcs_config['git'].branch = fugitive#head(s:sha1size) |
|
103 |
+ if s:vcs_config['git'].branch is# 'master' && winwidth(0) < 81 |
|
104 |
+ " Shorten default a bit |
|
105 |
+ let s:vcs_config['git'].branch='mas' |
|
106 |
+ endif |
|
107 |
+endfunction |
|
108 |
+ |
|
109 |
+function! s:display_git_branch() |
|
110 |
+ let name = b:buffer_vcs_config['git'].branch |
|
111 |
+ try |
|
112 |
+ let commit = fugitive#buffer().commit() |
|
113 |
+ |
|
114 |
+ if has_key(s:names, commit) |
|
115 |
+ let name = get(s:names, commit)."(".name.")" |
|
116 |
+ elseif !empty(commit) |
|
117 |
+ let ref = fugitive#repo().git_chomp('describe', '--all', '--exact-match', commit) |
|
118 |
+ if ref !~ "^fatal: no tag exactly matches" |
|
119 |
+ let name = s:format_name(substitute(ref, '\v\C^%(heads/|remotes/|tags/)=','',''))."(".name.")" |
|
120 |
+ else |
|
121 |
+ let name = matchstr(commit, '.\{'.s:sha1size.'}')."(".name.")" |
|
122 |
+ endif |
|
123 |
+ endif |
|
124 |
+ catch |
|
125 |
+ endtry |
|
126 |
+ |
|
127 |
+ return name |
|
128 |
+endfunction |
|
129 |
+ |
|
130 |
+function! s:update_hg_branch() |
|
131 |
+ if s:has_lawrencium() |
|
132 |
+ let cmd='LC_ALL=C hg qtop' |
|
133 |
+ let stl=lawrencium#statusline() |
|
134 |
+ let file=expand('%:p') |
|
135 |
+ if !empty(stl) && get(b:, 'airline_do_mq_check', 1) |
|
136 |
+ if g:airline#init#vim_async |
|
137 |
+ call airline#async#get_mq_async(cmd, file) |
|
138 |
+ elseif has("nvim") |
|
139 |
+ call airline#async#nvim_get_mq_async(cmd, file) |
|
140 |
+ else |
|
141 |
+ " remove \n at the end of the command |
|
142 |
+ let output=system(cmd)[0:-2] |
|
143 |
+ call airline#async#mq_output(output, file) |
|
144 |
+ endif |
|
145 |
+ endif |
|
146 |
+ " do not do mq check anymore |
|
147 |
+ let b:airline_do_mq_check = 0 |
|
148 |
+ if exists("b:mq") && !empty(b:mq) |
|
149 |
+ if stl is# 'default' |
|
150 |
+ " Shorten default a bit |
|
151 |
+ let stl='def' |
|
152 |
+ endif |
|
153 |
+ let stl.=' ['.b:mq.']' |
|
154 |
+ endif |
|
155 |
+ let s:vcs_config['mercurial'].branch = stl |
|
156 |
+ else |
|
157 |
+ let s:vcs_config['mercurial'].branch = '' |
|
158 |
+ endif |
|
159 |
+endfunction |
|
160 |
+ |
|
161 |
+function! s:display_hg_branch() |
|
162 |
+ return b:buffer_vcs_config['mercurial'].branch |
|
163 |
+endfunction |
|
164 |
+ |
|
165 |
+function! s:update_branch() |
|
166 |
+ for vcs in keys(s:vcs_config) |
|
167 |
+ call {s:vcs_config[vcs].update_branch}() |
|
168 |
+ if b:buffer_vcs_config[vcs].branch != s:vcs_config[vcs].branch |
|
169 |
+ let b:buffer_vcs_config[vcs].branch = s:vcs_config[vcs].branch |
|
170 |
+ unlet! b:airline_head |
|
171 |
+ endif |
|
172 |
+ endfor |
|
173 |
+endfunction |
|
174 |
+ |
|
175 |
+function! airline#extensions#branch#update_untracked_config(file, vcs) |
|
176 |
+ if !has_key(s:vcs_config[a:vcs].untracked, a:file) |
|
177 |
+ return |
|
178 |
+ elseif s:vcs_config[a:vcs].untracked[a:file] != b:buffer_vcs_config[a:vcs].untracked |
|
179 |
+ let b:buffer_vcs_config[a:vcs].untracked = s:vcs_config[a:vcs].untracked[a:file] |
|
180 |
+ unlet! b:airline_head |
|
181 |
+ endif |
|
182 |
+endfunction |
|
183 |
+ |
|
184 |
+function! s:update_untracked() |
|
185 |
+ let file = expand("%:p") |
|
186 |
+ if empty(file) || isdirectory(file) |
|
187 |
+ return |
|
188 |
+ endif |
|
189 |
+ |
|
190 |
+ let needs_update = 1 |
|
191 |
+ for vcs in keys(s:vcs_config) |
|
192 |
+ if file =~ s:vcs_config[vcs].exclude |
|
193 |
+ " Skip check for files that live in the exclude directory |
|
194 |
+ let needs_update = 0 |
|
195 |
+ endif |
|
196 |
+ if has_key(s:vcs_config[vcs].untracked, file) |
|
197 |
+ let needs_update = 0 |
|
198 |
+ call airline#extensions#branch#update_untracked_config(file, vcs) |
|
199 |
+ endif |
|
200 |
+ endfor |
|
201 |
+ |
|
202 |
+ if !needs_update |
|
203 |
+ return |
|
204 |
+ endif |
|
205 |
+ |
|
206 |
+ for vcs in keys(s:vcs_config) |
|
207 |
+ let config = s:vcs_config[vcs] |
|
208 |
+ if g:airline#init#vim_async |
|
209 |
+ " Note that asynchronous update updates s:vcs_config only, and only |
|
210 |
+ " s:update_untracked updates b:buffer_vcs_config. If s:vcs_config is |
|
211 |
+ " invalidated again before s:update_untracked is called, then we lose the |
|
212 |
+ " result of the previous call, i.e. the head string is not updated. It |
|
213 |
+ " doesn't happen often in practice, so we let it be. |
|
214 |
+ call airline#async#vim_vcs_untracked(config, file) |
|
215 |
+ else |
|
216 |
+ " nvim async or vim without job-feature |
|
217 |
+ call airline#async#nvim_vcs_untracked(config, file, vcs) |
|
218 |
+ endif |
|
219 |
+ endfor |
|
220 |
+endfunction |
|
221 |
+ |
|
222 |
+function! airline#extensions#branch#head() |
|
223 |
+ if !exists('b:buffer_vcs_config') |
|
224 |
+ call s:init_buffer() |
|
225 |
+ endif |
|
226 |
+ |
|
227 |
+ call s:update_branch() |
|
228 |
+ call s:update_untracked() |
|
229 |
+ |
|
230 |
+ if exists('b:airline_head') && !empty(b:airline_head) |
|
231 |
+ return b:airline_head |
|
232 |
+ endif |
|
233 |
+ |
|
234 |
+ let b:airline_head = '' |
|
235 |
+ let vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"]) |
|
236 |
+ |
|
237 |
+ let heads = [] |
|
238 |
+ for vcs in vcs_priority |
|
239 |
+ if !empty(b:buffer_vcs_config[vcs].branch) |
|
240 |
+ let heads += [vcs] |
|
241 |
+ endif |
|
242 |
+ endfor |
|
243 |
+ |
|
244 |
+ for vcs in heads |
|
245 |
+ if !empty(b:airline_head) |
|
246 |
+ let b:airline_head .= ' | ' |
|
247 |
+ endif |
|
248 |
+ if len(heads) > 1 |
|
249 |
+ let b:airline_head .= s:vcs_config[vcs].exe .':' |
|
250 |
+ endif |
|
251 |
+ let b:airline_head .= s:format_name({s:vcs_config[vcs].display_branch}()) |
|
252 |
+ let b:airline_head .= b:buffer_vcs_config[vcs].untracked |
|
253 |
+ endfor |
|
254 |
+ |
|
255 |
+ if empty(heads) |
|
256 |
+ if s:has_vcscommand() |
|
257 |
+ call VCSCommandEnableBufferSetup() |
|
258 |
+ if exists('b:VCSCommandBufferInfo') |
|
259 |
+ let b:airline_head = s:format_name(get(b:VCSCommandBufferInfo, 0, '')) |
|
260 |
+ endif |
|
261 |
+ endif |
|
262 |
+ endif |
|
263 |
+ |
|
264 |
+ if empty(heads) |
|
265 |
+ if s:has_custom_scm() |
|
266 |
+ try |
|
267 |
+ let Fn = function(g:airline#extensions#branch#custom_head) |
|
268 |
+ let b:airline_head = Fn() |
|
269 |
+ endtry |
|
270 |
+ endif |
|
271 |
+ endif |
|
272 |
+ |
|
273 |
+ if exists("g:airline#extensions#branch#displayed_head_limit") |
|
274 |
+ let w:displayed_head_limit = g:airline#extensions#branch#displayed_head_limit |
|
275 |
+ if len(b:airline_head) > w:displayed_head_limit - 1 |
|
276 |
+ let b:airline_head = b:airline_head[0:(w:displayed_head_limit - 1)].(&encoding ==? 'utf-8' ? '…' : '.') |
|
277 |
+ endif |
|
278 |
+ endif |
|
279 |
+ |
|
280 |
+ let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7 |
|
281 |
+ let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth) |
|
282 |
+ return b:airline_head |
|
283 |
+endfunction |
|
284 |
+ |
|
285 |
+function! airline#extensions#branch#get_head() |
|
286 |
+ let head = airline#extensions#branch#head() |
|
287 |
+ let empty_message = get(g:, 'airline#extensions#branch#empty_message', '') |
|
288 |
+ let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) |
|
289 |
+ return empty(head) |
|
290 |
+ \ ? empty_message |
|
291 |
+ \ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head) |
|
292 |
+endfunction |
|
293 |
+ |
|
294 |
+function! s:reset_untracked_cache(shellcmdpost) |
|
295 |
+ " shellcmdpost - whether function was called as a result of ShellCmdPost hook |
|
296 |
+ if !g:airline#init#vim_async && !has('nvim') |
|
297 |
+ if a:shellcmdpost |
|
298 |
+ " Clear cache only if there was no error or the script uses an |
|
299 |
+ " asynchronous interface. Otherwise, cache clearing would overwrite |
|
300 |
+ " v:shell_error with a system() call inside get_*_untracked. |
|
301 |
+ if v:shell_error |
|
302 |
+ return |
|
303 |
+ endif |
|
304 |
+ endif |
|
305 |
+ endif |
|
306 |
+ |
|
307 |
+ let file = expand("%:p") |
|
308 |
+ for vcs in keys(s:vcs_config) |
|
309 |
+ " Dump the value of the cache for the current file. Partially mitigates the |
|
310 |
+ " issue of cache invalidation happening before a call to |
|
311 |
+ " s:update_untracked() |
|
312 |
+ call airline#extensions#branch#update_untracked_config(file, vcs) |
|
313 |
+ let s:vcs_config[vcs].untracked = {} |
|
314 |
+ endfor |
|
315 |
+endfunction |
|
316 |
+ |
|
317 |
+function! airline#extensions#branch#init(ext) |
|
318 |
+ call airline#parts#define_function('branch', 'airline#extensions#branch#get_head') |
|
319 |
+ |
|
320 |
+ autocmd ShellCmdPost,CmdwinLeave * unlet! b:airline_head b:airline_do_mq_check |
|
321 |
+ autocmd User AirlineBeforeRefresh unlet! b:airline_head b:airline_do_mq_check |
|
322 |
+ autocmd BufWritePost * call s:reset_untracked_cache(0) |
|
323 |
+ autocmd ShellCmdPost * call s:reset_untracked_cache(1) |
|
324 |
+endfunction |
... | ... |
@@ -0,0 +1,29 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists('*bufferline#get_status_string') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+let s:overwrite = get(g:, 'airline#extensions#bufferline#overwrite_variables', 1) |
|
11 |
+ |
|
12 |
+function! airline#extensions#bufferline#init(ext) |
|
13 |
+ if s:overwrite |
|
14 |
+ highlight bufferline_selected gui=bold cterm=bold term=bold |
|
15 |
+ highlight link bufferline_selected_inactive airline_c_inactive |
|
16 |
+ let g:bufferline_inactive_highlight = 'airline_c' |
|
17 |
+ let g:bufferline_active_highlight = 'bufferline_selected' |
|
18 |
+ let g:bufferline_active_buffer_left = '' |
|
19 |
+ let g:bufferline_active_buffer_right = '' |
|
20 |
+ let g:bufferline_separator = g:airline_symbols.space |
|
21 |
+ endif |
|
22 |
+ |
|
23 |
+ if exists("+autochdir") && &autochdir == 1 |
|
24 |
+ " if 'acd' is set, vim-airline uses the path section, so we need ot redefine this here as well |
|
25 |
+ call airline#parts#define_raw('path', '%{bufferline#refresh_status()}'.bufferline#get_status_string()) |
|
26 |
+ else |
|
27 |
+ call airline#parts#define_raw('file', '%{bufferline#refresh_status()}'.bufferline#get_status_string()) |
|
28 |
+ endif |
|
29 |
+endfunction |
... | ... |
@@ -0,0 +1,16 @@ |
1 |
+" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists('*CapsLockStatusline') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#capslock#status() |
|
11 |
+ return tolower(CapsLockStatusline()) == '[caps]' ? 'CAPS' : '' |
|
12 |
+endfunction |
|
13 |
+ |
|
14 |
+function! airline#extensions#capslock#init(ext) |
|
15 |
+ call airline#parts#define_function('capslock', 'airline#extensions#capslock#status') |
|
16 |
+endfunction |
... | ... |
@@ -0,0 +1,18 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !get(g:, 'command_t_loaded', 0) |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#commandt#apply(...) |
|
11 |
+ if bufname('%') ==# 'GoToFile' |
|
12 |
+ call airline#extensions#apply_left_override('CommandT', '') |
|
13 |
+ endif |
|
14 |
+endfunction |
|
15 |
+ |
|
16 |
+function! airline#extensions#commandt#init(ext) |
|
17 |
+ call a:ext.add_statusline_func('airline#extensions#commandt#apply') |
|
18 |
+endfunction |
... | ... |
@@ -0,0 +1,32 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !get(g:, 'loaded_csv', 0) && !exists(':Table') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+let s:column_display = get(g:, 'airline#extensions#csv#column_display', 'Number') |
|
11 |
+ |
|
12 |
+function! airline#extensions#csv#get_column() |
|
13 |
+ if exists('*CSV_WCol') |
|
14 |
+ if s:column_display ==# 'Name' |
|
15 |
+ return '['.CSV_WCol('Name').CSV_WCol().']' |
|
16 |
+ else |
|
17 |
+ return '['.CSV_WCol().']' |
|
18 |
+ endif |
|
19 |
+ endif |
|
20 |
+ return '' |
|
21 |
+endfunction |
|
22 |
+ |
|
23 |
+function! airline#extensions#csv#apply(...) |
|
24 |
+ if &ft ==# "csv" |
|
25 |
+ call airline#extensions#prepend_to_section('gutter', |
|
26 |
+ \ g:airline_left_alt_sep.' %{airline#extensions#csv#get_column()}') |
|
27 |
+ endif |
|
28 |
+endfunction |
|
29 |
+ |
|
30 |
+function! airline#extensions#csv#init(ext) |
|
31 |
+ call a:ext.add_statusline_func('airline#extensions#csv#apply') |
|
32 |
+endfunction |
... | ... |
@@ -0,0 +1,81 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !get(g:, 'loaded_ctrlp', 0) |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+let s:color_template = get(g:, 'airline#extensions#ctrlp#color_template', 'insert') |
|
11 |
+ |
|
12 |
+function! airline#extensions#ctrlp#generate_color_map(dark, light, white) |
|
13 |
+ return { |
|
14 |
+ \ 'CtrlPdark' : a:dark, |
|
15 |
+ \ 'CtrlPlight' : a:light, |
|
16 |
+ \ 'CtrlPwhite' : a:white, |
|
17 |
+ \ 'CtrlParrow1' : [ a:light[1] , a:white[1] , a:light[3] , a:white[3] , '' ] , |
|
18 |
+ \ 'CtrlParrow2' : [ a:white[1] , a:light[1] , a:white[3] , a:light[3] , '' ] , |
|
19 |
+ \ 'CtrlParrow3' : [ a:light[1] , a:dark[1] , a:light[3] , a:dark[3] , '' ] , |
|
20 |
+ \ } |
|
21 |
+endfunction |
|
22 |
+ |
|
23 |
+function! airline#extensions#ctrlp#load_theme(palette) |
|
24 |
+ if exists('a:palette.ctrlp') |
|
25 |
+ let theme = a:palette.ctrlp |
|
26 |
+ else |
|
27 |
+ let s:color_template = has_key(a:palette, s:color_template) ? s:color_template : 'insert' |
|
28 |
+ let theme = airline#extensions#ctrlp#generate_color_map( |
|
29 |
+ \ a:palette[s:color_template]['airline_c'], |
|
30 |
+ \ a:palette[s:color_template]['airline_b'], |
|
31 |
+ \ a:palette[s:color_template]['airline_a']) |
|
32 |
+ endif |
|
33 |
+ for key in keys(theme) |
|
34 |
+ call airline#highlighter#exec(key, theme[key]) |
|
35 |
+ endfor |
|
36 |
+endfunction |
|
37 |
+ |
|
38 |
+" Arguments: focus, byfname, regexp, prv, item, nxt, marked |
|
39 |
+function! airline#extensions#ctrlp#ctrlp_airline(...) |
|
40 |
+ let b = airline#builder#new({'active': 1}) |
|
41 |
+ if a:2 == 'file' |
|
42 |
+ call b.add_section_spaced('CtrlPlight', 'by fname') |
|
43 |
+ endif |
|
44 |
+ if a:3 |
|
45 |
+ call b.add_section_spaced('CtrlPlight', 'regex') |
|
46 |
+ endif |
|
47 |
+ if get(g:, 'airline#extensions#ctrlp#show_adjacent_modes', 1) |
|
48 |
+ call b.add_section_spaced('CtrlPlight', a:4) |
|
49 |
+ call b.add_section_spaced('CtrlPwhite', a:5) |
|
50 |
+ call b.add_section_spaced('CtrlPlight', a:6) |
|
51 |
+ else |
|
52 |
+ call b.add_section_spaced('CtrlPwhite', a:5) |
|
53 |
+ endif |
|
54 |
+ call b.add_section_spaced('CtrlPdark', a:7) |
|
55 |
+ call b.split() |
|
56 |
+ call b.add_section_spaced('CtrlPdark', a:1) |
|
57 |
+ call b.add_section_spaced('CtrlPdark', a:2) |
|
58 |
+ call b.add_section_spaced('CtrlPlight', '%{getcwd()}') |
|
59 |
+ return b.build() |
|
60 |
+endfunction |
|
61 |
+ |
|
62 |
+" Argument: len |
|
63 |
+function! airline#extensions#ctrlp#ctrlp_airline_status(...) |
|
64 |
+ let len = '%#CtrlPdark# '.a:1 |
|
65 |
+ let dir = '%=%<%#CtrlParrow3#'.g:airline_right_sep.'%#CtrlPlight# '.getcwd().' %*' |
|
66 |
+ return len.dir |
|
67 |
+endfunction |
|
68 |
+ |
|
69 |
+function! airline#extensions#ctrlp#apply(...) |
|
70 |
+ " disable statusline overwrite if ctrlp already did it |
|
71 |
+ return match(&statusline, 'CtrlPwhite') >= 0 ? -1 : 0 |
|
72 |
+endfunction |
|
73 |
+ |
|
74 |
+function! airline#extensions#ctrlp#init(ext) |
|
75 |
+ let g:ctrlp_status_func = { |
|
76 |
+ \ 'main': 'airline#extensions#ctrlp#ctrlp_airline', |
|
77 |
+ \ 'prog': 'airline#extensions#ctrlp#ctrlp_airline_status', |
|
78 |
+ \ } |
|
79 |
+ call a:ext.add_statusline_func('airline#extensions#ctrlp#apply') |
|
80 |
+ call a:ext.add_theme_func('airline#extensions#ctrlp#load_theme') |
|
81 |
+endfunction |
... | ... |
@@ -0,0 +1,20 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:spc = g:airline_symbols.space |
|
7 |
+let s:padding = s:spc . s:spc . s:spc |
|
8 |
+let s:cs = ctrlspace#context#Configuration().Symbols.CS |
|
9 |
+ |
|
10 |
+function! airline#extensions#ctrlspace#statusline(...) |
|
11 |
+ let b = airline#builder#new({ 'active': 1 }) |
|
12 |
+ call b.add_section('airline_b', s:cs . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding)) |
|
13 |
+ call b.split() |
|
14 |
+ call b.add_section('airline_x', s:spc . ctrlspace#api#StatuslineTabSegment() . s:spc) |
|
15 |
+ return b.build() |
|
16 |
+endfunction |
|
17 |
+ |
|
18 |
+function! airline#extensions#ctrlspace#init(ext) |
|
19 |
+ let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()" |
|
20 |
+endfunction |
... | ... |
@@ -0,0 +1,132 @@ |
1 |
+" Copyright (C) 2014 Andrea Cedraro <a.cedraro@gmail.com> |
|
2 |
+" Copyright (C) 2017 Eduardo Suarez-Santana <e.suarezsantana@gmail.com> |
|
3 |
+" |
|
4 |
+" Permission is hereby granted, free of charge, to any person obtaining |
|
5 |
+" a copy of this software and associated documentation files (the "Software"), |
|
6 |
+" to deal in the Software without restriction, including without limitation |
|
7 |
+" the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
8 |
+" and/or sell copies of the Software, and to permit persons to whom the |
|
9 |
+" Software is furnished to do so, subject to the following conditions: |
|
10 |
+" |
|
11 |
+" The above copyright notice and this permission notice shall be included |
|
12 |
+" in all copies or substantial portions of the Software. |
|
13 |
+" |
|
14 |
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
15 |
+" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
16 |
+" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
17 |
+" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
18 |
+" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
19 |
+" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE |
|
20 |
+" OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
21 |
+ |
|
22 |
+scriptencoding utf-8 |
|
23 |
+ |
|
24 |
+let s:is_win = has('win32') || has('win64') |
|
25 |
+let s:is_iTerm = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'iTerm.app' |
|
26 |
+let s:is_AppleTerminal = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'Apple_Terminal' |
|
27 |
+ |
|
28 |
+let s:is_good = !has('gui_running') && !s:is_win && !s:is_AppleTerminal |
|
29 |
+ |
|
30 |
+let s:last_mode = '' |
|
31 |
+ |
|
32 |
+if !exists('g:cursormode_exit_mode') |
|
33 |
+ let g:cursormode_exit_mode='n' |
|
34 |
+endif |
|
35 |
+ |
|
36 |
+function! airline#extensions#cursormode#tmux_escape(escape) |
|
37 |
+ return '\033Ptmux;'.substitute(a:escape, '\\033', '\\033\\033', 'g').'\033\\' |
|
38 |
+endfunction |
|
39 |
+ |
|
40 |
+let s:iTerm_escape_template = '\033]Pl%s\033\\' |
|
41 |
+let s:xterm_escape_template = '\033]12;%s\007' |
|
42 |
+ |
|
43 |
+function! s:get_mode() |
|
44 |
+ return call(get(g:, 'cursormode_mode_func', 'mode'), []) |
|
45 |
+endfunction |
|
46 |
+ |
|
47 |
+function! airline#extensions#cursormode#set(...) |
|
48 |
+ let mode = s:get_mode() |
|
49 |
+ if mode !=# s:last_mode |
|
50 |
+ let s:last_mode = mode |
|
51 |
+ call s:set_cursor_color_for(mode) |
|
52 |
+ endif |
|
53 |
+ return '' |
|
54 |
+endfunction |
|
55 |
+ |
|
56 |
+function! s:set_cursor_color_for(mode) |
|
57 |
+ let mode = a:mode |
|
58 |
+ for mode in [a:mode, a:mode.&background] |
|
59 |
+ if has_key(s:color_map, mode) |
|
60 |
+ try |
|
61 |
+ let save_eventignore = &eventignore |
|
62 |
+ set eventignore=all |
|
63 |
+ let save_shelltemp = &shelltemp |
|
64 |
+ set noshelltemp |
|
65 |
+ |
|
66 |
+ silent call system(s:build_command(s:color_map[mode])) |
|
67 |
+ return |
|
68 |
+ finally |
|
69 |
+ let &shelltemp = save_shelltemp |
|
70 |
+ let &eventignore = save_eventignore |
|
71 |
+ endtry |
|
72 |
+ endif |
|
73 |
+ endfor |
|
74 |
+endfunction |
|
75 |
+ |
|
76 |
+function! s:build_command(color) |
|
77 |
+ if s:is_iTerm |
|
78 |
+ let color = substitute(a:color, '^#', '', '') |
|
79 |
+ let escape_template = s:iTerm_escape_template |
|
80 |
+ else |
|
81 |
+ let color = a:color |
|
82 |
+ let escape_template = s:xterm_escape_template |
|
83 |
+ endif |
|
84 |
+ |
|
85 |
+ let escape = printf(escape_template, color) |
|
86 |
+ if exists('$TMUX') |
|
87 |
+ let escape = airline#extensions#cursormode#tmux_escape(escape) |
|
88 |
+ endif |
|
89 |
+ return "printf '".escape."' > /dev/tty" |
|
90 |
+endfunction |
|
91 |
+ |
|
92 |
+function! s:get_color_map() |
|
93 |
+ if exists('g:cursormode_color_map') |
|
94 |
+ return g:cursormode_color_map |
|
95 |
+ endif |
|
96 |
+ |
|
97 |
+ try |
|
98 |
+ let map = g:cursormode#{g:colors_name}#color_map |
|
99 |
+ return map |
|
100 |
+ catch |
|
101 |
+ return { |
|
102 |
+ \ "nlight": "#000000", |
|
103 |
+ \ "ndark": "#BBBBBB", |
|
104 |
+ \ "i": "#0000BB", |
|
105 |
+ \ "v": "#FF5555", |
|
106 |
+ \ "V": "#BBBB00", |
|
107 |
+ \ "\<C-V>": "#BB00BB", |
|
108 |
+ \ } |
|
109 |
+ endtry |
|
110 |
+endfunction |
|
111 |
+ |
|
112 |
+augroup airline#extensions#cursormode |
|
113 |
+ autocmd! |
|
114 |
+ autocmd VimLeave * call s:set_cursor_color_for(g:cursormode_exit_mode) |
|
115 |
+ " autocmd VimEnter * call airline#extensions#cursormode#activate() |
|
116 |
+ autocmd Colorscheme * call airline#extensions#cursormode#activate() |
|
117 |
+augroup END |
|
118 |
+ |
|
119 |
+function! airline#extensions#cursormode#activate() |
|
120 |
+ let s:color_map = s:get_color_map() |
|
121 |
+ call airline#extensions#cursormode#set() |
|
122 |
+endfunction |
|
123 |
+ |
|
124 |
+function! airline#extensions#cursormode#apply(...) |
|
125 |
+ let w:airline_section_a = get(w:, 'airline_section_a', g:airline_section_a) |
|
126 |
+ let w:airline_section_a .= '%{airline#extensions#cursormode#set()}' |
|
127 |
+endfunction |
|
128 |
+ |
|
129 |
+function! airline#extensions#cursormode#init(ext) |
|
130 |
+ let s:color_map = s:get_color_map() |
|
131 |
+ call a:ext.add_statusline_func('airline#extensions#cursormode#apply') |
|
132 |
+endfunction |
... | ... |
@@ -0,0 +1,100 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:section_use_groups = get(g:, 'airline#extensions#default#section_use_groupitems', 1) |
|
7 |
+let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', { |
|
8 |
+ \ 'b': 79, |
|
9 |
+ \ 'x': 60, |
|
10 |
+ \ 'y': 88, |
|
11 |
+ \ 'z': 45, |
|
12 |
+ \ 'warning': 80, |
|
13 |
+ \ 'error': 80, |
|
14 |
+ \ }) |
|
15 |
+let s:layout = get(g:, 'airline#extensions#default#layout', [ |
|
16 |
+ \ [ 'a', 'b', 'c' ], |
|
17 |
+ \ [ 'x', 'y', 'z', 'warning', 'error' ] |
|
18 |
+ \ ]) |
|
19 |
+ |
|
20 |
+function! s:get_section(winnr, key, ...) |
|
21 |
+ if has_key(s:section_truncate_width, a:key) |
|
22 |
+ if winwidth(a:winnr) < s:section_truncate_width[a:key] |
|
23 |
+ return '' |
|
24 |
+ endif |
|
25 |
+ endif |
|
26 |
+ let spc = g:airline_symbols.space |
|
27 |
+ if !exists('g:airline_section_{a:key}') |
|
28 |
+ return '' |
|
29 |
+ endif |
|
30 |
+ let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) |
|
31 |
+ let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')] |
|
32 |
+ return empty(text) ? '' : prefix.text.suffix |
|
33 |
+endfunction |
|
34 |
+ |
|
35 |
+function! s:build_sections(builder, context, keys) |
|
36 |
+ for key in a:keys |
|
37 |
+ if (key == 'warning' || key == 'error') && !a:context.active |
|
38 |
+ continue |
|
39 |
+ endif |
|
40 |
+ call s:add_section(a:builder, a:context, key) |
|
41 |
+ endfor |
|
42 |
+endfunction |
|
43 |
+ |
|
44 |
+" There still is a highlighting bug when using groups %(%) in the statusline, |
|
45 |
+" deactivate it, unless it is fixed (7.4.1511) |
|
46 |
+if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81'))) |
|
47 |
+ function! s:add_section(builder, context, key) |
|
48 |
+ let condition = (a:key is# "warning" || a:key is# "error") && |
|
49 |
+ \ (v:version == 704 && !has("patch1511")) |
|
50 |
+ " i have no idea why the warning section needs special treatment, but it's |
|
51 |
+ " needed to prevent separators from showing up |
|
52 |
+ if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) |
|
53 |
+ return |
|
54 |
+ endif |
|
55 |
+ if condition |
|
56 |
+ call a:builder.add_raw('%(') |
|
57 |
+ endif |
|
58 |
+ call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) |
|
59 |
+ if condition |
|
60 |
+ call a:builder.add_raw('%)') |
|
61 |
+ endif |
|
62 |
+ endfunction |
|
63 |
+else |
|
64 |
+ " older version don't like the use of %(%) |
|
65 |
+ function! s:add_section(builder, context, key) |
|
66 |
+ if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) |
|
67 |
+ return |
|
68 |
+ endif |
|
69 |
+ if a:key == 'warning' |
|
70 |
+ call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key)) |
|
71 |
+ elseif a:key == 'error' |
|
72 |
+ call a:builder.add_raw('%#airline_error#'.s:get_section(a:context.winnr, a:key)) |
|
73 |
+ else |
|
74 |
+ call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) |
|
75 |
+ endif |
|
76 |
+ endfunction |
|
77 |
+endif |
|
78 |
+ |
|
79 |
+function! airline#extensions#default#apply(builder, context) |
|
80 |
+ let winnr = a:context.winnr |
|
81 |
+ let active = a:context.active |
|
82 |
+ |
|
83 |
+ if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse)) |
|
84 |
+ call s:build_sections(a:builder, a:context, s:layout[0]) |
|
85 |
+ else |
|
86 |
+ let text = s:get_section(winnr, 'c') |
|
87 |
+ if empty(text) |
|
88 |
+ let text = ' %f%m ' |
|
89 |
+ endif |
|
90 |
+ call a:builder.add_section('airline_c'.(a:context.bufnr), text) |
|
91 |
+ endif |
|
92 |
+ |
|
93 |
+ call a:builder.split(s:get_section(winnr, 'gutter', '', '')) |
|
94 |
+ |
|
95 |
+ if airline#util#getwinvar(winnr, 'airline_render_right', 1) |
|
96 |
+ call s:build_sections(a:builder, a:context, s:layout[1]) |
|
97 |
+ endif |
|
98 |
+ |
|
99 |
+ return 1 |
|
100 |
+endfunction |
... | ... |
@@ -0,0 +1,41 @@ |
1 |
+" MIT License. Copyright (c) 2017-2018 Thomas Dy et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !get(g:, 'loaded_denite', 0) |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+" Denite does not use vim's built-in modal editing but has a custom prompt |
|
11 |
+" that implements its own insert/normal mode so we have to handle changing the |
|
12 |
+" highlight |
|
13 |
+function! airline#extensions#denite#check_denite_mode(bufnr) |
|
14 |
+ if &filetype != 'denite' |
|
15 |
+ return '' |
|
16 |
+ endif |
|
17 |
+ let mode = split(denite#get_status_mode(), ' ') |
|
18 |
+ let mode = tolower(mode[1]) |
|
19 |
+ if !exists('b:denite_mode_cache') || mode != b:denite_mode_cache |
|
20 |
+ call airline#highlighter#highlight([mode], a:bufnr) |
|
21 |
+ let b:denite_mode_cache = mode |
|
22 |
+ endif |
|
23 |
+ return '' |
|
24 |
+endfunction |
|
25 |
+ |
|
26 |
+function! airline#extensions#denite#apply(...) |
|
27 |
+ if &ft == 'denite' |
|
28 |
+ let w:airline_skip_empty_sections = 0 |
|
29 |
+ call a:1.add_section('airline_a', ' Denite %{airline#extensions#denite#check_denite_mode('.a:2['bufnr'].')}') |
|
30 |
+ call a:1.add_section('airline_c', ' %{denite#get_status_sources()}') |
|
31 |
+ call a:1.split() |
|
32 |
+ call a:1.add_section('airline_y', ' %{denite#get_status_path()} ') |
|
33 |
+ call a:1.add_section('airline_z', ' %{denite#get_status_linenr()} ') |
|
34 |
+ return 1 |
|
35 |
+ endif |
|
36 |
+endfunction |
|
37 |
+ |
|
38 |
+function! airline#extensions#denite#init(ext) |
|
39 |
+ call denite#custom#option('_', 'statusline', 0) |
|
40 |
+ call a:ext.add_statusline_func('airline#extensions#denite#apply') |
|
41 |
+endfunction |
... | ... |
@@ -0,0 +1,61 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists(':ProjectCreate') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#eclim#creat_line(...) |
|
11 |
+ if &filetype == "tree" |
|
12 |
+ let builder = a:1 |
|
13 |
+ call builder.add_section('airline_a', ' Project ') |
|
14 |
+ call builder.add_section('airline_b', ' %f ') |
|
15 |
+ call builder.add_section('airline_c', '') |
|
16 |
+ return 1 |
|
17 |
+ endif |
|
18 |
+endfunction |
|
19 |
+ |
|
20 |
+function! airline#extensions#eclim#get_warnings() |
|
21 |
+ " Cache vavlues, so that it isn't called too often |
|
22 |
+ if exists("s:eclim_errors") && |
|
23 |
+ \ get(b:, 'airline_changenr', 0) == changenr() |
|
24 |
+ return s:eclim_errors |
|
25 |
+ endif |
|
26 |
+ let eclimList = eclim#display#signs#GetExisting() |
|
27 |
+ let s:eclim_errors = '' |
|
28 |
+ |
|
29 |
+ if !empty(eclimList) |
|
30 |
+ " Remove any non-eclim signs (see eclim#display#signs#Update) |
|
31 |
+ " First check for just errors since they are more important. |
|
32 |
+ " If there are no errors, then check for warnings. |
|
33 |
+ let errorList = filter(copy(eclimList), 'v:val.name =~ "^\\(qf_\\)\\?\\(error\\)$"') |
|
34 |
+ |
|
35 |
+ if (empty(errorList)) |
|
36 |
+ " use the warnings |
|
37 |
+ call filter(eclimList, 'v:val.name =~ "^\\(qf_\\)\\?\\(warning\\)$"') |
|
38 |
+ let type = 'W' |
|
39 |
+ else |
|
40 |
+ " Use the errors |
|
41 |
+ let eclimList = errorList |
|
42 |
+ let type = 'E' |
|
43 |
+ endif |
|
44 |
+ |
|
45 |
+ if !empty(eclimList) |
|
46 |
+ let errorsLine = eclimList[0]['line'] |
|
47 |
+ let errorsNumber = len(eclimList) |
|
48 |
+ let errors = "[Eclim:" . type . " line:".string(errorsLine)." (".string(errorsNumber).")]" |
|
49 |
+ if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == '' |
|
50 |
+ let s:eclim_errors = errors.(g:airline_symbols.space) |
|
51 |
+ endif |
|
52 |
+ endif |
|
53 |
+ endif |
|
54 |
+ let b:airline_changenr = changenr() |
|
55 |
+ return s:eclim_errors |
|
56 |
+endfunction |
|
57 |
+ |
|
58 |
+function! airline#extensions#eclim#init(ext) |
|
59 |
+ call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings') |
|
60 |
+ call a:ext.add_statusline_func('airline#extensions#eclim#creat_line') |
|
61 |
+endfunction |
... | ... |
@@ -0,0 +1,55 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+" we don't actually want this loaded :P |
|
7 |
+finish |
|
8 |
+ |
|
9 |
+" Due to some potential rendering issues, the use of the `space` variable is |
|
10 |
+" recommended. |
|
11 |
+let s:spc = g:airline_symbols.space |
|
12 |
+ |
|
13 |
+" Extension specific variables can be defined the usual fashion. |
|
14 |
+if !exists('g:airline#extensions#example#number_of_cats') |
|
15 |
+ let g:airline#extensions#example#number_of_cats = 42 |
|
16 |
+endif |
|
17 |
+ |
|
18 |
+" First we define an init function that will be invoked from extensions.vim |
|
19 |
+function! airline#extensions#example#init(ext) |
|
20 |
+ |
|
21 |
+ " Here we define a new part for the plugin. This allows users to place this |
|
22 |
+ " extension in arbitrary locations. |
|
23 |
+ call airline#parts#define_raw('cats', '%{airline#extensions#example#get_cats()}') |
|
24 |
+ |
|
25 |
+ " Next up we add a funcref so that we can run some code prior to the |
|
26 |
+ " statusline getting modifed. |
|
27 |
+ call a:ext.add_statusline_func('airline#extensions#example#apply') |
|
28 |
+ |
|
29 |
+ " You can also add a funcref for inactive statuslines. |
|
30 |
+ " call a:ext.add_inactive_statusline_func('airline#extensions#example#unapply') |
|
31 |
+endfunction |
|
32 |
+ |
|
33 |
+" This function will be invoked just prior to the statusline getting modified. |
|
34 |
+function! airline#extensions#example#apply(...) |
|
35 |
+ " First we check for the filetype. |
|
36 |
+ if &filetype == "nyancat" |
|
37 |
+ |
|
38 |
+ " Let's say we want to append to section_c, first we check if there's |
|
39 |
+ " already a window-local override, and if not, create it off of the global |
|
40 |
+ " section_c. |
|
41 |
+ let w:airline_section_c = get(w:, 'airline_section_c', g:airline_section_c) |
|
42 |
+ |
|
43 |
+ " Then we just append this extenion to it, optionally using separators. |
|
44 |
+ let w:airline_section_c .= s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#example#get_cats()}' |
|
45 |
+ endif |
|
46 |
+endfunction |
|
47 |
+ |
|
48 |
+" Finally, this function will be invoked from the statusline. |
|
49 |
+function! airline#extensions#example#get_cats() |
|
50 |
+ let cats = '' |
|
51 |
+ for i in range(1, g:airline#extensions#example#number_of_cats) |
|
52 |
+ let cats .= ' (,,,)=(^.^)=(,,,) ' |
|
53 |
+ endfor |
|
54 |
+ return cats |
|
55 |
+endfunction |
... | ... |
@@ -0,0 +1,45 @@ |
1 |
+" MIT License. Copyright (c) 2017-2018 Cimbali et al |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists('*fugitive#head') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+ |
|
11 |
+if exists("+autochdir") && &autochdir == 1 |
|
12 |
+ let s:fmod = ':p' |
|
13 |
+else |
|
14 |
+ let s:fmod = ':.' |
|
15 |
+endif |
|
16 |
+ |
|
17 |
+function! airline#extensions#fugitiveline#bufname() |
|
18 |
+ if !exists('b:fugitive_name') |
|
19 |
+ let b:fugitive_name = '' |
|
20 |
+ try |
|
21 |
+ let buffer = fugitive#buffer() |
|
22 |
+ if buffer.type('blob') |
|
23 |
+ let b:fugitive_name = buffer.repo().translate(buffer.path()) |
|
24 |
+ endif |
|
25 |
+ catch |
|
26 |
+ endtry |
|
27 |
+ endif |
|
28 |
+ |
|
29 |
+ if empty(b:fugitive_name) |
|
30 |
+ return fnamemodify(bufname('%'), s:fmod) |
|
31 |
+ else |
|
32 |
+ return fnamemodify(b:fugitive_name, s:fmod) |
|
33 |
+ endif |
|
34 |
+endfunction |
|
35 |
+ |
|
36 |
+function! airline#extensions#fugitiveline#init(ext) |
|
37 |
+ if exists("+autochdir") && &autochdir == 1 |
|
38 |
+ " if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well |
|
39 |
+ call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m') |
|
40 |
+ else |
|
41 |
+ call airline#parts#define_raw('file', '%<%{airline#extensions#fugitiveline#bufname()}%m') |
|
42 |
+ endif |
|
43 |
+ autocmd ShellCmdPost,CmdwinLeave * unlet! b:fugitive_name |
|
44 |
+ autocmd User AirlineBeforeRefresh unlet! b:fugitive_name |
|
45 |
+endfunction |
... | ... |
@@ -0,0 +1,17 @@ |
1 |
+" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !get(g:, 'loaded_gutentags', 0) |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#gutentags#status() |
|
11 |
+ let msg = gutentags#statusline() |
|
12 |
+ return empty(msg) ? '' : 'Gen. ' . msg |
|
13 |
+endfunction |
|
14 |
+ |
|
15 |
+function! airline#extensions#gutentags#init(ext) |
|
16 |
+ call airline#parts#define_function('gutentags', 'airline#extensions#gutentags#status') |
|
17 |
+endfunction |
... | ... |
@@ -0,0 +1,93 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) && !get(g:, 'loaded_quickfixsigns', 0) |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+let s:non_zero_only = get(g:, 'airline#extensions#hunks#non_zero_only', 0) |
|
11 |
+let s:hunk_symbols = get(g:, 'airline#extensions#hunks#hunk_symbols', ['+', '~', '-']) |
|
12 |
+ |
|
13 |
+function! s:get_hunks_signify() |
|
14 |
+ let hunks = sy#repo#get_stats() |
|
15 |
+ if hunks[0] >= 0 |
|
16 |
+ return hunks |
|
17 |
+ endif |
|
18 |
+ return [] |
|
19 |
+endfunction |
|
20 |
+ |
|
21 |
+function! s:is_branch_empty() |
|
22 |
+ return exists('*airline#extensions#branch#head') && |
|
23 |
+ \ empty(get(b:, 'airline_head', '')) |
|
24 |
+endfunction |
|
25 |
+ |
|
26 |
+function! s:get_hunks_gitgutter() |
|
27 |
+ if !get(g:, 'gitgutter_enabled', 0) || s:is_branch_empty() |
|
28 |
+ return '' |
|
29 |
+ endif |
|
30 |
+ return GitGutterGetHunkSummary() |
|
31 |
+endfunction |
|
32 |
+ |
|
33 |
+function! s:get_hunks_changes() |
|
34 |
+ if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty() |
|
35 |
+ return [] |
|
36 |
+ endif |
|
37 |
+ let hunks = changes#GetStats() |
|
38 |
+ return hunks == [0, 0, 0] ? [] : hunks |
|
39 |
+endfunction |
|
40 |
+ |
|
41 |
+function! s:get_hunks_empty() |
|
42 |
+ return '' |
|
43 |
+endfunction |
|
44 |
+ |
|
45 |
+function! s:get_hunks() |
|
46 |
+ if !exists('b:source_func') || get(b:, 'source_func', '') is# 's:get_hunks_empty' |
|
47 |
+ if get(g:, 'loaded_signify') && sy#buffer_is_active() |
|
48 |
+ let b:source_func = 's:get_hunks_signify' |
|
49 |
+ elseif exists('*GitGutterGetHunkSummary') |
|
50 |
+ let b:source_func = 's:get_hunks_gitgutter' |
|
51 |
+ elseif exists('*changes#GetStats') |
|
52 |
+ let b:source_func = 's:get_hunks_changes' |
|
53 |
+ elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary') |
|
54 |
+ let b:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary' |
|
55 |
+ else |
|
56 |
+ let b:source_func = 's:get_hunks_empty' |
|
57 |
+ endif |
|
58 |
+ endif |
|
59 |
+ return {b:source_func}() |
|
60 |
+endfunction |
|
61 |
+ |
|
62 |
+function! airline#extensions#hunks#get_hunks() |
|
63 |
+ if !get(w:, 'airline_active', 0) |
|
64 |
+ return '' |
|
65 |
+ endif |
|
66 |
+ " Cache values, so that it isn't called too often |
|
67 |
+ if exists("b:airline_hunks") && |
|
68 |
+ \ get(b:, 'airline_changenr', 0) == b:changedtick && |
|
69 |
+ \ winwidth(0) == get(s:, 'airline_winwidth', 0) && |
|
70 |
+ \ get(b:, 'source_func', '') isnot# 's:get_hunks_signify' && |
|
71 |
+ \ get(b:, 'source_func', '') isnot# 's:get_hunks_gitgutter' && |
|
72 |
+ \ get(b:, 'source_func', '') isnot# 's:get_hunks_empty' && |
|
73 |
+ \ get(b:, 'source_func', '') isnot# 's:get_hunks_changes' |
|
74 |
+ return b:airline_hunks |
|
75 |
+ endif |
|
76 |
+ let hunks = s:get_hunks() |
|
77 |
+ let string = '' |
|
78 |
+ if !empty(hunks) |
|
79 |
+ for i in [0, 1, 2] |
|
80 |
+ if (s:non_zero_only == 0 && winwidth(0) > 100) || hunks[i] > 0 |
|
81 |
+ let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i]) |
|
82 |
+ endif |
|
83 |
+ endfor |
|
84 |
+ endif |
|
85 |
+ let b:airline_hunks = string |
|
86 |
+ let b:airline_changenr = b:changedtick |
|
87 |
+ let s:airline_winwidth = winwidth(0) |
|
88 |
+ return string |
|
89 |
+endfunction |
|
90 |
+ |
|
91 |
+function! airline#extensions#hunks#init(ext) |
|
92 |
+ call airline#parts#define_function('hunks', 'airline#extensions#hunks#get_hunks') |
|
93 |
+endfunction |
... | ... |
@@ -0,0 +1,20 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Doron Behar, C.Brabandt et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !has('keymap') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#keymap#status() |
|
11 |
+ if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap')) |
|
12 |
+ return printf('%s', (!empty(&keymap) ? (g:airline_symbols.keymap . ' '. &keymap) : '')) |
|
13 |
+ else |
|
14 |
+ return '' |
|
15 |
+ endif |
|
16 |
+endfunction |
|
17 |
+ |
|
18 |
+function! airline#extensions#keymap#init(ext) |
|
19 |
+ call airline#parts#define_function('keymap', 'airline#extensions#keymap#status') |
|
20 |
+endfunction |
... | ... |
@@ -0,0 +1,35 @@ |
1 |
+" MIT License. Copyright (c) 2018 mox |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:enabled = get(g:, 'airline#extensions#localsearch#enabled', 1) |
|
7 |
+if !get(g:, 'loaded_localsearch', 0) || !s:enabled || get(g:, 'airline#extensions#localsearch#loaded', 0) |
|
8 |
+ finish |
|
9 |
+endif |
|
10 |
+let g:airline#extensions#localsearch#loaded = 001 |
|
11 |
+ |
|
12 |
+let s:spc = g:airline_symbols.space |
|
13 |
+ |
|
14 |
+function! airline#extensions#localsearch#load_theme(palette) |
|
15 |
+ call airline#highlighter#exec('localsearch_dark', [ '#ffffff' , '#000000' , 15 , 1 , '']) |
|
16 |
+endfunction |
|
17 |
+ |
|
18 |
+ |
|
19 |
+function! airline#extensions#localsearch#init(ext) |
|
20 |
+ call a:ext.add_theme_func('airline#extensions#localsearch#load_theme') |
|
21 |
+ call a:ext.add_statusline_func('airline#extensions#localsearch#apply') |
|
22 |
+endfunction |
|
23 |
+ |
|
24 |
+ |
|
25 |
+function! airline#extensions#localsearch#apply(...) |
|
26 |
+ " first variable is the statusline builder |
|
27 |
+ let builder = a:1 |
|
28 |
+ |
|
29 |
+ """"" WARNING: the API for the builder is not finalized and may change |
|
30 |
+ if exists('#localsearch#WinEnter') " If localsearch mode is enabled |
|
31 |
+ call builder.add_section('localsearch_dark', s:spc.airline#section#create('LS').s:spc) |
|
32 |
+ endif |
|
33 |
+ return 0 |
|
34 |
+endfunction |
|
35 |
+ |
... | ... |
@@ -0,0 +1,36 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+if !exists(':Neomake') |
|
5 |
+ finish |
|
6 |
+endif |
|
7 |
+ |
|
8 |
+let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:') |
|
9 |
+let s:warning_symbol = get(g:, 'airline#extensions#neomake#warning_symbol', 'W:') |
|
10 |
+ |
|
11 |
+function! s:get_counts() |
|
12 |
+ let l:counts = neomake#statusline#LoclistCounts() |
|
13 |
+ |
|
14 |
+ if empty(l:counts) |
|
15 |
+ return neomake#statusline#QflistCounts() |
|
16 |
+ else |
|
17 |
+ return l:counts |
|
18 |
+ endif |
|
19 |
+endfunction |
|
20 |
+ |
|
21 |
+function! airline#extensions#neomake#get_warnings() |
|
22 |
+ let counts = s:get_counts() |
|
23 |
+ let warnings = get(counts, 'W', 0) |
|
24 |
+ return warnings ? s:warning_symbol.warnings : '' |
|
25 |
+endfunction |
|
26 |
+ |
|
27 |
+function! airline#extensions#neomake#get_errors() |
|
28 |
+ let counts = s:get_counts() |
|
29 |
+ let errors = get(counts, 'E', 0) |
|
30 |
+ return errors ? s:error_symbol.errors : '' |
|
31 |
+endfunction |
|
32 |
+ |
|
33 |
+function! airline#extensions#neomake#init(ext) |
|
34 |
+ call airline#parts#define_function('neomake_warning_count', 'airline#extensions#neomake#get_warnings') |
|
35 |
+ call airline#parts#define_function('neomake_error_count', 'airline#extensions#neomake#get_errors') |
|
36 |
+endfunction |
... | ... |
@@ -0,0 +1,34 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists(':NetrwSettings') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#netrw#apply(...) |
|
11 |
+ if &ft == 'netrw' |
|
12 |
+ let spc = g:airline_symbols.space |
|
13 |
+ |
|
14 |
+ call a:1.add_section('airline_a', spc.'netrw'.spc) |
|
15 |
+ if exists('*airline#extensions#branch#get_head') |
|
16 |
+ call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) |
|
17 |
+ endif |
|
18 |
+ call a:1.add_section('airline_c', spc.'%f'.spc) |
|
19 |
+ call a:1.split() |
|
20 |
+ call a:1.add_section('airline_y', spc.'%{airline#extensions#netrw#sortstring()}'.spc) |
|
21 |
+ return 1 |
|
22 |
+ endif |
|
23 |
+endfunction |
|
24 |
+ |
|
25 |
+function! airline#extensions#netrw#init(ext) |
|
26 |
+ let g:netrw_force_overwrite_statusline = 0 |
|
27 |
+ call a:ext.add_statusline_func('airline#extensions#netrw#apply') |
|
28 |
+endfunction |
|
29 |
+ |
|
30 |
+ |
|
31 |
+function! airline#extensions#netrw#sortstring() |
|
32 |
+ let order = (get(g:, 'netrw_sort_direction', 'n') =~ 'n') ? '+' : '-' |
|
33 |
+ return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']' |
|
34 |
+endfunction |
... | ... |
@@ -0,0 +1,57 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !get(g:, 'loaded_nrrw_rgn', 0) |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#nrrwrgn#apply(...) |
|
11 |
+ if exists(":WidenRegion") == 2 |
|
12 |
+ let spc = g:airline_symbols.space |
|
13 |
+ if !exists("*nrrwrgn#NrrwRgnStatus()") || empty(nrrwrgn#NrrwRgnStatus()) |
|
14 |
+ call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn)) |
|
15 |
+ let bufname=(get(b:, 'orig_buf', 0) ? bufname(b:orig_buf) : substitute(bufname('%'), '^Nrrwrgn_\zs.*\ze_\d\+$', submatch(0), '')) |
|
16 |
+ call a:1.add_section('airline_c', spc.bufname.spc) |
|
17 |
+ call a:1.split() |
|
18 |
+ else |
|
19 |
+ let dict=nrrwrgn#NrrwRgnStatus() |
|
20 |
+ let vmode = { 'v': 'Char ', 'V': 'Line ', '': 'Block '} |
|
21 |
+ let mode = dict.visual ? vmode[dict.visual] : vmode['V'] |
|
22 |
+ let winwidth = winwidth(0) |
|
23 |
+ if winwidth < 80 |
|
24 |
+ let mode = mode[0] |
|
25 |
+ endif |
|
26 |
+ let title = (winwidth < 80 ? "Nrrw" : "Narrowed ") |
|
27 |
+ let multi = (winwidth < 80 ? 'M' : 'Multi') |
|
28 |
+ call a:1.add_section('airline_a', printf('[%s%s%s#%d]%s', (dict.multi ? multi : ""), |
|
29 |
+ \ title, mode, b:nrrw_instn, spc)) |
|
30 |
+ let name = dict.fullname |
|
31 |
+ if name !=# '[No Name]' |
|
32 |
+ if winwidth > 100 |
|
33 |
+ " need some space |
|
34 |
+ let name = fnamemodify(dict.fullname, ':~') |
|
35 |
+ if strlen(name) > 8 |
|
36 |
+ " shorten name |
|
37 |
+ let name = substitute(name, '\(.\)[^/\\]*\([/\\]\)', '\1\2', 'g') |
|
38 |
+ endif |
|
39 |
+ else |
|
40 |
+ let name = fnamemodify(dict.fullname, ':t') |
|
41 |
+ endif |
|
42 |
+ endif |
|
43 |
+ let range=(dict.multi ? '' : printf("[%d-%d]", dict.start[1], dict.end[1])) |
|
44 |
+ call a:1.add_section('airline_c', printf("%s %s %s", name, range, |
|
45 |
+ \ dict.enabled ? (&encoding ==? 'utf-8' ? "\u2713" : '') : '!')) |
|
46 |
+ call a:1.split() |
|
47 |
+ call a:1.add_section('airline_x', get(g:, 'airline_section_x').spc) |
|
48 |
+ call a:1.add_section('airline_y', spc.get(g:, 'airline_section_y').spc) |
|
49 |
+ call a:1.add_section('airline_z', spc.get(g:, 'airline_section_z')) |
|
50 |
+ endif |
|
51 |
+ return 1 |
|
52 |
+ endif |
|
53 |
+endfunction |
|
54 |
+ |
|
55 |
+function! airline#extensions#nrrwrgn#init(ext) |
|
56 |
+ call a:ext.add_statusline_func('airline#extensions#nrrwrgn#apply') |
|
57 |
+endfunction |
... | ... |
@@ -0,0 +1,22 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists('*ObsessionStatus') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+let s:spc = g:airline_symbols.space |
|
11 |
+ |
|
12 |
+if !exists('g:airline#extensions#obsession#indicator_text') |
|
13 |
+ let g:airline#extensions#obsession#indicator_text = '$' |
|
14 |
+endif |
|
15 |
+ |
|
16 |
+function! airline#extensions#obsession#init(ext) |
|
17 |
+ call airline#parts#define_function('obsession', 'airline#extensions#obsession#get_status') |
|
18 |
+endfunction |
|
19 |
+ |
|
20 |
+function! airline#extensions#obsession#get_status() |
|
21 |
+ return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '') |
|
22 |
+endfunction |
... | ... |
@@ -0,0 +1,50 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+function! airline#extensions#po#shorten() |
|
7 |
+ if exists("g:airline#extensions#po#displayed_limit") |
|
8 |
+ let w:displayed_po_limit = g:airline#extensions#po#displayed_limit |
|
9 |
+ if len(b:airline_po_stats) > w:displayed_po_limit - 1 |
|
10 |
+ let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 2)].(&encoding==?'utf-8' ? '…' : '.'). ']' |
|
11 |
+ endif |
|
12 |
+ endif |
|
13 |
+endfunction |
|
14 |
+ |
|
15 |
+function! airline#extensions#po#apply(...) |
|
16 |
+ if &ft ==# 'po' |
|
17 |
+ call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}') |
|
18 |
+ autocmd airline BufWritePost * unlet! b:airline_po_stats |
|
19 |
+ endif |
|
20 |
+endfunction |
|
21 |
+ |
|
22 |
+function! airline#extensions#po#stats() |
|
23 |
+ if exists('b:airline_po_stats') && !empty(b:airline_po_stats) |
|
24 |
+ return b:airline_po_stats |
|
25 |
+ endif |
|
26 |
+ |
|
27 |
+ let cmd = 'msgfmt --statistics -o /dev/null -- ' |
|
28 |
+ if g:airline#init#vim_async |
|
29 |
+ call airline#async#get_msgfmt_stat(cmd, expand('%:p')) |
|
30 |
+ elseif has("nvim") |
|
31 |
+ call airline#async#nvim_get_msgfmt_stat(cmd, expand('%:p')) |
|
32 |
+ else |
|
33 |
+ let airline_po_stats = system(cmd. shellescape(expand('%:p'))) |
|
34 |
+ if v:shell_error |
|
35 |
+ return '' |
|
36 |
+ endif |
|
37 |
+ try |
|
38 |
+ let b:airline_po_stats = '['. split(airline_po_stats, '\n')[0]. ']' |
|
39 |
+ let b:airline_po_stats = substitute(b:airline_po_stats, ' \(message\|translation\)s*\.*', '', 'g') |
|
40 |
+ catch |
|
41 |
+ let b:airline_po_stats = '' |
|
42 |
+ endtry |
|
43 |
+ call airline#extensions#po#shorten() |
|
44 |
+ endif |
|
45 |
+ return get(b:, 'airline_po_stats', '') |
|
46 |
+endfunction |
|
47 |
+ |
|
48 |
+function! airline#extensions#po#init(ext) |
|
49 |
+ call a:ext.add_statusline_func('airline#extensions#po#apply') |
|
50 |
+endfunction |
... | ... |
@@ -0,0 +1,35 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists(':PromptlineSnapshot') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+if !exists('airline#extensions#promptline#snapshot_file') || !len('airline#extensions#promptline#snapshot_file') |
|
11 |
+ finish |
|
12 |
+endif |
|
13 |
+ |
|
14 |
+let s:prompt_snapshot_file = get(g:, 'airline#extensions#promptline#snapshot_file', '') |
|
15 |
+let s:color_template = get(g:, 'airline#extensions#promptline#color_template', 'normal') |
|
16 |
+ |
|
17 |
+function! airline#extensions#promptline#init(ext) |
|
18 |
+ call a:ext.add_theme_func('airline#extensions#promptline#set_prompt_colors') |
|
19 |
+endfunction |
|
20 |
+ |
|
21 |
+function! airline#extensions#promptline#set_prompt_colors(palette) |
|
22 |
+ let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' |
|
23 |
+ let mode_palette = a:palette[color_template] |
|
24 |
+ |
|
25 |
+ if !has_key(g:, 'promptline_symbols') |
|
26 |
+ let g:promptline_symbols = { |
|
27 |
+ \ 'left' : g:airline_left_sep, |
|
28 |
+ \ 'right' : g:airline_right_sep, |
|
29 |
+ \ 'left_alt' : g:airline_left_alt_sep, |
|
30 |
+ \ 'right_alt' : g:airline_right_alt_sep} |
|
31 |
+ endif |
|
32 |
+ |
|
33 |
+ let promptline_theme = promptline#api#create_theme_from_airline(mode_palette) |
|
34 |
+ call promptline#api#create_snapshot_with_theme(s:prompt_snapshot_file, promptline_theme) |
|
35 |
+endfunction |
... | ... |
@@ -0,0 +1,58 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists('g:airline#extensions#quickfix#quickfix_text') |
|
7 |
+ let g:airline#extensions#quickfix#quickfix_text = 'Quickfix' |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+if !exists('g:airline#extensions#quickfix#location_text') |
|
11 |
+ let g:airline#extensions#quickfix#location_text = 'Location' |
|
12 |
+endif |
|
13 |
+ |
|
14 |
+function! airline#extensions#quickfix#apply(...) |
|
15 |
+ if &buftype == 'quickfix' |
|
16 |
+ let w:airline_section_a = s:get_text() |
|
17 |
+ let w:airline_section_b = '%{get(w:, "quickfix_title", "")}' |
|
18 |
+ let w:airline_section_c = '' |
|
19 |
+ let w:airline_section_x = '' |
|
20 |
+ endif |
|
21 |
+endfunction |
|
22 |
+ |
|
23 |
+function! airline#extensions#quickfix#init(ext) |
|
24 |
+ call a:ext.add_statusline_func('airline#extensions#quickfix#apply') |
|
25 |
+ call a:ext.add_inactive_statusline_func('airline#extensions#quickfix#inactive_qf_window') |
|
26 |
+endfunction |
|
27 |
+ |
|
28 |
+function! airline#extensions#quickfix#inactive_qf_window(...) |
|
29 |
+ if getbufvar(a:2.bufnr, '&filetype') is# 'qf' && !empty(airline#util#getwinvar(a:2.winnr, 'quickfix_title', '')) |
|
30 |
+ call setwinvar(a:2.winnr, 'airline_section_c', '[%{get(w:, "quickfix_title", "")}] %f %m') |
|
31 |
+ endif |
|
32 |
+endfunction |
|
33 |
+ |
|
34 |
+function! s:get_text() |
|
35 |
+ if exists("*win_getid") && exists("*getwininfo") |
|
36 |
+ let dict = getwininfo(win_getid()) |
|
37 |
+ if len(dict) > 0 && get(dict[0], 'quickfix', 0) && !get(dict[0], 'loclist', 0) |
|
38 |
+ return g:airline#extensions#quickfix#quickfix_text |
|
39 |
+ elseif len(dict) > 0 && get(dict[0], 'quickfix', 0) && get(dict[0], 'loclist', 0) |
|
40 |
+ return g:airline#extensions#quickfix#location_text |
|
41 |
+ endif |
|
42 |
+ endif |
|
43 |
+ redir => buffers |
|
44 |
+ silent ls |
|
45 |
+ redir END |
|
46 |
+ |
|
47 |
+ let nr = bufnr('%') |
|
48 |
+ for buf in split(buffers, '\n') |
|
49 |
+ if match(buf, '\v^\s*'.nr) > -1 |
|
50 |
+ if match(buf, '\cQuickfix') > -1 |
|
51 |
+ return g:airline#extensions#quickfix#quickfix_text |
|
52 |
+ else |
|
53 |
+ return g:airline#extensions#quickfix#location_text |
|
54 |
+ endif |
|
55 |
+ endif |
|
56 |
+ endfor |
|
57 |
+ return '' |
|
58 |
+endfunction |
... | ... |
@@ -0,0 +1,43 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists(':SyntasticCheck') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+let s:error_symbol = get(g:, 'airline#extensions#syntastic#error_symbol', 'E:') |
|
11 |
+let s:warning_symbol = get(g:, 'airline#extensions#syntastic#warning_symbol', 'W:') |
|
12 |
+ |
|
13 |
+function! airline#extensions#syntastic#get_warning() |
|
14 |
+ return airline#extensions#syntastic#get('warning') |
|
15 |
+endfunction |
|
16 |
+ |
|
17 |
+function! airline#extensions#syntastic#get_error() |
|
18 |
+ return airline#extensions#syntastic#get('error') |
|
19 |
+endfunction |
|
20 |
+ |
|
21 |
+function! airline#extensions#syntastic#get(type) |
|
22 |
+ let _backup = get(g:, 'syntastic_stl_format', '') |
|
23 |
+ let is_err = (a:type is# 'error') |
|
24 |
+ if is_err |
|
25 |
+ let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%e(#%fe)]}') |
|
26 |
+ else |
|
27 |
+ let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_warn', '%W{[%w(#%fw)]}') |
|
28 |
+ endif |
|
29 |
+ let cnt = SyntasticStatuslineFlag() |
|
30 |
+ if !empty(_backup) |
|
31 |
+ let g:syntastic_stl_format = _backup |
|
32 |
+ endif |
|
33 |
+ if empty(cnt) |
|
34 |
+ return '' |
|
35 |
+ else |
|
36 |
+ return (is_err ? s:error_symbol : s:warning_symbol).cnt |
|
37 |
+ endif |
|
38 |
+endfunction |
|
39 |
+ |
|
40 |
+function! airline#extensions#syntastic#init(ext) |
|
41 |
+ call airline#parts#define_function('syntastic-warn', 'airline#extensions#syntastic#get_warning') |
|
42 |
+ call airline#parts#define_function('syntastic-err', 'airline#extensions#syntastic#get_error') |
|
43 |
+endfunction |
... | ... |
@@ -0,0 +1,212 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+ |
|
7 |
+let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0) |
|
8 |
+if s:taboo |
|
9 |
+ let g:taboo_tabline = 0 |
|
10 |
+endif |
|
11 |
+ |
|
12 |
+let s:ctrlspace = get(g:, 'CtrlSpaceLoaded', 0) |
|
13 |
+ |
|
14 |
+function! airline#extensions#tabline#init(ext) |
|
15 |
+ if has('gui_running') |
|
16 |
+ set guioptions-=e |
|
17 |
+ endif |
|
18 |
+ |
|
19 |
+ autocmd User AirlineToggledOn call s:toggle_on() |
|
20 |
+ autocmd User AirlineToggledOff call s:toggle_off() |
|
21 |
+ |
|
22 |
+ call s:toggle_on() |
|
23 |
+ call a:ext.add_theme_func('airline#extensions#tabline#load_theme') |
|
24 |
+endfunction |
|
25 |
+ |
|
26 |
+function! s:toggle_off() |
|
27 |
+ call airline#extensions#tabline#autoshow#off() |
|
28 |
+ call airline#extensions#tabline#tabs#off() |
|
29 |
+ call airline#extensions#tabline#buffers#off() |
|
30 |
+ if s:ctrlspace |
|
31 |
+ call airline#extensions#tabline#ctrlspace#off() |
|
32 |
+ endif |
|
33 |
+endfunction |
|
34 |
+ |
|
35 |
+function! s:toggle_on() |
|
36 |
+ call airline#extensions#tabline#autoshow#on() |
|
37 |
+ call airline#extensions#tabline#tabs#on() |
|
38 |
+ call airline#extensions#tabline#buffers#on() |
|
39 |
+ if s:ctrlspace |
|
40 |
+ call airline#extensions#tabline#ctrlspace#on() |
|
41 |
+ endif |
|
42 |
+ |
|
43 |
+ set tabline=%!airline#extensions#tabline#get() |
|
44 |
+endfunction |
|
45 |
+ |
|
46 |
+function! s:update_tabline() |
|
47 |
+ if get(g:, 'airline#extensions#tabline#disable_refresh', 0) |
|
48 |
+ return |
|
49 |
+ endif |
|
50 |
+ let match = expand('<afile>') |
|
51 |
+ let ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', |
|
52 |
+ \ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree') |
|
53 |
+ if pumvisible() |
|
54 |
+ return |
|
55 |
+ elseif !get(g:, 'airline#extensions#tabline#enabled', 0) |
|
56 |
+ return |
|
57 |
+ " return, if buffer matches ignore pattern or is directory (netrw) |
|
58 |
+ elseif empty(match) |
|
59 |
+ \ || match(match, ignore_bufadd_pat) > -1 |
|
60 |
+ \ || isdirectory(expand("<afile>")) |
|
61 |
+ return |
|
62 |
+ endif |
|
63 |
+ doautocmd User BufMRUChange |
|
64 |
+ " sometimes, the tabline is not correctly updated see #1580 |
|
65 |
+ " so force redraw here |
|
66 |
+ let &tabline = &tabline |
|
67 |
+endfunction |
|
68 |
+ |
|
69 |
+function! airline#extensions#tabline#load_theme(palette) |
|
70 |
+ if pumvisible() |
|
71 |
+ return |
|
72 |
+ endif |
|
73 |
+ let colors = get(a:palette, 'tabline', {}) |
|
74 |
+ let tablabel = get(colors, 'airline_tablabel', a:palette.normal.airline_b) |
|
75 |
+ " Theme for tabs on the left |
|
76 |
+ let tab = get(colors, 'airline_tab', a:palette.normal.airline_b) |
|
77 |
+ let tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a) |
|
78 |
+ let tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a) |
|
79 |
+ let tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c) |
|
80 |
+ let tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a) |
|
81 |
+ let tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c) |
|
82 |
+ if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c') |
|
83 |
+ let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c) |
|
84 |
+ else |
|
85 |
+ "Fall back to normal airline_c if modified airline_c isn't present |
|
86 |
+ let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c) |
|
87 |
+ endif |
|
88 |
+ call airline#highlighter#exec('airline_tablabel', tablabel) |
|
89 |
+ call airline#highlighter#exec('airline_tab', tab) |
|
90 |
+ call airline#highlighter#exec('airline_tabsel', tabsel) |
|
91 |
+ call airline#highlighter#exec('airline_tabtype', tabtype) |
|
92 |
+ call airline#highlighter#exec('airline_tabfill', tabfill) |
|
93 |
+ call airline#highlighter#exec('airline_tabmod', tabmod) |
|
94 |
+ call airline#highlighter#exec('airline_tabmod_unsel', tabmodu) |
|
95 |
+ call airline#highlighter#exec('airline_tabhid', tabhid) |
|
96 |
+ |
|
97 |
+ " Theme for tabs on the right |
|
98 |
+ let tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a) |
|
99 |
+ let tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c) |
|
100 |
+ let tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a) |
|
101 |
+ let tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c) |
|
102 |
+ if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c') |
|
103 |
+ let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c) |
|
104 |
+ else |
|
105 |
+ "Fall back to normal airline_c if modified airline_c isn't present |
|
106 |
+ let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c) |
|
107 |
+ endif |
|
108 |
+ call airline#highlighter#exec('airline_tab_right', tab_right) |
|
109 |
+ call airline#highlighter#exec('airline_tabsel_right', tabsel_right) |
|
110 |
+ call airline#highlighter#exec('airline_tabmod_right', tabmod_right) |
|
111 |
+ call airline#highlighter#exec('airline_tabhid_right', tabhid_right) |
|
112 |
+ call airline#highlighter#exec('airline_tabmod_unsel_right', tabmodu_right) |
|
113 |
+endfunction |
|
114 |
+ |
|
115 |
+let s:current_tabcnt = -1 |
|
116 |
+ |
|
117 |
+function! airline#extensions#tabline#get() |
|
118 |
+ let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) |
|
119 |
+ let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1) |
|
120 |
+ |
|
121 |
+ let curtabcnt = tabpagenr('$') |
|
122 |
+ if curtabcnt != s:current_tabcnt |
|
123 |
+ let s:current_tabcnt = curtabcnt |
|
124 |
+ call airline#extensions#tabline#tabs#invalidate() |
|
125 |
+ call airline#extensions#tabline#buffers#invalidate() |
|
126 |
+ call airline#extensions#tabline#ctrlspace#invalidate() |
|
127 |
+ endif |
|
128 |
+ |
|
129 |
+ if !exists('#airline#BufAdd#*') |
|
130 |
+ autocmd airline BufAdd * call <sid>update_tabline() |
|
131 |
+ endif |
|
132 |
+ if s:ctrlspace |
|
133 |
+ return airline#extensions#tabline#ctrlspace#get() |
|
134 |
+ elseif show_buffers && curtabcnt == 1 || !show_tabs |
|
135 |
+ return airline#extensions#tabline#buffers#get() |
|
136 |
+ else |
|
137 |
+ return airline#extensions#tabline#tabs#get() |
|
138 |
+ endif |
|
139 |
+endfunction |
|
140 |
+ |
|
141 |
+function! airline#extensions#tabline#title(n) |
|
142 |
+ let title = '' |
|
143 |
+ if s:taboo |
|
144 |
+ let title = TabooTabTitle(a:n) |
|
145 |
+ endif |
|
146 |
+ |
|
147 |
+ if empty(title) && exists('*gettabvar') |
|
148 |
+ let title = gettabvar(a:n, 'title') |
|
149 |
+ endif |
|
150 |
+ |
|
151 |
+ if empty(title) |
|
152 |
+ let buflist = tabpagebuflist(a:n) |
|
153 |
+ let winnr = tabpagewinnr(a:n) |
|
154 |
+ let all_buffers = airline#extensions#tabline#buflist#list() |
|
155 |
+ return airline#extensions#tabline#get_buffer_name( |
|
156 |
+ \ buflist[winnr - 1], |
|
157 |
+ \ filter(buflist, 'index(all_buffers, v:val) != -1')) |
|
158 |
+ endif |
|
159 |
+ |
|
160 |
+ return title |
|
161 |
+endfunction |
|
162 |
+ |
|
163 |
+function! airline#extensions#tabline#get_buffer_name(nr, ...) |
|
164 |
+ let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list() |
|
165 |
+ let formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') |
|
166 |
+ return airline#extensions#tabline#formatters#{formatter}#format(a:nr, buffers) |
|
167 |
+endfunction |
|
168 |
+ |
|
169 |
+function! airline#extensions#tabline#new_builder() |
|
170 |
+ let builder_context = { |
|
171 |
+ \ 'active' : 1, |
|
172 |
+ \ 'tabline' : 1, |
|
173 |
+ \ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep), |
|
174 |
+ \ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep), |
|
175 |
+ \ } |
|
176 |
+ if get(g:, 'airline_powerline_fonts', 0) |
|
177 |
+ let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep) |
|
178 |
+ let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep) |
|
179 |
+ else |
|
180 |
+ let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ') |
|
181 |
+ let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|') |
|
182 |
+ endif |
|
183 |
+ |
|
184 |
+ return airline#extensions#tabline#builder#new(builder_context) |
|
185 |
+endfunction |
|
186 |
+ |
|
187 |
+function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr) |
|
188 |
+ let cur = bufnr('%') |
|
189 |
+ if cur == a:bufnr |
|
190 |
+ if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') |
|
191 |
+ let group = 'airline_tabmod' |
|
192 |
+ else |
|
193 |
+ let group = 'airline_tabsel' |
|
194 |
+ endif |
|
195 |
+ else |
|
196 |
+ if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') |
|
197 |
+ let group = 'airline_tabmod_unsel' |
|
198 |
+ elseif index(a:tab_bufs, a:bufnr) > -1 |
|
199 |
+ let group = 'airline_tab' |
|
200 |
+ else |
|
201 |
+ let group = 'airline_tabhid' |
|
202 |
+ endif |
|
203 |
+ endif |
|
204 |
+ return group |
|
205 |
+endfunction |
|
206 |
+ |
|
207 |
+function! airline#extensions#tabline#add_label(dict, type) |
|
208 |
+ if get(g:, 'airline#extensions#tabline#show_tab_type', 1) |
|
209 |
+ call a:dict.add_section_spaced('airline_tablabel', |
|
210 |
+ \ get(g:, 'airline#extensions#tabline#'.a:type.'_label', a:type)) |
|
211 |
+ endif |
|
212 |
+endfunction |
... | ... |
@@ -0,0 +1,55 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) |
|
7 |
+let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0) |
|
8 |
+let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0) |
|
9 |
+ |
|
10 |
+function! airline#extensions#tabline#autoshow#off() |
|
11 |
+ if exists('s:original_tabline') |
|
12 |
+ let &tabline = s:original_tabline |
|
13 |
+ let &showtabline = s:original_showtabline |
|
14 |
+ endif |
|
15 |
+ |
|
16 |
+ augroup airline_tabline_autoshow |
|
17 |
+ autocmd! |
|
18 |
+ augroup END |
|
19 |
+endfunction |
|
20 |
+ |
|
21 |
+function! airline#extensions#tabline#autoshow#on() |
|
22 |
+ let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ] |
|
23 |
+ |
|
24 |
+ augroup airline_tabline_autoshow |
|
25 |
+ autocmd! |
|
26 |
+ if s:buf_min_count <= 0 && s:tab_min_count <= 1 |
|
27 |
+ if &lines > 3 |
|
28 |
+ set showtabline=2 |
|
29 |
+ endif |
|
30 |
+ else |
|
31 |
+ if s:show_buffers == 1 |
|
32 |
+ autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list())) |
|
33 |
+ autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()) - 1) |
|
34 |
+ else |
|
35 |
+ autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$')) |
|
36 |
+ endif |
|
37 |
+ endif |
|
38 |
+ |
|
39 |
+ " Invalidate cache. This has to come after the BufUnload for |
|
40 |
+ " s:show_buffers, to invalidate the cache for BufEnter. |
|
41 |
+ autocmd BufLeave,BufAdd,BufUnload * call airline#extensions#tabline#buflist#invalidate() |
|
42 |
+ augroup END |
|
43 |
+endfunction |
|
44 |
+ |
|
45 |
+function! s:show_tabline(min_count, total_count) |
|
46 |
+ if a:total_count >= a:min_count |
|
47 |
+ if &showtabline != 2 && &lines > 3 |
|
48 |
+ set showtabline=2 |
|
49 |
+ endif |
|
50 |
+ else |
|
51 |
+ if &showtabline != 0 |
|
52 |
+ set showtabline=0 |
|
53 |
+ endif |
|
54 |
+ endif |
|
55 |
+endfunction |
... | ... |
@@ -0,0 +1,247 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:spc = g:airline_symbols.space |
|
7 |
+ |
|
8 |
+let s:current_bufnr = -1 |
|
9 |
+let s:current_modified = 0 |
|
10 |
+let s:current_tabline = '' |
|
11 |
+let s:current_visible_buffers = [] |
|
12 |
+ |
|
13 |
+let s:number_map = { |
|
14 |
+ \ '0': '⁰', |
|
15 |
+ \ '1': '¹', |
|
16 |
+ \ '2': '²', |
|
17 |
+ \ '3': '³', |
|
18 |
+ \ '4': '⁴', |
|
19 |
+ \ '5': '⁵', |
|
20 |
+ \ '6': '⁶', |
|
21 |
+ \ '7': '⁷', |
|
22 |
+ \ '8': '⁸', |
|
23 |
+ \ '9': '⁹' |
|
24 |
+ \ } |
|
25 |
+let s:number_map = &encoding == 'utf-8' |
|
26 |
+ \ ? get(g:, 'airline#extensions#tabline#buffer_idx_format', s:number_map) |
|
27 |
+ \ : {} |
|
28 |
+ |
|
29 |
+function! airline#extensions#tabline#buffers#off() |
|
30 |
+ augroup airline_tabline_buffers |
|
31 |
+ autocmd! |
|
32 |
+ augroup END |
|
33 |
+endfunction |
|
34 |
+ |
|
35 |
+function! airline#extensions#tabline#buffers#on() |
|
36 |
+ augroup airline_tabline_buffers |
|
37 |
+ autocmd! |
|
38 |
+ autocmd BufDelete * call airline#extensions#tabline#buffers#invalidate() |
|
39 |
+ autocmd User BufMRUChange call airline#extensions#tabline#buflist#invalidate() |
|
40 |
+ autocmd User BufMRUChange call airline#extensions#tabline#buffers#invalidate() |
|
41 |
+ augroup END |
|
42 |
+endfunction |
|
43 |
+ |
|
44 |
+function! airline#extensions#tabline#buffers#invalidate() |
|
45 |
+ let s:current_bufnr = -1 |
|
46 |
+endfunction |
|
47 |
+ |
|
48 |
+function! airline#extensions#tabline#buffers#get() |
|
49 |
+ try |
|
50 |
+ call <sid>map_keys() |
|
51 |
+ catch |
|
52 |
+ " no-op |
|
53 |
+ endtry |
|
54 |
+ let cur = bufnr('%') |
|
55 |
+ if cur == s:current_bufnr && &columns == s:column_width |
|
56 |
+ if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified |
|
57 |
+ return s:current_tabline |
|
58 |
+ endif |
|
59 |
+ endif |
|
60 |
+ |
|
61 |
+ let b = airline#extensions#tabline#new_builder() |
|
62 |
+ let tab_bufs = tabpagebuflist(tabpagenr()) |
|
63 |
+ let show_buf_label_first = 0 |
|
64 |
+ |
|
65 |
+ if get(g:, 'airline#extensions#tabline#buf_label_first', 0) |
|
66 |
+ let show_buf_label_first = 1 |
|
67 |
+ endif |
|
68 |
+ if show_buf_label_first |
|
69 |
+ call airline#extensions#tabline#add_label(b, 'buffers') |
|
70 |
+ endif |
|
71 |
+ |
|
72 |
+ let b.tab_bufs = tabpagebuflist(tabpagenr()) |
|
73 |
+ |
|
74 |
+ let b.overflow_group = 'airline_tabhid' |
|
75 |
+ let b.buffers = airline#extensions#tabline#buflist#list() |
|
76 |
+ if get(g:, 'airline#extensions#tabline#current_first', 0) |
|
77 |
+ if index(b.buffers, cur) > -1 |
|
78 |
+ call remove(b.buffers, index(b.buffers, cur)) |
|
79 |
+ endif |
|
80 |
+ let b.buffers = [cur] + b.buffers |
|
81 |
+ endif |
|
82 |
+ |
|
83 |
+ function! b.get_group(i) dict |
|
84 |
+ let bufnum = get(self.buffers, a:i, -1) |
|
85 |
+ if bufnum == -1 |
|
86 |
+ return '' |
|
87 |
+ endif |
|
88 |
+ let group = airline#extensions#tabline#group_of_bufnr(self.tab_bufs, bufnum) |
|
89 |
+ if bufnum == bufnr('%') |
|
90 |
+ let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 |
|
91 |
+ endif |
|
92 |
+ return group |
|
93 |
+ endfunction |
|
94 |
+ |
|
95 |
+ if has("tablineat") |
|
96 |
+ function! b.get_pretitle(i) dict |
|
97 |
+ let bufnum = get(self.buffers, a:i, -1) |
|
98 |
+ return '%'.bufnum.'@airline#extensions#tabline#buffers#clickbuf@' |
|
99 |
+ endfunction |
|
100 |
+ |
|
101 |
+ function b.get_posttitle(i) dict |
|
102 |
+ return '%X' |
|
103 |
+ endfunction |
|
104 |
+ endif |
|
105 |
+ |
|
106 |
+ function! b.get_title(i) dict |
|
107 |
+ let bufnum = get(self.buffers, a:i, -1) |
|
108 |
+ let group = self.get_group(a:i) |
|
109 |
+ let pgroup = self.get_group(a:i - 1) |
|
110 |
+ " always add a space when powerline_fonts are used |
|
111 |
+ " or for the very first item |
|
112 |
+ if get(g:, 'airline_powerline_fonts', 0) || a:i == 0 |
|
113 |
+ let space = s:spc |
|
114 |
+ else |
|
115 |
+ let space= (pgroup == group ? s:spc : '') |
|
116 |
+ endif |
|
117 |
+ |
|
118 |
+ if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) |
|
119 |
+ if len(s:number_map) > 0 |
|
120 |
+ return space. get(s:number_map, a:i+1, '') . '%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)' . s:spc |
|
121 |
+ else |
|
122 |
+ return '['.(a:i+1).s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)'.']' |
|
123 |
+ endif |
|
124 |
+ else |
|
125 |
+ return space.'%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)'.s:spc |
|
126 |
+ endif |
|
127 |
+ endfunction |
|
128 |
+ |
|
129 |
+ let current_buffer = max([index(b.buffers, cur), 0]) |
|
130 |
+ let last_buffer = len(b.buffers) - 1 |
|
131 |
+ call b.insert_titles(current_buffer, 0, last_buffer) |
|
132 |
+ |
|
133 |
+ call b.add_section('airline_tabfill', '') |
|
134 |
+ call b.split() |
|
135 |
+ call b.add_section('airline_tabfill', '') |
|
136 |
+ if !show_buf_label_first |
|
137 |
+ call airline#extensions#tabline#add_label(b, 'buffers') |
|
138 |
+ endif |
|
139 |
+ |
|
140 |
+ if tabpagenr('$') > 1 |
|
141 |
+ call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$'))) |
|
142 |
+ endif |
|
143 |
+ |
|
144 |
+ let s:current_bufnr = cur |
|
145 |
+ let s:column_width = &columns |
|
146 |
+ let s:current_tabline = b.build() |
|
147 |
+ let s:current_visible_buffers = copy(b.buffers) |
|
148 |
+ if b._right_title <= last_buffer |
|
149 |
+ call remove(s:current_visible_buffers, b._right_title, last_buffer) |
|
150 |
+ endif |
|
151 |
+ if b._left_title > 0 |
|
152 |
+ call remove(s:current_visible_buffers, 0, b._left_title) |
|
153 |
+ endif |
|
154 |
+ return s:current_tabline |
|
155 |
+endfunction |
|
156 |
+ |
|
157 |
+function! s:select_tab(buf_index) |
|
158 |
+ " no-op when called in 'keymap_ignored_filetypes' |
|
159 |
+ if count(get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes', |
|
160 |
+ \ ['vimfiler', 'nerdtree']), &ft) |
|
161 |
+ return |
|
162 |
+ endif |
|
163 |
+ |
|
164 |
+ let idx = a:buf_index |
|
165 |
+ if s:current_visible_buffers[0] == -1 |
|
166 |
+ let idx = idx + 1 |
|
167 |
+ endif |
|
168 |
+ |
|
169 |
+ let buf = get(s:current_visible_buffers, idx, 0) |
|
170 |
+ if buf != 0 |
|
171 |
+ exec 'b!' . buf |
|
172 |
+ endif |
|
173 |
+endfunction |
|
174 |
+ |
|
175 |
+function! s:jump_to_tab(offset) |
|
176 |
+ let l = airline#extensions#tabline#buflist#list() |
|
177 |
+ let i = index(l, bufnr('%')) |
|
178 |
+ if i > -1 |
|
179 |
+ exec 'b!' . l[(i + a:offset) % len(l)] |
|
180 |
+ endif |
|
181 |
+endfunction |
|
182 |
+ |
|
183 |
+function! s:map_keys() |
|
184 |
+ if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1) |
|
185 |
+ noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR> |
|
186 |
+ noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR> |
|
187 |
+ noremap <silent> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR> |
|
188 |
+ noremap <silent> <Plug>AirlineSelectTab4 :call <SID>select_tab(3)<CR> |
|
189 |
+ noremap <silent> <Plug>AirlineSelectTab5 :call <SID>select_tab(4)<CR> |
|
190 |
+ noremap <silent> <Plug>AirlineSelectTab6 :call <SID>select_tab(5)<CR> |
|
191 |
+ noremap <silent> <Plug>AirlineSelectTab7 :call <SID>select_tab(6)<CR> |
|
192 |
+ noremap <silent> <Plug>AirlineSelectTab8 :call <SID>select_tab(7)<CR> |
|
193 |
+ noremap <silent> <Plug>AirlineSelectTab9 :call <SID>select_tab(8)<CR> |
|
194 |
+ noremap <silent> <Plug>AirlineSelectPrevTab :<C-u>call <SID>jump_to_tab(-v:count1)<CR> |
|
195 |
+ noremap <silent> <Plug>AirlineSelectNextTab :<C-u>call <SID>jump_to_tab(v:count1)<CR> |
|
196 |
+ endif |
|
197 |
+endfunction |
|
198 |
+ |
|
199 |
+function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, modifiers) abort |
|
200 |
+ " Clickable buffers |
|
201 |
+ " works only in recent NeoVim with has('tablineat') |
|
202 |
+ |
|
203 |
+ " single mouse button click without modifiers pressed |
|
204 |
+ if a:clicks == 1 && a:modifiers !~# '[^ ]' |
|
205 |
+ if a:button is# 'l' |
|
206 |
+ " left button - switch to buffer |
|
207 |
+ silent execute 'buffer' a:minwid |
|
208 |
+ elseif a:button is# 'm' |
|
209 |
+ " middle button - delete buffer |
|
210 |
+ |
|
211 |
+ if get(g:, 'airline#extensions#tabline#middle_click_preserves_windows', 0) == 0 |
|
212 |
+ " just simply delete the clicked buffer. This will cause windows |
|
213 |
+ " associated with the clicked buffer to be closed. |
|
214 |
+ silent execute 'bdelete' a:minwid |
|
215 |
+ else |
|
216 |
+ " find windows displaying the clicked buffer and open an new |
|
217 |
+ " buffer in them. |
|
218 |
+ let current_window = bufwinnr("%") |
|
219 |
+ let window_number = bufwinnr(a:minwid) |
|
220 |
+ let last_window_visited = -1 |
|
221 |
+ |
|
222 |
+ " Set to 1 if the clicked buffer was open in any windows. |
|
223 |
+ let buffer_in_window = 0 |
|
224 |
+ |
|
225 |
+ " Find the next window with the clicked buffer open. If bufwinnr() |
|
226 |
+ " returns the same window number, this is because we clicked a new |
|
227 |
+ " buffer, and then tried editing a new buffer. Vim won't create a |
|
228 |
+ " new empty buffer for the same window, so we get the same window |
|
229 |
+ " number from bufwinnr(). In this case we just give up and don't |
|
230 |
+ " delete the buffer. |
|
231 |
+ " This could be made cleaner if we could check if the clicked buffer |
|
232 |
+ " is a new buffer, but I don't know if there is a way to do that. |
|
233 |
+ while window_number != -1 && window_number != last_window_visited |
|
234 |
+ let buffer_in_window = 1 |
|
235 |
+ silent execute window_number . 'wincmd w' |
|
236 |
+ silent execute 'enew' |
|
237 |
+ let last_window_visited = window_number |
|
238 |
+ let window_number = bufwinnr(a:minwid) |
|
239 |
+ endwhile |
|
240 |
+ silent execute current_window . 'wincmd w' |
|
241 |
+ if window_number != last_window_visited || buffer_in_window == 0 |
|
242 |
+ silent execute 'bdelete' a:minwid |
|
243 |
+ endif |
|
244 |
+ endif |
|
245 |
+ endif |
|
246 |
+ endif |
|
247 |
+endfunction |
... | ... |
@@ -0,0 +1,68 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+function! airline#extensions#tabline#buflist#invalidate() |
|
7 |
+ unlet! s:current_buffer_list |
|
8 |
+endfunction |
|
9 |
+ |
|
10 |
+" paths in excludes list |
|
11 |
+function! s:ExcludePaths(nr, exclude_paths) |
|
12 |
+ let bpath = fnamemodify(bufname(a:nr), ":p") |
|
13 |
+ for f in a:exclude_paths |
|
14 |
+ if bpath =~# f | return 1 | endif |
|
15 |
+ endfor |
|
16 |
+endfunction |
|
17 |
+ |
|
18 |
+" other types to exclude |
|
19 |
+function! s:ExcludeOther(nr, exclude_preview) |
|
20 |
+ if (getbufvar(a:nr, 'current_syntax') == 'qf') || |
|
21 |
+ \ (a:exclude_preview && getbufvar(a:nr, '&bufhidden') == 'wipe' |
|
22 |
+ \ && getbufvar(a:nr, '&buftype') == 'nofile') |
|
23 |
+ return 1 | endif |
|
24 |
+endfunction |
|
25 |
+ |
|
26 |
+function! airline#extensions#tabline#buflist#list() |
|
27 |
+ if exists('s:current_buffer_list') |
|
28 |
+ return s:current_buffer_list |
|
29 |
+ endif |
|
30 |
+ |
|
31 |
+ let exclude_buffers = get(g:, 'airline#extensions#tabline#exclude_buffers', []) |
|
32 |
+ let exclude_paths = get(g:, 'airline#extensions#tabline#excludes', []) |
|
33 |
+ let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1) |
|
34 |
+ |
|
35 |
+ let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$")) |
|
36 |
+ |
|
37 |
+ let buffers = [] |
|
38 |
+ " If this is too slow, we can switch to a different algorithm. |
|
39 |
+ " Basically branch 535 already does it, but since it relies on |
|
40 |
+ " BufAdd autocommand, I'd like to avoid this if possible. |
|
41 |
+ for nr in list |
|
42 |
+ if buflisted(nr) |
|
43 |
+ " Do not add to the bufferlist, if either |
|
44 |
+ " 1) bufnr is exclude_buffers list |
|
45 |
+ " 2) buffername matches one of exclude_paths patterns |
|
46 |
+ " 3) buffer is a quickfix buffer |
|
47 |
+ " 4) when excluding preview windows: |
|
48 |
+ " 'bufhidden' == wipe |
|
49 |
+ " 'buftype' == nofile |
|
50 |
+ |
|
51 |
+ " check buffer numbers first |
|
52 |
+ if index(exclude_buffers, nr) >= 0 |
|
53 |
+ continue |
|
54 |
+ " check paths second |
|
55 |
+ elseif !empty(exclude_paths) && s:ExcludePaths(nr, exclude_paths) |
|
56 |
+ continue |
|
57 |
+ " check other types last |
|
58 |
+ elseif s:ExcludeOther(nr, exclude_preview) |
|
59 |
+ continue |
|
60 |
+ endif |
|
61 |
+ |
|
62 |
+ call add(buffers, nr) |
|
63 |
+ endif |
|
64 |
+ endfor |
|
65 |
+ |
|
66 |
+ let s:current_buffer_list = buffers |
|
67 |
+ return buffers |
|
68 |
+endfunction |
... | ... |
@@ -0,0 +1,232 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:prototype = {} |
|
7 |
+ |
|
8 |
+" Set the point in the tabline where the builder should insert the titles. |
|
9 |
+" |
|
10 |
+" Subsequent calls will overwrite the previous ones, so only the last call |
|
11 |
+" determines to location to insert titles. |
|
12 |
+" |
|
13 |
+" NOTE: The titles are not inserted until |build| is called, so that the |
|
14 |
+" remaining contents of the tabline can be taken into account. |
|
15 |
+" |
|
16 |
+" Callers should define at least |get_title| and |get_group| on the host |
|
17 |
+" object before calling |build|. |
|
18 |
+function! s:prototype.insert_titles(current, first, last) dict |
|
19 |
+ let self._first_title = a:first " lowest index |
|
20 |
+ let self._last_title = a:last " highest index |
|
21 |
+ let self._left_title = a:current " next index to add on the left |
|
22 |
+ let self._right_title = a:current + 1 " next index to add on the right |
|
23 |
+ let self._left_position = self.get_position() " left end of titles |
|
24 |
+ let self._right_position = self._left_position " right end of the titles |
|
25 |
+endfunction |
|
26 |
+ |
|
27 |
+" Insert a title for entry number |index|, of group |group| at position |pos|, |
|
28 |
+" if there is space for it. Returns 1 if it is inserted, 0 otherwise |
|
29 |
+" |
|
30 |
+" |force| inserts the title even if there isn't enough space left for it. |
|
31 |
+" |sep_size| adjusts the size change that the title is considered to take up, |
|
32 |
+" to account for changes to the separators |
|
33 |
+" |
|
34 |
+" The title is defined by |get_title| on the hosting object, called with |
|
35 |
+" |index| as its only argument. |
|
36 |
+" |get_pretitle| and |get_posttitle| may be defined on the host object to |
|
37 |
+" insert some formatting before or after the title. These should be 0-width. |
|
38 |
+" |
|
39 |
+" This method updates |_right_position| and |_remaining_space| on the host |
|
40 |
+" object, if the title is inserted. |
|
41 |
+function! s:prototype.try_insert_title(index, group, pos, sep_size, force) dict |
|
42 |
+ let title = self.get_title(a:index) |
|
43 |
+ let title_size = s:tabline_evaluated_length(title) + a:sep_size |
|
44 |
+ if a:force || self._remaining_space >= title_size |
|
45 |
+ let pos = a:pos |
|
46 |
+ if has_key(self, "get_pretitle") |
|
47 |
+ call self.insert_raw(self.get_pretitle(a:index), pos) |
|
48 |
+ let self._right_position += 1 |
|
49 |
+ let pos += 1 |
|
50 |
+ endif |
|
51 |
+ |
|
52 |
+ call self.insert_section(a:group, title, pos) |
|
53 |
+ let self._right_position += 1 |
|
54 |
+ let pos += 1 |
|
55 |
+ |
|
56 |
+ if has_key(self, "get_posttitle") |
|
57 |
+ call self.insert_raw(self.get_posttitle(a:index), pos) |
|
58 |
+ let self._right_position += 1 |
|
59 |
+ let pos += 1 |
|
60 |
+ endif |
|
61 |
+ |
|
62 |
+ let self._remaining_space -= title_size |
|
63 |
+ return 1 |
|
64 |
+ endif |
|
65 |
+ return 0 |
|
66 |
+endfunction |
|
67 |
+ |
|
68 |
+function! s:get_separator_change(new_group, old_group, end_group, sep_size, alt_sep_size) |
|
69 |
+ return s:get_separator_change_with_end(a:new_group, a:old_group, a:end_group, a:end_group, a:sep_size, a:alt_sep_size) |
|
70 |
+endfunction |
|
71 |
+ |
|
72 |
+" Compute the change in size of the tabline caused by separators |
|
73 |
+" |
|
74 |
+" This should be kept up-to-date with |s:get_transitioned_seperator| and |
|
75 |
+" |s:get_separator| in autoload/airline/builder.vim |
|
76 |
+function! s:get_separator_change_with_end(new_group, old_group, new_end_group, old_end_group, sep_size, alt_sep_size) |
|
77 |
+ let sep_change = 0 |
|
78 |
+ if !empty(a:new_end_group) " Separator between title and the end |
|
79 |
+ let sep_change += airline#builder#should_change_group(a:new_group, a:new_end_group) ? a:sep_size : a:alt_sep_size |
|
80 |
+ endif |
|
81 |
+ if !empty(a:old_group) " Separator between the title and the one adjacent |
|
82 |
+ let sep_change += airline#builder#should_change_group(a:new_group, a:old_group) ? a:sep_size : a:alt_sep_size |
|
83 |
+ if !empty(a:old_end_group) " Remove mis-predicted separator |
|
84 |
+ let sep_change -= airline#builder#should_change_group(a:old_group, a:old_end_group) ? a:sep_size : a:alt_sep_size |
|
85 |
+ endif |
|
86 |
+ endif |
|
87 |
+ return sep_change |
|
88 |
+endfunction |
|
89 |
+ |
|
90 |
+" This replaces the build function of the |airline#builder#new| object, to |
|
91 |
+" insert titles as specified by the last call to |insert_titles| before |
|
92 |
+" passing to the original build function. |
|
93 |
+" |
|
94 |
+" Callers should define at least |get_title| and |get_group| on the host |
|
95 |
+" object if |insert_titles| has been called on it. |
|
96 |
+function! s:prototype.build() dict |
|
97 |
+ if has_key(self, '_left_position') && self._first_title <= self._last_title |
|
98 |
+ let self._remaining_space = &columns - s:tabline_evaluated_length(self._build()) |
|
99 |
+ |
|
100 |
+ let center_active = get(g:, 'airline#extensions#tabline#center_active', 0) |
|
101 |
+ |
|
102 |
+ let sep_size = s:tabline_evaluated_length(self._context.left_sep) |
|
103 |
+ let alt_sep_size = s:tabline_evaluated_length(self._context.left_alt_sep) |
|
104 |
+ |
|
105 |
+ let outer_left_group = airline#builder#get_prev_group(self._sections, self._left_position) |
|
106 |
+ let outer_right_group = airline#builder#get_next_group(self._sections, self._right_position) |
|
107 |
+ |
|
108 |
+ let overflow_marker = get(g:, 'airline#extensions#tabline#overflow_marker', g:airline_symbols.ellipsis) |
|
109 |
+ let overflow_marker_size = s:tabline_evaluated_length(overflow_marker) |
|
110 |
+ " Allow space for the markers before we begin filling in titles. |
|
111 |
+ if self._left_title > self._first_title |
|
112 |
+ let self._remaining_space -= overflow_marker_size + |
|
113 |
+ \ s:get_separator_change(self.overflow_group, "", outer_left_group, sep_size, alt_sep_size) |
|
114 |
+ endif |
|
115 |
+ if self._left_title < self._last_title |
|
116 |
+ let self._remaining_space -= overflow_marker_size + |
|
117 |
+ \ s:get_separator_change(self.overflow_group, "", outer_right_group, sep_size, alt_sep_size) |
|
118 |
+ endif |
|
119 |
+ |
|
120 |
+ " Add the current title |
|
121 |
+ let group = self.get_group(self._left_title) |
|
122 |
+ if self._left_title == self._first_title |
|
123 |
+ let sep_change = s:get_separator_change(group, "", outer_left_group, sep_size, alt_sep_size) |
|
124 |
+ else |
|
125 |
+ let sep_change = s:get_separator_change(group, "", self.overflow_group, sep_size, alt_sep_size) |
|
126 |
+ endif |
|
127 |
+ if self._left_title == self._last_title |
|
128 |
+ let sep_change += s:get_separator_change(group, "", outer_right_group, sep_size, alt_sep_size) |
|
129 |
+ else |
|
130 |
+ let sep_change += s:get_separator_change(group, "", self.overflow_group, sep_size, alt_sep_size) |
|
131 |
+ endif |
|
132 |
+ let left_group = group |
|
133 |
+ let right_group = group |
|
134 |
+ let self._left_title -= |
|
135 |
+ \ self.try_insert_title(self._left_title, group, self._left_position, sep_change, 1) |
|
136 |
+ |
|
137 |
+ if get(g:, 'airline#extensions#tabline#current_first', 0) |
|
138 |
+ " always have current title first |
|
139 |
+ let self._left_position += 1 |
|
140 |
+ endif |
|
141 |
+ |
|
142 |
+ if !center_active && self._right_title <= self._last_title |
|
143 |
+ " Add the title to the right |
|
144 |
+ let group = self.get_group(self._right_title) |
|
145 |
+ if self._right_title == self._last_title |
|
146 |
+ let sep_change = s:get_separator_change_with_end(group, right_group, outer_right_group, self.overflow_group, sep_size, alt_sep_size) - overflow_marker_size |
|
147 |
+ else |
|
148 |
+ let sep_change = s:get_separator_change(group, right_group, self.overflow_group, sep_size, alt_sep_size) |
|
149 |
+ endif |
|
150 |
+ let right_group = group |
|
151 |
+ let self._right_title += |
|
152 |
+ \ self.try_insert_title(self._right_title, group, self._right_position, sep_change, 1) |
|
153 |
+ endif |
|
154 |
+ |
|
155 |
+ while self._remaining_space > 0 |
|
156 |
+ let done = 0 |
|
157 |
+ if self._left_title >= self._first_title |
|
158 |
+ " Insert next title to the left |
|
159 |
+ let group = self.get_group(self._left_title) |
|
160 |
+ if self._left_title == self._first_title |
|
161 |
+ let sep_change = s:get_separator_change_with_end(group, left_group, outer_left_group, self.overflow_group, sep_size, alt_sep_size) - overflow_marker_size |
|
162 |
+ else |
|
163 |
+ let sep_change = s:get_separator_change(group, left_group, self.overflow_group, sep_size, alt_sep_size) |
|
164 |
+ endif |
|
165 |
+ let left_group = group |
|
166 |
+ let done = self.try_insert_title(self._left_title, group, self._left_position, sep_change, 0) |
|
167 |
+ let self._left_title -= done |
|
168 |
+ endif |
|
169 |
+ " If center_active is set, this |if| operates as an independent |if|, |
|
170 |
+ " otherwise as an |elif|. |
|
171 |
+ if self._right_title <= self._last_title && (center_active || !done) |
|
172 |
+ " Insert next title to the right |
|
173 |
+ let group = self.get_group(self._right_title) |
|
174 |
+ if self._right_title == self._last_title |
|
175 |
+ let sep_change = s:get_separator_change_with_end(group, right_group, outer_right_group, self.overflow_group, sep_size, alt_sep_size) - overflow_marker_size |
|
176 |
+ else |
|
177 |
+ let sep_change = s:get_separator_change(group, right_group, self.overflow_group, sep_size, alt_sep_size) |
|
178 |
+ endif |
|
179 |
+ let right_group = group |
|
180 |
+ let done = self.try_insert_title(self._right_title, group, self._right_position, sep_change, 0) |
|
181 |
+ let self._right_title += done |
|
182 |
+ endif |
|
183 |
+ if !done |
|
184 |
+ break |
|
185 |
+ endif |
|
186 |
+ endwhile |
|
187 |
+ |
|
188 |
+ if self._left_title >= self._first_title |
|
189 |
+ if get(g:, 'airline#extensions#tabline#current_first', 0) |
|
190 |
+ let self._left_position -= 1 |
|
191 |
+ endif |
|
192 |
+ call self.insert_section(self.overflow_group, overflow_marker, self._left_position) |
|
193 |
+ let self._right_position += 1 |
|
194 |
+ endif |
|
195 |
+ |
|
196 |
+ if self._right_title <= self._last_title |
|
197 |
+ call self.insert_section(self.overflow_group, overflow_marker, self._right_position) |
|
198 |
+ endif |
|
199 |
+ endif |
|
200 |
+ |
|
201 |
+ return self._build() |
|
202 |
+endfunction |
|
203 |
+ |
|
204 |
+let s:prototype.overflow_group = 'airline_tab' |
|
205 |
+ |
|
206 |
+" Extract the text content a tabline will render. (Incomplete). |
|
207 |
+" |
|
208 |
+" See :help 'statusline' for the list of fields. |
|
209 |
+function! s:evaluate_tabline(tabline) |
|
210 |
+ let tabline = a:tabline |
|
211 |
+ let tabline = substitute(tabline, '%{\([^}]\+\)}', '\=eval(submatch(1))', 'g') |
|
212 |
+ let tabline = substitute(tabline, '%#[^#]\+#', '', 'g') |
|
213 |
+ let tabline = substitute(tabline, '%(\([^)]\+\)%)', '\1', 'g') |
|
214 |
+ let tabline = substitute(tabline, '%\d\+[TX]', '', 'g') |
|
215 |
+ let tabline = substitute(tabline, '%=', '', 'g') |
|
216 |
+ let tabline = substitute(tabline, '%\d*\*', '', 'g') |
|
217 |
+ if has('tablineat') |
|
218 |
+ let tabline = substitute(tabline, '%@[^@]\+@', '', 'g') |
|
219 |
+ endif |
|
220 |
+ return tabline |
|
221 |
+endfunction |
|
222 |
+ |
|
223 |
+function! s:tabline_evaluated_length(tabline) |
|
224 |
+ return airline#util#strchars(s:evaluate_tabline(a:tabline)) |
|
225 |
+endfunction |
|
226 |
+ |
|
227 |
+function! airline#extensions#tabline#builder#new(context) |
|
228 |
+ let builder = airline#builder#new(a:context) |
|
229 |
+ let builder._build = builder.build |
|
230 |
+ call extend(builder, s:prototype, 'force') |
|
231 |
+ return builder |
|
232 |
+endfunction |
... | ... |
@@ -0,0 +1,176 @@ |
1 |
+" MIT License. Copyright (c) 2016-2018 Kevin Sapper et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:current_bufnr = -1 |
|
7 |
+let s:current_tabnr = -1 |
|
8 |
+let s:current_tabline = '' |
|
9 |
+ |
|
10 |
+function! airline#extensions#tabline#ctrlspace#off() |
|
11 |
+ augroup airline_tabline_ctrlspace |
|
12 |
+ autocmd! |
|
13 |
+ augroup END |
|
14 |
+endfunction |
|
15 |
+ |
|
16 |
+function! airline#extensions#tabline#ctrlspace#on() |
|
17 |
+ augroup airline_tabline_ctrlspace |
|
18 |
+ autocmd! |
|
19 |
+ autocmd BufDelete * call airline#extensions#tabline#ctrlspace#invalidate() |
|
20 |
+ augroup END |
|
21 |
+endfunction |
|
22 |
+ |
|
23 |
+function! airline#extensions#tabline#ctrlspace#invalidate() |
|
24 |
+ let s:current_bufnr = -1 |
|
25 |
+ let s:current_tabnr = -1 |
|
26 |
+endfunction |
|
27 |
+ |
|
28 |
+function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pos) |
|
29 |
+ if a:pos == 0 |
|
30 |
+ let pos_extension = '' |
|
31 |
+ else |
|
32 |
+ let pos_extension = '_right' |
|
33 |
+ endif |
|
34 |
+ |
|
35 |
+ let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab) |
|
36 |
+ " add by tenfy(tenfyzhong@qq.com) |
|
37 |
+ " if the current buffer no in the buffer list |
|
38 |
+ " return false and no redraw tabline. |
|
39 |
+ " Fixes #1515. if there a BufEnter autocmd execute redraw. The tabline may no update. |
|
40 |
+ let bufnr_list = map(copy(s:buffer_list), 'v:val["index"]') |
|
41 |
+ if index(bufnr_list, a:cur_buf) == -1 |
|
42 |
+ return 0 |
|
43 |
+ endif |
|
44 |
+ |
|
45 |
+ for buffer in s:buffer_list |
|
46 |
+ if a:cur_buf == buffer.index |
|
47 |
+ if buffer.modified |
|
48 |
+ let group = 'airline_tabmod'.pos_extension |
|
49 |
+ else |
|
50 |
+ let group = 'airline_tabsel'.pos_extension |
|
51 |
+ endif |
|
52 |
+ else |
|
53 |
+ if buffer.modified |
|
54 |
+ let group = 'airline_tabmod_unsel'.pos_extension |
|
55 |
+ elseif buffer.visible |
|
56 |
+ let group = 'airline_tab'.pos_extension |
|
57 |
+ else |
|
58 |
+ let group = 'airline_tabhid'.pos_extension |
|
59 |
+ endif |
|
60 |
+ endif |
|
61 |
+ |
|
62 |
+ let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)' |
|
63 |
+ |
|
64 |
+ if has("tablineat") |
|
65 |
+ let buf_name = '%'.buffer.index.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X' |
|
66 |
+ endif |
|
67 |
+ |
|
68 |
+ call a:builder.add_section_spaced(group, buf_name) |
|
69 |
+ endfor |
|
70 |
+ " add by tenfy(tenfyzhong@qq.com) |
|
71 |
+ " if the selected buffer was updated |
|
72 |
+ " return true |
|
73 |
+ return 1 |
|
74 |
+endfunction |
|
75 |
+ |
|
76 |
+function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos) |
|
77 |
+ if a:pos == 0 |
|
78 |
+ let pos_extension = '' |
|
79 |
+ else |
|
80 |
+ let pos_extension = '_right' |
|
81 |
+ endif |
|
82 |
+ |
|
83 |
+ for tab in s:tab_list |
|
84 |
+ if tab.current |
|
85 |
+ if tab.modified |
|
86 |
+ let group = 'airline_tabmod'.pos_extension |
|
87 |
+ else |
|
88 |
+ let group = 'airline_tabsel'.pos_extension |
|
89 |
+ endif |
|
90 |
+ else |
|
91 |
+ if tab.modified |
|
92 |
+ let group = 'airline_tabmod_unsel'.pos_extension |
|
93 |
+ else |
|
94 |
+ let group = 'airline_tabhid'.pos_extension |
|
95 |
+ endif |
|
96 |
+ endif |
|
97 |
+ |
|
98 |
+ call a:builder.add_section_spaced(group, '%'.tab.index.'T'.tab.title.ctrlspace#api#TabBuffersNumber(tab.index).'%T') |
|
99 |
+ endfor |
|
100 |
+endfunction |
|
101 |
+ |
|
102 |
+function! airline#extensions#tabline#ctrlspace#get() |
|
103 |
+ let cur_buf = bufnr('%') |
|
104 |
+ let buffer_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') |
|
105 |
+ let tab_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') |
|
106 |
+ let switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0) |
|
107 |
+ |
|
108 |
+ try |
|
109 |
+ call airline#extensions#tabline#tabs#map_keys() |
|
110 |
+ catch |
|
111 |
+ " no-op |
|
112 |
+ endtry |
|
113 |
+ let s:tab_list = ctrlspace#api#TabList() |
|
114 |
+ for tab in s:tab_list |
|
115 |
+ if tab.current |
|
116 |
+ let cur_tab = tab.index |
|
117 |
+ endif |
|
118 |
+ endfor |
|
119 |
+ |
|
120 |
+ if cur_buf == s:current_bufnr && cur_tab == s:current_tabnr |
|
121 |
+ return s:current_tabline |
|
122 |
+ endif |
|
123 |
+ |
|
124 |
+ let builder = airline#extensions#tabline#new_builder() |
|
125 |
+ |
|
126 |
+ " Add left tabline content |
|
127 |
+ if get(g:, 'airline#extensions#tabline#show_buffers', 1) == 0 |
|
128 |
+ call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0) |
|
129 |
+ elseif get(g:, 'airline#extensions#tabline#show_tabs', 1) == 0 |
|
130 |
+ " add by tenfy(tenfyzhong@qq.com) |
|
131 |
+ " if current buffer no in the buffer list, does't update tabline |
|
132 |
+ if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0 |
|
133 |
+ return s:current_tabline |
|
134 |
+ endif |
|
135 |
+ else |
|
136 |
+ if switch_buffers_and_tabs == 0 |
|
137 |
+ call builder.add_section_spaced('airline_tabtype', buffer_label) |
|
138 |
+ " add by tenfy(tenfyzhong@qq.com) |
|
139 |
+ " if current buffer no in the buffer list, does't update tabline |
|
140 |
+ if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0 |
|
141 |
+ return s:current_tabline |
|
142 |
+ endif |
|
143 |
+ else |
|
144 |
+ call builder.add_section_spaced('airline_tabtype', tab_label) |
|
145 |
+ call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0) |
|
146 |
+ endif |
|
147 |
+ endif |
|
148 |
+ |
|
149 |
+ call builder.add_section('airline_tabfill', '') |
|
150 |
+ call builder.split() |
|
151 |
+ call builder.add_section('airline_tabfill', '') |
|
152 |
+ |
|
153 |
+ " Add right tabline content |
|
154 |
+ if get(g:, 'airline#extensions#tabline#show_buffers', 1) == 0 |
|
155 |
+ call builder.add_section_spaced('airline_tabtype', tab_label) |
|
156 |
+ elseif get(g:, 'airline#extensions#tabline#show_tabs', 1) == 0 |
|
157 |
+ call builder.add_section_spaced('airline_tabtype', buffer_label) |
|
158 |
+ else |
|
159 |
+ if switch_buffers_and_tabs == 0 |
|
160 |
+ call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1) |
|
161 |
+ call builder.add_section_spaced('airline_tabtype', tab_label) |
|
162 |
+ else |
|
163 |
+ " add by tenfy(tenfyzhong@qq.com) |
|
164 |
+ " if current buffer no in the buffer list, does't update tabline |
|
165 |
+ if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1) == 0 |
|
166 |
+ return s:current_tabline |
|
167 |
+ endif |
|
168 |
+ call builder.add_section_spaced('airline_tabtype', buffer_label) |
|
169 |
+ endif |
|
170 |
+ endif |
|
171 |
+ |
|
172 |
+ let s:current_bufnr = cur_buf |
|
173 |
+ let s:current_tabnr = cur_tab |
|
174 |
+ let s:current_tabline = builder.build() |
|
175 |
+ return s:current_tabline |
|
176 |
+endfunction |
... | ... |
@@ -0,0 +1,41 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) |
|
7 |
+let s:fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0) |
|
8 |
+let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ') |
|
9 |
+let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0) |
|
10 |
+let s:buf_modified_symbol = g:airline_symbols.modified |
|
11 |
+ |
|
12 |
+function! airline#extensions#tabline#formatters#default#format(bufnr, buffers) |
|
13 |
+ let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.') |
|
14 |
+ let _ = '' |
|
15 |
+ |
|
16 |
+ let name = bufname(a:bufnr) |
|
17 |
+ if empty(name) |
|
18 |
+ let _ .= '[No Name]' |
|
19 |
+ else |
|
20 |
+ if s:fnamecollapse |
|
21 |
+ let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g') |
|
22 |
+ else |
|
23 |
+ let _ .= fnamemodify(name, fmod) |
|
24 |
+ endif |
|
25 |
+ if a:bufnr != bufnr('%') && s:fnametruncate && strlen(_) > s:fnametruncate |
|
26 |
+ let _ = strpart(_, 0, s:fnametruncate) |
|
27 |
+ endif |
|
28 |
+ endif |
|
29 |
+ |
|
30 |
+ return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _) |
|
31 |
+endfunction |
|
32 |
+ |
|
33 |
+function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name) |
|
34 |
+ let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : '' |
|
35 |
+ let _ .= substitute(a:buffer_name, '\\', '/', 'g') |
|
36 |
+ |
|
37 |
+ if getbufvar(a:bufnr, '&modified') == 1 |
|
38 |
+ let _ .= s:buf_modified_symbol |
|
39 |
+ endif |
|
40 |
+ return _ |
|
41 |
+endfunction |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+function! airline#extensions#tabline#formatters#jsformatter#format(bufnr, buffers) |
|
7 |
+ let buf = bufname(a:bufnr) |
|
8 |
+ let filename = fnamemodify(buf, ':t') |
|
9 |
+ |
|
10 |
+ if filename == 'index.js' || filename == 'index.jsx' || filename == 'index.ts' || filename == 'index.tsx' |
|
11 |
+ return fnamemodify(buf, ':p:h:t') . '/i' |
|
12 |
+ else |
|
13 |
+ return airline#extensions#tabline#formatters#unique_tail_improved#format(a:bufnr, a:buffers) |
|
14 |
+ endif |
|
15 |
+endfunction |
... | ... |
@@ -0,0 +1,14 @@ |
1 |
+" MIT License. Copyright (c) 2017-2018 C.Brabandt et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+function! airline#extensions#tabline#formatters#tabnr#format(tab_nr_type, nr) |
|
7 |
+ if a:tab_nr_type == 0 " nr of splits |
|
8 |
+ return (g:airline_symbols.space).'%{len(tabpagebuflist('.a:nr.'))}' |
|
9 |
+ elseif a:tab_nr_type == 1 " tab number |
|
10 |
+ return (g:airline_symbols.space).a:nr |
|
11 |
+ else "== 2 splits and tab number |
|
12 |
+ return (g:airline_symbols.space).a:nr.'.%{len(tabpagebuflist('.a:nr.'))}' |
|
13 |
+ endif |
|
14 |
+endfunction |
... | ... |
@@ -0,0 +1,41 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffers) |
|
7 |
+ let duplicates = {} |
|
8 |
+ let tails = {} |
|
9 |
+ let map = {} |
|
10 |
+ for nr in a:buffers |
|
11 |
+ let name = bufname(nr) |
|
12 |
+ if empty(name) |
|
13 |
+ let map[nr] = '[No Name]' |
|
14 |
+ else |
|
15 |
+ let tail = fnamemodify(name, ':s?/\+$??:t') |
|
16 |
+ if has_key(tails, tail) |
|
17 |
+ let duplicates[nr] = nr |
|
18 |
+ endif |
|
19 |
+ let tails[tail] = 1 |
|
20 |
+ let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, tail) |
|
21 |
+ endif |
|
22 |
+ endfor |
|
23 |
+ |
|
24 |
+ let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.') |
|
25 |
+ for nr in values(duplicates) |
|
26 |
+ let name = bufname(nr) |
|
27 |
+ let fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) |
|
28 |
+ if fnamecollapse |
|
29 |
+ let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')) |
|
30 |
+ else |
|
31 |
+ let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(name, fmod)) |
|
32 |
+ endif |
|
33 |
+ endfor |
|
34 |
+ |
|
35 |
+ if has_key(map, a:bufnr) |
|
36 |
+ return map[a:bufnr] |
|
37 |
+ endif |
|
38 |
+ |
|
39 |
+ " if we get here, the buffer list isn't in sync with the selected buffer yet, fall back to the default |
|
40 |
+ return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) |
|
41 |
+endfunction |
... | ... |
@@ -0,0 +1,91 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:skip_symbol = '…' |
|
7 |
+ |
|
8 |
+function! airline#extensions#tabline#formatters#unique_tail_improved#format(bufnr, buffers) |
|
9 |
+ if len(a:buffers) <= 1 " don't need to compare bufnames if has less than one buffer opened |
|
10 |
+ return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) |
|
11 |
+ endif |
|
12 |
+ |
|
13 |
+ let curbuf_tail = fnamemodify(bufname(a:bufnr), ':t') |
|
14 |
+ let do_deduplicate = 0 |
|
15 |
+ let path_tokens = {} |
|
16 |
+ |
|
17 |
+ for nr in a:buffers |
|
18 |
+ let name = bufname(nr) |
|
19 |
+ if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail " only perform actions if curbuf_tail isn't unique |
|
20 |
+ let do_deduplicate = 1 |
|
21 |
+ let tokens = reverse(split(substitute(fnamemodify(name, ':p:h'), '\\', '/', 'g'), '/')) |
|
22 |
+ let token_index = 0 |
|
23 |
+ for token in tokens |
|
24 |
+ if token == '' | continue | endif |
|
25 |
+ if token == '.' | break | endif |
|
26 |
+ if !has_key(path_tokens, token_index) |
|
27 |
+ let path_tokens[token_index] = {} |
|
28 |
+ endif |
|
29 |
+ let path_tokens[token_index][token] = 1 |
|
30 |
+ let token_index += 1 |
|
31 |
+ endfor |
|
32 |
+ endif |
|
33 |
+ endfor |
|
34 |
+ |
|
35 |
+ if do_deduplicate == 1 |
|
36 |
+ let path = [] |
|
37 |
+ let token_index = 0 |
|
38 |
+ for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:h'), '\\', '/', 'g'), '/')) |
|
39 |
+ if token == '.' | break | endif |
|
40 |
+ let duplicated = 0 |
|
41 |
+ let uniq = 1 |
|
42 |
+ let single = 1 |
|
43 |
+ if has_key(path_tokens, token_index) |
|
44 |
+ let duplicated = 1 |
|
45 |
+ if len(keys(path_tokens[token_index])) > 1 | let single = 0 | endif |
|
46 |
+ if has_key(path_tokens[token_index], token) | let uniq = 0 | endif |
|
47 |
+ endif |
|
48 |
+ call insert(path, {'token': token, 'duplicated': duplicated, 'uniq': uniq, 'single': single}) |
|
49 |
+ let token_index += 1 |
|
50 |
+ endfor |
|
51 |
+ |
|
52 |
+ let buf_name = [curbuf_tail] |
|
53 |
+ let has_uniq = 0 |
|
54 |
+ let has_skipped = 0 |
|
55 |
+ for token1 in reverse(path) |
|
56 |
+ if !token1['duplicated'] && len(buf_name) > 1 |
|
57 |
+ call insert(buf_name, s:skip_symbol) |
|
58 |
+ let has_skipped = 0 |
|
59 |
+ break |
|
60 |
+ endif |
|
61 |
+ |
|
62 |
+ if has_uniq == 1 |
|
63 |
+ call insert(buf_name, s:skip_symbol) |
|
64 |
+ let has_skipped = 0 |
|
65 |
+ break |
|
66 |
+ endif |
|
67 |
+ |
|
68 |
+ if token1['uniq'] == 0 && token1['single'] == 1 |
|
69 |
+ let has_skipped = 1 |
|
70 |
+ else |
|
71 |
+ if has_skipped == 1 |
|
72 |
+ call insert(buf_name, s:skip_symbol) |
|
73 |
+ let has_skipped = 0 |
|
74 |
+ endif |
|
75 |
+ call insert(buf_name, token1['token']) |
|
76 |
+ endif |
|
77 |
+ |
|
78 |
+ if token1['uniq'] == 1 |
|
79 |
+ let has_uniq = 1 |
|
80 |
+ endif |
|
81 |
+ endfor |
|
82 |
+ |
|
83 |
+ if has_skipped == 1 |
|
84 |
+ call insert(buf_name, s:skip_symbol) |
|
85 |
+ endif |
|
86 |
+ |
|
87 |
+ return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, join(buf_name, '/')) |
|
88 |
+ else |
|
89 |
+ return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) |
|
90 |
+ endif |
|
91 |
+endfunction |
... | ... |
@@ -0,0 +1,125 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:spc = g:airline_symbols.space |
|
7 |
+let s:current_bufnr = -1 |
|
8 |
+let s:current_tabnr = -1 |
|
9 |
+let s:current_modified = 0 |
|
10 |
+ |
|
11 |
+function! airline#extensions#tabline#tabs#off() |
|
12 |
+ augroup airline_tabline_tabs |
|
13 |
+ autocmd! |
|
14 |
+ augroup END |
|
15 |
+endfunction |
|
16 |
+ |
|
17 |
+function! airline#extensions#tabline#tabs#on() |
|
18 |
+ augroup airline_tabline_tabs |
|
19 |
+ autocmd! |
|
20 |
+ autocmd BufDelete * call airline#extensions#tabline#tabs#invalidate() |
|
21 |
+ augroup END |
|
22 |
+endfunction |
|
23 |
+ |
|
24 |
+function! airline#extensions#tabline#tabs#invalidate() |
|
25 |
+ let s:current_bufnr = -1 |
|
26 |
+endfunction |
|
27 |
+ |
|
28 |
+function! airline#extensions#tabline#tabs#get() |
|
29 |
+ let curbuf = bufnr('%') |
|
30 |
+ let curtab = tabpagenr() |
|
31 |
+ try |
|
32 |
+ call airline#extensions#tabline#tabs#map_keys() |
|
33 |
+ catch |
|
34 |
+ " no-op |
|
35 |
+ endtry |
|
36 |
+ if curbuf == s:current_bufnr && curtab == s:current_tabnr && &columns == s:column_width |
|
37 |
+ if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified |
|
38 |
+ return s:current_tabline |
|
39 |
+ endif |
|
40 |
+ endif |
|
41 |
+ |
|
42 |
+ let b = airline#extensions#tabline#new_builder() |
|
43 |
+ |
|
44 |
+ call airline#extensions#tabline#add_label(b, 'tabs') |
|
45 |
+ |
|
46 |
+ function! b.get_group(i) dict |
|
47 |
+ let curtab = tabpagenr() |
|
48 |
+ let group = 'airline_tab' |
|
49 |
+ if a:i == curtab |
|
50 |
+ let group = 'airline_tabsel' |
|
51 |
+ if g:airline_detect_modified |
|
52 |
+ for bi in tabpagebuflist(curtab) |
|
53 |
+ if getbufvar(bi, '&modified') |
|
54 |
+ let group = 'airline_tabmod' |
|
55 |
+ endif |
|
56 |
+ endfor |
|
57 |
+ endif |
|
58 |
+ let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 |
|
59 |
+ endif |
|
60 |
+ return group |
|
61 |
+ endfunction |
|
62 |
+ |
|
63 |
+ function! b.get_title(i) dict |
|
64 |
+ let val = '%(' |
|
65 |
+ |
|
66 |
+ if get(g:, 'airline#extensions#tabline#show_tab_nr', 1) |
|
67 |
+ let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) |
|
68 |
+ let val .= airline#extensions#tabline#tabs#tabnr_formatter(tab_nr_type, a:i) |
|
69 |
+ endif |
|
70 |
+ |
|
71 |
+ return val.'%'.a:i.'T %{airline#extensions#tabline#title('.a:i.')} %)' |
|
72 |
+ endfunction |
|
73 |
+ |
|
74 |
+ call b.insert_titles(curtab, 1, tabpagenr('$')) |
|
75 |
+ |
|
76 |
+ call b.add_section('airline_tabfill', '') |
|
77 |
+ call b.split() |
|
78 |
+ call b.add_section('airline_tabfill', '') |
|
79 |
+ |
|
80 |
+ if get(g:, 'airline#extensions#tabline#show_close_button', 1) |
|
81 |
+ call b.add_section('airline_tab_right', ' %999X'. |
|
82 |
+ \ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ') |
|
83 |
+ endif |
|
84 |
+ |
|
85 |
+ if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1 |
|
86 |
+ let buffers = tabpagebuflist(curtab) |
|
87 |
+ for nr in buffers |
|
88 |
+ let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right" |
|
89 |
+ call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)') |
|
90 |
+ endfor |
|
91 |
+ if get(g:, 'airline#extensions#tabline#show_buffers', 1) |
|
92 |
+ call airline#extensions#tabline#add_label(b, 'buffers') |
|
93 |
+ endif |
|
94 |
+ endif |
|
95 |
+ |
|
96 |
+ let s:current_bufnr = curbuf |
|
97 |
+ let s:current_tabnr = curtab |
|
98 |
+ let s:column_width = &columns |
|
99 |
+ let s:current_tabline = b.build() |
|
100 |
+ return s:current_tabline |
|
101 |
+endfunction |
|
102 |
+ |
|
103 |
+function! airline#extensions#tabline#tabs#map_keys() |
|
104 |
+ if exists("s:airline_tabline_map_key") |
|
105 |
+ return |
|
106 |
+ endif |
|
107 |
+ noremap <silent> <Plug>AirlineSelectTab1 :1tabn<CR> |
|
108 |
+ noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR> |
|
109 |
+ noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR> |
|
110 |
+ noremap <silent> <Plug>AirlineSelectTab4 :4tabn<CR> |
|
111 |
+ noremap <silent> <Plug>AirlineSelectTab5 :5tabn<CR> |
|
112 |
+ noremap <silent> <Plug>AirlineSelectTab6 :6tabn<CR> |
|
113 |
+ noremap <silent> <Plug>AirlineSelectTab7 :7tabn<CR> |
|
114 |
+ noremap <silent> <Plug>AirlineSelectTab8 :8tabn<CR> |
|
115 |
+ noremap <silent> <Plug>AirlineSelectTab9 :9tabn<CR> |
|
116 |
+ noremap <silent> <Plug>AirlineSelectPrevTab gT |
|
117 |
+ " tabn {count} goes to count tab does not go {count} tab pages forward! |
|
118 |
+ noremap <silent> <Plug>AirlineSelectNextTab :<C-U>exe repeat(':tabn\|', v:count1)<cr> |
|
119 |
+ let s:airline_tabline_map_key = 1 |
|
120 |
+endfunction |
|
121 |
+ |
|
122 |
+function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i) |
|
123 |
+ let formatter = get(g:, 'airline#extensions#tabline#tabnr_formatter', 'tabnr') |
|
124 |
+ return airline#extensions#tabline#formatters#{formatter}#format(a:nr, a:i) |
|
125 |
+endfunction |
... | ... |
@@ -0,0 +1,395 @@ |
1 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
2 |
+" xTabline - Reduced version for vim-airline |
|
3 |
+" Copyright (C) 2018 Gianmaria Bajo <mg1979.git@gmail.com> |
|
4 |
+" License: MIT License |
|
5 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
6 |
+ |
|
7 |
+ |
|
8 |
+function! airline#extensions#tabline#xtabline#init() |
|
9 |
+ |
|
10 |
+ let s:state = 0 |
|
11 |
+ |
|
12 |
+ " initialize mappings |
|
13 |
+ call airline#extensions#tabline#xtabline#maps() |
|
14 |
+ |
|
15 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
16 |
+ " Variables |
|
17 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
18 |
+ |
|
19 |
+ let g:loaded_xtabline = 1 |
|
20 |
+ let s:most_recent = -1 |
|
21 |
+ let s:xtabline_filtering = 1 |
|
22 |
+ |
|
23 |
+ let t:xtl_excluded = get(g:, 'airline#extensions#tabline#exclude_buffers', []) |
|
24 |
+ let t:xtl_accepted = [] |
|
25 |
+ |
|
26 |
+ let g:xtabline_include_previews = get(g:, 'xtabline_include_previews', 1) |
|
27 |
+ |
|
28 |
+ let g:xtabline_alt_action = get(g:, 'xtabline_alt_action', "buffer #") |
|
29 |
+ |
|
30 |
+ |
|
31 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
32 |
+ " Autocommands |
|
33 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
34 |
+ |
|
35 |
+ augroup plugin-xtabline |
|
36 |
+ autocmd! |
|
37 |
+ |
|
38 |
+ autocmd TabNew * call s:Do('new') |
|
39 |
+ autocmd TabEnter * call s:Do('enter') |
|
40 |
+ autocmd TabLeave * call s:Do('leave') |
|
41 |
+ autocmd TabClosed * call s:Do('close') |
|
42 |
+ |
|
43 |
+ autocmd BufEnter * let g:xtabline_changing_buffer = 0 |
|
44 |
+ autocmd BufAdd,BufDelete,BufWrite * call airline#extensions#tabline#xtabline#filter_buffers() |
|
45 |
+ augroup END |
|
46 |
+ |
|
47 |
+ |
|
48 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
49 |
+ " Commands |
|
50 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
51 |
+ |
|
52 |
+ com! XTabReopen call airline#extensions#tabline#xtabline#reopen_last_tab() |
|
53 |
+ |
|
54 |
+endfunction |
|
55 |
+ |
|
56 |
+ |
|
57 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
58 |
+" Mappings |
|
59 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
60 |
+ |
|
61 |
+function! airline#extensions#tabline#xtabline#maps() |
|
62 |
+ |
|
63 |
+ if !exists('g:xtabline_disable_keybindings') |
|
64 |
+ |
|
65 |
+ fun! s:mapkeys(keys, plug) |
|
66 |
+ if empty(mapcheck(a:keys)) && !hasmapto(a:plug) |
|
67 |
+ silent! execute 'nmap <unique> '.a:keys.' '.a:plug |
|
68 |
+ endif |
|
69 |
+ endfun |
|
70 |
+ |
|
71 |
+ call s:mapkeys('<F5>','<Plug>XTablineToggleTabs') |
|
72 |
+ call s:mapkeys('<leader><F5>','<Plug>XTablineToggleFiltering') |
|
73 |
+ call s:mapkeys('<BS>','<Plug>XTablineSelectBuffer') |
|
74 |
+ call s:mapkeys(']l','<Plug>XTablineNextBuffer') |
|
75 |
+ call s:mapkeys('[l','<Plug>XTablinePrevBuffer') |
|
76 |
+ call s:mapkeys('<leader>tr','<Plug>XTablineReopen') |
|
77 |
+ endif |
|
78 |
+ |
|
79 |
+ nnoremap <unique> <script> <Plug>XTablineToggleTabs <SID>ToggleTabs |
|
80 |
+ nnoremap <silent> <SID>ToggleTabs :call airline#extensions#tabline#xtabline#toggle_tabs()<cr> |
|
81 |
+ |
|
82 |
+ nnoremap <unique> <script> <Plug>XTablineToggleFiltering <SID>ToggleFiltering |
|
83 |
+ nnoremap <silent> <SID>ToggleFiltering :call airline#extensions#tabline#xtabline#toggle_buffers()<cr> |
|
84 |
+ |
|
85 |
+ nnoremap <unique> <script> <Plug>XTablineSelectBuffer <SID>SelectBuffer |
|
86 |
+ nnoremap <silent> <expr> <SID>SelectBuffer g:xtabline_changing_buffer ? "\<C-c>" : ":<C-u>call airline#extensions#tabline#xtabline#select_buffer(v:count)\<cr>" |
|
87 |
+ |
|
88 |
+ nnoremap <unique> <script> <Plug>XTablineNextBuffer <SID>NextBuffer |
|
89 |
+ nnoremap <silent> <expr> <SID>NextBuffer airline#extensions#tabline#xtabline#next_buffer(v:count1) |
|
90 |
+ |
|
91 |
+ nnoremap <unique> <script> <Plug>XTablinePrevBuffer <SID>PrevBuffer |
|
92 |
+ nnoremap <silent> <expr> <SID>PrevBuffer airline#extensions#tabline#xtabline#prev_buffer(v:count1) |
|
93 |
+ |
|
94 |
+ nnoremap <unique> <script> <Plug>XTablineReopen <SID>ReopenLastTab |
|
95 |
+ nnoremap <silent> <SID>ReopenLastTab :XTabReopen<cr> |
|
96 |
+ |
|
97 |
+ if get(g:, 'xtabline_cd_commands', 0) |
|
98 |
+ map <unique> <leader>cdc <Plug>XTablineCdCurrent |
|
99 |
+ map <unique> <leader>cdd <Plug>XTablineCdDown1 |
|
100 |
+ map <unique> <leader>cd2 <Plug>XTablineCdDown2 |
|
101 |
+ map <unique> <leader>cd3 <Plug>XTablineCdDown3 |
|
102 |
+ map <unique> <leader>cdh <Plug>XTablineCdHome |
|
103 |
+ nnoremap <unique> <script> <Plug>XTablineCdCurrent :cd %:p:h<cr>:doautocmd BufAdd<cr>:pwd<cr> |
|
104 |
+ nnoremap <unique> <script> <Plug>XTablineCdDown1 :cd %:p:h:h<cr>:doautocmd BufAdd<cr>:pwd<cr> |
|
105 |
+ nnoremap <unique> <script> <Plug>XTablineCdDown2 :cd %:p:h:h:h<cr>:doautocmd BufAdd<cr>:pwd<cr> |
|
106 |
+ nnoremap <unique> <script> <Plug>XTablineCdDown3 :cd %:p:h:h:h:h<cr>:doautocmd BufAdd<cr>:pwd<cr> |
|
107 |
+ nnoremap <unique> <script> <Plug>XTablineCdHome :cd ~<cr>:doautocmd BufAdd<cr>:pwd<cr> |
|
108 |
+ endif |
|
109 |
+endfunction |
|
110 |
+ |
|
111 |
+ |
|
112 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
113 |
+" Commands functions |
|
114 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
115 |
+ |
|
116 |
+function! airline#extensions#tabline#xtabline#toggle_tabs() |
|
117 |
+ """Toggle between tabs/buffers tabline.""" |
|
118 |
+ |
|
119 |
+ if tabpagenr("$") == 1 | echo "There is only one tab." | return | endif |
|
120 |
+ |
|
121 |
+ if g:airline#extensions#tabline#show_tabs |
|
122 |
+ let g:airline#extensions#tabline#show_tabs = 0 |
|
123 |
+ echo "Showing buffers" |
|
124 |
+ else |
|
125 |
+ let g:airline#extensions#tabline#show_tabs = 1 |
|
126 |
+ echo "Showing tabs" |
|
127 |
+ endif |
|
128 |
+ |
|
129 |
+ doautocmd BufAdd |
|
130 |
+endfunction |
|
131 |
+ |
|
132 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
133 |
+ |
|
134 |
+function! airline#extensions#tabline#xtabline#toggle_buffers() |
|
135 |
+ """Toggle buffer filtering in the tabline.""" |
|
136 |
+ |
|
137 |
+ if s:xtabline_filtering |
|
138 |
+ let s:xtabline_filtering = 0 |
|
139 |
+ let g:airline#extensions#tabline#exclude_buffers = [] |
|
140 |
+ echo "Buffer filtering turned off" |
|
141 |
+ doautocmd BufAdd |
|
142 |
+ else |
|
143 |
+ let s:xtabline_filtering = 1 |
|
144 |
+ call airline#extensions#tabline#xtabline#filter_buffers() |
|
145 |
+ echo "Buffer filtering turned on" |
|
146 |
+ doautocmd BufAdd |
|
147 |
+ endif |
|
148 |
+endfunction |
|
149 |
+ |
|
150 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
151 |
+ |
|
152 |
+function! airline#extensions#tabline#xtabline#reopen_last_tab() |
|
153 |
+ """Reopen the last closed tab.""" |
|
154 |
+ |
|
155 |
+ if !exists('s:most_recently_closed_tab') |
|
156 |
+ echo "No recent tabs." | return | endif |
|
157 |
+ |
|
158 |
+ let tab = s:most_recently_closed_tab |
|
159 |
+ tabnew |
|
160 |
+ let empty = bufnr("%") |
|
161 |
+ let t:cwd = tab['cwd'] |
|
162 |
+ cd `=t:cwd` |
|
163 |
+ let t:name = tab['name'] |
|
164 |
+ for buf in tab['buffers'] | execute "badd ".buf | endfor |
|
165 |
+ execute "edit ".tab['buffers'][0] |
|
166 |
+ execute "bdelete ".empty |
|
167 |
+endfunction |
|
168 |
+ |
|
169 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
170 |
+ |
|
171 |
+function! airline#extensions#tabline#xtabline#filter_buffers() |
|
172 |
+ """Filter buffers so that only the ones within the tab's cwd will show up. |
|
173 |
+ |
|
174 |
+ " 'accepted' is a list of buffer numbers, for quick access. |
|
175 |
+ " 'excluded' is a list of buffer numbers, it will be used by Airline to hide buffers. |
|
176 |
+ |
|
177 |
+ if !s:xtabline_filtering | return | endif |
|
178 |
+ |
|
179 |
+ let g:airline#extensions#tabline#exclude_buffers = [] |
|
180 |
+ let t:xtl_excluded = g:airline#extensions#tabline#exclude_buffers |
|
181 |
+ let t:xtl_accepted = [] | let accepted = t:xtl_accepted |
|
182 |
+ let previews = g:xtabline_include_previews |
|
183 |
+ |
|
184 |
+ " bufnr(0) is the alternate buffer |
|
185 |
+ for buf in range(1, bufnr("$")) |
|
186 |
+ |
|
187 |
+ if !buflisted(buf) | continue | endif |
|
188 |
+ |
|
189 |
+ " get the path |
|
190 |
+ let path = expand("#".buf.":p") |
|
191 |
+ |
|
192 |
+ " confront with the cwd |
|
193 |
+ if !previews && path =~ "^".getcwd() |
|
194 |
+ call add(accepted, buf) |
|
195 |
+ elseif previews && path =~ getcwd() |
|
196 |
+ call add(accepted, buf) |
|
197 |
+ else |
|
198 |
+ call add(t:xtl_excluded, buf) |
|
199 |
+ endif |
|
200 |
+ endfor |
|
201 |
+ |
|
202 |
+ call s:RefreshTabline() |
|
203 |
+endfunction |
|
204 |
+ |
|
205 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
206 |
+ |
|
207 |
+function! airline#extensions#tabline#xtabline#next_buffer(nr) |
|
208 |
+ """Switch to next visible buffer.""" |
|
209 |
+ |
|
210 |
+ if ( s:NotEnoughBuffers() || !s:xtabline_filtering ) | return | endif |
|
211 |
+ let accepted = t:xtl_accepted |
|
212 |
+ |
|
213 |
+ let ix = index(accepted, bufnr("%")) |
|
214 |
+ let target = ix + a:nr |
|
215 |
+ let total = len(accepted) |
|
216 |
+ |
|
217 |
+ if ix == -1 |
|
218 |
+ " not in index, go back to most recent or back to first |
|
219 |
+ if s:most_recent == -1 || s:most_recent >= total |
|
220 |
+ let s:most_recent = 0 |
|
221 |
+ endif |
|
222 |
+ |
|
223 |
+ elseif target >= total |
|
224 |
+ " over last buffer |
|
225 |
+ while target >= total | let target -= total | endwhile |
|
226 |
+ let s:most_recent = target |
|
227 |
+ |
|
228 |
+ else |
|
229 |
+ let s:most_recent = target |
|
230 |
+ endif |
|
231 |
+ |
|
232 |
+ return ":buffer " . accepted[s:most_recent] . "\<cr>" |
|
233 |
+endfunction |
|
234 |
+ |
|
235 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
236 |
+ |
|
237 |
+function! airline#extensions#tabline#xtabline#prev_buffer(nr) |
|
238 |
+ """Switch to previous visible buffer.""" |
|
239 |
+ |
|
240 |
+ if ( s:NotEnoughBuffers() || !s:xtabline_filtering ) | return | endif |
|
241 |
+ let accepted = t:xtl_accepted |
|
242 |
+ |
|
243 |
+ let ix = index(accepted, bufnr("%")) |
|
244 |
+ let target = ix - a:nr |
|
245 |
+ let total = len(accepted) |
|
246 |
+ |
|
247 |
+ if ix == -1 |
|
248 |
+ " not in index, go back to most recent or back to first |
|
249 |
+ if s:most_recent == -1 || s:most_recent >= total |
|
250 |
+ let s:most_recent = 0 |
|
251 |
+ endif |
|
252 |
+ |
|
253 |
+ elseif target < 0 |
|
254 |
+ " before first buffer |
|
255 |
+ while target < 0 | let target += total | endwhile |
|
256 |
+ let s:most_recent = target |
|
257 |
+ |
|
258 |
+ else |
|
259 |
+ let s:most_recent = target |
|
260 |
+ endif |
|
261 |
+ |
|
262 |
+ return ":buffer " . accepted[s:most_recent] . "\<cr>" |
|
263 |
+endfunction |
|
264 |
+ |
|
265 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
266 |
+ |
|
267 |
+function! airline#extensions#tabline#xtabline#select_buffer(nr) |
|
268 |
+ """Switch to visible buffer in the tabline with [count].""" |
|
269 |
+ |
|
270 |
+ if ( a:nr == 0 || !s:xtabline_filtering ) | execute g:xtabline_alt_action | return | endif |
|
271 |
+ let accepted = t:xtl_accepted |
|
272 |
+ |
|
273 |
+ if (a:nr > len(accepted)) || s:NotEnoughBuffers() || accepted[a:nr - 1] == bufnr("%") |
|
274 |
+ return |
|
275 |
+ else |
|
276 |
+ let g:xtabline_changing_buffer = 1 |
|
277 |
+ execute "buffer ".accepted[a:nr - 1] |
|
278 |
+ endif |
|
279 |
+endfunction |
|
280 |
+ |
|
281 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
282 |
+ |
|
283 |
+function! s:TabBuffers() |
|
284 |
+ """Return a list of buffers names for this tab.""" |
|
285 |
+ |
|
286 |
+ return map(copy(t:xtl_accepted), 'bufname(v:val)') |
|
287 |
+endfunction |
|
288 |
+ |
|
289 |
+ |
|
290 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
291 |
+" Helper functions |
|
292 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
293 |
+ |
|
294 |
+function! s:NotEnoughBuffers() |
|
295 |
+ """Just return if there aren't enough buffers.""" |
|
296 |
+ |
|
297 |
+ if len(t:xtl_accepted) < 2 |
|
298 |
+ if index(t:xtl_accepted, bufnr("%")) == -1 |
|
299 |
+ return |
|
300 |
+ elseif !len(t:xtl_accepted) |
|
301 |
+ echo "No available buffers for this tab." |
|
302 |
+ else |
|
303 |
+ echo "No other available buffers for this tab." |
|
304 |
+ endif |
|
305 |
+ return 1 |
|
306 |
+ endif |
|
307 |
+endfunction |
|
308 |
+ |
|
309 |
+function! s:RefreshTabline() |
|
310 |
+ call airline#extensions#tabline#buflist#invalidate() |
|
311 |
+endfunction |
|
312 |
+ |
|
313 |
+ |
|
314 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
315 |
+" TabPageCd |
|
316 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
317 |
+ |
|
318 |
+" tabpagecd - Turn :cd into :tabpagecd, to use one tab page per project |
|
319 |
+" expanded version by mg979 |
|
320 |
+" Copyright (C) 2012-2013 Kana Natsuno <http://whileimautomaton.net/> |
|
321 |
+" Copyright (C) 2018 Gianmaria Bajo <mg1979.git@gmail.com> |
|
322 |
+" License: MIT License |
|
323 |
+ |
|
324 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
325 |
+ |
|
326 |
+function! s:InitCwds() |
|
327 |
+ if !exists('g:xtab_cwds') | let g:xtab_cwds = [] | endif |
|
328 |
+ |
|
329 |
+ while len(g:xtab_cwds) < tabpagenr("$") |
|
330 |
+ call add(g:xtab_cwds, getcwd()) |
|
331 |
+ endwhile |
|
332 |
+ let s:state = 1 |
|
333 |
+ let t:cwd = getcwd() |
|
334 |
+ let s:last_tab = 0 |
|
335 |
+ call airline#extensions#tabline#xtabline#filter_buffers() |
|
336 |
+endfunction |
|
337 |
+ |
|
338 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
339 |
+ |
|
340 |
+function! airline#extensions#tabline#xtabline#update_obsession() |
|
341 |
+ let string = 'let g:xtab_cwds = '.string(g:xtab_cwds).' | call airline#extensions#tabline#xtabline#update_obsession()' |
|
342 |
+ if !exists('g:obsession_append') |
|
343 |
+ let g:obsession_append = [string] |
|
344 |
+ else |
|
345 |
+ call filter(g:obsession_append, 'v:val !~# "^let g:xtab_cwds"') |
|
346 |
+ call add(g:obsession_append, string) |
|
347 |
+ endif |
|
348 |
+endfunction |
|
349 |
+ |
|
350 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
351 |
+ |
|
352 |
+function! s:Do(action) |
|
353 |
+ let arg = a:action |
|
354 |
+ if !s:state | call s:InitCwds() | return | endif |
|
355 |
+ |
|
356 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
357 |
+ |
|
358 |
+ if arg == 'new' |
|
359 |
+ |
|
360 |
+ call insert(g:xtab_cwds, getcwd(), tabpagenr()-1) |
|
361 |
+ |
|
362 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
363 |
+ |
|
364 |
+ elseif arg == 'enter' |
|
365 |
+ |
|
366 |
+ let t:cwd =g:xtab_cwds[tabpagenr()-1] |
|
367 |
+ |
|
368 |
+ cd `=t:cwd` |
|
369 |
+ call airline#extensions#tabline#xtabline#filter_buffers() |
|
370 |
+ |
|
371 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
372 |
+ |
|
373 |
+ elseif arg == 'leave' |
|
374 |
+ |
|
375 |
+ let t:cwd = getcwd() |
|
376 |
+ let g:xtab_cwds[tabpagenr()-1] = t:cwd |
|
377 |
+ let s:last_tab = tabpagenr() - 1 |
|
378 |
+ |
|
379 |
+ if !exists('t:name') | let t:name = t:cwd | endif |
|
380 |
+ let s:most_recent_tab = {'cwd': t:cwd, 'name': t:name, 'buffers': s:TabBuffers()} |
|
381 |
+ |
|
382 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
383 |
+ |
|
384 |
+ elseif arg == 'close' |
|
385 |
+ |
|
386 |
+ let s:most_recently_closed_tab = copy(s:most_recent_tab) |
|
387 |
+ call remove(g:xtab_cwds, s:last_tab) |
|
388 |
+ endif |
|
389 |
+ |
|
390 |
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
391 |
+ |
|
392 |
+ call airline#extensions#tabline#xtabline#update_obsession() |
|
393 |
+endfunction |
|
394 |
+ |
|
395 |
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
... | ... |
@@ -0,0 +1,58 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists(':TagbarToggle') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+let s:flags = get(g:, 'airline#extensions#tagbar#flags', '') |
|
11 |
+let s:spc = g:airline_symbols.space |
|
12 |
+let s:init=0 |
|
13 |
+ |
|
14 |
+" Arguments: current, sort, fname |
|
15 |
+function! airline#extensions#tagbar#get_status(...) |
|
16 |
+ let builder = airline#builder#new({ 'active': a:1 }) |
|
17 |
+ call builder.add_section('airline_a', s:spc.'Tagbar'.s:spc) |
|
18 |
+ call builder.add_section('airline_b', s:spc.a:2.s:spc) |
|
19 |
+ call builder.add_section('airline_c', s:spc.a:3.s:spc) |
|
20 |
+ return builder.build() |
|
21 |
+endfunction |
|
22 |
+ |
|
23 |
+function! airline#extensions#tagbar#inactive_apply(...) |
|
24 |
+ if getwinvar(a:2.winnr, '&filetype') == 'tagbar' |
|
25 |
+ return -1 |
|
26 |
+ endif |
|
27 |
+endfunction |
|
28 |
+ |
|
29 |
+let s:airline_tagbar_last_lookup_time = 0 |
|
30 |
+let s:airline_tagbar_last_lookup_val = '' |
|
31 |
+function! airline#extensions#tagbar#currenttag() |
|
32 |
+ if get(w:, 'airline_active', 0) |
|
33 |
+ if !s:init |
|
34 |
+ try |
|
35 |
+ " try to load the plugin, if filetypes are disabled, |
|
36 |
+ " this will cause an error, so try only once |
|
37 |
+ let a=tagbar#currenttag('%', '', '') |
|
38 |
+ catch |
|
39 |
+ endtry |
|
40 |
+ unlet! a |
|
41 |
+ let s:init=1 |
|
42 |
+ endif |
|
43 |
+ " function tagbar#currenttag does not exist, if filetype is not enabled |
|
44 |
+ if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag") |
|
45 |
+ let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags) |
|
46 |
+ let s:airline_tagbar_last_lookup_time = localtime() |
|
47 |
+ endif |
|
48 |
+ return s:airline_tagbar_last_lookup_val |
|
49 |
+ endif |
|
50 |
+ return '' |
|
51 |
+endfunction |
|
52 |
+ |
|
53 |
+function! airline#extensions#tagbar#init(ext) |
|
54 |
+ call a:ext.add_inactive_statusline_func('airline#extensions#tagbar#inactive_apply') |
|
55 |
+ let g:tagbar_status_func = 'airline#extensions#tagbar#get_status' |
|
56 |
+ |
|
57 |
+ call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag') |
|
58 |
+endfunction |
... | ... |
@@ -0,0 +1,22 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+function! airline#extensions#term#apply(...) |
|
7 |
+ if &buftype == 'terminal' |
|
8 |
+ let spc = g:airline_symbols.space |
|
9 |
+ |
|
10 |
+ call a:1.add_section('airline_a', spc.'TERMINAL'.spc) |
|
11 |
+ call a:1.add_section('airline_b', '') |
|
12 |
+ call a:1.add_section('airline_c', spc.'%f') |
|
13 |
+ call a:1.split() |
|
14 |
+ call a:1.add_section('airline_y', '') |
|
15 |
+ call a:1.add_section('airline_z', spc.airline#section#create_right(['linenr', 'maxlinenr'])) |
|
16 |
+ return 1 |
|
17 |
+ endif |
|
18 |
+endfunction |
|
19 |
+ |
|
20 |
+function! airline#extensions#term#init(ext) |
|
21 |
+ call a:ext.add_statusline_func('airline#extensions#term#apply') |
|
22 |
+endfunction |
... | ... |
@@ -0,0 +1,27 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists(':Tmuxline') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+let s:tmuxline_snapshot_file = get(g:, 'airline#extensions#tmuxline#snapshot_file', '') |
|
11 |
+let s:color_template = get(g:, 'airline#extensions#tmuxline#color_template', 'normal') |
|
12 |
+ |
|
13 |
+function! airline#extensions#tmuxline#init(ext) |
|
14 |
+ call a:ext.add_theme_func('airline#extensions#tmuxline#set_tmux_colors') |
|
15 |
+endfunction |
|
16 |
+ |
|
17 |
+function! airline#extensions#tmuxline#set_tmux_colors(palette) |
|
18 |
+ let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' |
|
19 |
+ let mode_palette = a:palette[color_template] |
|
20 |
+ |
|
21 |
+ let tmuxline_theme = tmuxline#api#create_theme_from_airline(mode_palette) |
|
22 |
+ call tmuxline#api#set_theme(tmuxline_theme) |
|
23 |
+ |
|
24 |
+ if strlen(s:tmuxline_snapshot_file) |
|
25 |
+ call tmuxline#api#snapshot(s:tmuxline_snapshot_file) |
|
26 |
+ endif |
|
27 |
+endfunction |
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists(':UndotreeToggle') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#undotree#apply(...) |
|
11 |
+ if exists('t:undotree') |
|
12 |
+ if &ft == 'undotree' |
|
13 |
+ if exists('*t:undotree.GetStatusLine') |
|
14 |
+ call airline#extensions#apply_left_override('undo', '%{t:undotree.GetStatusLine()}') |
|
15 |
+ else |
|
16 |
+ call airline#extensions#apply_left_override('undotree', '%f') |
|
17 |
+ endif |
|
18 |
+ endif |
|
19 |
+ |
|
20 |
+ if &ft == 'diff' && exists('*t:diffpanel.GetStatusLine') |
|
21 |
+ call airline#extensions#apply_left_override('diff', '%{t:diffpanel.GetStatusLine()}') |
|
22 |
+ endif |
|
23 |
+ endif |
|
24 |
+endfunction |
|
25 |
+ |
|
26 |
+function! airline#extensions#undotree#init(ext) |
|
27 |
+ call a:ext.add_statusline_func('airline#extensions#undotree#apply') |
|
28 |
+endfunction |
... | ... |
@@ -0,0 +1,24 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !get(g:, 'loaded_unicodePlugin', 0) |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#unicode#apply(...) |
|
11 |
+ if exists(":UnicodeTable") == 2 && bufname('') ==# 'UnicodeTable' |
|
12 |
+ call airline#parts#define('unicode', { |
|
13 |
+ \ 'text': '[UnicodeTable]', |
|
14 |
+ \ 'accent': 'bold' }) |
|
15 |
+ let w:airline_section_a = airline#section#create(['unicode']) |
|
16 |
+ let w:airline_section_b = '' |
|
17 |
+ let w:airline_section_c = ' ' |
|
18 |
+ let w:airline_section_y = '' |
|
19 |
+ endif |
|
20 |
+endfunction |
|
21 |
+ |
|
22 |
+function! airline#extensions#unicode#init(ext) |
|
23 |
+ call a:ext.add_statusline_func('airline#extensions#unicode#apply') |
|
24 |
+endfunction |
... | ... |
@@ -0,0 +1,24 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !get(g:, 'loaded_unite', 0) |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#unite#apply(...) |
|
11 |
+ if &ft == 'unite' |
|
12 |
+ call a:1.add_section('airline_a', ' Unite ') |
|
13 |
+ call a:1.add_section('airline_b', ' %{get(unite#get_context(), "buffer_name", "")} ') |
|
14 |
+ call a:1.add_section('airline_c', ' %{unite#get_status_string()} ') |
|
15 |
+ call a:1.split() |
|
16 |
+ call a:1.add_section('airline_y', ' %{get(unite#get_context(), "real_buffer_name", "")} ') |
|
17 |
+ return 1 |
|
18 |
+ endif |
|
19 |
+endfunction |
|
20 |
+ |
|
21 |
+function! airline#extensions#unite#init(ext) |
|
22 |
+ let g:unite_force_overwrite_statusline = 0 |
|
23 |
+ call a:ext.add_statusline_func('airline#extensions#unite#apply') |
|
24 |
+endfunction |
... | ... |
@@ -0,0 +1,34 @@ |
1 |
+" MIT License. Copyright (c) 2016-2018 Jerome Reybert et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+" This plugin replace the whole section_a when in vimagit buffer |
|
5 |
+scriptencoding utf-8 |
|
6 |
+ |
|
7 |
+if !get(g:, 'loaded_magit', 0) |
|
8 |
+ finish |
|
9 |
+endif |
|
10 |
+ |
|
11 |
+function! airline#extensions#vimagit#init(ext) |
|
12 |
+ call a:ext.add_statusline_func('airline#extensions#vimagit#apply') |
|
13 |
+endfunction |
|
14 |
+ |
|
15 |
+function! airline#extensions#vimagit#get_mode() |
|
16 |
+ if ( exists("*magit#get_current_mode") ) |
|
17 |
+ return magit#get_current_mode() |
|
18 |
+ else |
|
19 |
+ if ( b:magit_current_commit_mode == '' ) |
|
20 |
+ return "STAGING" |
|
21 |
+ elseif ( b:magit_current_commit_mode == 'CC' ) |
|
22 |
+ return "COMMIT" |
|
23 |
+ elseif ( b:magit_current_commit_mode == 'CA' ) |
|
24 |
+ return "AMEND" |
|
25 |
+ else |
|
26 |
+ return "???" |
|
27 |
+ endif |
|
28 |
+endfunction |
|
29 |
+ |
|
30 |
+function! airline#extensions#vimagit#apply(...) |
|
31 |
+ if ( &filetype == 'magit' ) |
|
32 |
+ let w:airline_section_a = '%{airline#extensions#vimagit#get_mode()}' |
|
33 |
+ endif |
|
34 |
+endfunction |
... | ... |
@@ -0,0 +1,84 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+" This plugin replace the whole section_a when in vimagit buffer |
|
5 |
+scriptencoding utf-8 |
|
6 |
+ |
|
7 |
+let s:spc = g:airline_symbols.space |
|
8 |
+ |
|
9 |
+function! s:SetDefault(var, val) |
|
10 |
+ if !exists(a:var) |
|
11 |
+ execute 'let ' . a:var . '=' . string(a:val) |
|
12 |
+ endif |
|
13 |
+endfunction |
|
14 |
+ |
|
15 |
+" Left and right delimiters (added only when status string is not empty) |
|
16 |
+call s:SetDefault( 'g:airline#extensions#vimtex#left', "{") |
|
17 |
+call s:SetDefault( 'g:airline#extensions#vimtex#right', "}") |
|
18 |
+ |
|
19 |
+" The current tex file is the main project file |
|
20 |
+call s:SetDefault( 'g:airline#extensions#vimtex#main', "" ) |
|
21 |
+" |
|
22 |
+" The current tex file is a subfile of the project |
|
23 |
+" and the compilation is set for the main file |
|
24 |
+call s:SetDefault( 'g:airline#extensions#vimtex#sub_main', "m") |
|
25 |
+" |
|
26 |
+" The current tex file is a subfile of the project |
|
27 |
+" and the compilation is set for this subfile |
|
28 |
+call s:SetDefault( 'g:airline#extensions#vimtex#sub_local', "l") |
|
29 |
+" |
|
30 |
+" Compilation is running and continuous compilation is off |
|
31 |
+call s:SetDefault( 'g:airline#extensions#vimtex#compiled', "c₁") |
|
32 |
+ |
|
33 |
+" Compilation is running and continuous compilation is on |
|
34 |
+call s:SetDefault( 'g:airline#extensions#vimtex#continuous', "c") |
|
35 |
+ |
|
36 |
+" Viewer is opened |
|
37 |
+call s:SetDefault( 'g:airline#extensions#vimtex#viewer', "v") |
|
38 |
+ |
|
39 |
+function! airline#extensions#vimtex#init(ext) |
|
40 |
+ call airline#parts#define_raw('vimtex', '%{airline#extensions#vimtex#get_scope()}') |
|
41 |
+ call a:ext.add_statusline_func('airline#extensions#vimtex#apply') |
|
42 |
+endfunction |
|
43 |
+ |
|
44 |
+function! airline#extensions#vimtex#apply(...) |
|
45 |
+ if exists("b:vimtex") |
|
46 |
+ let w:airline_section_x = get(w:, 'airline_section_x', g:airline_section_x) |
|
47 |
+ let w:airline_section_x.=s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#vimtex#get_scope()}' |
|
48 |
+ endif |
|
49 |
+endfunction |
|
50 |
+ |
|
51 |
+function! airline#extensions#vimtex#get_scope() |
|
52 |
+ let l:status = '' |
|
53 |
+ |
|
54 |
+ let vt_local = get(b:, 'vimtex_local', {}) |
|
55 |
+ if empty(vt_local) |
|
56 |
+ let l:status .= g:airline#extensions#vimtex#main |
|
57 |
+ else |
|
58 |
+ if get(vt_local, 'active') |
|
59 |
+ let l:status .= g:airline#extensions#vimtex#sub_local |
|
60 |
+ else |
|
61 |
+ let l:status .= g:airline#extensions#vimtex#sub_main |
|
62 |
+ endif |
|
63 |
+ endif |
|
64 |
+ |
|
65 |
+ if get(get(get(b:, 'vimtex', {}), 'viewer', {}), 'xwin_id') |
|
66 |
+ let l:status .= g:airline#extensions#vimtex#viewer |
|
67 |
+ endif |
|
68 |
+ |
|
69 |
+ let l:compiler = get(get(b:, 'vimtex', {}), 'compiler', {}) |
|
70 |
+ if !empty(l:compiler) |
|
71 |
+ if has_key(l:compiler, 'is_running') && b:vimtex.compiler.is_running() |
|
72 |
+ if get(l:compiler, 'continuous') |
|
73 |
+ let l:status .= g:airline#extensions#vimtex#continuous |
|
74 |
+ else |
|
75 |
+ let l:status .= g:airline#extensions#vimtex#compiled |
|
76 |
+ endif |
|
77 |
+ endif |
|
78 |
+ endif |
|
79 |
+ |
|
80 |
+ if !empty(l:status) |
|
81 |
+ let l:status = g:airline#extensions#vimtex#left . l:status . g:airline#extensions#vimtex#right |
|
82 |
+ endif |
|
83 |
+ return l:status |
|
84 |
+endfunction |
... | ... |
@@ -0,0 +1,31 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:spc = g:airline_symbols.space |
|
7 |
+ |
|
8 |
+function! airline#extensions#virtualenv#init(ext) |
|
9 |
+ call a:ext.add_statusline_func('airline#extensions#virtualenv#apply') |
|
10 |
+endfunction |
|
11 |
+ |
|
12 |
+function! airline#extensions#virtualenv#apply(...) |
|
13 |
+ if &filetype =~# "python" |
|
14 |
+ if get(g:, 'virtualenv_loaded', 0) |
|
15 |
+ let statusline = virtualenv#statusline() |
|
16 |
+ else |
|
17 |
+ let statusline = fnamemodify($VIRTUAL_ENV, ':t') |
|
18 |
+ endif |
|
19 |
+ if !empty(statusline) |
|
20 |
+ call airline#extensions#append_to_section('x', |
|
21 |
+ \ s:spc.g:airline_right_alt_sep.s:spc.statusline) |
|
22 |
+ endif |
|
23 |
+ endif |
|
24 |
+endfunction |
|
25 |
+ |
|
26 |
+function! airline#extensions#virtualenv#update() |
|
27 |
+ if &filetype =~# "python" |
|
28 |
+ call airline#extensions#virtualenv#apply() |
|
29 |
+ call airline#update_statusline() |
|
30 |
+ endif |
|
31 |
+endfunction |
... | ... |
@@ -0,0 +1,168 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html |
|
5 |
+ |
|
6 |
+scriptencoding utf-8 |
|
7 |
+ |
|
8 |
+let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1) |
|
9 |
+let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace) |
|
10 |
+let s:default_checks = ['indent', 'trailing', 'mixed-indent-file'] |
|
11 |
+ |
|
12 |
+let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) |
|
13 |
+let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] } |
|
14 |
+ |
|
15 |
+function! s:check_mixed_indent() |
|
16 |
+ let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0) |
|
17 |
+ if indent_algo == 1 |
|
18 |
+ " [<tab>]<space><tab> |
|
19 |
+ " spaces before or between tabs are not allowed |
|
20 |
+ let t_s_t = '(^\t* +\t\s*\S)' |
|
21 |
+ " <tab>(<space> x count) |
|
22 |
+ " count of spaces at the end of tabs should be less than tabstop value |
|
23 |
+ let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' |
|
24 |
+ return search('\v' . t_s_t . '|' . t_l_s, 'nw') |
|
25 |
+ elseif indent_algo == 2 |
|
26 |
+ return search('\v(^\t* +\t\s*\S)', 'nw') |
|
27 |
+ else |
|
28 |
+ return search('\v(^\t+ +)|(^ +\t+)', 'nw') |
|
29 |
+ endif |
|
30 |
+endfunction |
|
31 |
+ |
|
32 |
+function! s:check_mixed_indent_file() |
|
33 |
+ let c_like_langs = get(g:, 'airline#extensions#c_like_langs', |
|
34 |
+ \ [ 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ]) |
|
35 |
+ if index(c_like_langs, &ft) > -1 |
|
36 |
+ " for C-like languages: allow /** */ comment style with one space before the '*' |
|
37 |
+ let head_spc = '\v(^ +\*@!)' |
|
38 |
+ else |
|
39 |
+ let head_spc = '\v(^ +)' |
|
40 |
+ endif |
|
41 |
+ let indent_tabs = search('\v(^\t+)', 'nw') |
|
42 |
+ let indent_spc = search(head_spc, 'nw') |
|
43 |
+ if indent_tabs > 0 && indent_spc > 0 |
|
44 |
+ return printf("%d:%d", indent_tabs, indent_spc) |
|
45 |
+ else |
|
46 |
+ return '' |
|
47 |
+ endif |
|
48 |
+endfunction |
|
49 |
+ |
|
50 |
+function! airline#extensions#whitespace#check() |
|
51 |
+ let max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) |
|
52 |
+ if &readonly || !&modifiable || !s:enabled || line('$') > max_lines |
|
53 |
+ \ || get(b:, 'airline_whitespace_disabled', 0) |
|
54 |
+ return '' |
|
55 |
+ endif |
|
56 |
+ |
|
57 |
+ if !exists('b:airline_whitespace_check') |
|
58 |
+ let b:airline_whitespace_check = '' |
|
59 |
+ let checks = get(b:, 'airline_whitespace_checks', get(g:, 'airline#extensions#whitespace#checks', s:default_checks)) |
|
60 |
+ |
|
61 |
+ let trailing = 0 |
|
62 |
+ if index(checks, 'trailing') > -1 |
|
63 |
+ try |
|
64 |
+ let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$') |
|
65 |
+ let trailing = search(regexp, 'nw') |
|
66 |
+ catch |
|
67 |
+ echomsg 'airline#whitespace: error occurred evaluating '. regexp |
|
68 |
+ echomsg v:exception |
|
69 |
+ return '' |
|
70 |
+ endtry |
|
71 |
+ endif |
|
72 |
+ |
|
73 |
+ let mixed = 0 |
|
74 |
+ let check = 'indent' |
|
75 |
+ if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0 |
|
76 |
+ let mixed = s:check_mixed_indent() |
|
77 |
+ endif |
|
78 |
+ |
|
79 |
+ let mixed_file = '' |
|
80 |
+ let check = 'mixed-indent-file' |
|
81 |
+ if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0 |
|
82 |
+ let mixed_file = s:check_mixed_indent_file() |
|
83 |
+ endif |
|
84 |
+ |
|
85 |
+ let long = 0 |
|
86 |
+ if index(checks, 'long') > -1 && &tw > 0 |
|
87 |
+ let long = search('\%>'.&tw.'v.\+', 'nw') |
|
88 |
+ endif |
|
89 |
+ |
|
90 |
+ if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file) |
|
91 |
+ let b:airline_whitespace_check = s:symbol |
|
92 |
+ if strlen(s:symbol) > 0 |
|
93 |
+ let space = (g:airline_symbols.space) |
|
94 |
+ else |
|
95 |
+ let space = '' |
|
96 |
+ endif |
|
97 |
+ |
|
98 |
+ if s:show_message |
|
99 |
+ if trailing != 0 |
|
100 |
+ let trailing_fmt = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing') |
|
101 |
+ let b:airline_whitespace_check .= space.printf(trailing_fmt, trailing) |
|
102 |
+ endif |
|
103 |
+ if mixed != 0 |
|
104 |
+ let mixed_indent_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent') |
|
105 |
+ let b:airline_whitespace_check .= space.printf(mixed_indent_fmt, mixed) |
|
106 |
+ endif |
|
107 |
+ if long != 0 |
|
108 |
+ let long_fmt = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long') |
|
109 |
+ let b:airline_whitespace_check .= space.printf(long_fmt, long) |
|
110 |
+ endif |
|
111 |
+ if !empty(mixed_file) |
|
112 |
+ let mixed_indent_file_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', '[%s]mix-indent-file') |
|
113 |
+ let b:airline_whitespace_check .= space.printf(mixed_indent_file_fmt, mixed_file) |
|
114 |
+ endif |
|
115 |
+ endif |
|
116 |
+ endif |
|
117 |
+ endif |
|
118 |
+ return airline#util#shorten(b:airline_whitespace_check, 120, 9) |
|
119 |
+endfunction |
|
120 |
+ |
|
121 |
+function! airline#extensions#whitespace#toggle() |
|
122 |
+ if s:enabled |
|
123 |
+ augroup airline_whitespace |
|
124 |
+ autocmd! |
|
125 |
+ augroup END |
|
126 |
+ augroup! airline_whitespace |
|
127 |
+ let s:enabled = 0 |
|
128 |
+ else |
|
129 |
+ call airline#extensions#whitespace#init() |
|
130 |
+ let s:enabled = 1 |
|
131 |
+ endif |
|
132 |
+ |
|
133 |
+ if exists("g:airline#extensions#whitespace#enabled") |
|
134 |
+ let g:airline#extensions#whitespace#enabled = s:enabled |
|
135 |
+ if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0 |
|
136 |
+ let g:airline_section_warning .= airline#section#create(['whitespace']) |
|
137 |
+ call airline#update_statusline() |
|
138 |
+ endif |
|
139 |
+ endif |
|
140 |
+ echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') |
|
141 |
+endfunction |
|
142 |
+ |
|
143 |
+function! airline#extensions#whitespace#disable() |
|
144 |
+ if s:enabled |
|
145 |
+ call airline#extensions#whitespace#toggle() |
|
146 |
+ endif |
|
147 |
+endfunction |
|
148 |
+ |
|
149 |
+function! airline#extensions#whitespace#init(...) |
|
150 |
+ call airline#parts#define_function('whitespace', 'airline#extensions#whitespace#check') |
|
151 |
+ |
|
152 |
+ unlet! b:airline_whitespace_check |
|
153 |
+ augroup airline_whitespace |
|
154 |
+ autocmd! |
|
155 |
+ autocmd CursorHold,BufWritePost * call <sid>ws_refresh() |
|
156 |
+ augroup END |
|
157 |
+endfunction |
|
158 |
+ |
|
159 |
+function! s:ws_refresh() |
|
160 |
+ if get(b:, 'airline_ws_changedtick', 0) == b:changedtick |
|
161 |
+ return |
|
162 |
+ endif |
|
163 |
+ unlet! b:airline_whitespace_check |
|
164 |
+ if get(g:, 'airline_skip_empty_sections', 0) |
|
165 |
+ exe ':AirlineRefresh' |
|
166 |
+ endif |
|
167 |
+ let b:airline_ws_changedtick = b:changedtick |
|
168 |
+endfunction |
... | ... |
@@ -0,0 +1,29 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists('g:loaded_windowswap') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+let s:spc = g:airline_symbols.space |
|
11 |
+ |
|
12 |
+if !exists('g:airline#extensions#windowswap#indicator_text') |
|
13 |
+ let g:airline#extensions#windowswap#indicator_text = 'WS' |
|
14 |
+endif |
|
15 |
+ |
|
16 |
+function! airline#extensions#windowswap#init(ext) |
|
17 |
+ call airline#parts#define_function('windowswap', 'airline#extensions#windowswap#get_status') |
|
18 |
+endfunction |
|
19 |
+ |
|
20 |
+function! airline#extensions#windowswap#get_status() |
|
21 |
+ " use new tab-aware api if WS is up to date |
|
22 |
+ let s:mark = exists('*WindowSwap#IsCurrentWindowMarked') ? |
|
23 |
+ \WindowSwap#IsCurrentWindowMarked() : |
|
24 |
+ \(WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr()) |
|
25 |
+ if s:mark |
|
26 |
+ return g:airline#extensions#windowswap#indicator_text.s:spc |
|
27 |
+ endif |
|
28 |
+ return '' |
|
29 |
+endfunction |
... | ... |
@@ -0,0 +1,43 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default') |
|
7 |
+let g:airline#extensions#wordcount#filetypes = get(g:, 'airline#extensions#wordcount#filetypes', |
|
8 |
+ \ '\vhelp|markdown|rst|org|text|asciidoc|tex|mail') |
|
9 |
+ |
|
10 |
+function! s:wordcount_update() |
|
11 |
+ if empty(bufname('')) |
|
12 |
+ return |
|
13 |
+ endif |
|
14 |
+ if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1 |
|
15 |
+ let l:mode = mode() |
|
16 |
+ if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S' |
|
17 |
+ let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format() |
|
18 |
+ let b:airline_change_tick = b:changedtick |
|
19 |
+ else |
|
20 |
+ if get(b:, 'airline_wordcount_cache', '') is# '' || |
|
21 |
+ \ b:airline_wordcount_cache isnot# get(b:, 'airline_wordcount', '') || |
|
22 |
+ \ get(b:, 'airline_change_tick', 0) != b:changedtick || |
|
23 |
+ \ get(b:, 'airline_winwidth', 0) != winwidth(0) |
|
24 |
+ " cache data |
|
25 |
+ let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format() |
|
26 |
+ let b:airline_wordcount_cache = b:airline_wordcount |
|
27 |
+ let b:airline_change_tick = b:changedtick |
|
28 |
+ let b:airline_winwidth = winwidth(0) |
|
29 |
+ endif |
|
30 |
+ endif |
|
31 |
+ endif |
|
32 |
+endfunction |
|
33 |
+ |
|
34 |
+function! airline#extensions#wordcount#apply(...) |
|
35 |
+ if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1 |
|
36 |
+ call airline#extensions#prepend_to_section('z', '%{get(b:, "airline_wordcount", "")}') |
|
37 |
+ endif |
|
38 |
+endfunction |
|
39 |
+ |
|
40 |
+function! airline#extensions#wordcount#init(ext) |
|
41 |
+ call a:ext.add_statusline_func('airline#extensions#wordcount#apply') |
|
42 |
+ autocmd BufReadPost,CursorMoved,CursorMovedI * call s:wordcount_update() |
|
43 |
+endfunction |
... | ... |
@@ -0,0 +1,66 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+function! airline#extensions#wordcount#formatters#default#format() |
|
7 |
+ let fmt = get(g:, 'airline#extensions#wordcount#formatter#default#fmt', '%s words') |
|
8 |
+ let fmt_short = get(g:, 'airline#extensions#wordcount#formatter#default#fmt_short', fmt == '%s words' ? '%sW' : fmt) |
|
9 |
+ let words = string(s:wordcount()) |
|
10 |
+ if empty(words) |
|
11 |
+ return |
|
12 |
+ endif |
|
13 |
+ let result = g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space |
|
14 |
+ if winwidth(0) >= 80 |
|
15 |
+ let separator = s:get_decimal_group() |
|
16 |
+ if words > 999 && !empty(separator) |
|
17 |
+ " Format number according to locale, e.g. German: 1.245 or English: 1,245 |
|
18 |
+ let words = substitute(words, '\d\@<=\(\(\d\{3\}\)\+\)$', separator.'&', 'g') |
|
19 |
+ endif |
|
20 |
+ let result = printf(fmt, words). result |
|
21 |
+ else |
|
22 |
+ let result = printf(fmt_short, words). result |
|
23 |
+ endif |
|
24 |
+ return result |
|
25 |
+endfunction |
|
26 |
+ |
|
27 |
+function! s:wordcount() |
|
28 |
+ if exists("*wordcount") |
|
29 |
+ let l:mode = mode() |
|
30 |
+ if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S' |
|
31 |
+ let l:visual_words = wordcount()['visual_words'] |
|
32 |
+ if l:visual_words != '' |
|
33 |
+ return l:visual_words |
|
34 |
+ else |
|
35 |
+ return 0 |
|
36 |
+ endif |
|
37 |
+ else |
|
38 |
+ return wordcount()['words'] |
|
39 |
+ endif |
|
40 |
+ elseif mode() =~? 's' |
|
41 |
+ return |
|
42 |
+ else |
|
43 |
+ let old_status = v:statusmsg |
|
44 |
+ let position = getpos(".") |
|
45 |
+ exe "silent normal! g\<c-g>" |
|
46 |
+ let stat = v:statusmsg |
|
47 |
+ call setpos('.', position) |
|
48 |
+ let v:statusmsg = old_status |
|
49 |
+ |
|
50 |
+ let parts = split(stat) |
|
51 |
+ if len(parts) > 11 |
|
52 |
+ return str2nr(parts[11]) |
|
53 |
+ else |
|
54 |
+ return |
|
55 |
+ endif |
|
56 |
+ endif |
|
57 |
+endfunction |
|
58 |
+ |
|
59 |
+function! s:get_decimal_group() |
|
60 |
+ if match(v:lang, '\v\cC|en') > -1 |
|
61 |
+ return ',' |
|
62 |
+ elseif match(v:lang, '\v\cde|dk|fr|pt') > -1 |
|
63 |
+ return '.' |
|
64 |
+ endif |
|
65 |
+ return '' |
|
66 |
+endfunction |
... | ... |
@@ -0,0 +1,24 @@ |
1 |
+" MIT License. Copyright (c) 2017-2018 YoungHoon Rhiu et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if !exists('g:XkbSwitchLib') |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+ |
|
10 |
+function! airline#extensions#xkblayout#status() |
|
11 |
+ let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '') |
|
12 |
+ let keyboard_layout = split(keyboard_layout, '\.')[-1] |
|
13 |
+ let short_codes = {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'} |
|
14 |
+ |
|
15 |
+ if has_key(short_codes, keyboard_layout) |
|
16 |
+ let keyboard_layout = short_codes[keyboard_layout] |
|
17 |
+ endif |
|
18 |
+ |
|
19 |
+ return keyboard_layout |
|
20 |
+endfunction |
|
21 |
+ |
|
22 |
+function! airline#extensions#xkblayout#init(ext) |
|
23 |
+ call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status') |
|
24 |
+endfunction |
... | ... |
@@ -0,0 +1,37 @@ |
1 |
+" MIT License. Copyright (c) 2015-2018 Evgeny Firsov et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:spc = g:airline_symbols.space |
|
7 |
+let s:error_symbol = get(g:, 'airline#extensions#ycm#error_symbol', 'E:') |
|
8 |
+let s:warning_symbol = get(g:, 'airline#extensions#ycm#warning_symbol', 'W:') |
|
9 |
+ |
|
10 |
+function! airline#extensions#ycm#init(ext) |
|
11 |
+ call airline#parts#define_function('ycm_error_count', 'airline#extensions#ycm#get_error_count') |
|
12 |
+ call airline#parts#define_function('ycm_warning_count', 'airline#extensions#ycm#get_warning_count') |
|
13 |
+endfunction |
|
14 |
+ |
|
15 |
+function! airline#extensions#ycm#get_error_count() |
|
16 |
+ if exists(':YcmDiag') && exists("*youcompleteme#GetErrorCount") |
|
17 |
+ let cnt = youcompleteme#GetErrorCount() |
|
18 |
+ |
|
19 |
+ if cnt != 0 |
|
20 |
+ return s:error_symbol.cnt |
|
21 |
+ endif |
|
22 |
+ endif |
|
23 |
+ |
|
24 |
+ return '' |
|
25 |
+endfunction |
|
26 |
+ |
|
27 |
+function! airline#extensions#ycm#get_warning_count() |
|
28 |
+ if exists(':YcmDiag') && exists("*youcompleteme#GetWarningCount") |
|
29 |
+ let cnt = youcompleteme#GetWarningCount() |
|
30 |
+ |
|
31 |
+ if cnt != 0 |
|
32 |
+ return s:warning_symbol.cnt.s:spc |
|
33 |
+ endif |
|
34 |
+ endif |
|
35 |
+ |
|
36 |
+ return '' |
|
37 |
+endfunction |
... | ... |
@@ -0,0 +1,267 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:is_win32term = (has('win32') || has('win64')) && |
|
7 |
+ \ !has('gui_running') && |
|
8 |
+ \ (empty($CONEMUBUILD) || &term !=? 'xterm') && |
|
9 |
+ \ !(exists("+termguicolors") && &termguicolors) |
|
10 |
+ |
|
11 |
+let s:separators = {} |
|
12 |
+let s:accents = {} |
|
13 |
+let s:hl_groups = {} |
|
14 |
+ |
|
15 |
+function! s:gui2cui(rgb, fallback) |
|
16 |
+ if a:rgb == '' |
|
17 |
+ return a:fallback |
|
18 |
+ elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1 |
|
19 |
+ return a:rgb |
|
20 |
+ endif |
|
21 |
+ let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)') |
|
22 |
+ return airline#msdos#round_msdos_colors(rgb) |
|
23 |
+endfunction |
|
24 |
+ |
|
25 |
+function! s:get_syn(group, what) |
|
26 |
+ if !exists("g:airline_gui_mode") |
|
27 |
+ let g:airline_gui_mode = airline#init#gui_mode() |
|
28 |
+ endif |
|
29 |
+ let color = '' |
|
30 |
+ if hlexists(a:group) |
|
31 |
+ let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode) |
|
32 |
+ endif |
|
33 |
+ if empty(color) || color == -1 |
|
34 |
+ " should always exists |
|
35 |
+ let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode) |
|
36 |
+ " however, just in case |
|
37 |
+ if empty(color) || color == -1 |
|
38 |
+ let color = 'NONE' |
|
39 |
+ endif |
|
40 |
+ endif |
|
41 |
+ return color |
|
42 |
+endfunction |
|
43 |
+ |
|
44 |
+function! s:get_array(fg, bg, opts) |
|
45 |
+ let opts=empty(a:opts) ? '' : join(a:opts, ',') |
|
46 |
+ return g:airline_gui_mode ==# 'gui' |
|
47 |
+ \ ? [ a:fg, a:bg, '', '', opts ] |
|
48 |
+ \ : [ '', '', a:fg, a:bg, opts ] |
|
49 |
+endfunction |
|
50 |
+ |
|
51 |
+function! airline#highlighter#reset_hlcache() |
|
52 |
+ let s:hl_groups = {} |
|
53 |
+endfunction |
|
54 |
+ |
|
55 |
+function! airline#highlighter#get_highlight(group, ...) |
|
56 |
+ if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group) |
|
57 |
+ return s:hl_groups[a:group] |
|
58 |
+ else |
|
59 |
+ let fg = s:get_syn(a:group, 'fg') |
|
60 |
+ let bg = s:get_syn(a:group, 'bg') |
|
61 |
+ let reverse = g:airline_gui_mode ==# 'gui' |
|
62 |
+ \ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui') |
|
63 |
+ \ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm') |
|
64 |
+ \|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term') |
|
65 |
+ let bold = synIDattr(synIDtrans(hlID(a:group)), 'bold') |
|
66 |
+ let opts = a:000 |
|
67 |
+ if bold |
|
68 |
+ let opts = ['bold'] |
|
69 |
+ endif |
|
70 |
+ let res = reverse ? s:get_array(bg, fg, opts) : s:get_array(fg, bg, opts) |
|
71 |
+ endif |
|
72 |
+ let s:hl_groups[a:group] = res |
|
73 |
+ return res |
|
74 |
+endfunction |
|
75 |
+ |
|
76 |
+function! airline#highlighter#get_highlight2(fg, bg, ...) |
|
77 |
+ let fg = s:get_syn(a:fg[0], a:fg[1]) |
|
78 |
+ let bg = s:get_syn(a:bg[0], a:bg[1]) |
|
79 |
+ return s:get_array(fg, bg, a:000) |
|
80 |
+endfunction |
|
81 |
+ |
|
82 |
+function! s:hl_group_exists(group) |
|
83 |
+ if !hlexists(a:group) |
|
84 |
+ return 0 |
|
85 |
+ elseif empty(synIDattr(hlID(a:group), 'fg')) |
|
86 |
+ return 0 |
|
87 |
+ endif |
|
88 |
+ return 1 |
|
89 |
+endfunction |
|
90 |
+ |
|
91 |
+function! airline#highlighter#exec(group, colors) |
|
92 |
+ if pumvisible() |
|
93 |
+ return |
|
94 |
+ endif |
|
95 |
+ let colors = a:colors |
|
96 |
+ if s:is_win32term |
|
97 |
+ let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, '')) |
|
98 |
+ let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, '')) |
|
99 |
+ endif |
|
100 |
+ let old_hi = airline#highlighter#get_highlight(a:group) |
|
101 |
+ if len(colors) == 4 |
|
102 |
+ call add(colors, '') |
|
103 |
+ endif |
|
104 |
+ if g:airline_gui_mode ==# 'gui' |
|
105 |
+ let new_hi = [colors[0], colors[1], '', '', colors[4]] |
|
106 |
+ else |
|
107 |
+ let new_hi = ['', '', printf("%s", colors[2]), printf("%s", colors[3]), colors[4]] |
|
108 |
+ endif |
|
109 |
+ let colors = s:CheckDefined(colors) |
|
110 |
+ if old_hi != new_hi || !s:hl_group_exists(a:group) |
|
111 |
+ let cmd = printf('hi %s %s %s %s %s %s %s %s', |
|
112 |
+ \ a:group, s:Get(colors, 0, 'guifg='), s:Get(colors, 1, 'guibg='), |
|
113 |
+ \ s:Get(colors, 2, 'ctermfg='), s:Get(colors, 3, 'ctermbg='), |
|
114 |
+ \ s:Get(colors, 4, 'gui='), s:Get(colors, 4, 'cterm='), |
|
115 |
+ \ s:Get(colors, 4, 'term=')) |
|
116 |
+ exe cmd |
|
117 |
+ if has_key(s:hl_groups, a:group) |
|
118 |
+ let s:hl_groups[a:group] = colors |
|
119 |
+ endif |
|
120 |
+ endif |
|
121 |
+endfunction |
|
122 |
+ |
|
123 |
+function! s:CheckDefined(colors) |
|
124 |
+ " Checks, whether the definition of the colors is valid and is not empty or NONE |
|
125 |
+ " e.g. if the colors would expand to this: |
|
126 |
+ " hi airline_c ctermfg=NONE ctermbg=NONE |
|
127 |
+ " that means to clear that highlighting group, therefore, fallback to Normal |
|
128 |
+ " highlighting group for the cterm values |
|
129 |
+ |
|
130 |
+ " This only works, if the Normal highlighting group is actually defined, so |
|
131 |
+ " return early, if it has been cleared |
|
132 |
+ if !exists("g:airline#highlighter#normal_fg_hi") |
|
133 |
+ let g:airline#highlighter#normal_fg_hi = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm') |
|
134 |
+ endif |
|
135 |
+ if empty(g:airline#highlighter#normal_fg_hi) || g:airline#highlighter#normal_fg_hi < 0 |
|
136 |
+ return a:colors |
|
137 |
+ endif |
|
138 |
+ |
|
139 |
+ for val in a:colors |
|
140 |
+ if !empty(val) && val !=# 'NONE' |
|
141 |
+ return a:colors |
|
142 |
+ endif |
|
143 |
+ endfor |
|
144 |
+ " this adds the bold attribute to the term argument of the :hi command, |
|
145 |
+ " but at least this makes sure, the group will be defined |
|
146 |
+ let fg = g:airline#highlighter#normal_fg_hi |
|
147 |
+ let bg = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm') |
|
148 |
+ if bg < 0 |
|
149 |
+ " in case there is no background color defined for Normal |
|
150 |
+ let bg = a:colors[3] |
|
151 |
+ endif |
|
152 |
+ return a:colors[0:1] + [fg, bg] + [a:colors[4]] |
|
153 |
+endfunction |
|
154 |
+ |
|
155 |
+function! s:Get(dict, key, prefix) |
|
156 |
+ let res=get(a:dict, a:key, '') |
|
157 |
+ if res is '' |
|
158 |
+ return '' |
|
159 |
+ else |
|
160 |
+ return a:prefix. res |
|
161 |
+ endif |
|
162 |
+endfunction |
|
163 |
+ |
|
164 |
+function! s:exec_separator(dict, from, to, inverse, suffix) |
|
165 |
+ if pumvisible() |
|
166 |
+ return |
|
167 |
+ endif |
|
168 |
+ let l:from = airline#themes#get_highlight(a:from.a:suffix) |
|
169 |
+ let l:to = airline#themes#get_highlight(a:to.a:suffix) |
|
170 |
+ let group = a:from.'_to_'.a:to.a:suffix |
|
171 |
+ if a:inverse |
|
172 |
+ let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ] |
|
173 |
+ else |
|
174 |
+ let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ] |
|
175 |
+ endif |
|
176 |
+ let a:dict[group] = colors |
|
177 |
+ call airline#highlighter#exec(group, colors) |
|
178 |
+endfunction |
|
179 |
+ |
|
180 |
+function! airline#highlighter#load_theme() |
|
181 |
+ if pumvisible() |
|
182 |
+ return |
|
183 |
+ endif |
|
184 |
+ for winnr in filter(range(1, winnr('$')), 'v:val != winnr()') |
|
185 |
+ call airline#highlighter#highlight_modified_inactive(winbufnr(winnr)) |
|
186 |
+ endfor |
|
187 |
+ call airline#highlighter#highlight(['inactive']) |
|
188 |
+ if getbufvar( bufnr('%'), '&modified' ) |
|
189 |
+ call airline#highlighter#highlight(['normal', 'modified']) |
|
190 |
+ else |
|
191 |
+ call airline#highlighter#highlight(['normal']) |
|
192 |
+ endif |
|
193 |
+endfunction |
|
194 |
+ |
|
195 |
+function! airline#highlighter#add_separator(from, to, inverse) |
|
196 |
+ let s:separators[a:from.a:to] = [a:from, a:to, a:inverse] |
|
197 |
+ call <sid>exec_separator({}, a:from, a:to, a:inverse, '') |
|
198 |
+endfunction |
|
199 |
+ |
|
200 |
+function! airline#highlighter#add_accent(accent) |
|
201 |
+ let s:accents[a:accent] = 1 |
|
202 |
+endfunction |
|
203 |
+ |
|
204 |
+function! airline#highlighter#highlight_modified_inactive(bufnr) |
|
205 |
+ if getbufvar(a:bufnr, '&modified') |
|
206 |
+ let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c') |
|
207 |
+ \ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : [] |
|
208 |
+ else |
|
209 |
+ let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c') |
|
210 |
+ \ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : [] |
|
211 |
+ endif |
|
212 |
+ |
|
213 |
+ if !empty(colors) |
|
214 |
+ call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors) |
|
215 |
+ endif |
|
216 |
+endfunction |
|
217 |
+ |
|
218 |
+function! airline#highlighter#highlight(modes, ...) |
|
219 |
+ let bufnr = a:0 ? a:1 : '' |
|
220 |
+ let p = g:airline#themes#{g:airline_theme}#palette |
|
221 |
+ |
|
222 |
+ " draw the base mode, followed by any overrides |
|
223 |
+ let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val') |
|
224 |
+ let suffix = a:modes[0] == 'inactive' ? '_inactive' : '' |
|
225 |
+ for mode in mapped |
|
226 |
+ if mode == 'inactive' && winnr('$') == 1 |
|
227 |
+ " there exist no inactive windows, don't need to create all those |
|
228 |
+ " highlighting groups |
|
229 |
+ continue |
|
230 |
+ endif |
|
231 |
+ if exists('g:airline#themes#{g:airline_theme}#palette[mode]') |
|
232 |
+ let dict = g:airline#themes#{g:airline_theme}#palette[mode] |
|
233 |
+ for kvp in items(dict) |
|
234 |
+ let mode_colors = kvp[1] |
|
235 |
+ let name = kvp[0] |
|
236 |
+ if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive' |
|
237 |
+ let name = 'airline_c'.bufnr |
|
238 |
+ endif |
|
239 |
+ call airline#highlighter#exec(name.suffix, mode_colors) |
|
240 |
+ |
|
241 |
+ for accent in keys(s:accents) |
|
242 |
+ if !has_key(p.accents, accent) |
|
243 |
+ continue |
|
244 |
+ endif |
|
245 |
+ let colors = copy(mode_colors) |
|
246 |
+ if p.accents[accent][0] != '' |
|
247 |
+ let colors[0] = p.accents[accent][0] |
|
248 |
+ endif |
|
249 |
+ if p.accents[accent][2] != '' |
|
250 |
+ let colors[2] = p.accents[accent][2] |
|
251 |
+ endif |
|
252 |
+ if len(colors) >= 5 |
|
253 |
+ let colors[4] = get(p.accents[accent], 4, '') |
|
254 |
+ else |
|
255 |
+ call add(colors, get(p.accents[accent], 4, '')) |
|
256 |
+ endif |
|
257 |
+ call airline#highlighter#exec(name.suffix.'_'.accent, colors) |
|
258 |
+ endfor |
|
259 |
+ endfor |
|
260 |
+ |
|
261 |
+ " TODO: optimize this |
|
262 |
+ for sep in items(s:separators) |
|
263 |
+ call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix) |
|
264 |
+ endfor |
|
265 |
+ endif |
|
266 |
+ endfor |
|
267 |
+endfunction |
... | ... |
@@ -0,0 +1,201 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+function! s:check_defined(variable, default) |
|
7 |
+ if !exists(a:variable) |
|
8 |
+ let {a:variable} = a:default |
|
9 |
+ endif |
|
10 |
+endfunction |
|
11 |
+ |
|
12 |
+let s:loaded = 0 |
|
13 |
+function! airline#init#bootstrap() |
|
14 |
+ if s:loaded |
|
15 |
+ return |
|
16 |
+ endif |
|
17 |
+ let s:loaded = 1 |
|
18 |
+ |
|
19 |
+ let g:airline#init#bootstrapping = 1 |
|
20 |
+ |
|
21 |
+ let g:airline#init#vim_async = (v:version >= 800 && has('job')) |
|
22 |
+ let g:airline#init#is_windows = has('win32') || has('win64') |
|
23 |
+ |
|
24 |
+ call s:check_defined('g:airline_detect_modified', 1) |
|
25 |
+ call s:check_defined('g:airline_detect_paste', 1) |
|
26 |
+ call s:check_defined('g:airline_detect_crypt', 1) |
|
27 |
+ call s:check_defined('g:airline_detect_spell', 1) |
|
28 |
+ call s:check_defined('g:airline_detect_spelllang', 1) |
|
29 |
+ call s:check_defined('g:airline_detect_iminsert', 0) |
|
30 |
+ call s:check_defined('g:airline_inactive_collapse', 1) |
|
31 |
+ call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus']) |
|
32 |
+ call s:check_defined('g:airline_exclude_filetypes', []) |
|
33 |
+ call s:check_defined('g:airline_exclude_preview', 0) |
|
34 |
+ call s:check_defined('g:airline_gui_mode', airline#init#gui_mode()) |
|
35 |
+ |
|
36 |
+ call s:check_defined('g:airline_mode_map', {}) |
|
37 |
+ call extend(g:airline_mode_map, { |
|
38 |
+ \ '__' : '------', |
|
39 |
+ \ 'n' : 'NORMAL', |
|
40 |
+ \ 'i' : 'INSERT', |
|
41 |
+ \ 'R' : 'REPLACE', |
|
42 |
+ \ 'v' : 'VISUAL', |
|
43 |
+ \ 'V' : 'V-LINE', |
|
44 |
+ \ 'c' : 'COMMAND', |
|
45 |
+ \ '' : 'V-BLOCK', |
|
46 |
+ \ 's' : 'SELECT', |
|
47 |
+ \ 'S' : 'S-LINE', |
|
48 |
+ \ '' : 'S-BLOCK', |
|
49 |
+ \ 't' : 'TERMINAL', |
|
50 |
+ \ }, 'keep') |
|
51 |
+ |
|
52 |
+ call s:check_defined('g:airline_theme_map', {}) |
|
53 |
+ call extend(g:airline_theme_map, { |
|
54 |
+ \ '\CTomorrow': 'tomorrow', |
|
55 |
+ \ 'base16': 'base16', |
|
56 |
+ \ 'mo[l|n]okai': 'molokai', |
|
57 |
+ \ 'wombat': 'wombat', |
|
58 |
+ \ 'zenburn': 'zenburn', |
|
59 |
+ \ 'solarized': 'solarized', |
|
60 |
+ \ 'flattened': 'solarized', |
|
61 |
+ \ '\CNeoSolarized': 'solarized', |
|
62 |
+ \ }, 'keep') |
|
63 |
+ |
|
64 |
+ call s:check_defined('g:airline_symbols', {}) |
|
65 |
+ " First define the symbols, |
|
66 |
+ " that are common in Powerline/Unicode/ASCII mode, |
|
67 |
+ " then add specific symbols for either mode |
|
68 |
+ call extend(g:airline_symbols, { |
|
69 |
+ \ 'paste': 'PASTE', |
|
70 |
+ \ 'spell': 'SPELL', |
|
71 |
+ \ 'modified': '+', |
|
72 |
+ \ 'space': ' ', |
|
73 |
+ \ 'keymap': 'Keymap:', |
|
74 |
+ \ 'ellipsis': '...' |
|
75 |
+ \ }, 'keep') |
|
76 |
+ |
|
77 |
+ if get(g:, 'airline_powerline_fonts', 0) |
|
78 |
+ " Symbols for Powerline terminals |
|
79 |
+ call s:check_defined('g:airline_left_sep', "\ue0b0") " |
|
80 |
+ call s:check_defined('g:airline_left_alt_sep', "\ue0b1") " |
|
81 |
+ call s:check_defined('g:airline_right_sep', "\ue0b2") " |
|
82 |
+ call s:check_defined('g:airline_right_alt_sep', "\ue0b3") " |
|
83 |
+ " ro=, ws=☲, lnr=☰, mlnr=, br=, nx=Ɇ, crypt=🔒 |
|
84 |
+ call extend(g:airline_symbols, { |
|
85 |
+ \ 'readonly': "\ue0a2", |
|
86 |
+ \ 'whitespace': "\u2632", |
|
87 |
+ \ 'linenr': "\u2630 ", |
|
88 |
+ \ 'maxlinenr': " \ue0a1", |
|
89 |
+ \ 'branch': "\ue0a0", |
|
90 |
+ \ 'notexists': "\u0246", |
|
91 |
+ \ 'crypt': nr2char(0x1F512), |
|
92 |
+ \ }, 'keep') |
|
93 |
+ elseif &encoding==?'utf-8' && !get(g:, "airline_symbols_ascii", 0) |
|
94 |
+ " Symbols for Unicode terminals |
|
95 |
+ call s:check_defined('g:airline_left_sep', "") |
|
96 |
+ call s:check_defined('g:airline_left_alt_sep', "") |
|
97 |
+ call s:check_defined('g:airline_right_sep', "") |
|
98 |
+ call s:check_defined('g:airline_right_alt_sep', "") |
|
99 |
+ " ro=⊝, ws=☲, lnr=☰, mlnr=㏑, br=ᚠ, nx=Ɇ, crypt=🔒 |
|
100 |
+ call extend(g:airline_symbols, { |
|
101 |
+ \ 'readonly': "\u229D", |
|
102 |
+ \ 'whitespace': "\u2632", |
|
103 |
+ \ 'linenr': "\u2630 ", |
|
104 |
+ \ 'maxlinenr': " \u33D1", |
|
105 |
+ \ 'branch': "\u16A0", |
|
106 |
+ \ 'notexists': "\u0246", |
|
107 |
+ \ 'crypt': nr2char(0x1F512), |
|
108 |
+ \ }, 'keep') |
|
109 |
+ else |
|
110 |
+ " Symbols for ASCII terminals |
|
111 |
+ call s:check_defined('g:airline_left_sep', "") |
|
112 |
+ call s:check_defined('g:airline_left_alt_sep', "") |
|
113 |
+ call s:check_defined('g:airline_right_sep', "") |
|
114 |
+ call s:check_defined('g:airline_right_alt_sep', "") |
|
115 |
+ call extend(g:airline_symbols, { |
|
116 |
+ \ 'readonly': 'RO', |
|
117 |
+ \ 'whitespace': '!', |
|
118 |
+ \ 'linenr': 'ln ', |
|
119 |
+ \ 'maxlinenr': ' :', |
|
120 |
+ \ 'branch': '', |
|
121 |
+ \ 'notexists': '?', |
|
122 |
+ \ 'crypt': 'cr', |
|
123 |
+ \ }, 'keep') |
|
124 |
+ endif |
|
125 |
+ |
|
126 |
+ call airline#parts#define('mode', { |
|
127 |
+ \ 'function': 'airline#parts#mode', |
|
128 |
+ \ 'accent': 'bold', |
|
129 |
+ \ }) |
|
130 |
+ call airline#parts#define_function('iminsert', 'airline#parts#iminsert') |
|
131 |
+ call airline#parts#define_function('paste', 'airline#parts#paste') |
|
132 |
+ call airline#parts#define_function('crypt', 'airline#parts#crypt') |
|
133 |
+ call airline#parts#define_function('spell', 'airline#parts#spell') |
|
134 |
+ call airline#parts#define_function('filetype', 'airline#parts#filetype') |
|
135 |
+ call airline#parts#define('readonly', { |
|
136 |
+ \ 'function': 'airline#parts#readonly', |
|
137 |
+ \ 'accent': 'red', |
|
138 |
+ \ }) |
|
139 |
+ call airline#parts#define_raw('file', '%f%m') |
|
140 |
+ call airline#parts#define_raw('path', '%F%m') |
|
141 |
+ call airline#parts#define('linenr', { |
|
142 |
+ \ 'raw': '%{g:airline_symbols.linenr}%4l', |
|
143 |
+ \ 'accent': 'bold'}) |
|
144 |
+ call airline#parts#define('maxlinenr', { |
|
145 |
+ \ 'raw': '/%L%{g:airline_symbols.maxlinenr}', |
|
146 |
+ \ 'accent': 'bold'}) |
|
147 |
+ call airline#parts#define_function('ffenc', 'airline#parts#ffenc') |
|
148 |
+ call airline#parts#define_empty(['hunks', 'branch', 'obsession', 'tagbar', |
|
149 |
+ \ 'syntastic-warn', 'syntastic-err', 'eclim', 'whitespace','windowswap', |
|
150 |
+ \ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count', |
|
151 |
+ \ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count']) |
|
152 |
+ call airline#parts#define_text('capslock', '') |
|
153 |
+ call airline#parts#define_text('gutentags', '') |
|
154 |
+ call airline#parts#define_text('xkblayout', '') |
|
155 |
+ call airline#parts#define_text('keymap', '') |
|
156 |
+ |
|
157 |
+ unlet g:airline#init#bootstrapping |
|
158 |
+endfunction |
|
159 |
+ |
|
160 |
+function! airline#init#gui_mode() |
|
161 |
+ return has('gui_running') || (has("termguicolors") && &termguicolors == 1) ? 'gui' : 'cterm' |
|
162 |
+endfunction |
|
163 |
+ |
|
164 |
+function! airline#init#sections() |
|
165 |
+ let spc = g:airline_symbols.space |
|
166 |
+ if !exists('g:airline_section_a') |
|
167 |
+ let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'keymap', 'spell', 'capslock', 'xkblayout', 'iminsert']) |
|
168 |
+ endif |
|
169 |
+ if !exists('g:airline_section_b') |
|
170 |
+ let g:airline_section_b = airline#section#create(['hunks', 'branch']) |
|
171 |
+ endif |
|
172 |
+ if !exists('g:airline_section_c') |
|
173 |
+ if exists("+autochdir") && &autochdir == 1 |
|
174 |
+ let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly']) |
|
175 |
+ else |
|
176 |
+ let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly']) |
|
177 |
+ endif |
|
178 |
+ endif |
|
179 |
+ if !exists('g:airline_section_gutter') |
|
180 |
+ let g:airline_section_gutter = airline#section#create(['%=']) |
|
181 |
+ endif |
|
182 |
+ if !exists('g:airline_section_x') |
|
183 |
+ let g:airline_section_x = airline#section#create_right(['tagbar', 'gutentags', 'filetype']) |
|
184 |
+ endif |
|
185 |
+ if !exists('g:airline_section_y') |
|
186 |
+ let g:airline_section_y = airline#section#create_right(['ffenc']) |
|
187 |
+ endif |
|
188 |
+ if !exists('g:airline_section_z') |
|
189 |
+ if winwidth(0) > 80 |
|
190 |
+ let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v']) |
|
191 |
+ else |
|
192 |
+ let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3v']) |
|
193 |
+ endif |
|
194 |
+ endif |
|
195 |
+ if !exists('g:airline_section_error') |
|
196 |
+ let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count']) |
|
197 |
+ endif |
|
198 |
+ if !exists('g:airline_section_warning') |
|
199 |
+ let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'whitespace']) |
|
200 |
+ endif |
|
201 |
+endfunction |
... | ... |
@@ -0,0 +1,59 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+" basic 16 msdos from MSDOS |
|
7 |
+" see output of color, should be |
|
8 |
+" 0 Black |
|
9 |
+" 1 DarkBlue |
|
10 |
+" 2 DarkGreen |
|
11 |
+" 3 DarkCyan |
|
12 |
+" 4 DarkRed |
|
13 |
+" 5 DarkMagenta |
|
14 |
+" 6 Brown |
|
15 |
+" 7 LightGray |
|
16 |
+" 8 DarkGray |
|
17 |
+" 9 Blue |
|
18 |
+" 10 Green |
|
19 |
+" 11 Cyan |
|
20 |
+" 12 Red |
|
21 |
+" 13 Magenta |
|
22 |
+" 14 Yellow |
|
23 |
+" 15 White |
|
24 |
+ |
|
25 |
+let s:basic16 = [ |
|
26 |
+ \ [ 0x00, 0x00, 0x00 ], |
|
27 |
+ \ [ 0x00, 0x00, 0x80 ], |
|
28 |
+ \ [ 0x00, 0x80, 0x00 ], |
|
29 |
+ \ [ 0x00, 0x80, 0x80 ], |
|
30 |
+ \ [ 0x80, 0x00, 0x00 ], |
|
31 |
+ \ [ 0x80, 0x00, 0x80 ], |
|
32 |
+ \ [ 0x80, 0x80, 0x00 ], |
|
33 |
+ \ [ 0xC0, 0xC0, 0xC0 ], |
|
34 |
+ \ [ 0x80, 0x80, 0x80 ], |
|
35 |
+ \ [ 0x00, 0x00, 0xFF ], |
|
36 |
+ \ [ 0x00, 0xFF, 0x00 ], |
|
37 |
+ \ [ 0x00, 0xFF, 0xFF ], |
|
38 |
+ \ [ 0xFF, 0x00, 0x00 ], |
|
39 |
+ \ [ 0xFF, 0x00, 0xFF ], |
|
40 |
+ \ [ 0xFF, 0xFF, 0x00 ], |
|
41 |
+ \ [ 0xFF, 0xFF, 0xFF ] |
|
42 |
+ \ ] |
|
43 |
+ |
|
44 |
+function! airline#msdos#round_msdos_colors(rgblist) |
|
45 |
+ " Check for values from MSDOS 16 color terminal |
|
46 |
+ let best = [] |
|
47 |
+ let min = 100000 |
|
48 |
+ let list = s:basic16 |
|
49 |
+ for value in list |
|
50 |
+ let t = abs(value[0] - a:rgblist[0]) + |
|
51 |
+ \ abs(value[1] - a:rgblist[1]) + |
|
52 |
+ \ abs(value[2] - a:rgblist[2]) |
|
53 |
+ if min > t |
|
54 |
+ let min = t |
|
55 |
+ let best = value |
|
56 |
+ endif |
|
57 |
+ endfor |
|
58 |
+ return index(s:basic16, best) |
|
59 |
+endfunction |
... | ... |
@@ -0,0 +1,109 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+let s:parts = {} |
|
7 |
+ |
|
8 |
+" PUBLIC API {{{ |
|
9 |
+ |
|
10 |
+function! airline#parts#define(key, config) |
|
11 |
+ let s:parts[a:key] = get(s:parts, a:key, {}) |
|
12 |
+ if exists('g:airline#init#bootstrapping') |
|
13 |
+ call extend(s:parts[a:key], a:config, 'keep') |
|
14 |
+ else |
|
15 |
+ call extend(s:parts[a:key], a:config, 'force') |
|
16 |
+ endif |
|
17 |
+endfunction |
|
18 |
+ |
|
19 |
+function! airline#parts#define_function(key, name) |
|
20 |
+ call airline#parts#define(a:key, { 'function': a:name }) |
|
21 |
+endfunction |
|
22 |
+ |
|
23 |
+function! airline#parts#define_text(key, text) |
|
24 |
+ call airline#parts#define(a:key, { 'text': a:text }) |
|
25 |
+endfunction |
|
26 |
+ |
|
27 |
+function! airline#parts#define_raw(key, raw) |
|
28 |
+ call airline#parts#define(a:key, { 'raw': a:raw }) |
|
29 |
+endfunction |
|
30 |
+ |
|
31 |
+function! airline#parts#define_minwidth(key, width) |
|
32 |
+ call airline#parts#define(a:key, { 'minwidth': a:width }) |
|
33 |
+endfunction |
|
34 |
+ |
|
35 |
+function! airline#parts#define_condition(key, predicate) |
|
36 |
+ call airline#parts#define(a:key, { 'condition': a:predicate }) |
|
37 |
+endfunction |
|
38 |
+ |
|
39 |
+function! airline#parts#define_accent(key, accent) |
|
40 |
+ call airline#parts#define(a:key, { 'accent': a:accent }) |
|
41 |
+endfunction |
|
42 |
+ |
|
43 |
+function! airline#parts#define_empty(keys) |
|
44 |
+ for key in a:keys |
|
45 |
+ call airline#parts#define_raw(key, '') |
|
46 |
+ endfor |
|
47 |
+endfunction |
|
48 |
+ |
|
49 |
+function! airline#parts#get(key) |
|
50 |
+ return get(s:parts, a:key, {}) |
|
51 |
+endfunction |
|
52 |
+ |
|
53 |
+" }}} |
|
54 |
+ |
|
55 |
+function! airline#parts#mode() |
|
56 |
+ return airline#util#shorten(get(w:, 'airline_current_mode', ''), 79, 1) |
|
57 |
+endfunction |
|
58 |
+ |
|
59 |
+function! airline#parts#crypt() |
|
60 |
+ return g:airline_detect_crypt && exists("+key") && !empty(&key) ? g:airline_symbols.crypt : '' |
|
61 |
+endfunction |
|
62 |
+ |
|
63 |
+function! airline#parts#paste() |
|
64 |
+ return g:airline_detect_paste && &paste ? g:airline_symbols.paste : '' |
|
65 |
+endfunction |
|
66 |
+ |
|
67 |
+function! airline#parts#spell() |
|
68 |
+ let spelllang = g:airline_detect_spelllang ? printf(" [%s]", toupper(substitute(&spelllang, ',', '/', 'g'))) : '' |
|
69 |
+ if g:airline_detect_spell && &spell |
|
70 |
+ if winwidth(0) >= 90 |
|
71 |
+ return g:airline_symbols.spell . spelllang |
|
72 |
+ elseif winwidth(0) >= 70 |
|
73 |
+ return g:airline_symbols.spell |
|
74 |
+ else |
|
75 |
+ return split(g:airline_symbols.spell, '\zs')[0] |
|
76 |
+ endif |
|
77 |
+ endif |
|
78 |
+ return '' |
|
79 |
+endfunction |
|
80 |
+ |
|
81 |
+function! airline#parts#iminsert() |
|
82 |
+ if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name') |
|
83 |
+ return toupper(b:keymap_name) |
|
84 |
+ endif |
|
85 |
+ return '' |
|
86 |
+endfunction |
|
87 |
+ |
|
88 |
+function! airline#parts#readonly() |
|
89 |
+ if &readonly && !filereadable(bufname('%')) |
|
90 |
+ return '[noperm]' |
|
91 |
+ else |
|
92 |
+ return &readonly ? g:airline_symbols.readonly : '' |
|
93 |
+ endif |
|
94 |
+endfunction |
|
95 |
+ |
|
96 |
+function! airline#parts#filetype() |
|
97 |
+ return winwidth(0) < 90 && strlen(&filetype) > 3 ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? '…' : '>') : &filetype |
|
98 |
+endfunction |
|
99 |
+ |
|
100 |
+function! airline#parts#ffenc() |
|
101 |
+ let expected = get(g:, 'airline#parts#ffenc#skip_expected_string', '') |
|
102 |
+ let bomb = &l:bomb ? '[BOM]' : '' |
|
103 |
+ let ff = strlen(&ff) ? '['.&ff.']' : '' |
|
104 |
+ if expected is# &fenc.bomb.ff |
|
105 |
+ return '' |
|
106 |
+ else |
|
107 |
+ return &fenc.bomb.ff |
|
108 |
+ endif |
|
109 |
+endfunction |
... | ... |
@@ -0,0 +1,84 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+call airline#init#bootstrap() |
|
7 |
+let s:spc = g:airline_symbols.space |
|
8 |
+ |
|
9 |
+function! s:wrap_accent(part, value) |
|
10 |
+ if exists('a:part.accent') |
|
11 |
+ call airline#highlighter#add_accent(a:part.accent) |
|
12 |
+ return '%#__accent_'.(a:part.accent).'#'.a:value.'%#__restore__#' |
|
13 |
+ endif |
|
14 |
+ return a:value |
|
15 |
+endfunction |
|
16 |
+ |
|
17 |
+function! s:create(parts, append) |
|
18 |
+ let _ = '' |
|
19 |
+ for idx in range(len(a:parts)) |
|
20 |
+ let part = airline#parts#get(a:parts[idx]) |
|
21 |
+ let val = '' |
|
22 |
+ let add_sep = get(l:, 'add_sep', 0) |
|
23 |
+ |
|
24 |
+ if exists('part.function') |
|
25 |
+ let func = (part.function).'()' |
|
26 |
+ elseif exists('part.text') |
|
27 |
+ let func = '"'.(part.text).'"' |
|
28 |
+ else |
|
29 |
+ if a:append > 0 && idx != 0 |
|
30 |
+ let val .= s:spc.g:airline_left_alt_sep.s:spc |
|
31 |
+ endif |
|
32 |
+ if a:append < 0 && idx != 0 |
|
33 |
+ let t = '' |
|
34 |
+ if !add_sep |
|
35 |
+ let t = s:spc.g:airline_right_alt_sep.s:spc |
|
36 |
+ endif |
|
37 |
+ let val = t.val |
|
38 |
+ endif |
|
39 |
+ if exists('part.raw') |
|
40 |
+ let _ .= s:wrap_accent(part, val.(part.raw)) |
|
41 |
+ continue |
|
42 |
+ else |
|
43 |
+ let _ .= s:wrap_accent(part, val.a:parts[idx]) |
|
44 |
+ continue |
|
45 |
+ endif |
|
46 |
+ endif |
|
47 |
+ |
|
48 |
+ let minwidth = get(part, 'minwidth', 0) |
|
49 |
+ |
|
50 |
+ if a:append > 0 && idx != 0 |
|
51 |
+ let partval = printf('%%{airline#util#append(%s,%s)}', func, minwidth) |
|
52 |
+ " will add an extra separator, if minwidth is zero |
|
53 |
+ let add_sep = (minwidth == 0) |
|
54 |
+ elseif a:append < 0 && idx != len(a:parts) - 1 |
|
55 |
+ let partval = printf('%%{airline#util#prepend(%s,%s)}', func, minwidth) |
|
56 |
+ " will add an extra separator, if minwidth is zero |
|
57 |
+ let add_sep = (minwidth == 0) |
|
58 |
+ else |
|
59 |
+ let partval = printf('%%{airline#util#wrap(%s,%s)}', func, minwidth) |
|
60 |
+ let add_sep = 0 |
|
61 |
+ endif |
|
62 |
+ |
|
63 |
+ if exists('part.condition') |
|
64 |
+ let partval = substitute(partval, '{', '\="{".(part.condition)." ? "', '') |
|
65 |
+ let partval = substitute(partval, '}', ' : ""}', '') |
|
66 |
+ endif |
|
67 |
+ |
|
68 |
+ let val .= s:wrap_accent(part, partval) |
|
69 |
+ let _ .= val |
|
70 |
+ endfor |
|
71 |
+ return _ |
|
72 |
+endfunction |
|
73 |
+ |
|
74 |
+function! airline#section#create(parts) |
|
75 |
+ return s:create(a:parts, 0) |
|
76 |
+endfunction |
|
77 |
+ |
|
78 |
+function! airline#section#create_left(parts) |
|
79 |
+ return s:create(a:parts, 1) |
|
80 |
+endfunction |
|
81 |
+ |
|
82 |
+function! airline#section#create_right(parts) |
|
83 |
+ return s:create(a:parts, -1) |
|
84 |
+endfunction |
... | ... |
@@ -0,0 +1,76 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+" generates a dictionary which defines the colors for each highlight group |
|
7 |
+function! airline#themes#generate_color_map(sect1, sect2, sect3, ...) |
|
8 |
+ let palette = { |
|
9 |
+ \ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] , |
|
10 |
+ \ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] , |
|
11 |
+ \ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] , |
|
12 |
+ \ } |
|
13 |
+ |
|
14 |
+ if a:0 > 0 |
|
15 |
+ call extend(palette, { |
|
16 |
+ \ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] , |
|
17 |
+ \ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] , |
|
18 |
+ \ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] , |
|
19 |
+ \ }) |
|
20 |
+ else |
|
21 |
+ call extend(palette, { |
|
22 |
+ \ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] , |
|
23 |
+ \ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] , |
|
24 |
+ \ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] , |
|
25 |
+ \ }) |
|
26 |
+ endif |
|
27 |
+ |
|
28 |
+ return palette |
|
29 |
+endfunction |
|
30 |
+ |
|
31 |
+function! airline#themes#get_highlight(group, ...) |
|
32 |
+ return call('airline#highlighter#get_highlight', [a:group] + a:000) |
|
33 |
+endfunction |
|
34 |
+ |
|
35 |
+function! airline#themes#get_highlight2(fg, bg, ...) |
|
36 |
+ return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000) |
|
37 |
+endfunction |
|
38 |
+ |
|
39 |
+function! airline#themes#patch(palette) |
|
40 |
+ for mode in keys(a:palette) |
|
41 |
+ if !has_key(a:palette[mode], 'airline_warning') |
|
42 |
+ let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ] |
|
43 |
+ endif |
|
44 |
+ if !has_key(a:palette[mode], 'airline_error') |
|
45 |
+ let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ] |
|
46 |
+ endif |
|
47 |
+ if !has_key(a:palette[mode], 'airline_term') |
|
48 |
+ "let a:palette[mode]['airline_term'] = [ '#9cffd3', '#202020', 85, 232] |
|
49 |
+ let a:palette[mode]['airline_term'] = airline#highlighter#get_highlight('airline_c') |
|
50 |
+ endif |
|
51 |
+ endfor |
|
52 |
+ |
|
53 |
+ let a:palette.accents = get(a:palette, 'accents', {}) |
|
54 |
+ let a:palette.accents.none = [ '', '', '', '', '' ] |
|
55 |
+ let a:palette.accents.bold = [ '', '', '', '', 'bold' ] |
|
56 |
+ let a:palette.accents.italic = [ '', '', '', '', 'italic' ] |
|
57 |
+ |
|
58 |
+ if !has_key(a:palette.accents, 'red') |
|
59 |
+ let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ] |
|
60 |
+ endif |
|
61 |
+ if !has_key(a:palette.accents, 'green') |
|
62 |
+ let a:palette.accents.green = [ '#008700' , '' , 22 , '' ] |
|
63 |
+ endif |
|
64 |
+ if !has_key(a:palette.accents, 'blue') |
|
65 |
+ let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ] |
|
66 |
+ endif |
|
67 |
+ if !has_key(a:palette.accents, 'yellow') |
|
68 |
+ let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ] |
|
69 |
+ endif |
|
70 |
+ if !has_key(a:palette.accents, 'orange') |
|
71 |
+ let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ] |
|
72 |
+ endif |
|
73 |
+ if !has_key(a:palette.accents, 'purple') |
|
74 |
+ let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ] |
|
75 |
+ endif |
|
76 |
+endfunction |
... | ... |
@@ -0,0 +1,156 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 tw=80 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+" Airline themes are generated based on the following concepts: |
|
7 |
+" * The section of the status line, valid Airline statusline sections are: |
|
8 |
+" * airline_a (left most section) |
|
9 |
+" * airline_b (section just to the right of airline_a) |
|
10 |
+" * airline_c (section just to the right of airline_b) |
|
11 |
+" * airline_x (first section of the right most sections) |
|
12 |
+" * airline_y (section just to the right of airline_x) |
|
13 |
+" * airline_z (right most section) |
|
14 |
+" * The mode of the buffer, as reported by the :mode() function. Airline |
|
15 |
+" converts the values reported by mode() to the following: |
|
16 |
+" * normal |
|
17 |
+" * insert |
|
18 |
+" * replace |
|
19 |
+" * visual |
|
20 |
+" * inactive |
|
21 |
+" The last one is actually no real mode as returned by mode(), but used by |
|
22 |
+" airline to style inactive statuslines (e.g. windows, where the cursor |
|
23 |
+" currently does not reside in). |
|
24 |
+" * In addition to each section and mode specified above, airline themes |
|
25 |
+" can also specify overrides. Overrides can be provided for the following |
|
26 |
+" scenarios: |
|
27 |
+" * 'modified' |
|
28 |
+" * 'paste' |
|
29 |
+" |
|
30 |
+" Airline themes are specified as a global viml dictionary using the above |
|
31 |
+" sections, modes and overrides as keys to the dictionary. The name of the |
|
32 |
+" dictionary is significant and should be specified as: |
|
33 |
+" * g:airline#themes#<theme_name>#palette |
|
34 |
+" where <theme_name> is substituted for the name of the theme.vim file where the |
|
35 |
+" theme definition resides. Airline themes should reside somewhere on the |
|
36 |
+" 'runtimepath' where it will be loaded at vim startup, for example: |
|
37 |
+" * autoload/airline/themes/theme_name.vim |
|
38 |
+" |
|
39 |
+" For this, the dark.vim, theme, this is defined as |
|
40 |
+let g:airline#themes#dark#palette = {} |
|
41 |
+ |
|
42 |
+" Keys in the dictionary are composed of the mode, and if specified the |
|
43 |
+" override. For example: |
|
44 |
+" * g:airline#themes#dark#palette.normal |
|
45 |
+" * the colors for a statusline while in normal mode |
|
46 |
+" * g:airline#themes#dark#palette.normal_modified |
|
47 |
+" * the colors for a statusline while in normal mode when the buffer has |
|
48 |
+" been modified |
|
49 |
+" * g:airline#themes#dark#palette.visual |
|
50 |
+" * the colors for a statusline while in visual mode |
|
51 |
+" |
|
52 |
+" Values for each dictionary key is an array of color values that should be |
|
53 |
+" familiar for colorscheme designers: |
|
54 |
+" * [guifg, guibg, ctermfg, ctermbg, opts] |
|
55 |
+" See "help attr-list" for valid values for the "opt" value. |
|
56 |
+" |
|
57 |
+" Each theme must provide an array of such values for each airline section of |
|
58 |
+" the statusline (airline_a through airline_z). A convenience function, |
|
59 |
+" airline#themes#generate_color_map() exists to mirror airline_a/b/c to |
|
60 |
+" airline_x/y/z, respectively. |
|
61 |
+ |
|
62 |
+" The dark.vim theme: |
|
63 |
+let s:airline_a_normal = [ '#00005f' , '#dfff00' , 17 , 190 ] |
|
64 |
+let s:airline_b_normal = [ '#ffffff' , '#444444' , 255 , 238 ] |
|
65 |
+let s:airline_c_normal = [ '#9cffd3' , '#202020' , 85 , 234 ] |
|
66 |
+let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:airline_a_normal, s:airline_b_normal, s:airline_c_normal) |
|
67 |
+ |
|
68 |
+" It should be noted the above is equivalent to: |
|
69 |
+" let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map( |
|
70 |
+" \ [ '#00005f' , '#dfff00' , 17 , 190 ], " section airline_a |
|
71 |
+" \ [ '#ffffff' , '#444444' , 255 , 238 ], " section airline_b |
|
72 |
+" \ [ '#9cffd3' , '#202020' , 85 , 234 ] " section airline_c |
|
73 |
+" \) |
|
74 |
+" |
|
75 |
+" In turn, that is equivalent to: |
|
76 |
+" let g:airline#themes#dark#palette.normal = { |
|
77 |
+" \ 'airline_a': [ '#00005f' , '#dfff00' , 17 , 190 ], "section airline_a |
|
78 |
+" \ 'airline_b': [ '#ffffff' , '#444444' , 255 , 238 ], "section airline_b |
|
79 |
+" \ 'airline_c': [ '#9cffd3' , '#202020' , 85 , 234 ], "section airline_c |
|
80 |
+" \ 'airline_x': [ '#9cffd3' , '#202020' , 85 , 234 ], "section airline_x |
|
81 |
+" \ 'airline_y': [ '#ffffff' , '#444444' , 255 , 238 ], "section airline_y |
|
82 |
+" \ 'airline_z': [ '#00005f' , '#dfff00' , 17 , 190 ] "section airline_z |
|
83 |
+" \} |
|
84 |
+" |
|
85 |
+" airline#themes#generate_color_map() also uses the values provided as |
|
86 |
+" parameters to create intermediary groups such as: |
|
87 |
+" airline_a_to_airline_b |
|
88 |
+" airline_b_to_airline_c |
|
89 |
+" etc... |
|
90 |
+ |
|
91 |
+" Here we define overrides for when the buffer is modified. This will be |
|
92 |
+" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are |
|
93 |
+" declared. |
|
94 |
+let g:airline#themes#dark#palette.normal_modified = { |
|
95 |
+ \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , |
|
96 |
+ \ } |
|
97 |
+ |
|
98 |
+ |
|
99 |
+let s:airline_a_insert = [ '#00005f' , '#00dfff' , 17 , 45 ] |
|
100 |
+let s:airline_b_insert = [ '#ffffff' , '#005fff' , 255 , 27 ] |
|
101 |
+let s:airline_c_insert = [ '#ffffff' , '#000080' , 15 , 17 ] |
|
102 |
+let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:airline_a_insert, s:airline_b_insert, s:airline_c_insert) |
|
103 |
+let g:airline#themes#dark#palette.insert_modified = { |
|
104 |
+ \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , |
|
105 |
+ \ } |
|
106 |
+let g:airline#themes#dark#palette.insert_paste = { |
|
107 |
+ \ 'airline_a': [ s:airline_a_insert[0] , '#d78700' , s:airline_a_insert[2] , 172 , '' ] , |
|
108 |
+ \ } |
|
109 |
+ |
|
110 |
+ |
|
111 |
+let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert) |
|
112 |
+let g:airline#themes#dark#palette.replace.airline_a = [ s:airline_b_insert[0] , '#af0000' , s:airline_b_insert[2] , 124 , '' ] |
|
113 |
+let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified |
|
114 |
+ |
|
115 |
+ |
|
116 |
+let s:airline_a_visual = [ '#000000' , '#ffaf00' , 232 , 214 ] |
|
117 |
+let s:airline_b_visual = [ '#000000' , '#ff5f00' , 232 , 202 ] |
|
118 |
+let s:airline_c_visual = [ '#ffffff' , '#5f0000' , 15 , 52 ] |
|
119 |
+let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:airline_a_visual, s:airline_b_visual, s:airline_c_visual) |
|
120 |
+let g:airline#themes#dark#palette.visual_modified = { |
|
121 |
+ \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , |
|
122 |
+ \ } |
|
123 |
+ |
|
124 |
+ |
|
125 |
+let s:airline_a_inactive = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] |
|
126 |
+let s:airline_b_inactive = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ] |
|
127 |
+let s:airline_c_inactive = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ] |
|
128 |
+let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:airline_a_inactive, s:airline_b_inactive, s:airline_c_inactive) |
|
129 |
+let g:airline#themes#dark#palette.inactive_modified = { |
|
130 |
+ \ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] , |
|
131 |
+ \ } |
|
132 |
+ |
|
133 |
+ |
|
134 |
+" Accents are used to give parts within a section a slightly different look or |
|
135 |
+" color. Here we are defining a "red" accent, which is used by the 'readonly' |
|
136 |
+" part by default. Only the foreground colors are specified, so the background |
|
137 |
+" colors are automatically extracted from the underlying section colors. What |
|
138 |
+" this means is that regardless of which section the part is defined in, it |
|
139 |
+" will be red instead of the section's foreground color. You can also have |
|
140 |
+" multiple parts with accents within a section. |
|
141 |
+let g:airline#themes#dark#palette.accents = { |
|
142 |
+ \ 'red': [ '#ff0000' , '' , 160 , '' ] |
|
143 |
+ \ } |
|
144 |
+ |
|
145 |
+ |
|
146 |
+" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp |
|
147 |
+" variable so that related functionality is loaded iff the user is using |
|
148 |
+" ctrlp. Note that this is optional, and if you do not define ctrlp colors |
|
149 |
+" they will be chosen automatically from the existing palette. |
|
150 |
+if get(g:, 'loaded_ctrlp', 0) |
|
151 |
+ let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( |
|
152 |
+ \ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ], |
|
153 |
+ \ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ], |
|
154 |
+ \ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ]) |
|
155 |
+endif |
|
156 |
+ |
... | ... |
@@ -0,0 +1,46 @@ |
1 |
+" Theme to mimic the default colorscheme of powerline |
|
2 |
+" Not 100% the same so it's powerline... ish. |
|
3 |
+" |
|
4 |
+" Differences from default powerline: |
|
5 |
+" * Paste indicator isn't colored different |
|
6 |
+" * Far right hand section matches the color of the mode indicator |
|
7 |
+" |
|
8 |
+" Differences from other airline themes: |
|
9 |
+" * No color differences when you're in a modified buffer |
|
10 |
+" * Visual mode only changes the mode section. Otherwise |
|
11 |
+" it appears the same as normal mode |
|
12 |
+ |
|
13 |
+" Normal mode " fg & bg |
|
14 |
+let s:N1 = [ '#005f00' , '#afd700' , 22 , 148 ] " darkestgreen & brightgreen |
|
15 |
+let s:N2 = [ '#9e9e9e' , '#303030' , 247 , 236 ] " gray8 & gray2 |
|
16 |
+let s:N3 = [ '#ffffff' , '#121212' , 231 , 233 ] " white & gray4 |
|
17 |
+ |
|
18 |
+" Insert mode " fg & bg |
|
19 |
+let s:I1 = [ '#005f5f' , '#ffffff' , 23 , 231 ] " darkestcyan & white |
|
20 |
+let s:I2 = [ '#5fafd7' , '#0087af' , 74 , 31 ] " darkcyan & darkblue |
|
21 |
+let s:I3 = [ '#87d7ff' , '#005f87' , 117 , 24 ] " mediumcyan & darkestblue |
|
22 |
+ |
|
23 |
+" Visual mode " fg & bg |
|
24 |
+let s:V1 = [ '#080808' , '#ffaf00' , 232 , 214 ] " gray3 & brightestorange |
|
25 |
+ |
|
26 |
+" Replace mode " fg & bg |
|
27 |
+let s:RE = [ '#ffffff' , '#d70000' , 231 , 160 ] " white & brightred |
|
28 |
+ |
|
29 |
+let g:airline#themes#powerlineish#palette = {} |
|
30 |
+ |
|
31 |
+let g:airline#themes#powerlineish#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
|
32 |
+ |
|
33 |
+let g:airline#themes#powerlineish#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
|
34 |
+let g:airline#themes#powerlineish#palette.insert_replace = { |
|
35 |
+ \ 'airline_a': [ s:RE[0] , s:I1[1] , s:RE[1] , s:I1[3] , '' ] } |
|
36 |
+ |
|
37 |
+let g:airline#themes#powerlineish#palette.visual = { |
|
38 |
+ \ 'airline_a': [ s:V1[0] , s:V1[1] , s:V1[2] , s:V1[3] , '' ] } |
|
39 |
+ |
|
40 |
+let g:airline#themes#powerlineish#palette.replace = copy(airline#themes#powerlineish#palette.normal) |
|
41 |
+let g:airline#themes#powerlineish#palette.replace.airline_a = [ s:RE[0] , s:RE[1] , s:RE[2] , s:RE[3] , '' ] |
|
42 |
+ |
|
43 |
+ |
|
44 |
+let s:IA = [ s:N2[0] , s:N3[1] , s:N2[2] , s:N3[3] , '' ] |
|
45 |
+let g:airline#themes#powerlineish#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
|
46 |
+ |
... | ... |
@@ -0,0 +1,98 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+" TODO: Try to cache winwidth(0) function |
|
5 |
+" e.g. store winwidth per window and access that, only update it, if the size |
|
6 |
+" actually changed. |
|
7 |
+scriptencoding utf-8 |
|
8 |
+ |
|
9 |
+call airline#init#bootstrap() |
|
10 |
+let s:spc = g:airline_symbols.space |
|
11 |
+ |
|
12 |
+function! airline#util#shorten(text, winwidth, minwidth, ...) |
|
13 |
+ if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth |
|
14 |
+ if get(a:000, 0, 0) |
|
15 |
+ " shorten from tail |
|
16 |
+ return '…'.matchstr(a:text, '.\{'.a:minwidth.'}$') |
|
17 |
+ else |
|
18 |
+ " shorten from beginning of string |
|
19 |
+ return matchstr(a:text, '^.\{'.a:minwidth.'}').'…' |
|
20 |
+ endif |
|
21 |
+ else |
|
22 |
+ return a:text |
|
23 |
+ endif |
|
24 |
+endfunction |
|
25 |
+ |
|
26 |
+function! airline#util#wrap(text, minwidth) |
|
27 |
+ if a:minwidth > 0 && winwidth(0) < a:minwidth |
|
28 |
+ return '' |
|
29 |
+ endif |
|
30 |
+ return a:text |
|
31 |
+endfunction |
|
32 |
+ |
|
33 |
+function! airline#util#append(text, minwidth) |
|
34 |
+ if a:minwidth > 0 && winwidth(0) < a:minwidth |
|
35 |
+ return '' |
|
36 |
+ endif |
|
37 |
+ let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc |
|
38 |
+ return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text |
|
39 |
+endfunction |
|
40 |
+ |
|
41 |
+function! airline#util#warning(msg) |
|
42 |
+ echohl WarningMsg |
|
43 |
+ echomsg "airline: ".a:msg |
|
44 |
+ echohl Normal |
|
45 |
+endfunction |
|
46 |
+ |
|
47 |
+function! airline#util#prepend(text, minwidth) |
|
48 |
+ if a:minwidth > 0 && winwidth(0) < a:minwidth |
|
49 |
+ return '' |
|
50 |
+ endif |
|
51 |
+ return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc |
|
52 |
+endfunction |
|
53 |
+ |
|
54 |
+if v:version >= 704 |
|
55 |
+ function! airline#util#getwinvar(winnr, key, def) |
|
56 |
+ return getwinvar(a:winnr, a:key, a:def) |
|
57 |
+ endfunction |
|
58 |
+else |
|
59 |
+ function! airline#util#getwinvar(winnr, key, def) |
|
60 |
+ let winvals = getwinvar(a:winnr, '') |
|
61 |
+ return get(winvals, a:key, a:def) |
|
62 |
+ endfunction |
|
63 |
+endif |
|
64 |
+ |
|
65 |
+if v:version >= 704 |
|
66 |
+ function! airline#util#exec_funcrefs(list, ...) |
|
67 |
+ for Fn in a:list |
|
68 |
+ let code = call(Fn, a:000) |
|
69 |
+ if code != 0 |
|
70 |
+ return code |
|
71 |
+ endif |
|
72 |
+ endfor |
|
73 |
+ return 0 |
|
74 |
+ endfunction |
|
75 |
+else |
|
76 |
+ function! airline#util#exec_funcrefs(list, ...) |
|
77 |
+ " for 7.2; we cannot iterate the list, hence why we use range() |
|
78 |
+ " for 7.3-[97, 328]; we cannot reuse the variable, hence the {} |
|
79 |
+ for i in range(0, len(a:list) - 1) |
|
80 |
+ let Fn{i} = a:list[i] |
|
81 |
+ let code = call(Fn{i}, a:000) |
|
82 |
+ if code != 0 |
|
83 |
+ return code |
|
84 |
+ endif |
|
85 |
+ endfor |
|
86 |
+ return 0 |
|
87 |
+ endfunction |
|
88 |
+endif |
|
89 |
+ |
|
90 |
+" Compatibility wrapper for strchars, in case this vim version does not |
|
91 |
+" have it natively |
|
92 |
+function! airline#util#strchars(str) |
|
93 |
+ if exists('*strchars') |
|
94 |
+ return strchars(a:str) |
|
95 |
+ else |
|
96 |
+ return strlen(substitute(a:str, '.', 'a', 'g')) |
|
97 |
+ endif |
|
98 |
+endfunction |
... | ... |
@@ -0,0 +1,1449 @@ |
1 |
+*airline.txt* Lean and mean status/tabline that's light as air |
|
2 |
+*airline* *vim-airline* |
|
3 |
+ _ _ _ _ ~ |
|
4 |
+ __ _(_)_ __ ___ __ _(_)_ __| (_)_ __ ___ ~ |
|
5 |
+ \ \ / / | '_ ` _ \ _____ / _` | | '__| | | '_ \ / _ \ ~ |
|
6 |
+ \ V /| | | | | | |_____| (_| | | | | | | | | | __/ ~ |
|
7 |
+ \_/ |_|_| |_| |_| \__,_|_|_| |_|_|_| |_|\___| ~ |
|
8 |
+ ~ |
|
9 |
+============================================================================== |
|
10 |
+CONTENTS *airline-contents* |
|
11 |
+ |
|
12 |
+ 01. Intro ............................................... |airline-intro| |
|
13 |
+ 02. Features ......................................... |airline-features| |
|
14 |
+ 03. Name ................................................. |airline-name| |
|
15 |
+ 04. Configuration ............................... |airline-configuration| |
|
16 |
+ 05. Commands ......................................... |airline-commands| |
|
17 |
+ 06. Autocommands ................................. |airline-autocommands| |
|
18 |
+ 07. Customization ............................... |airline-customization| |
|
19 |
+ 08. Extensions ..................................... |airline-extensions| |
|
20 |
+ 09. Advanced Customization ............. |airline-advanced-customization| |
|
21 |
+ 10. Funcrefs ......................................... |airline-funcrefs| |
|
22 |
+ 11. Pipeline ......................................... |airline-pipeline| |
|
23 |
+ 12. Writing Extensions ..................... |airline-writing-extensions| |
|
24 |
+ 13. Writing Themes ..................................... |airline-themes| |
|
25 |
+ 14. Troubleshooting ........................... |airline-troubleshooting| |
|
26 |
+ 15. Contributions ............................... |airline-contributions| |
|
27 |
+ 16. License ........................................... |airline-license| |
|
28 |
+ |
|
29 |
+============================================================================== |
|
30 |
+INTRODUCTION *airline-intro* |
|
31 |
+ |
|
32 |
+vim-airline is a fast and lightweight alternative to powerline, written |
|
33 |
+in 100% vimscript with no outside dependencies. |
|
34 |
+ |
|
35 |
+When the plugin is correctly loaded, Vim will draw a nice statusline at the |
|
36 |
+bottom of each window. |
|
37 |
+ |
|
38 |
+That line consists of several sections, each one displaying some piece of |
|
39 |
+information. By default (without configuration) this line will look like this: > |
|
40 |
+ |
|
41 |
++-----------------------------------------------------------------------------+ |
|
42 |
+|~ | |
|
43 |
+|~ | |
|
44 |
+|~ VIM - Vi IMproved | |
|
45 |
+|~ | |
|
46 |
+|~ version 8.0 | |
|
47 |
+|~ by Bram Moolenaar et al. | |
|
48 |
+|~ Vim is open source and freely distributable | |
|
49 |
+|~ | |
|
50 |
+|~ type :h :q<Enter> to exit | |
|
51 |
+|~ type :help<Enter> or <F1> for on-line help | |
|
52 |
+|~ type :help version8<Enter> for version info | |
|
53 |
+|~ | |
|
54 |
+|~ | |
|
55 |
++-----------------------------------------------------------------------------+ |
|
56 |
+| A | B | C X | Y | Z | [...] | |
|
57 |
++-----------------------------------------------------------------------------+ |
|
58 |
+ |
|
59 |
+The statusline is the colored line at the bottom, which contains the sections |
|
60 |
+(possibly in different colors): |
|
61 |
+ |
|
62 |
+section meaning (example)~ |
|
63 |
+-------------------------- |
|
64 |
+ A displays the mode + additional flags like crypt/spell/paste (INSERT) |
|
65 |
+ B VCS information (branch, hunk summary) (master) |
|
66 |
+ C filename + read-only flag (~/.vim/vimrc RO) |
|
67 |
+ X filetype (vim) |
|
68 |
+ Y file encoding[fileformat] (utf-8[unix]) |
|
69 |
+ Z current position in the file |
|
70 |
+ percentage % ☰ current line/number of lines ln : column |
|
71 |
+ So this: 10% ☰ 10/100 ln : 20 means: > |
|
72 |
+ 10% - 10 percent |
|
73 |
+ ☰ 10 - current line 10 |
|
74 |
+ /100 ln - of 100 lines |
|
75 |
+ : 20 - current column 20 |
|
76 |
+< |
|
77 |
+ [...] additional sections (warning/errors/statistics) |
|
78 |
+ from external plugins (e.g. YCM/syntastic/...) |
|
79 |
+ |
|
80 |
+For a better look, those sections can be colored differently, depending on the mode and |
|
81 |
+whether the current file is 'modified' |
|
82 |
+ |
|
83 |
+Additionally, several extensions exists, that can provide additional feature (e.g. the |
|
84 |
+tabline extension provides an extra statusline on the top of the Vim window and can |
|
85 |
+display loaded buffers and tabs in the current Vim session). |
|
86 |
+ |
|
87 |
+Most of this is customizable and the default sections can be configured using the vim |
|
88 |
+variables g:airline_section_<name> (see |airline-default-sections|) |
|
89 |
+ |
|
90 |
+============================================================================== |
|
91 |
+FEATURES *airline-features* |
|
92 |
+ |
|
93 |
+* tiny core written with extensibility in mind. |
|
94 |
+* integrates with many popular plugins. |
|
95 |
+* looks good with regular fonts, and provides configuration points so you |
|
96 |
+ can use unicode or powerline symbols. |
|
97 |
+* optimized for speed; it loads in under a millisecond. |
|
98 |
+* fully customizable; if you know a little 'statusline' syntax you can |
|
99 |
+ tweak it to your needs. |
|
100 |
+* extremely easy to write themes. |
|
101 |
+ |
|
102 |
+============================================================================== |
|
103 |
+NAME *airline-name* |
|
104 |
+ |
|
105 |
+Where did the name come from? |
|
106 |
+ |
|
107 |
+I wrote this on an airplane, and since it's light as air it turned out to be a |
|
108 |
+good name :-) |
|
109 |
+ |
|
110 |
+============================================================================== |
|
111 |
+CONFIGURATION *airline-configuration* |
|
112 |
+ |
|
113 |
+There are a couple configuration values available (shown with their default |
|
114 |
+values): |
|
115 |
+ |
|
116 |
+* the separator used on the left side > |
|
117 |
+ let g:airline_left_sep='>' |
|
118 |
+< |
|
119 |
+* the separator used on the right side > |
|
120 |
+ let g:airline_right_sep='<' |
|
121 |
+< |
|
122 |
+* enable modified detection > |
|
123 |
+ let g:airline_detect_modified=1 |
|
124 |
+ |
|
125 |
+* enable paste detection > |
|
126 |
+ let g:airline_detect_paste=1 |
|
127 |
+< |
|
128 |
+* enable crypt detection > |
|
129 |
+ let g:airline_detect_crypt=1 |
|
130 |
+ |
|
131 |
+* enable spell detection > |
|
132 |
+ let g:airline_detect_spell=1 |
|
133 |
+ |
|
134 |
+* display spelling language when spell detection is enabled |
|
135 |
+ (if enough space is available) > |
|
136 |
+ let g:airline_detect_spelllang=1 |
|
137 |
+< |
|
138 |
+* enable iminsert detection > |
|
139 |
+ let g:airline_detect_iminsert=0 |
|
140 |
+< |
|
141 |
+* determine whether inactive windows should have the left section collapsed to |
|
142 |
+ only the filename of that buffer. > |
|
143 |
+ let g:airline_inactive_collapse=1 |
|
144 |
+< |
|
145 |
+* themes are automatically selected based on the matching colorscheme. this |
|
146 |
+ can be overridden by defining a value. > |
|
147 |
+ let g:airline_theme='dark' |
|
148 |
+< |
|
149 |
+ Note: Only the dark theme is distributed with vim-airline. For more themes, |
|
150 |
+ checkout the vim-airline-themes repository |
|
151 |
+ (github.com/vim-airline/vim-airline-themes) |
|
152 |
+ |
|
153 |
+* if you want to patch the airline theme before it gets applied, you can |
|
154 |
+ supply the name of a function where you can modify the palette. > |
|
155 |
+ let g:airline_theme_patch_func = 'AirlineThemePatch' |
|
156 |
+ function! AirlineThemePatch(palette) |
|
157 |
+ if g:airline_theme == 'badwolf' |
|
158 |
+ for colors in values(a:palette.inactive) |
|
159 |
+ let colors[3] = 245 |
|
160 |
+ endfor |
|
161 |
+ endif |
|
162 |
+ endfunction |
|
163 |
+< |
|
164 |
+* By default, airline will use unicode symbols if your encoding matches |
|
165 |
+ utf-8. If you want the powerline symbols set this variable: > |
|
166 |
+ let g:airline_powerline_fonts = 1 |
|
167 |
+< |
|
168 |
+ If you want to use plain ascii symbols, set this variable: > |
|
169 |
+ let g:airline_symbols_ascii = 1 |
|
170 |
+< |
|
171 |
+* define the set of text to display for each mode. > |
|
172 |
+ let g:airline_mode_map = {} " see source for the defaults |
|
173 |
+ |
|
174 |
+ " or copy paste the following into your vimrc for shortform text |
|
175 |
+ let g:airline_mode_map = { |
|
176 |
+ \ '__' : '-', |
|
177 |
+ \ 'n' : 'N', |
|
178 |
+ \ 'i' : 'I', |
|
179 |
+ \ 'R' : 'R', |
|
180 |
+ \ 'c' : 'C', |
|
181 |
+ \ 'v' : 'V', |
|
182 |
+ \ 'V' : 'V', |
|
183 |
+ \ '' : 'V', |
|
184 |
+ \ 's' : 'S', |
|
185 |
+ \ 'S' : 'S', |
|
186 |
+ \ '' : 'S', |
|
187 |
+ \ } |
|
188 |
+< |
|
189 |
+* define the set of filename match queries which excludes a window from having |
|
190 |
+ its statusline modified > |
|
191 |
+ let g:airline_exclude_filenames = [] " see source for current list |
|
192 |
+< |
|
193 |
+* define the set of filetypes which are excluded from having its window |
|
194 |
+ statusline modified > |
|
195 |
+ let g:airline_exclude_filetypes = [] " see source for current list |
|
196 |
+< |
|
197 |
+* defines whether the preview window should be excluded from have its window |
|
198 |
+ statusline modified (may help with plugins which use the preview window |
|
199 |
+ heavily) > |
|
200 |
+ let g:airline_exclude_preview = 0 |
|
201 |
+< |
|
202 |
+* disable the Airline customization for selective windows (this is a |
|
203 |
+ window-local variable so you can disable it for only some windows) > |
|
204 |
+ let w:airline_disabled = 1 |
|
205 |
+ |
|
206 |
+* Do not draw separators for empty sections (only for the active window) > |
|
207 |
+ let g:airline_skip_empty_sections = 1 |
|
208 |
+< |
|
209 |
+ This variable can be overriden by setting a window-local variable with |
|
210 |
+ the same name (in the correct window): > |
|
211 |
+ let w:airline_skip_empty_sections = 0 |
|
212 |
+< |
|
213 |
+* Caches the changes to the highlighting groups, should therefore be faster. |
|
214 |
+ Set this to one, if you experience a sluggish Vim: > |
|
215 |
+ let g:airline_highlighting_cache = 0 |
|
216 |
+< |
|
217 |
+============================================================================== |
|
218 |
+COMMANDS *airline-commands* |
|
219 |
+ |
|
220 |
+:AirlineTheme {theme-name} *:AirlineTheme* |
|
221 |
+ Displays or changes the current theme. |
|
222 |
+ |
|
223 |
+:AirlineToggleWhitespace *:AirlineToggleWhitespace* |
|
224 |
+ Toggles whitespace detection. |
|
225 |
+ |
|
226 |
+:AirlineToggle *:AirlineToggle* |
|
227 |
+ Toggles between the standard 'statusline' and airline. |
|
228 |
+ |
|
229 |
+:AirlineRefresh *:AirlineRefresh* |
|
230 |
+ Refreshes all highlight groups and redraws the statusline. |
|
231 |
+ |
|
232 |
+============================================================================== |
|
233 |
+AUTOCOMMANDS *airline-autocommands* |
|
234 |
+ |
|
235 |
+Airline comes with some user-defined autocommands. |
|
236 |
+ |
|
237 |
+|AirlineAfterInit| after plugin is initialized, but before the statusline |
|
238 |
+ is replaced |
|
239 |
+|AirlineAfterTheme| after theme of the statusline has been changed |
|
240 |
+|AirlineToggledOn| after airline is activated and replaced the statusline |
|
241 |
+|AirlineToggledOff| after airline is deactivated and the statusline is |
|
242 |
+ restored to the original |
|
243 |
+ |
|
244 |
+============================================================================== |
|
245 |
+CUSTOMIZATION *airline-customization* |
|
246 |
+ |
|
247 |
+The following are some unicode symbols for customizing the left/right |
|
248 |
+separators, as well as the powerline font glyphs. |
|
249 |
+ |
|
250 |
+Note: You must define the dictionary first before setting values. Also, it's a |
|
251 |
+good idea to check whether it exists as to avoid accidentally overwriting |
|
252 |
+its contents. > |
|
253 |
+ if !exists('g:airline_symbols') |
|
254 |
+ let g:airline_symbols = {} |
|
255 |
+ endif |
|
256 |
+ |
|
257 |
+ " unicode symbols |
|
258 |
+ let g:airline_left_sep = '»' |
|
259 |
+ let g:airline_left_sep = '▶' |
|
260 |
+ let g:airline_right_sep = '«' |
|
261 |
+ let g:airline_right_sep = '◀' |
|
262 |
+ let g:airline_symbols.crypt = '🔒' |
|
263 |
+ let g:airline_symbols.linenr = '☰' |
|
264 |
+ let g:airline_symbols.linenr = '␊' |
|
265 |
+ let g:airline_symbols.linenr = '' |
|
266 |
+ let g:airline_symbols.linenr = '¶' |
|
267 |
+ let g:airline_symbols.maxlinenr = '' |
|
268 |
+ let g:airline_symbols.maxlinenr = '㏑' |
|
269 |
+ let g:airline_symbols.branch = '⎇' |
|
270 |
+ let g:airline_symbols.paste = 'ρ' |
|
271 |
+ let g:airline_symbols.paste = 'Þ' |
|
272 |
+ let g:airline_symbols.paste = '∥' |
|
273 |
+ let g:airline_symbols.spell = 'Ꞩ' |
|
274 |
+ let g:airline_symbols.notexists = '∄' |
|
275 |
+ let g:airline_symbols.whitespace = 'Ξ' |
|
276 |
+ |
|
277 |
+ " powerline symbols |
|
278 |
+ let g:airline_left_sep = '' |
|
279 |
+ let g:airline_left_alt_sep = '' |
|
280 |
+ let g:airline_right_sep = '' |
|
281 |
+ let g:airline_right_alt_sep = '' |
|
282 |
+ let g:airline_symbols.branch = '' |
|
283 |
+ let g:airline_symbols.readonly = '' |
|
284 |
+ let g:airline_symbols.linenr = '☰' |
|
285 |
+ let g:airline_symbols.maxlinenr = '' |
|
286 |
+ |
|
287 |
+ " old vim-powerline symbols |
|
288 |
+ let g:airline_left_sep = '⮀' |
|
289 |
+ let g:airline_left_alt_sep = '⮁' |
|
290 |
+ let g:airline_right_sep = '⮂' |
|
291 |
+ let g:airline_right_alt_sep = '⮃' |
|
292 |
+ let g:airline_symbols.branch = '⭠' |
|
293 |
+ let g:airline_symbols.readonly = '⭤' |
|
294 |
+ let g:airline_symbols.linenr = '⭡' |
|
295 |
+< |
|
296 |
+ |
|
297 |
+For more intricate customizations, you can replace the predefined sections |
|
298 |
+with the usual statusline syntax. |
|
299 |
+ |
|
300 |
+Note: If you define any section variables it will replace the default values |
|
301 |
+entirely. If you want to disable only certain parts of a section you can try |
|
302 |
+using variables defined in the |airline-configuration| or |airline-extensions| |
|
303 |
+section. |
|
304 |
+ |airline-default-sections| |
|
305 |
+> |
|
306 |
+ variable names default contents |
|
307 |
+ ---------------------------------------------------------------------------- |
|
308 |
+ let g:airline_section_a (mode, crypt, paste, spell, iminsert) |
|
309 |
+ let g:airline_section_b (hunks, branch)[*] |
|
310 |
+ let g:airline_section_c (bufferline or filename) |
|
311 |
+ let g:airline_section_gutter (readonly, csv) |
|
312 |
+ let g:airline_section_x (tagbar, filetype, virtualenv) |
|
313 |
+ let g:airline_section_y (fileencoding, fileformat) |
|
314 |
+ let g:airline_section_z (percentage, line number, column number) |
|
315 |
+ let g:airline_section_error (ycm_error_count, syntastic-err, eclim) |
|
316 |
+ let g:airline_section_warning (ycm_warning_count, syntastic-warn, whitespace) |
|
317 |
+ |
|
318 |
+ " [*] This section needs at least the fugitive extension or else |
|
319 |
+ " it will remain empty |
|
320 |
+ " |
|
321 |
+ " here is an example of how you could replace the branch indicator with |
|
322 |
+ " the current working directory (limited to 10 characters), |
|
323 |
+ " followed by the filename. |
|
324 |
+ let g:airline_section_b = '%-0.10{getcwd()}' |
|
325 |
+ let g:airline_section_c = '%t' |
|
326 |
+< |
|
327 |
+============================================================================== |
|
328 |
+EXTENSIONS *airline-extensions* |
|
329 |
+ |
|
330 |
+Most extensions are enabled by default and lazily loaded when the |
|
331 |
+corresponding plugin (if any) is detected. |
|
332 |
+ |
|
333 |
+By default, airline will attempt to load any extension it can find in the |
|
334 |
+'runtimepath'. On some systems this can result in an undesirable startup |
|
335 |
+cost. You can disable the check with the following flag. > |
|
336 |
+ let g:airline#extensions#disable_rtp_load = 1 |
|
337 |
+< |
|
338 |
+ Note: Third party plugins that rely on this behavior will be affected. You |
|
339 |
+ will need to manually load them. |
|
340 |
+ |
|
341 |
+Alternatively, if you want a minimalistic setup and would rather opt-in which |
|
342 |
+extensions get loaded instead of disabling each individually, you can declare |
|
343 |
+the following list variable: > |
|
344 |
+ " an empty list disables all extensions |
|
345 |
+ let g:airline_extensions = [] |
|
346 |
+ |
|
347 |
+ " or only load what you want |
|
348 |
+ let g:airline_extensions = ['branch', 'tabline'] |
|
349 |
+< |
|
350 |
+------------------------------------- *airline-default* |
|
351 |
+The default extension understands all of the `g:` variables in the |
|
352 |
+|airline-configuration| section, however it also has some more fine-tuned |
|
353 |
+configuration values that you can use. |
|
354 |
+ |
|
355 |
+* control which sections get truncated and at what width. > |
|
356 |
+ let g:airline#extensions#default#section_truncate_width = { |
|
357 |
+ \ 'b': 79, |
|
358 |
+ \ 'x': 60, |
|
359 |
+ \ 'y': 88, |
|
360 |
+ \ 'z': 45, |
|
361 |
+ \ 'warning': 80, |
|
362 |
+ \ 'error': 80, |
|
363 |
+ \ } |
|
364 |
+ |
|
365 |
+ " Note: set to an empty dictionary to disable truncation. |
|
366 |
+ let g:airline#extensions#default#section_truncate_width = {} |
|
367 |
+< |
|
368 |
+* configure the layout of the sections by specifying an array of two arrays |
|
369 |
+ (first array is the left side, second array is the right side). > |
|
370 |
+ let g:airline#extensions#default#layout = [ |
|
371 |
+ \ [ 'a', 'b', 'c' ], |
|
372 |
+ \ [ 'x', 'y', 'z', 'error', 'warning' ] |
|
373 |
+ \ ] |
|
374 |
+< |
|
375 |
+* configure the layout to not use %(%) grouping items in the statusline. |
|
376 |
+ Try setting this to zero, if you notice bleeding color artifacts > |
|
377 |
+ let airline#extensions#default#section_use_groupitems = 1 |
|
378 |
+< |
|
379 |
+* configure the fileformat output |
|
380 |
+ By default, it will display something like 'utf-8[unix]', however, you can |
|
381 |
+ skip displaying it, if the output matches a configured string. To do so, |
|
382 |
+ set > |
|
383 |
+ let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]' |
|
384 |
+< |
|
385 |
+------------------------------------- *airline-quickfix* |
|
386 |
+The quickfix extension is a simple built-in extension which determines |
|
387 |
+whether the buffer is a quickfix or location list buffer, and adjusts the |
|
388 |
+title accordingly. |
|
389 |
+ |
|
390 |
+* configure the title text for quickfix buffers > |
|
391 |
+ let g:airline#extensions#quickfix#quickfix_text = 'Quickfix' |
|
392 |
+< |
|
393 |
+* configure the title text for location list buffers > |
|
394 |
+ let g:airline#extensions#quickfix#location_text = 'Location' |
|
395 |
+< |
|
396 |
+ |
|
397 |
+------------------------------------- *airline-bufferline* |
|
398 |
+vim-bufferline <https://github.com/bling/vim-bufferline> |
|
399 |
+ |
|
400 |
+* enable/disable bufferline integration > |
|
401 |
+ let g:airline#extensions#bufferline#enabled = 1 |
|
402 |
+< |
|
403 |
+* determine whether bufferline will overwrite customization variables > |
|
404 |
+ let g:airline#extensions#bufferline#overwrite_variables = 1 |
|
405 |
+< |
|
406 |
+------------------------------------- *airline-nerdtree* |
|
407 |
+NerdTree <https://github.com/scrooloose/nerdtree.git> |
|
408 |
+ |
|
409 |
+Airline displays the Nerdtree specific statusline (which can be configured using |
|
410 |
+the |'NerdTreeStatusline'|variable. |
|
411 |
+ |
|
412 |
+------------------------------------- *airline-fugitiveline* |
|
413 |
+This extension hides the fugitive://**// part of the buffer names, to only |
|
414 |
+show the file name as if it were in the current working tree. |
|
415 |
+It is deactivated by default if |airline-bufferline| is activated. |
|
416 |
+ |
|
417 |
+* enable/disable bufferline integration > |
|
418 |
+ let g:airline#extensions#fugitiveline#enabled = 1 |
|
419 |
+< |
|
420 |
+------------------------------------- *airline-branch* |
|
421 |
+ |
|
422 |
+vim-airline will display the branch-indicator together with the branch name in |
|
423 |
+the statusline, if one of the following plugins is installed: |
|
424 |
+ |
|
425 |
+fugitive.vim <https://github.com/tpope/vim-fugitive> |
|
426 |
+lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium> |
|
427 |
+vcscommand <http://www.vim.org/scripts/script.php?script_id=90> |
|
428 |
+ |
|
429 |
+If a file is edited, that is not yet in the repository, the |
|
430 |
+notexists symbol will be displayed after the branch name. |
|
431 |
+ |
|
432 |
+* enable/disable fugitive/lawrencium integration > |
|
433 |
+ let g:airline#extensions#branch#enabled = 1 |
|
434 |
+< |
|
435 |
+* change the text for when no branch is detected > |
|
436 |
+ let g:airline#extensions#branch#empty_message = '' |
|
437 |
+< |
|
438 |
+* define the order in which the branches of different vcs systems will be |
|
439 |
+ displayed on the statusline (currently only for fugitive and lawrencium) > |
|
440 |
+ let g:airline#extensions#branch#vcs_priority = ["git", "mercurial"] |
|
441 |
+< |
|
442 |
+* use vcscommand.vim if available > |
|
443 |
+ let g:airline#extensions#branch#use_vcscommand = 0 |
|
444 |
+< |
|
445 |
+* truncate long branch names to a fixed length > |
|
446 |
+ let g:airline#extensions#branch#displayed_head_limit = 10 |
|
447 |
+< |
|
448 |
+* customize formatting of branch name > |
|
449 |
+ " default value leaves the name unmodifed |
|
450 |
+ let g:airline#extensions#branch#format = 0 |
|
451 |
+ |
|
452 |
+ " to only show the tail, e.g. a branch 'feature/foo' becomes 'foo', use |
|
453 |
+ let g:airline#extensions#branch#format = 1 |
|
454 |
+ |
|
455 |
+ " to truncate all path sections but the last one, e.g. a branch |
|
456 |
+ " 'foo/bar/baz' becomes 'f/b/baz', use |
|
457 |
+ let g:airline#extensions#branch#format = 2 |
|
458 |
+ |
|
459 |
+ " if a string is provided, it should be the name of a function that |
|
460 |
+ " takes a string and returns the desired value |
|
461 |
+ let g:airline#extensions#branch#format = 'CustomBranchName' |
|
462 |
+ function! CustomBranchName(name) |
|
463 |
+ return '[' . a:name . ']' |
|
464 |
+ endfunction |
|
465 |
+< |
|
466 |
+* truncate sha1 commits at this number of characters > |
|
467 |
+ let g:airline#extensions#branch#sha1_len = 10 |
|
468 |
+ |
|
469 |
+* customize branch name retrieval for any version control system > |
|
470 |
+ let g:airline#extensions#branch#custom_head = 'GetScmBranch' |
|
471 |
+ function! GetScmBranch() |
|
472 |
+ if !exists('b:perforce_client') |
|
473 |
+ let b:perforce_client = system('p4 client -o | grep Client') |
|
474 |
+ " Invalidate cache to prevent stale data when switching clients. Use a |
|
475 |
+ " buffer-unique group name to prevent clearing autocmds for other |
|
476 |
+ " buffers. |
|
477 |
+ exec 'augroup perforce_client-'. bufnr("%") |
|
478 |
+ au! |
|
479 |
+ autocmd BufWinLeave <buffer> silent! unlet! b:perforce_client |
|
480 |
+ augroup END |
|
481 |
+ endif |
|
482 |
+ return b:perforce_client |
|
483 |
+ endfunction |
|
484 |
+ |
|
485 |
+< |
|
486 |
+------------------------------------- *airline-syntastic* |
|
487 |
+syntastic <https://github.com/vim-syntastic/syntastic> |
|
488 |
+ |
|
489 |
+* enable/disable syntastic integration > |
|
490 |
+ let g:airline#extensions#syntastic#enabled = 1 |
|
491 |
+ |
|
492 |
+ Note: The recommendation from syntastic to modify the statusline directly |
|
493 |
+ does not apply, if you use vim-airline, since it will take care for you of |
|
494 |
+ adjusting the statusline. |
|
495 |
+ |
|
496 |
+* syntastic error_symbol > |
|
497 |
+ let airline#extensions#syntastic#error_symbol = 'E:' |
|
498 |
+< |
|
499 |
+* syntastic statusline error format (see |syntastic_stl_format|) > |
|
500 |
+ let airline#extensions#syntastic#stl_format_err = '%E{[%e(#%fe)]}' |
|
501 |
+ |
|
502 |
+* syntastic warning > |
|
503 |
+ let airline#extensions#syntastic#warning_symbol = 'W:' |
|
504 |
+< |
|
505 |
+* syntastic statusline warning format (see |syntastic_stl_format|) > |
|
506 |
+ let airline#extensions#syntastic#stl_format_err = '%W{[%w(#%fw)]}' |
|
507 |
+< |
|
508 |
+------------------------------------- *airline-tagbar* |
|
509 |
+tagbar <https://github.com/majutsushi/tagbar> |
|
510 |
+ |
|
511 |
+* enable/disable tagbar integration > |
|
512 |
+ let g:airline#extensions#tagbar#enabled = 1 |
|
513 |
+< |
|
514 |
+* change how tags are displayed (:help tagbar-statusline) > |
|
515 |
+ let g:airline#extensions#tagbar#flags = '' (default) |
|
516 |
+ let g:airline#extensions#tagbar#flags = 'f' |
|
517 |
+ let g:airline#extensions#tagbar#flags = 's' |
|
518 |
+ let g:airline#extensions#tagbar#flags = 'p' |
|
519 |
+< |
|
520 |
+------------------------------------- *airline-csv* |
|
521 |
+csv.vim <https://github.com/chrisbra/csv.vim> |
|
522 |
+ |
|
523 |
+* enable/disable csv integration for displaying the current column. > |
|
524 |
+ let g:airline#extensions#csv#enabled = 1 |
|
525 |
+< |
|
526 |
+* change how columns are displayed. > |
|
527 |
+ let g:airline#extensions#csv#column_display = 'Number' (default) |
|
528 |
+ let g:airline#extensions#csv#column_display = 'Name' |
|
529 |
+< |
|
530 |
+------------------------------------- *airline-hunks* |
|
531 |
+vim-gitgutter <https://github.com/airblade/vim-gitgutter> |
|
532 |
+vim-signify <https://github.com/mhinz/vim-signify> |
|
533 |
+changesPlugin <https://github.com/chrisbra/changesPlugin> |
|
534 |
+quickfixsigns <https://github.com/tomtom/quickfixsigns_vim> |
|
535 |
+ |
|
536 |
+* enable/disable showing a summary of changed hunks under source control. > |
|
537 |
+ let g:airline#extensions#hunks#enabled = 1 |
|
538 |
+< |
|
539 |
+* enable/disable showing only non-zero hunks. > |
|
540 |
+ let g:airline#extensions#hunks#non_zero_only = 0 |
|
541 |
+< |
|
542 |
+* set hunk count symbols. > |
|
543 |
+ let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-'] |
|
544 |
+< |
|
545 |
+------------------------------------- *airline-vimagit* |
|
546 |
+vimagit <https://github.com/jreybert/vimagit> |
|
547 |
+ |
|
548 |
+* enable/disable vimagit integration > |
|
549 |
+ let g:airline#extensions#vimagit#enabled = 1 |
|
550 |
+< |
|
551 |
+------------------------------------- *airline-ctrlp* |
|
552 |
+ctrlp <https://github.com/ctrlpvim/ctrlp.vim> |
|
553 |
+ |
|
554 |
+* configure which mode colors should ctrlp window use (takes effect |
|
555 |
+ only if the active airline theme doesn't define ctrlp colors) > |
|
556 |
+ let g:airline#extensions#ctrlp#color_template = 'insert' (default) |
|
557 |
+ let g:airline#extensions#ctrlp#color_template = 'normal' |
|
558 |
+ let g:airline#extensions#ctrlp#color_template = 'visual' |
|
559 |
+ let g:airline#extensions#ctrlp#color_template = 'replace' |
|
560 |
+< |
|
561 |
+ |
|
562 |
+* configure whether to show the previous and next modes (mru, buffer, etc...) |
|
563 |
+> |
|
564 |
+ let g:airline#extensions#ctrlp#show_adjacent_modes = 1 |
|
565 |
+< |
|
566 |
+------------------------------------- *airline-virtualenv* |
|
567 |
+virtualenv <https://github.com/jmcantrell/vim-virtualenv> |
|
568 |
+ |
|
569 |
+* enable/disable virtualenv integration > |
|
570 |
+ let g:airline#extensions#virtualenv#enabled = 1 |
|
571 |
+< |
|
572 |
+------------------------------------- *airline-eclim* |
|
573 |
+eclim <https://eclim.org> |
|
574 |
+ |
|
575 |
+* enable/disable eclim integration, which works well with the |
|
576 |
+ |airline-syntastic| extension. > |
|
577 |
+ let g:airline#extensions#eclim#enabled = 1 |
|
578 |
+ |
|
579 |
+------------------------------------- *airline-wordcount* |
|
580 |
+* enable/disable word counting. > |
|
581 |
+ let g:airline#extensions#wordcount#enabled = 1 |
|
582 |
+< |
|
583 |
+* regex of filetypes to enable word counting. > |
|
584 |
+ " the default value matches filetypes typically used for documentation |
|
585 |
+ " such as markdown and help files. |
|
586 |
+ let g:airline#extensions#wordcount#filetypes = ... |
|
587 |
+ (default: markdown,rst,org,help,text,tex,mail) |
|
588 |
+ |
|
589 |
+* defines the name of a formatter for word count will be displayed: > |
|
590 |
+ " The default will try to guess LC_NUMERIC and format number accordingly |
|
591 |
+ " e.g. 1,042 in English and 1.042 in German locale |
|
592 |
+ let g:airline#extensions#wordcount#formatter = 'default' |
|
593 |
+ |
|
594 |
+ " here is how you can define a 'foo' formatter: |
|
595 |
+ " create a file in the dir autoload/airline/extensions/wordcount/formatters/ |
|
596 |
+ " called foo.vim |
|
597 |
+ " this example needs at least Vim > 7.4.1042 |
|
598 |
+ function! airline#extensions#wordcount#formatters#foo#format(format,fmt) |
|
599 |
+ return (wordcount()['words'] == 0 ? 'NONE' : |
|
600 |
+ \ wordcount()['words'] > 100 ? 'okay' : 'not enough') |
|
601 |
+ endfunction |
|
602 |
+ let g:airline#extensions#wordline#formatter = 'foo' |
|
603 |
+ |
|
604 |
+* defines how to display the wordcount statistics for the default formatter: > |
|
605 |
+ " Defaults are below. If fmt_short isn't defined, fmt is used. |
|
606 |
+ " '%s' will be substituted by the word count |
|
607 |
+ " fmt_short is displayed when window width is less than 80 |
|
608 |
+ let g:airline#extensions#wordcount#formatter#default#fmt = '%s words' |
|
609 |
+ let g:airline#extensions#wordcount#formatter#default#fmt_short = '%sW' |
|
610 |
+< |
|
611 |
+------------------------------------- *airline-whitespace* |
|
612 |
+* enable/disable detection of whitespace errors. > |
|
613 |
+ let g:airline#extensions#whitespace#enabled = 1 |
|
614 |
+< |
|
615 |
+* disable detection of whitespace errors. > |
|
616 |
+ " useful to call for particular file types (e.g., in "ftplugin/*") |
|
617 |
+ silent! call airline#extensions#whitespace#disable() |
|
618 |
+< |
|
619 |
+* customize the type of mixed indent checking to perform. > |
|
620 |
+ " must be all spaces or all tabs before the first non-whitespace character |
|
621 |
+ let g:airline#extensions#whitespace#mixed_indent_algo = 0 (default) |
|
622 |
+ |
|
623 |
+ " certain number of spaces are allowed after tabs, but not in between |
|
624 |
+ " this algorithm works well for /** */ style comments in a tab-indented file |
|
625 |
+ let g:airline#extensions#whitespace#mixed_indent_algo = 1 |
|
626 |
+ |
|
627 |
+ " spaces are allowed after tabs, but not in between |
|
628 |
+ " this algorithm works well with programming styles that use tabs for |
|
629 |
+ " indentation and spaces for alignment |
|
630 |
+ let g:airline#extensions#whitespace#mixed_indent_algo = 2 |
|
631 |
+< |
|
632 |
+* customize the whitespace symbol. > |
|
633 |
+ let g:airline#extensions#whitespace#symbol = '!' |
|
634 |
+< |
|
635 |
+* configure which whitespace checks to enable. > |
|
636 |
+ " indent: mixed indent within a line |
|
637 |
+ " long: overlong lines |
|
638 |
+ " trailing: trailing whitespace |
|
639 |
+ " mixed-indent-file: different indentation in different lines |
|
640 |
+ let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing', 'long', 'mixed-indent-file' ] |
|
641 |
+ |
|
642 |
+ " this can also be configured for an individual buffer |
|
643 |
+ let b:airline_whitespace_checks = [ 'indent', 'trailing', 'long', 'mixed-indent-file' ] |
|
644 |
+< |
|
645 |
+* configure the maximum number of lines where whitespace checking is enabled. > |
|
646 |
+ let g:airline#extensions#whitespace#max_lines = 20000 |
|
647 |
+< |
|
648 |
+* configure whether a message should be displayed. > |
|
649 |
+ let g:airline#extensions#whitespace#show_message = 1 |
|
650 |
+< |
|
651 |
+* configure the formatting of the warning messages. > |
|
652 |
+ let g:airline#extensions#whitespace#trailing_format = 'trailing[%s]' |
|
653 |
+ let g:airline#extensions#whitespace#mixed_indent_format = 'mixed-indent[%s]' |
|
654 |
+ let g:airline#extensions#whitespace#long_format = 'long[%s]' |
|
655 |
+ let g:airline#extensions#whitespace#mixed_indent_file_format = 'mix-indent-file[%s]' |
|
656 |
+ |
|
657 |
+* configure custom trailing whitespace regexp rule > |
|
658 |
+ let g:airline#extensions#whitespace#trailing_regexp = '\s$' |
|
659 |
+ |
|
660 |
+* configure, which filetypes have special treatment of /* */ comments, |
|
661 |
+ matters for mix-indent-file algorithm: > |
|
662 |
+ let airline#extensions#c_like_langs = ['c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php'] |
|
663 |
+< |
|
664 |
+* disable whitespace checking for an individual buffer > |
|
665 |
+ " Checking is enabled by default because b:airline_whitespace_disabled |
|
666 |
+ " is by default not defined: |
|
667 |
+ unlet b:airline_whitespace_disabled |
|
668 |
+ |
|
669 |
+ " If b:airline_whitespace_disabled is defined and is non-zero for a buffer, |
|
670 |
+ " then whitespace checking will be disabled for that buffer; for example: |
|
671 |
+ " let b:airline_whitespace_disabled = 1 |
|
672 |
+< |
|
673 |
+------------------------------------- *airline-tabline* |
|
674 |
+Note: If you're using the ctrlspace tabline only the option marked with (c) |
|
675 |
+are supported! |
|
676 |
+ |
|
677 |
+* enable/disable enhanced tabline. (c) > |
|
678 |
+ let g:airline#extensions#tabline#enabled = 0 |
|
679 |
+ |
|
680 |
+* enable/disable displaying open splits per tab (only when tabs are opened). > |
|
681 |
+ let g:airline#extensions#tabline#show_splits = 1 |
|
682 |
+ |
|
683 |
+* switch position of buffers and tabs on splited tabline (c) |
|
684 |
+ (only supported for ctrlspace plugin). > |
|
685 |
+ let g:airline#extensions#tabline#switch_buffers_and_tabs = 0 |
|
686 |
+< |
|
687 |
+* enable/disable displaying buffers with a single tab. (c) > |
|
688 |
+ let g:airline#extensions#tabline#show_buffers = 1 |
|
689 |
+ |
|
690 |
+Note: If you are using neovim (has('tablineat') = 1), then you can click |
|
691 |
+on the tabline with the left mouse button to switch to that buffer, and |
|
692 |
+with the middle mouse button to delete that buffer. |
|
693 |
+ |
|
694 |
+* if you want to show the current active buffer like this: |
|
695 |
+ ---------------------- |
|
696 |
+ buffer <buffer> buffer ` |
|
697 |
+> |
|
698 |
+ let g:airline#extensions#tabline#alt_sep = 1 |
|
699 |
+< Only makes sense, if g:airline_right_sep is not empty. |
|
700 |
+ default: 0 |
|
701 |
+ |
|
702 |
+* enable/disable displaying tabs, regardless of number. (c) > |
|
703 |
+ let g:airline#extensions#tabline#show_tabs = 1 |
|
704 |
+< |
|
705 |
+* configure filename match rules to exclude from the tabline. > |
|
706 |
+ let g:airline#extensions#tabline#excludes = [] |
|
707 |
+ |
|
708 |
+* enable/disable display preview window buffer in the tabline. > |
|
709 |
+ let g:airline#extensions#tabline#exclude_preview = 1 |
|
710 |
+ |
|
711 |
+* configure how numbers are displayed in tab mode. > |
|
712 |
+ let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default) |
|
713 |
+ let g:airline#extensions#tabline#tab_nr_type = 1 " tab number |
|
714 |
+ let g:airline#extensions#tabline#tab_nr_type = 2 " splits and tab number |
|
715 |
+ let g:airline#extensions#tabline#tabnr_formatter = 'tabnr' |
|
716 |
+ |
|
717 |
+ Note: last option can be used to specify a different formatter for |
|
718 |
+ displaying the numbers. By default tabline/formatter/tabnr.vim is used |
|
719 |
+< |
|
720 |
+* enable/disable displaying tab number in tabs mode. > |
|
721 |
+ let g:airline#extensions#tabline#show_tab_nr = 1 |
|
722 |
+ |
|
723 |
+* enable/disable displaying tab type (e.g. [buffers]/[tabs]) > |
|
724 |
+ let g:airline#extensions#tabline#show_tab_type = 1 |
|
725 |
+ |
|
726 |
+* show buffer label at first position: > |
|
727 |
+ let g:airline#extensions#tabline#buf_label_first = 1 |
|
728 |
+ |
|
729 |
+* rename label for buffers (default: 'buffers') (c) > |
|
730 |
+ let g:airline#extensions#tabline#buffers_label = 'b' |
|
731 |
+ |
|
732 |
+* rename label for tabs (default: 'tabs') (c) > |
|
733 |
+ let g:airline#extensions#tabline#tabs_label = 't' |
|
734 |
+ |
|
735 |
+* change the symbol for skipped tabs/buffers (default '...') > |
|
736 |
+ let g:airline#extensions#tabline#overflow_marker = '…' |
|
737 |
+ |
|
738 |
+* always show current tabpage/buffer first > |
|
739 |
+ let airline#extensions#tabline#current_first = 1 |
|
740 |
+< default: 0 |
|
741 |
+ |
|
742 |
+* enable/disable displaying index of the buffer. |
|
743 |
+ |
|
744 |
+ When enabled, numbers will be displayed in the tabline and mappings will be |
|
745 |
+ exposed to allow you to select a buffer directly. Up to 9 mappings will be |
|
746 |
+ exposed. > |
|
747 |
+ |
|
748 |
+ let g:airline#extensions#tabline#buffer_idx_mode = 1 |
|
749 |
+ nmap <leader>1 <Plug>AirlineSelectTab1 |
|
750 |
+ nmap <leader>2 <Plug>AirlineSelectTab2 |
|
751 |
+ nmap <leader>3 <Plug>AirlineSelectTab3 |
|
752 |
+ nmap <leader>4 <Plug>AirlineSelectTab4 |
|
753 |
+ nmap <leader>5 <Plug>AirlineSelectTab5 |
|
754 |
+ nmap <leader>6 <Plug>AirlineSelectTab6 |
|
755 |
+ nmap <leader>7 <Plug>AirlineSelectTab7 |
|
756 |
+ nmap <leader>8 <Plug>AirlineSelectTab8 |
|
757 |
+ nmap <leader>9 <Plug>AirlineSelectTab9 |
|
758 |
+ nmap <leader>- <Plug>AirlineSelectPrevTab |
|
759 |
+ nmap <leader>+ <Plug>AirlineSelectNextTab |
|
760 |
+< |
|
761 |
+ Note: Mappings will be ignored within "g:airline#extensions#tabline#keymap_ignored_filetypes". |
|
762 |
+ |
|
763 |
+ Note: In buffer_idx_mode these mappings won't change the |
|
764 |
+ current tab, but switch to the buffer visible in that tab. |
|
765 |
+ Use |gt| for switching tabs. |
|
766 |
+ In tabmode, those mappings will switch to the specified tab. |
|
767 |
+ |
|
768 |
+* define the set of filetypes which are ignored selectTab keymappings > |
|
769 |
+ let g:airline#extensions#tabline#keymap_ignored_filetypes = ['vimfiler', 'nerdtree'] |
|
770 |
+ |
|
771 |
+* change the display format of the buffer index > |
|
772 |
+ let g:airline#extensions#tabline#buffer_idx_format = { |
|
773 |
+ \ '0': '0 ', |
|
774 |
+ \ '1': '1 ', |
|
775 |
+ \ '2': '2 ', |
|
776 |
+ \ '3': '3 ', |
|
777 |
+ \ '4': '4 ', |
|
778 |
+ \ '5': '5 ', |
|
779 |
+ \ '6': '6 ', |
|
780 |
+ \ '7': '7 ', |
|
781 |
+ \ '8': '8 ', |
|
782 |
+ \ '9': '9 ' |
|
783 |
+ \} |
|
784 |
+< |
|
785 |
+ |
|
786 |
+* defines the name of a formatter for how buffer names are displayed. (c) > |
|
787 |
+ let g:airline#extensions#tabline#formatter = 'default' |
|
788 |
+ |
|
789 |
+ " here is how you can define a 'foo' formatter: |
|
790 |
+ " create a file in the dir autoload/airline/extensions/tabline/formatters/ |
|
791 |
+ " called foo.vim > |
|
792 |
+ function! airline#extensions#tabline#formatters#foo#format(bufnr, buffers) |
|
793 |
+ return fnamemodify(bufname(a:bufnr), ':t') |
|
794 |
+ endfunction |
|
795 |
+ let g:airline#extensions#tabline#formatter = 'foo' |
|
796 |
+< |
|
797 |
+ |
|
798 |
+ Note: the following variables are used by the 'default' formatter. |
|
799 |
+ When no disambiguation is needed, both 'unique_tail_improved' and |
|
800 |
+ 'unique_tail' delegate formatting to 'default', so these variables also |
|
801 |
+ control rendering of unique filenames when using these formatters. |
|
802 |
+ |
|
803 |
+ * configure whether buffer numbers should be shown. > |
|
804 |
+ let g:airline#extensions#tabline#buffer_nr_show = 0 |
|
805 |
+< |
|
806 |
+ * configure how buffer numbers should be formatted with |printf()|. > |
|
807 |
+ let g:airline#extensions#tabline#buffer_nr_format = '%s: ' |
|
808 |
+< |
|
809 |
+ * configure the formatting of filenames (see |filename-modifiers|). > |
|
810 |
+ let g:airline#extensions#tabline#fnamemod = ':p:.' |
|
811 |
+< |
|
812 |
+ * configure collapsing parent directories in buffer name. > |
|
813 |
+ let g:airline#extensions#tabline#fnamecollapse = 1 |
|
814 |
+< |
|
815 |
+ * configure truncating non-active buffer names to specified length. > |
|
816 |
+ let g:airline#extensions#tabline#fnametruncate = 0 |
|
817 |
+ |
|
818 |
+ " The `unique_tail` algorithm will display the tail of the filename, unless |
|
819 |
+ " there is another file of the same name, in which it will display it along |
|
820 |
+ " with the containing parent directory. |
|
821 |
+ let g:airline#extensions#tabline#formatter = 'unique_tail' |
|
822 |
+ |
|
823 |
+ " The following variables are also used by `unique_tail` formatter. |
|
824 |
+ " the meanings are the same as the ones in default formatter. |
|
825 |
+ |
|
826 |
+ let g:airline#extensions#tabline#fnamemod = ':p:.' |
|
827 |
+ let g:airline#extensions#tabline#fnamecollapse = 1 |
|
828 |
+ |
|
829 |
+ " The `unique_tail_improved` - another algorithm, that will smartly uniquify |
|
830 |
+ " buffers names with similar filename, suppressing common parts of paths. |
|
831 |
+ let g:airline#extensions#tabline#formatter = 'unique_tail_improved' |
|
832 |
+< |
|
833 |
+* configure the minimum number of buffers needed to show the tabline. > |
|
834 |
+ let g:airline#extensions#tabline#buffer_min_count = 0 |
|
835 |
+< |
|
836 |
+ Note: this setting only applies to a single tab and when `show_buffers` is |
|
837 |
+ true. |
|
838 |
+ |
|
839 |
+* configure the minimum number of tabs needed to show the tabline. > |
|
840 |
+ let g:airline#extensions#tabline#tab_min_count = 0 |
|
841 |
+< |
|
842 |
+ Note: this setting only applies when `show_buffers` is false. |
|
843 |
+ |
|
844 |
+* configure separators for the tabline only. > |
|
845 |
+ let g:airline#extensions#tabline#left_sep = '' |
|
846 |
+ let g:airline#extensions#tabline#left_alt_sep = '' |
|
847 |
+ let g:airline#extensions#tabline#right_sep = '' |
|
848 |
+ let g:airline#extensions#tabline#right_alt_sep = '' |
|
849 |
+ |
|
850 |
+* configure whether close button should be shown: > |
|
851 |
+ let g:airline#extensions#tabline#show_close_button = 1 |
|
852 |
+ |
|
853 |
+* configure symbol used to represent close button > |
|
854 |
+ let g:airline#extensions#tabline#close_symbol = 'X' |
|
855 |
+ |
|
856 |
+* configure pattern to be ignored on BufAdd autocommand > |
|
857 |
+ " fixes unnecessary redraw, when e.g. opening Gundo window |
|
858 |
+ let airline#extensions#tabline#ignore_bufadd_pat = |
|
859 |
+ \ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree' |
|
860 |
+ |
|
861 |
+Note: Enabling this extension will modify 'showtabline' and 'guioptions'. |
|
862 |
+ |
|
863 |
+* enable Refresh of tabline buffers on |BufAdd| autocommands |
|
864 |
+ (set this to one, if you note 'AirlineTablineRefresh', however, this |
|
865 |
+ won't update airline on |:badd| commands) > |
|
866 |
+ let airline#extensions#tabline#disable_refresh = 0 |
|
867 |
+ |
|
868 |
+* preserve windows when closing a buffer from the bufferline (default: 0) > |
|
869 |
+ let airline#extensions#tabline#middle_click_preserves_windows = 1 |
|
870 |
+< |
|
871 |
+------------------------------------- *airline-xtabline* |
|
872 |
+xtabline <https://github.com/mg979/vim-xtabline> |
|
873 |
+ |
|
874 |
+This is a simplified and stand-alone version of the original extension. |
|
875 |
+The bigger version adds fzf commands, session management, tab bookmarks, and |
|
876 |
+features that you may not need. They both require |vim-airline| anyway. |
|
877 |
+ |
|
878 |
+Main features and default mappings of this extension are: |
|
879 |
+ |
|
880 |
+* tab cwd persistance, also across sessions if vim-obsession is being used. |
|
881 |
+ |
|
882 |
+* buffer filtering in the tabline: only buffers whose path is within the tab |
|
883 |
+ cwd will be shown in the tabline. |
|
884 |
+ |
|
885 |
+* toggle tabs/buffer view on the tabline, toggle buffer filtering: |
|
886 |
+> |
|
887 |
+ nmap <F5> <Plug>XTablineToggleTabs |
|
888 |
+ nmap <leader><F5> <Plug>XTablineToggleFiltering |
|
889 |
+ |
|
890 |
+* reopen last closed tab, restoring its cwd and buffers: |
|
891 |
+> |
|
892 |
+ nmap <leader>tr <Plug>XTablineReopen <SID>ReopenLastTab |
|
893 |
+ |
|
894 |
+* switch among filtered buffers (accepts count): |
|
895 |
+> |
|
896 |
+ nmap ]l <Plug>XTablineNextBuffer |
|
897 |
+ nmap [l <Plug>XTablinePrevBuffer |
|
898 |
+ |
|
899 |
+* go to N buffer (a count must be provided): |
|
900 |
+> |
|
901 |
+ nmap <BS> <Plug>XTablineSelectBuffer |
|
902 |
+ |
|
903 |
+* alternative command if count is not provided: |
|
904 |
+> |
|
905 |
+ let g:xtabline_alt_action = "buffer #" |
|
906 |
+ |
|
907 |
+----------------------------------------------------------------------------- |
|
908 |
+ |
|
909 |
+You may also set these options: |
|
910 |
+ |
|
911 |
+* exclude fugitive logs and files that share part of the real buffer path: |
|
912 |
+> |
|
913 |
+ let g:xtabline_include_previews = 0 (default 1) |
|
914 |
+ |
|
915 |
+* activate fast cwd selection mappings: |
|
916 |
+> |
|
917 |
+ let g:xtabline_cd_commands = 1 (default 0) |
|
918 |
+ |
|
919 |
+* default mappings for them are: |
|
920 |
+> |
|
921 |
+ map <leader>cdc <Plug>XTablineCdCurrent |
|
922 |
+ map <leader>cdd <Plug>XTablineCdDown1 |
|
923 |
+ map <leader>cd2 <Plug>XTablineCdDown2 |
|
924 |
+ map <leader>cd3 <Plug>XTablineCdDown3 |
|
925 |
+ map <leader>cdh <Plug>XTablineCdHome |
|
926 |
+ |
|
927 |
+Note: if you don't use these mappings and change the cwd, the tabline won't |
|
928 |
+be updated automatically. Either re-enter the tab or press <F5> two times. |
|
929 |
+ |
|
930 |
+* here are some easier mappings to change tab buffer: |
|
931 |
+> |
|
932 |
+ nnoremap <silent> <expr> <Right> v:count? |
|
933 |
+ \ airline#extensions#tabline#xtabline#next_buffer(v:count) : "\<Right>" |
|
934 |
+ nnoremap <silent> <expr> <Left> v:count? |
|
935 |
+ \ airline#extensions#tabline#xtabline#prev_buffer(v:count) : "\<Left>" |
|
936 |
+ |
|
937 |
+------------------------------------- *airline-tmuxline* |
|
938 |
+tmuxline <https://github.com/edkolev/tmuxline.vim> |
|
939 |
+ |
|
940 |
+* enable/disable tmuxline integration > |
|
941 |
+ let g:airline#extensions#tmuxline#enabled = 0 |
|
942 |
+< |
|
943 |
+* configure which mode colors should be used in tmux statusline > |
|
944 |
+ let airline#extensions#tmuxline#color_template = 'normal' (default) |
|
945 |
+ let airline#extensions#tmuxline#color_template = 'insert' |
|
946 |
+ let airline#extensions#tmuxline#color_template = 'visual' |
|
947 |
+ let airline#extensions#tmuxline#color_template = 'replace' |
|
948 |
+< |
|
949 |
+* if specified, setting this option will trigger writing to the file whenever the |
|
950 |
+ airline theme is applied, i.e. when :AirlineTheme is executed and on vim |
|
951 |
+ startup > |
|
952 |
+ airline#extensions#tmuxline#snapshot_file = "~/.tmux-statusline-colors.conf" |
|
953 |
+< |
|
954 |
+------------------------------------- *airline-promptline* |
|
955 |
+promptline <https://github.com/edkolev/promptline.vim> |
|
956 |
+ |
|
957 |
+* configure the path to the snapshot .sh file. Mandatory option. The created |
|
958 |
+ file should be sourced by the shell on login > |
|
959 |
+ " in .vimrc |
|
960 |
+ airline#extensions#promptline#snapshot_file = "~/.shell_prompt.sh" |
|
961 |
+ |
|
962 |
+ " in .bashrc/.zshrc |
|
963 |
+ [ -f ~/.shell_prompt.sh ] && source ~/.shell_prompt.sh |
|
964 |
+< |
|
965 |
+* enable/disable promptline integration > |
|
966 |
+ let g:airline#extensions#promptline#enabled = 0 |
|
967 |
+< |
|
968 |
+* configure which mode colors should be used in prompt > |
|
969 |
+ let airline#extensions#promptline#color_template = 'normal' (default) |
|
970 |
+ let airline#extensions#promptline#color_template = 'insert' |
|
971 |
+ let airline#extensions#promptline#color_template = 'visual' |
|
972 |
+ let airline#extensions#promptline#color_template = 'replace' |
|
973 |
+< |
|
974 |
+------------------------------------- *airline-nrrwrgn* |
|
975 |
+NrrwRgn <https://github.com/chrisbra/NrrwRgn> |
|
976 |
+ |
|
977 |
+* enable/disable NrrwRgn integration > |
|
978 |
+ let g:airline#extensions#nrrwrgn#enabled = 1 |
|
979 |
+ |
|
980 |
+------------------------------------- *airline-gutentags* |
|
981 |
+vim-gutentags <https://github.com/ludovicchabant/vim-gutentags> |
|
982 |
+ |
|
983 |
+* enable/disable vim-gutentags integration > |
|
984 |
+ let g:airline#extensions#gutentags#enabled = 1 |
|
985 |
+ |
|
986 |
+------------------------------------- *airline-capslock* |
|
987 |
+vim-capslock <https://github.com/tpope/vim-capslock> |
|
988 |
+ |
|
989 |
+* enable/disable vim-capslock integration > |
|
990 |
+ let g:airline#extensions#capslock#enabled = 1 |
|
991 |
+ |
|
992 |
+------------------------------------- *airline-xkblayout* |
|
993 |
+vim-xkblayout |
|
994 |
+ |
|
995 |
+* enable/disable vim-xkblayout extension > |
|
996 |
+ let g:airline#extensions#xkblayout#enabled = 1 |
|
997 |
+ |
|
998 |
+* define path to the backend switcher library |
|
999 |
+ Linux (Install https://github.com/ierton/xkb-switch): > |
|
1000 |
+ let g:XkbSwitchLib = '/usr/local/lib/libxkbswitch.so' |
|
1001 |
+< |
|
1002 |
+ macOS (Install https://github.com/vovkasm/input-source-switcher): > |
|
1003 |
+ let g:XkbSwitchLib = '/usr/local/lib/libInputSourceSwitcher.dylib' |
|
1004 |
+ |
|
1005 |
+------------------------------------- *airline-keymap* |
|
1006 |
+vim-keymap |
|
1007 |
+ |
|
1008 |
+* enable/disable vim-keymap extension > |
|
1009 |
+ let g:airline#extensions#keymap#enabled = 1 |
|
1010 |
+ |
|
1011 |
+------------------------------------- *airline-windowswap* |
|
1012 |
+vim-windowswap <https://github.com/wesQ3/vim-windowswap> |
|
1013 |
+ |
|
1014 |
+* enable/disable vim-windowswap integration > |
|
1015 |
+ let g:airline#extensions#windowswap#enabled = 1 |
|
1016 |
+ |
|
1017 |
+* set marked window indicator string > |
|
1018 |
+ let g:airline#extensions#windowswap#indicator_text = 'WS' |
|
1019 |
+< |
|
1020 |
+------------------------------------- *airline-obsession* |
|
1021 |
+vim-obsession <https://github.com/tpope/vim-obsession> |
|
1022 |
+ |
|
1023 |
+* enable/disable vim-obsession integration > |
|
1024 |
+ let g:airline#extensions#obsession#enabled = 1 |
|
1025 |
+ |
|
1026 |
+* set marked window indicator string > |
|
1027 |
+ let g:airline#extensions#obsession#indicator_text = '$' |
|
1028 |
+< |
|
1029 |
+------------------------------------- *airline-taboo* |
|
1030 |
+taboo.vim <https://github.com/gcmt/taboo.vim> |
|
1031 |
+ |
|
1032 |
+* enable/disable taboo.vim integration > |
|
1033 |
+ let g:airline#extensions#taboo#enabled = 1 |
|
1034 |
+< |
|
1035 |
+------------------------------------- *airline-ctrlspace* |
|
1036 |
+vim-ctrlspace <https://github.com/szw/vim-ctrlspace> |
|
1037 |
+ |
|
1038 |
+* enable/disable vim-ctrlspace integration > |
|
1039 |
+ let g:airline#extensions#ctrlspace#enabled = 1 |
|
1040 |
+< |
|
1041 |
+ To make the vim-ctrlspace integration work you will need to make the |
|
1042 |
+ ctrlspace statusline function call the correct airline function. Therefore |
|
1043 |
+ add the following line into your .vimrc: > |
|
1044 |
+ |
|
1045 |
+ let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()" |
|
1046 |
+< |
|
1047 |
+------------------------------------- *airline-ycm* |
|
1048 |
+YouCompleteMe <https://github.com/Valloric/YouCompleteMe> |
|
1049 |
+ |
|
1050 |
+Shows number of errors and warnings in the current file detected by YCM. |
|
1051 |
+ |
|
1052 |
+* enable/disable YCM integration > |
|
1053 |
+ let g:airline#extensions#ycm#enabled = 1 |
|
1054 |
+ |
|
1055 |
+* set error count prefix > |
|
1056 |
+ let g:airline#extensions#ycm#error_symbol = 'E:' |
|
1057 |
+ |
|
1058 |
+* set warning count prefix > |
|
1059 |
+ let g:airline#extensions#ycm#warning_symbol = 'W:' |
|
1060 |
+< |
|
1061 |
+------------------------------------- *airline-po* |
|
1062 |
+po.vim <http://www.vim.org/scripts/script.php?script_id=2530> |
|
1063 |
+ |
|
1064 |
+* enable/disable po integration > |
|
1065 |
+ let g:airline#extensions#po#enabled = 1 |
|
1066 |
+< |
|
1067 |
+* truncate width names to a fixed length > |
|
1068 |
+ let g:airline#extensions#po#displayed_limit = 0 |
|
1069 |
+ |
|
1070 |
+------------------------------------- *airline-vimtex* |
|
1071 |
+vimtex <https://github.com/lervag/vimtex> |
|
1072 |
+ |
|
1073 |
+Shows the current file's vimtex related info. |
|
1074 |
+ |
|
1075 |
+* enable/disable vimtex integration > |
|
1076 |
+ let g:airline#extensions#vimtex#enabled = 1 |
|
1077 |
+< |
|
1078 |
+* left and right delimiters (shown only when status string is not empty) > |
|
1079 |
+ let g:airline#extensions#vimtex#left = "{" |
|
1080 |
+ let g:airline#extensions#vimtex#right = "}" |
|
1081 |
+ |
|
1082 |
+State indicators: |
|
1083 |
+ |
|
1084 |
+* the current tex file is the main project file (nothing is shown by default) > |
|
1085 |
+ let g:airline#extensions#vimtex#main = "" |
|
1086 |
+ |
|
1087 |
+* the current tex file is a subfile of the project |
|
1088 |
+ and the compilation is set for the main file > |
|
1089 |
+ let g:airline#extensions#vimtex#sub_main = "m" |
|
1090 |
+ |
|
1091 |
+* the current tex file is a subfile of the project |
|
1092 |
+ and the compilation is set for this subfile > |
|
1093 |
+ let g:airline#extensions#vimtex#sub_local = "l" |
|
1094 |
+ |
|
1095 |
+* single compilation is running > |
|
1096 |
+ let g:airline#extensions#vimtex#compiled = "c₁" |
|
1097 |
+ |
|
1098 |
+* continuous compilation is running > |
|
1099 |
+ let g:airline#extensions#vimtex#continuous = "c" |
|
1100 |
+ |
|
1101 |
+* viewer is opened > |
|
1102 |
+ let g:airline#extensions#vimtex#viewer = "v" |
|
1103 |
+ |
|
1104 |
+------------------------------------- *airline-ale* |
|
1105 |
+ale <https://github.com/w0rp/ale> |
|
1106 |
+ |
|
1107 |
+* enable/disable ale integration > |
|
1108 |
+ let g:airline#extensions#ale#enabled = 1 |
|
1109 |
+ |
|
1110 |
+* ale error_symbol > |
|
1111 |
+ let airline#extensions#ale#error_symbol = 'E:' |
|
1112 |
+< |
|
1113 |
+* ale warning > |
|
1114 |
+ let airline#extensions#ale#warning_symbol = 'W:' |
|
1115 |
+ |
|
1116 |
+* ale show_line_numbers > |
|
1117 |
+ let airline#extensions#ale#show_line_numbers = 1 |
|
1118 |
+< |
|
1119 |
+* ale open_lnum_symbol > |
|
1120 |
+ let airline#extensions#ale#open_lnum_symbol = '(L' |
|
1121 |
+< |
|
1122 |
+* ale close_lnum_symbol > |
|
1123 |
+ let airline#extensions#ale#close_lnum_symbol = ')' |
|
1124 |
+< |
|
1125 |
+------------------------------------- *airline-neomake* |
|
1126 |
+neomake <https://github.com/neomake/neomake> |
|
1127 |
+ |
|
1128 |
+* enable/disable neomake integration > |
|
1129 |
+ let g:airline#extensions#neomake#enabled = 1 |
|
1130 |
+ |
|
1131 |
+* neomake error_symbol > |
|
1132 |
+ let airline#extensions#neomake#error_symbol = 'E:' |
|
1133 |
+< |
|
1134 |
+* neomake warning > |
|
1135 |
+ let airline#extensions#neomake#warning_symbol = 'W:' |
|
1136 |
+< |
|
1137 |
+------------------------------------- *airline-localsearch* |
|
1138 |
+localsearch <https://github.com/mox-mox/localsearch> |
|
1139 |
+ |
|
1140 |
+* enable/disable localsearch indicator integration > |
|
1141 |
+ let g:airline#extensions#localsearch#enabled = 1 |
|
1142 |
+ |
|
1143 |
+------------------------------------- *airline-cursormode* |
|
1144 |
+cursormode <https://github.com/vheon/vim-cursormode> |
|
1145 |
+ |
|
1146 |
+Built-in extension to displays cursor in different colors depending on the |
|
1147 |
+current mode (only works in terminals iTerm, AppleTerm and xterm) |
|
1148 |
+ |
|
1149 |
+* enable cursormode integration > |
|
1150 |
+ let g:airline#extensions#cursormode#enabled = 1 |
|
1151 |
+ |
|
1152 |
+* mode function. Return value is used as key for the color mapping. Default is |
|
1153 |
+ |mode()| |
|
1154 |
+ `let g:cursormode_mode_func = 'mode'` |
|
1155 |
+ |
|
1156 |
+* color mapping. Keys come from `g:cursormode_mode_func` (background value can |
|
1157 |
+ be appended) |
|
1158 |
+ `let g:cursormode_color_map = {` |
|
1159 |
+ `\ "nlight": '#000000',` |
|
1160 |
+ `\ "ndark": '#BBBBBB',` |
|
1161 |
+ `\ "i": g:airline#themes#{g:airline_theme}#palette.insert.airline_a[1],` |
|
1162 |
+ `\ "R": g:airline#themes#{g:airline_theme}#palette.replace.airline_a[1],` |
|
1163 |
+ `\ "v": g:airline#themes#{g:airline_theme}#palette.visual.airline_a[1],` |
|
1164 |
+ `\ "V": g:airline#themes#{g:airline_theme}#palette.visual.airline_a[1],` |
|
1165 |
+ `\ "\<C-V>": g:airline#themes#{g:airline_theme}#palette.visual.airline_a[1],` |
|
1166 |
+ `\ }` |
|
1167 |
+ |
|
1168 |
+============================================================================== |
|
1169 |
+ADVANCED CUSTOMIZATION *airline-advanced-customization* |
|
1170 |
+ |
|
1171 |
+The defaults will accommodate the mass majority of users with minimal |
|
1172 |
+configuration. However, if you want to reposition sections or contents you can |
|
1173 |
+do so with built-in helper functions, which makes it possible to create |
|
1174 |
+sections in a more declarative style. |
|
1175 |
+ |
|
1176 |
+------------------------------------- *airline-parts* |
|
1177 |
+A part is something that contains metadata that eventually gets rendered into |
|
1178 |
+the statusline. You can define parts that contain constant strings or |
|
1179 |
+functions. Defining parts is needed if you want to use features like automatic |
|
1180 |
+insertion of separators or hiding based on window width. |
|
1181 |
+ |
|
1182 |
+For example, this is how you would define a part function: > |
|
1183 |
+ call airline#parts#define_function('foo', 'GetFooText') |
|
1184 |
+< |
|
1185 |
+Here is how you would define a part that is visible only if the window width |
|
1186 |
+greater than a minimum width. > |
|
1187 |
+ call airline#parts#define_minwidth('foo', 50) |
|
1188 |
+< |
|
1189 |
+Parts can be configured to be visible conditionally. > |
|
1190 |
+ call airline#parts#define_condition('foo', 'getcwd() =~ "work_dir"') |
|
1191 |
+< |
|
1192 |
+ |
|
1193 |
+Now add part "foo" to section section airline_section_y: > |
|
1194 |
+ let g:airline_section_y = airline#section#create_right(['ffenc','foo']) |
|
1195 |
+< |
|
1196 |
+Note: Part definitions are combinative; e.g. the two examples above modify the |
|
1197 |
+same `foo` part. |
|
1198 |
+ |
|
1199 |
+Note: Look at the source code and tests for the full API. |
|
1200 |
+ |
|
1201 |
+------------------------------------- *airline-predefined-parts* |
|
1202 |
+Before is a list of parts that are predefined by vim-airline. |
|
1203 |
+ |
|
1204 |
+* `mode` displays the current mode |
|
1205 |
+* `iminsert` displays the current insert method |
|
1206 |
+* `paste` displays the paste indicator |
|
1207 |
+* `crypt` displays the crypted indicator |
|
1208 |
+* `spell` displays the spell indicator |
|
1209 |
+* `filetype` displays the file type |
|
1210 |
+* `readonly` displays the read only indicator |
|
1211 |
+* `file` displays the filename and modified indicator |
|
1212 |
+* `path` displays the filename (absolute path) and modifier indicator |
|
1213 |
+* `linenr` displays the current line number |
|
1214 |
+* `maxlinenr` displays the number of lines in the buffer |
|
1215 |
+* `ffenc` displays the file format and encoding |
|
1216 |
+ |
|
1217 |
+And the following are defined for their respective extensions: |
|
1218 |
+ |
|
1219 |
+`ale_error_count` `ale_warning_count` `branch` `eclim` `hunks` |
|
1220 |
+`neomake_error_count` `neomake_warning_count` `obsession` |
|
1221 |
+`syntastic-warn` `syntastic-err` `tagbar` `whitespace` |
|
1222 |
+`windowswap` `ycm_error_count` `ycm_warning_count` |
|
1223 |
+ |
|
1224 |
+------------------------------------- *airline-accents* |
|
1225 |
+Accents can be defined on any part, like so: > |
|
1226 |
+ call airline#parts#define_accent('foo', 'red') |
|
1227 |
+< |
|
1228 |
+This will override the colors of that part by using what is defined in that |
|
1229 |
+particular accent. In the above example, the `red` accent is used, which means |
|
1230 |
+regardless of which section the part is used in, it will have red foreground |
|
1231 |
+colors instead of the section's default foreground color. |
|
1232 |
+ |
|
1233 |
+The following accents are defined by default. Themes can define their variants |
|
1234 |
+of the colors, but defaults will be provided if missing. > |
|
1235 |
+ bold, italic, red, green, blue, yellow, orange, purple, none |
|
1236 |
+< |
|
1237 |
+The defaults configure the mode and line number parts to be bold, and the |
|
1238 |
+readonly part to be red. |
|
1239 |
+ |
|
1240 |
+"none" is special. This can be used, to remove a bold accent from an existing |
|
1241 |
+theme. For example, usually the mode part of the statusline is usually defined |
|
1242 |
+to be bold. However, it can be hard to remove an existing bold accent from the |
|
1243 |
+default configuration. Therefore, you can use the none accent to remove |
|
1244 |
+existing accents, so if you put > |
|
1245 |
+ call airline#parts#define_accent('mode', 'none') |
|
1246 |
+the mode section will be set to non-bold font style. |
|
1247 |
+ |
|
1248 |
+------------------------------------- *airline-sections* |
|
1249 |
+Once a part is defined, you can use helper functions to generate the |
|
1250 |
+statuslines for each section. For example, to use the part above, we could |
|
1251 |
+define a section like this: > |
|
1252 |
+ function! AirlineInit() |
|
1253 |
+ let g:airline_section_a = airline#section#create(['mode', ' ', 'foo']) |
|
1254 |
+ let g:airline_section_b = airline#section#create_left(['ffenc','file']) |
|
1255 |
+ let g:airline_section_c = airline#section#create(['%{getcwd()}']) |
|
1256 |
+ endfunction |
|
1257 |
+ autocmd User AirlineAfterInit call AirlineInit() |
|
1258 |
+< |
|
1259 |
+This will create a section with the `mode`, followed by a space, and our `foo` |
|
1260 |
+part in section `a`. Section `b` will have two parts with a left-side |
|
1261 |
+separator. And section `c` will contain the current path. You may notice that |
|
1262 |
+the space and cwd are not defined parts. For convenience, if a part of that |
|
1263 |
+key does not exist, it will be inserted as is. The unit tests will be a good |
|
1264 |
+resource for possibilities. |
|
1265 |
+ |
|
1266 |
+Note: The use of |User| is important, because most extensions are lazily |
|
1267 |
+loaded, so we must give them a chance to define their parts before we can use |
|
1268 |
+them. Also this autocommand is only triggered, after the airline functions are |
|
1269 |
+actually available on startup. |
|
1270 |
+ |
|
1271 |
+Note: The `airline#section#create` function and friends will do its best to |
|
1272 |
+create a section with the appropriate separators, but it only works for |
|
1273 |
+function and text parts. Special 'statusline' items like %f or raw/undefined |
|
1274 |
+parts will not work as it is not possible to inspect their widths/contents |
|
1275 |
+before rendering to the statusline. |
|
1276 |
+ |
|
1277 |
+============================================================================== |
|
1278 |
+FUNCREFS *airline-funcrefs* |
|
1279 |
+ |
|
1280 |
+vim-airline internally uses funcrefs to integrate with third party plugins, |
|
1281 |
+and you can tap into this functionality to extend it for you needs. This is |
|
1282 |
+the most powerful way to customize the statusline, and sometimes it may be |
|
1283 |
+easier to go this route than the above methods. |
|
1284 |
+ |
|
1285 |
+Every section can have two values. The default value is the global `g:` |
|
1286 |
+variable which is used in the absence of a `w:` value. This makes it very easy |
|
1287 |
+to override only certain parts of the statusline by only defining window-local |
|
1288 |
+variables for a subset of all sections. |
|
1289 |
+ |
|
1290 |
+------------------------------------- *add_statusline_func* |
|
1291 |
+The following is an example of how you can extend vim-airline to support a |
|
1292 |
+new plugin. > |
|
1293 |
+ function! MyPlugin(...) |
|
1294 |
+ if &filetype == 'MyPluginFileType' |
|
1295 |
+ let w:airline_section_a = 'MyPlugin' |
|
1296 |
+ let w:airline_section_b = '%f' |
|
1297 |
+ let w:airline_section_c = '%{MyPlugin#function()}' |
|
1298 |
+ let g:airline_variable_referenced_in_statusline = 'foo' |
|
1299 |
+ endif |
|
1300 |
+ endfunction |
|
1301 |
+ call airline#add_statusline_func('MyPlugin') |
|
1302 |
+< |
|
1303 |
+Notice that only the left side of the statusline is overwritten. This means |
|
1304 |
+the right side (the line/column numbers, etc) will be intact. |
|
1305 |
+ |
|
1306 |
+------------------------------------- *remove_statusline_func* |
|
1307 |
+You can also remove a function as well, which is useful for when you want a |
|
1308 |
+temporary override. > |
|
1309 |
+ call airline#remove_statusline_func('MyPlugin') |
|
1310 |
+< |
|
1311 |
+============================================================================== |
|
1312 |
+PIPELINE *airline-pipeline* |
|
1313 |
+ |
|
1314 |
+Sometimes you want to do more than just use overrides. The statusline funcref |
|
1315 |
+is invoked and passed two arguments. The first of these arguments is the |
|
1316 |
+statusline builder. You can use this to build completely custom statuslines |
|
1317 |
+to your liking. Here is an example: > |
|
1318 |
+> |
|
1319 |
+ function! MyPlugin(...) |
|
1320 |
+ " first variable is the statusline builder |
|
1321 |
+ let builder = a:1 |
|
1322 |
+ |
|
1323 |
+ " WARNING: the API for the builder is not finalized and may change |
|
1324 |
+ call builder.add_section('Normal', '%f') |
|
1325 |
+ call builder.add_section('WarningMsg', '%{getcwd()}') |
|
1326 |
+ call builder.split() |
|
1327 |
+ call builder.add_section('airline_z', '%p%%') |
|
1328 |
+ |
|
1329 |
+ " tell the core to use the contents of the builder |
|
1330 |
+ return 1 |
|
1331 |
+ endfunction |
|
1332 |
+< |
|
1333 |
+The above example uses various example highlight groups to demonstrate |
|
1334 |
+that you can use any combination from the loaded colorscheme. However, if |
|
1335 |
+you want colors to change between modes, you should use one of the section |
|
1336 |
+highlight groups, e.g. `airline_a` and `airline_b`. |
|
1337 |
+ |
|
1338 |
+The second variable is the context, which is a dictionary containing various |
|
1339 |
+values such as whether the statusline is active or not, and the window number. |
|
1340 |
+> |
|
1341 |
+ context = { |
|
1342 |
+ 'winnr': 'the window number for the statusline', |
|
1343 |
+ 'active': 'whether the window is active or not', |
|
1344 |
+ 'bufnr': 'the current buffer for this window', |
|
1345 |
+ } |
|
1346 |
+< |
|
1347 |
+------------------------------------- *airline-pipeline-return-codes* |
|
1348 |
+The pipeline accepts various return codes and can be used to determine the |
|
1349 |
+next action. The following are the supported codes: > |
|
1350 |
+ 0 the default, continue on with the next funcref |
|
1351 |
+ -1 do not modify the statusline |
|
1352 |
+ 1 modify the statusline with the current contents of the builder |
|
1353 |
+< |
|
1354 |
+Note: Any value other than 0 will halt the pipeline and prevent the next |
|
1355 |
+funcref from executing. |
|
1356 |
+ |
|
1357 |
+============================================================================== |
|
1358 |
+WRITING EXTENSIONS *airline-writing-extensions* |
|
1359 |
+ |
|
1360 |
+For contributions into the plugin, here are the following guidelines: |
|
1361 |
+ |
|
1362 |
+1. For simple 'filetype' checks, they can be added directly into the |
|
1363 |
+`extensions.vim` file. |
|
1364 |
+ |
|
1365 |
+2. Pretty much everything else should live as a separate file under the |
|
1366 |
+`extensions/` directory. |
|
1367 |
+ |
|
1368 |
+ a. Inside `extensions.vim`, add a check for some variable or command that |
|
1369 |
+ is always available (these must be defined in `plugin/`, and _not_ |
|
1370 |
+ `autoload/` of the other plugin). If it exists, then initialize the |
|
1371 |
+ extension. This ensures that the extension is loaded if and only if the |
|
1372 |
+ user has the other plugin installed. Also, a check to |
|
1373 |
+ `airline#extensions#foo_plugin#enabled` should be performed to allow the |
|
1374 |
+ user to disable it. |
|
1375 |
+ |
|
1376 |
+ b. Configuration variables for the extension should reside in the |
|
1377 |
+ extension, e.g. `g:airline#extensions#foo_plugin#bar_variable`. |
|
1378 |
+ |
|
1379 |
+See the source of |example.vim| for documented code of how to write one. |
|
1380 |
+Looking at the other extensions is also a good resource. |
|
1381 |
+ |
|
1382 |
+============================================================================== |
|
1383 |
+WRITING THEMES *airline-themes* |
|
1384 |
+ |
|
1385 |
+Themes are written "close to the metal" -- you will need to know some basic |
|
1386 |
+VimL syntax to write a theme, but if you've written in any programming |
|
1387 |
+language before it will be easy to pick up. |
|
1388 |
+ |
|
1389 |
+The |dark.vim| theme fully documents this procedure and will guide you through |
|
1390 |
+the process. |
|
1391 |
+ |
|
1392 |
+For other examples, you can visit the official themes repository at |
|
1393 |
+<https://github.com/vim-airline/vim-airline-themes>. It also includes |
|
1394 |
+examples such as |jellybeans.vim| which define colors by extracting highlight |
|
1395 |
+groups from the underlying colorscheme. |
|
1396 |
+ |
|
1397 |
+============================================================================== |
|
1398 |
+TROUBLESHOOTING *airline-troubleshooting* |
|
1399 |
+ |
|
1400 |
+Q. There are no colors. |
|
1401 |
+A. You need to set up your terminal correctly. For more details, see |
|
1402 |
+ <http://vim.wikia.com/wiki/256_colors_in_vim>. Alternatively, if you want |
|
1403 |
+ to bypass the automatic detection of terminal colors, you can force Vim |
|
1404 |
+ into 256 color mode with this: > |
|
1405 |
+ set t_Co=256 |
|
1406 |
+< |
|
1407 |
+Q. The statusline does not appear until I create a split. |
|
1408 |
+A. This is the default setting of 'laststatus'. If you want it to appear all |
|
1409 |
+ the time, add the following to your vimrc: > |
|
1410 |
+ set laststatus=2 |
|
1411 |
+< |
|
1412 |
+Q. Powerline symbols are not showing up. |
|
1413 |
+A. First, you must install patched powerline fonts. Second, you must enable |
|
1414 |
+ unicode in vim. > |
|
1415 |
+ set encoding=utf-8 |
|
1416 |
+< |
|
1417 |
+Q. There is a pause when leaving insert mode. |
|
1418 |
+A. Add the following to your vimrc. > |
|
1419 |
+ set ttimeoutlen=50 |
|
1420 |
+< |
|
1421 |
+Q. The colors look a little off for some themes. |
|
1422 |
+A. Certain themes are derived from the active colorscheme by extracting colors |
|
1423 |
+ from predefined highlight groups. These airline themes will look good for |
|
1424 |
+ their intended matching colorschemes, but will be hit or miss when loaded |
|
1425 |
+ with other colorschemes. |
|
1426 |
+ |
|
1427 |
+Q. Themes are missing |
|
1428 |
+A. Themes have been extracted into the vim-airlines-themes repository. Simply |
|
1429 |
+ clone https://github.com/vim-airline/vim-airline-themes and everything |
|
1430 |
+ should work again. |
|
1431 |
+ |
|
1432 |
+Q. Performance is bad |
|
1433 |
+A. Check the question at the wiki: |
|
1434 |
+ https://github.com/vim-airline/vim-airline/wiki/FAQ#i-have-a-performance-problem |
|
1435 |
+ |
|
1436 |
+Solutions to other common problems can be found in the Wiki: |
|
1437 |
+<https://github.com/vim-airline/vim-airline/wiki/FAQ> |
|
1438 |
+ |
|
1439 |
+============================================================================== |
|
1440 |
+CONTRIBUTIONS *airline-contributions* |
|
1441 |
+ |
|
1442 |
+Contributions and pull requests are welcome. |
|
1443 |
+ |
|
1444 |
+============================================================================== |
|
1445 |
+LICENSE *airline-license* |
|
1446 |
+ |
|
1447 |
+MIT License. Copyright © 2013-2017 Bailey Ling, Christian Brabandt |
|
1448 |
+ |
|
1449 |
+ vim:tw=78:ts=8:ft=help:norl: |
... | ... |
@@ -0,0 +1,163 @@ |
1 |
+" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. |
|
2 |
+" vim: et ts=2 sts=2 sw=2 |
|
3 |
+ |
|
4 |
+scriptencoding utf-8 |
|
5 |
+ |
|
6 |
+if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline) |
|
7 |
+ finish |
|
8 |
+endif |
|
9 |
+let g:loaded_airline = 1 |
|
10 |
+ |
|
11 |
+let s:airline_initialized = 0 |
|
12 |
+function! s:init() |
|
13 |
+ if s:airline_initialized |
|
14 |
+ return |
|
15 |
+ endif |
|
16 |
+ let s:airline_initialized = 1 |
|
17 |
+ |
|
18 |
+ call airline#extensions#load() |
|
19 |
+ call airline#init#sections() |
|
20 |
+ |
|
21 |
+ let s:theme_in_vimrc = exists('g:airline_theme') |
|
22 |
+ if s:theme_in_vimrc |
|
23 |
+ try |
|
24 |
+ let palette = g:airline#themes#{g:airline_theme}#palette |
|
25 |
+ catch |
|
26 |
+ echom 'Could not resolve airline theme "' . g:airline_theme . '". Themes have been migrated to github.com/vim-airline/vim-airline-themes.' |
|
27 |
+ let g:airline_theme = 'dark' |
|
28 |
+ endtry |
|
29 |
+ silent call airline#switch_theme(g:airline_theme) |
|
30 |
+ else |
|
31 |
+ let g:airline_theme = 'dark' |
|
32 |
+ silent call s:on_colorscheme_changed() |
|
33 |
+ endif |
|
34 |
+ |
|
35 |
+ silent doautocmd User AirlineAfterInit |
|
36 |
+endfunction |
|
37 |
+ |
|
38 |
+function! s:on_window_changed() |
|
39 |
+ if pumvisible() && (!&previewwindow || g:airline_exclude_preview) |
|
40 |
+ return |
|
41 |
+ endif |
|
42 |
+ " Handle each window only once, since we might come here several times for |
|
43 |
+ " different autocommands. |
|
44 |
+ let l:key = [bufnr('%'), winnr(), winnr('$'), tabpagenr(), &ft] |
|
45 |
+ if get(g:, 'airline_last_window_changed', []) == l:key |
|
46 |
+ \ && &stl is# '%!airline#statusline('.winnr().')' |
|
47 |
+ \ && &ft !~? 'gitcommit' |
|
48 |
+ " fugitive is special, it changes names and filetypes several times, |
|
49 |
+ " make sure the caching does not get into its way |
|
50 |
+ return |
|
51 |
+ endif |
|
52 |
+ let g:airline_last_window_changed = l:key |
|
53 |
+ call s:init() |
|
54 |
+ call airline#update_statusline() |
|
55 |
+endfunction |
|
56 |
+ |
|
57 |
+function! s:on_colorscheme_changed() |
|
58 |
+ call s:init() |
|
59 |
+ unlet! g:airline#highlighter#normal_fg_hi |
|
60 |
+ call airline#highlighter#reset_hlcache() |
|
61 |
+ let g:airline_gui_mode = airline#init#gui_mode() |
|
62 |
+ if !s:theme_in_vimrc |
|
63 |
+ call airline#switch_matching_theme() |
|
64 |
+ endif |
|
65 |
+ |
|
66 |
+ " couldn't find a match, or theme was defined, just refresh |
|
67 |
+ call airline#load_theme() |
|
68 |
+endfunction |
|
69 |
+ |
|
70 |
+function! airline#cmdwinenter(...) |
|
71 |
+ call airline#extensions#apply_left_override('Command Line', '') |
|
72 |
+endfunction |
|
73 |
+ |
|
74 |
+function! s:airline_toggle() |
|
75 |
+ if exists("#airline") |
|
76 |
+ augroup airline |
|
77 |
+ au! |
|
78 |
+ augroup END |
|
79 |
+ augroup! airline |
|
80 |
+ |
|
81 |
+ if exists("s:stl") |
|
82 |
+ let &stl = s:stl |
|
83 |
+ endif |
|
84 |
+ call airline#highlighter#reset_hlcache() |
|
85 |
+ |
|
86 |
+ silent doautocmd User AirlineToggledOff |
|
87 |
+ else |
|
88 |
+ let s:stl = &statusline |
|
89 |
+ augroup airline |
|
90 |
+ autocmd! |
|
91 |
+ |
|
92 |
+ autocmd CmdwinEnter * |
|
93 |
+ \ call airline#add_statusline_func('airline#cmdwinenter') |
|
94 |
+ \ | call <sid>on_window_changed() |
|
95 |
+ autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter') |
|
96 |
+ |
|
97 |
+ autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed() |
|
98 |
+ if exists("##OptionSet") |
|
99 |
+ " Make sure that g_airline_gui_mode is refreshed |
|
100 |
+ autocmd OptionSet termguicolors call <sid>on_colorscheme_changed() |
|
101 |
+ endif |
|
102 |
+ " Refresh airline for :syntax off |
|
103 |
+ autocmd SourcePre */syntax/syntax.vim |
|
104 |
+ \ call airline#extensions#tabline#buffers#invalidate() |
|
105 |
+ autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload * |
|
106 |
+ \ call <sid>on_window_changed() |
|
107 |
+ if exists('#CompleteDone') |
|
108 |
+ autocmd CompleteDone * call <sid>on_window_changed() |
|
109 |
+ endif |
|
110 |
+ |
|
111 |
+ autocmd VimResized * unlet! w:airline_lastmode | :call <sid>airline_refresh() |
|
112 |
+ autocmd TabEnter * :unlet! w:airline_lastmode | let w:airline_active=1 |
|
113 |
+ autocmd BufWritePost */autoload/airline/themes/*.vim |
|
114 |
+ \ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0] |
|
115 |
+ \ | call airline#load_theme() |
|
116 |
+ augroup END |
|
117 |
+ |
|
118 |
+ if &laststatus < 2 |
|
119 |
+ set laststatus=2 |
|
120 |
+ endif |
|
121 |
+ if s:airline_initialized |
|
122 |
+ call s:on_window_changed() |
|
123 |
+ endif |
|
124 |
+ |
|
125 |
+ silent doautocmd User AirlineToggledOn |
|
126 |
+ endif |
|
127 |
+endfunction |
|
128 |
+ |
|
129 |
+function! s:get_airline_themes(a, l, p) |
|
130 |
+ let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:a.'*'), "\n") |
|
131 |
+ return map(files, 'fnamemodify(v:val, ":t:r")') |
|
132 |
+endfunction |
|
133 |
+ |
|
134 |
+function! s:airline_theme(...) |
|
135 |
+ if a:0 |
|
136 |
+ call airline#switch_theme(a:1) |
|
137 |
+ else |
|
138 |
+ echo g:airline_theme |
|
139 |
+ endif |
|
140 |
+endfunction |
|
141 |
+ |
|
142 |
+function! s:airline_refresh() |
|
143 |
+ if !exists("#airline") |
|
144 |
+ " disabled |
|
145 |
+ return |
|
146 |
+ endif |
|
147 |
+ let nomodeline='' |
|
148 |
+ if v:version > 703 || v:version == 703 && has("patch438") |
|
149 |
+ let nomodeline = '<nomodeline>' |
|
150 |
+ endif |
|
151 |
+ exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline) |
|
152 |
+ call airline#highlighter#reset_hlcache() |
|
153 |
+ call airline#load_theme() |
|
154 |
+ call airline#update_statusline() |
|
155 |
+endfunction |
|
156 |
+ |
|
157 |
+command! -bar -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>) |
|
158 |
+command! -bar AirlineToggleWhitespace call airline#extensions#whitespace#toggle() |
|
159 |
+command! -bar AirlineToggle call s:airline_toggle() |
|
160 |
+command! -bar AirlineRefresh call s:airline_refresh() |
|
161 |
+ |
|
162 |
+call airline#init#bootstrap() |
|
163 |
+call s:airline_toggle() |
... | ... |
@@ -0,0 +1,87 @@ |
1 |
+let g:airline_theme = 'dark' |
|
2 |
+ |
|
3 |
+source plugin/airline.vim |
|
4 |
+doautocmd VimEnter |
|
5 |
+ |
|
6 |
+function! MyFuncref(...) |
|
7 |
+ call a:1.add_raw('hello world') |
|
8 |
+ return 1 |
|
9 |
+endfunction |
|
10 |
+ |
|
11 |
+function! MyIgnoreFuncref(...) |
|
12 |
+ return -1 |
|
13 |
+endfunction |
|
14 |
+ |
|
15 |
+function! MyAppend1(...) |
|
16 |
+ call a:1.add_raw('hello') |
|
17 |
+endfunction |
|
18 |
+ |
|
19 |
+function! MyAppend2(...) |
|
20 |
+ call a:1.add_raw('world') |
|
21 |
+endfunction |
|
22 |
+ |
|
23 |
+describe 'airline' |
|
24 |
+ before |
|
25 |
+ let g:airline_statusline_funcrefs = [] |
|
26 |
+ end |
|
27 |
+ |
|
28 |
+ it 'should run user funcrefs first' |
|
29 |
+ call airline#add_statusline_func('MyFuncref') |
|
30 |
+ let &statusline = '' |
|
31 |
+ call airline#update_statusline() |
|
32 |
+ Expect airline#statusline(1) =~ 'hello world' |
|
33 |
+ end |
|
34 |
+ |
|
35 |
+ it 'should not change the statusline with -1' |
|
36 |
+ call airline#add_statusline_funcref(function('MyIgnoreFuncref')) |
|
37 |
+ let &statusline = 'foo' |
|
38 |
+ call airline#update_statusline() |
|
39 |
+ Expect &statusline == 'foo' |
|
40 |
+ end |
|
41 |
+ |
|
42 |
+ it 'should support multiple chained funcrefs' |
|
43 |
+ call airline#add_statusline_func('MyAppend1') |
|
44 |
+ call airline#add_statusline_func('MyAppend2') |
|
45 |
+ call airline#update_statusline() |
|
46 |
+ Expect airline#statusline(1) =~ 'helloworld' |
|
47 |
+ end |
|
48 |
+ |
|
49 |
+ it 'should allow users to redefine sections' |
|
50 |
+ let g:airline_section_a = airline#section#create(['mode', 'mode']) |
|
51 |
+ call airline#update_statusline() |
|
52 |
+ 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#' |
|
53 |
+ end |
|
54 |
+ |
|
55 |
+ it 'should remove funcrefs properly' |
|
56 |
+ let c = len(g:airline_statusline_funcrefs) |
|
57 |
+ call airline#add_statusline_func('MyIgnoreFuncref') |
|
58 |
+ call airline#remove_statusline_func('MyIgnoreFuncref') |
|
59 |
+ Expect len(g:airline_statusline_funcrefs) == c |
|
60 |
+ end |
|
61 |
+ |
|
62 |
+ it 'should overwrite the statusline with active and inactive splits' |
|
63 |
+ wincmd s |
|
64 |
+ Expect airline#statusline(1) !~ 'inactive' |
|
65 |
+ Expect airline#statusline(2) =~ 'inactive' |
|
66 |
+ wincmd c |
|
67 |
+ end |
|
68 |
+ |
|
69 |
+ it 'should collapse the inactive split if the variable is set true' |
|
70 |
+ let g:airline_inactive_collapse = 1 |
|
71 |
+ wincmd s |
|
72 |
+ Expect getwinvar(2, '&statusline') !~ 'airline#parts#mode' |
|
73 |
+ wincmd c |
|
74 |
+ end |
|
75 |
+ |
|
76 |
+ it 'should not collapse the inactive split if the variable is set false' |
|
77 |
+ let g:airline_inactive_collapse = 0 |
|
78 |
+ wincmd s |
|
79 |
+ Expect getwinvar(2, '&statusline') != 'airline#parts#mode' |
|
80 |
+ wincmd c |
|
81 |
+ end |
|
82 |
+ |
|
83 |
+ it 'should include check_mode' |
|
84 |
+ Expect airline#statusline(1) =~ 'airline#check_mode' |
|
85 |
+ end |
|
86 |
+end |
|
87 |
+ |
... | ... |
@@ -0,0 +1,108 @@ |
1 |
+let g:airline_theme = 'dark' |
|
2 |
+call airline#init#bootstrap() |
|
3 |
+ |
|
4 |
+describe 'active builder' |
|
5 |
+ before |
|
6 |
+ let s:builder = airline#builder#new({'active': 1}) |
|
7 |
+ end |
|
8 |
+ |
|
9 |
+ it 'should start with an empty statusline' |
|
10 |
+ let stl = s:builder.build() |
|
11 |
+ Expect stl == '' |
|
12 |
+ end |
|
13 |
+ |
|
14 |
+ it 'should transition colors from one to the next' |
|
15 |
+ call s:builder.add_section('Normal', 'hello') |
|
16 |
+ call s:builder.add_section('Search', 'world') |
|
17 |
+ let stl = s:builder.build() |
|
18 |
+ Expect stl =~ '%#Normal#hello%#Normal_to_Search#%#Search#world' |
|
19 |
+ end |
|
20 |
+ |
|
21 |
+ it 'should reuse highlight group if background colors match' |
|
22 |
+ call airline#highlighter#reset_hlcache() |
|
23 |
+ highlight Foo1 ctermfg=1 ctermbg=2 |
|
24 |
+ highlight Foo2 ctermfg=1 ctermbg=2 |
|
25 |
+ call s:builder.add_section('Foo1', 'hello') |
|
26 |
+ call s:builder.add_section('Foo2', 'world') |
|
27 |
+ let stl = s:builder.build() |
|
28 |
+ Expect stl =~ '%#Foo1#helloworld' |
|
29 |
+ end |
|
30 |
+ |
|
31 |
+ it 'should switch highlight groups if foreground colors differ' |
|
32 |
+ call airline#highlighter#reset_hlcache() |
|
33 |
+ highlight Foo1 ctermfg=1 ctermbg=2 |
|
34 |
+ highlight Foo2 ctermfg=2 ctermbg=2 |
|
35 |
+ call s:builder.add_section('Foo1', 'hello') |
|
36 |
+ call s:builder.add_section('Foo2', 'world') |
|
37 |
+ let stl = s:builder.build() |
|
38 |
+ Expect stl =~ '%#Foo1#hello%#Foo1_to_Foo2#%#Foo2#world' |
|
39 |
+ end |
|
40 |
+ |
|
41 |
+ it 'should split left/right sections' |
|
42 |
+ call s:builder.split() |
|
43 |
+ let stl = s:builder.build() |
|
44 |
+ Expect stl =~ '%=' |
|
45 |
+ end |
|
46 |
+ |
|
47 |
+ it 'after split, sections use the right separator' |
|
48 |
+ call s:builder.split() |
|
49 |
+ call s:builder.add_section('Normal', 'hello') |
|
50 |
+ call s:builder.add_section('Search', 'world') |
|
51 |
+ let stl = s:builder.build() |
|
52 |
+ Expect stl =~ 'hello%#Normal_to_Search#%#Search#world' |
|
53 |
+ end |
|
54 |
+ |
|
55 |
+ it 'should not repeat the same highlight group' |
|
56 |
+ call s:builder.add_section('Normal', 'hello') |
|
57 |
+ call s:builder.add_section('Normal', 'hello') |
|
58 |
+ let stl = s:builder.build() |
|
59 |
+ Expect stl == '%#Normal#hellohello' |
|
60 |
+ end |
|
61 |
+ |
|
62 |
+ it 'should replace accent groups with the specified group' |
|
63 |
+ call s:builder.add_section('Normal', '%#__accent_foo#hello') |
|
64 |
+ let stl = s:builder.build() |
|
65 |
+ Expect stl == '%#Normal#%#Normal_foo#hello' |
|
66 |
+ end |
|
67 |
+ |
|
68 |
+ it 'should replace two accent groups with correct groups' |
|
69 |
+ call s:builder.add_section('Normal', '%#__accent_foo#hello%#__accent_bar#world') |
|
70 |
+ let stl = s:builder.build() |
|
71 |
+ Expect stl =~ '%#Normal_foo#hello%#Normal_bar#world' |
|
72 |
+ end |
|
73 |
+ |
|
74 |
+ it 'should special restore group should go back to previous group' |
|
75 |
+ call s:builder.add_section('Normal', '%#__restore__#') |
|
76 |
+ let stl = s:builder.build() |
|
77 |
+ Expect stl !~ '%#__restore__#' |
|
78 |
+ Expect stl =~ '%#Normal#' |
|
79 |
+ end |
|
80 |
+ |
|
81 |
+ it 'should blend colors from the left through the split to the right' |
|
82 |
+ call s:builder.add_section('Normal', 'hello') |
|
83 |
+ call s:builder.split() |
|
84 |
+ call s:builder.add_section('Search', 'world') |
|
85 |
+ let stl = s:builder.build() |
|
86 |
+ Expect stl =~ 'Normal_to_Search' |
|
87 |
+ end |
|
88 |
+end |
|
89 |
+ |
|
90 |
+describe 'inactive builder' |
|
91 |
+ before |
|
92 |
+ let s:builder = airline#builder#new({'active': 0}) |
|
93 |
+ end |
|
94 |
+ |
|
95 |
+ it 'should transition colors from one to the next' |
|
96 |
+ call s:builder.add_section('Normal', 'hello') |
|
97 |
+ call s:builder.add_section('Search', 'world') |
|
98 |
+ let stl = s:builder.build() |
|
99 |
+ Expect stl =~ '%#Normal_inactive#hello%#Normal_to_Search_inactive#%#Search_inactive#world' |
|
100 |
+ end |
|
101 |
+ |
|
102 |
+ it 'should not render accents' |
|
103 |
+ call s:builder.add_section('Normal', '%#__accent_foo#hello%#foo#foo%#__accent_bar#world') |
|
104 |
+ let stl = s:builder.build() |
|
105 |
+ Expect stl == '%#Normal_inactive#hello%#foo_inactive#fooworld' |
|
106 |
+ end |
|
107 |
+end |
|
108 |
+ |
... | ... |
@@ -0,0 +1,35 @@ |
1 |
+source plugin/airline.vim |
|
2 |
+doautocmd VimEnter |
|
3 |
+ |
|
4 |
+describe 'commands' |
|
5 |
+ it 'should toggle off and on' |
|
6 |
+ execute 'AirlineToggle' |
|
7 |
+ Expect exists('#airline') to_be_false |
|
8 |
+ execute 'AirlineToggle' |
|
9 |
+ Expect exists('#airline') to_be_true |
|
10 |
+ end |
|
11 |
+ |
|
12 |
+ it 'should toggle whitespace off and on' |
|
13 |
+ call airline#extensions#load() |
|
14 |
+ execute 'AirlineToggleWhitespace' |
|
15 |
+ Expect exists('#airline_whitespace') to_be_false |
|
16 |
+ execute 'AirlineToggleWhitespace' |
|
17 |
+ Expect exists('#airline_whitespace') to_be_true |
|
18 |
+ end |
|
19 |
+ |
|
20 |
+ it 'should display theme name with no args' |
|
21 |
+ execute 'AirlineTheme simple' |
|
22 |
+ Expect g:airline_theme == 'simple' |
|
23 |
+ execute 'AirlineTheme dark' |
|
24 |
+ Expect g:airline_theme == 'dark' |
|
25 |
+ execute 'AirlineTheme doesnotexist' |
|
26 |
+ Expect g:airline_theme == 'dark' |
|
27 |
+ colors molokai |
|
28 |
+ Expect g:airline_theme == 'molokai' |
|
29 |
+ end |
|
30 |
+ |
|
31 |
+ it 'should have a refresh command' |
|
32 |
+ Expect exists(':AirlineRefresh') to_be_true |
|
33 |
+ end |
|
34 |
+end |
|
35 |
+ |
... | ... |
@@ -0,0 +1,31 @@ |
1 |
+let g:airline#extensions#default#layout = [ |
|
2 |
+ \ [ 'c', 'a', 'b', 'warning' ], |
|
3 |
+ \ [ 'x', 'z', 'y' ] |
|
4 |
+ \ ] |
|
5 |
+ |
|
6 |
+source plugin/airline.vim |
|
7 |
+doautocmd VimEnter |
|
8 |
+ |
|
9 |
+describe 'default' |
|
10 |
+ before |
|
11 |
+ let s:builder = airline#builder#new({'active': 1}) |
|
12 |
+ end |
|
13 |
+ |
|
14 |
+ it 'should use the layout' |
|
15 |
+ call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 }) |
|
16 |
+ let stl = s:builder.build() |
|
17 |
+ Expect stl =~ 'airline_c_to_airline_a' |
|
18 |
+ Expect stl =~ 'airline_a_to_airline_b' |
|
19 |
+ Expect stl =~ 'airline_b_to_airline_warning' |
|
20 |
+ Expect stl =~ 'airline_x_to_airline_z' |
|
21 |
+ Expect stl =~ 'airline_z_to_airline_y' |
|
22 |
+ end |
|
23 |
+ |
|
24 |
+ it 'should only render warning section in active splits' |
|
25 |
+ wincmd s |
|
26 |
+ Expect airline#statusline(1) =~ 'warning' |
|
27 |
+ Expect airline#statusline(2) !~ 'warning' |
|
28 |
+ wincmd c |
|
29 |
+ end |
|
30 |
+end |
|
31 |
+ |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+let g:airline_theme = 'dark' |
|
2 |
+ |
|
3 |
+describe 'highlighter' |
|
4 |
+ it 'should create separator highlight groups' |
|
5 |
+ hi Foo1 ctermfg=1 ctermbg=2 |
|
6 |
+ hi Foo2 ctermfg=3 ctermbg=4 |
|
7 |
+ call airline#highlighter#add_separator('Foo1', 'Foo2', 0) |
|
8 |
+ let hl = airline#highlighter#get_highlight('Foo1_to_Foo2') |
|
9 |
+ Expect hl == [ '', '', '4', '2', '' ] |
|
10 |
+ end |
|
11 |
+ |
|
12 |
+ it 'should populate accent colors' |
|
13 |
+ Expect exists('g:airline#themes#dark#palette.normal.airline_c_red') to_be_false |
|
14 |
+ Expect hlID('airline_c_red') == 0 |
|
15 |
+ call airline#themes#patch(g:airline#themes#dark#palette) |
|
16 |
+ call airline#highlighter#add_accent('red') |
|
17 |
+ call airline#highlighter#highlight(['normal']) |
|
18 |
+ Expect hlID('airline_c_red') != 0 |
|
19 |
+ end |
|
20 |
+end |
|
21 |
+ |
... | ... |
@@ -0,0 +1,87 @@ |
1 |
+let s:sections = ['a', 'b', 'c', 'gutter', 'x', 'y', 'z', 'warning'] |
|
2 |
+ |
|
3 |
+function! s:clear() |
|
4 |
+ for key in s:sections |
|
5 |
+ unlet! g:airline_section_{key} |
|
6 |
+ endfor |
|
7 |
+endfunction |
|
8 |
+ |
|
9 |
+call airline#init#bootstrap() |
|
10 |
+ |
|
11 |
+describe 'init sections' |
|
12 |
+ before |
|
13 |
+ call s:clear() |
|
14 |
+ call airline#init#sections() |
|
15 |
+ end |
|
16 |
+ |
|
17 |
+ after |
|
18 |
+ call s:clear() |
|
19 |
+ end |
|
20 |
+ |
|
21 |
+ it 'section a should have mode, paste, spell, iminsert' |
|
22 |
+ Expect g:airline_section_a =~ 'mode' |
|
23 |
+ Expect g:airline_section_a =~ 'paste' |
|
24 |
+ Expect g:airline_section_a =~ 'spell' |
|
25 |
+ Expect g:airline_section_a =~ 'iminsert' |
|
26 |
+ end |
|
27 |
+ |
|
28 |
+ it 'section b should be blank because no extensions are installed' |
|
29 |
+ Expect g:airline_section_b == '' |
|
30 |
+ end |
|
31 |
+ |
|
32 |
+ it 'section c should be file' |
|
33 |
+ Expect g:airline_section_c == '%<%f%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#' |
|
34 |
+ end |
|
35 |
+ |
|
36 |
+ it 'section x should be filetype' |
|
37 |
+ Expect g:airline_section_x == '%{airline#util#prepend("",0)}%{airline#util#wrap(airline#parts#filetype(),0)}' |
|
38 |
+ end |
|
39 |
+ |
|
40 |
+ it 'section y should be fenc and ff' |
|
41 |
+ Expect g:airline_section_y =~ 'ff' |
|
42 |
+ Expect g:airline_section_y =~ 'fenc' |
|
43 |
+ end |
|
44 |
+ |
|
45 |
+ it 'section z should be line numbers' |
|
46 |
+ Expect g:airline_section_z =~ '%3p%%' |
|
47 |
+ Expect g:airline_section_z =~ '%4l' |
|
48 |
+ Expect g:airline_section_z =~ '%3v' |
|
49 |
+ end |
|
50 |
+ |
|
51 |
+ it 'should not redefine sections already defined' |
|
52 |
+ for s in s:sections |
|
53 |
+ let g:airline_section_{s} = s |
|
54 |
+ endfor |
|
55 |
+ call airline#init#bootstrap() |
|
56 |
+ for s in s:sections |
|
57 |
+ Expect g:airline_section_{s} == s |
|
58 |
+ endfor |
|
59 |
+ end |
|
60 |
+ |
|
61 |
+ it 'all default statusline extensions should be blank' |
|
62 |
+ Expect airline#parts#get('ale_error_count').raw == '' |
|
63 |
+ Expect airline#parts#get('ale_warning_count').raw == '' |
|
64 |
+ Expect airline#parts#get('hunks').raw == '' |
|
65 |
+ Expect airline#parts#get('branch').raw == '' |
|
66 |
+ Expect airline#parts#get('eclim').raw == '' |
|
67 |
+ Expect airline#parts#get('neomake_error_count').raw == '' |
|
68 |
+ Expect airline#parts#get('neomake_warning_count').raw == '' |
|
69 |
+ Expect airline#parts#get('obsession').raw == '' |
|
70 |
+ Expect airline#parts#get('syntastic-err').raw == '' |
|
71 |
+ Expect airline#parts#get('syntastic-warn').raw == '' |
|
72 |
+ Expect airline#parts#get('tagbar').raw == '' |
|
73 |
+ Expect airline#parts#get('whitespace').raw == '' |
|
74 |
+ Expect airline#parts#get('windowswap').raw == '' |
|
75 |
+ Expect airline#parts#get('ycm_error_count').raw == '' |
|
76 |
+ Expect airline#parts#get('ycm_warning_count').raw == '' |
|
77 |
+ end |
|
78 |
+end |
|
79 |
+ |
|
80 |
+describe 'init parts' |
|
81 |
+ it 'should not redefine parts already defined' |
|
82 |
+ call airline#parts#define_raw('linenr', 'bar') |
|
83 |
+ call airline#init#sections() |
|
84 |
+ Expect g:airline_section_z =~ 'bar' |
|
85 |
+ end |
|
86 |
+end |
|
87 |
+ |
... | ... |
@@ -0,0 +1,39 @@ |
1 |
+describe 'parts' |
|
2 |
+ it 'overwrites existing values' |
|
3 |
+ call airline#parts#define('foo', { 'test': '123' }) |
|
4 |
+ Expect airline#parts#get('foo').test == '123' |
|
5 |
+ call airline#parts#define('foo', { 'test': '321' }) |
|
6 |
+ Expect airline#parts#get('foo').test == '321' |
|
7 |
+ end |
|
8 |
+ |
|
9 |
+ it 'can define a function part' |
|
10 |
+ call airline#parts#define_function('func', 'bar') |
|
11 |
+ Expect airline#parts#get('func').function == 'bar' |
|
12 |
+ end |
|
13 |
+ |
|
14 |
+ it 'can define a text part' |
|
15 |
+ call airline#parts#define_text('text', 'bar') |
|
16 |
+ Expect airline#parts#get('text').text == 'bar' |
|
17 |
+ end |
|
18 |
+ |
|
19 |
+ it 'can define a raw part' |
|
20 |
+ call airline#parts#define_raw('raw', 'bar') |
|
21 |
+ Expect airline#parts#get('raw').raw == 'bar' |
|
22 |
+ end |
|
23 |
+ |
|
24 |
+ it 'can define a minwidth' |
|
25 |
+ call airline#parts#define_minwidth('mw', 123) |
|
26 |
+ Expect airline#parts#get('mw').minwidth == 123 |
|
27 |
+ end |
|
28 |
+ |
|
29 |
+ it 'can define a condition' |
|
30 |
+ call airline#parts#define_condition('part', '1') |
|
31 |
+ Expect airline#parts#get('part').condition == '1' |
|
32 |
+ end |
|
33 |
+ |
|
34 |
+ it 'can define a accent' |
|
35 |
+ call airline#parts#define_accent('part', 'red') |
|
36 |
+ Expect airline#parts#get('part').accent == 'red' |
|
37 |
+ end |
|
38 |
+end |
|
39 |
+ |
... | ... |
@@ -0,0 +1,81 @@ |
1 |
+function! SectionSpec() |
|
2 |
+endfunction |
|
3 |
+ |
|
4 |
+describe 'section' |
|
5 |
+ before |
|
6 |
+ call airline#parts#define_text('text', 'text') |
|
7 |
+ call airline#parts#define_raw('raw', 'raw') |
|
8 |
+ call airline#parts#define_function('func', 'SectionSpec') |
|
9 |
+ end |
|
10 |
+ |
|
11 |
+ it 'should be able to reference default parts' |
|
12 |
+ let s = airline#section#create(['paste']) |
|
13 |
+ Expect s == '%{airline#util#wrap(airline#parts#paste(),0)}' |
|
14 |
+ end |
|
15 |
+ |
|
16 |
+ it 'should create sections with no separators' |
|
17 |
+ let s = airline#section#create(['text', 'raw', 'func']) |
|
18 |
+ Expect s == '%{airline#util#wrap("text",0)}raw%{airline#util#wrap(SectionSpec(),0)}' |
|
19 |
+ end |
|
20 |
+ |
|
21 |
+ it 'should create left sections with separators' |
|
22 |
+ let s = airline#section#create_left(['text', 'text']) |
|
23 |
+ Expect s == '%{airline#util#wrap("text",0)}%{airline#util#append("text",0)}' |
|
24 |
+ end |
|
25 |
+ |
|
26 |
+ it 'should create right sections with separators' |
|
27 |
+ let s = airline#section#create_right(['text', 'text']) |
|
28 |
+ Expect s == '%{airline#util#prepend("text",0)}%{airline#util#wrap("text",0)}' |
|
29 |
+ end |
|
30 |
+ |
|
31 |
+ it 'should prefix with accent group if provided and restore afterwards' |
|
32 |
+ call airline#parts#define('hi', { |
|
33 |
+ \ 'raw': 'hello', |
|
34 |
+ \ 'accent': 'red', |
|
35 |
+ \ }) |
|
36 |
+ let s = airline#section#create(['hi']) |
|
37 |
+ Expect s == '%#__accent_red#hello%#__restore__#' |
|
38 |
+ end |
|
39 |
+ |
|
40 |
+ it 'should accent functions' |
|
41 |
+ call airline#parts#define_function('hi', 'Hello') |
|
42 |
+ call airline#parts#define_accent('hi', 'bold') |
|
43 |
+ let s = airline#section#create(['hi']) |
|
44 |
+ Expect s == '%#__accent_bold#%{airline#util#wrap(Hello(),0)}%#__restore__#' |
|
45 |
+ end |
|
46 |
+ |
|
47 |
+ it 'should parse out a section from the distro' |
|
48 |
+ call airline#extensions#load() |
|
49 |
+ let s = airline#section#create(['whitespace']) |
|
50 |
+ Expect s =~ 'airline#extensions#whitespace#check' |
|
51 |
+ end |
|
52 |
+ |
|
53 |
+ it 'should use parts as is if they are not found' |
|
54 |
+ let s = airline#section#create(['asdf', 'func']) |
|
55 |
+ Expect s == 'asdf%{airline#util#wrap(SectionSpec(),0)}' |
|
56 |
+ end |
|
57 |
+ |
|
58 |
+ it 'should force add separators for raw and missing keys' |
|
59 |
+ let s = airline#section#create_left(['asdf', 'raw']) |
|
60 |
+ Expect s == 'asdf raw' |
|
61 |
+ let s = airline#section#create_left(['asdf', 'aaaa', 'raw']) |
|
62 |
+ Expect s == 'asdf aaaa raw' |
|
63 |
+ let s = airline#section#create_right(['raw', '%f']) |
|
64 |
+ Expect s == 'raw %f' |
|
65 |
+ let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}']) |
|
66 |
+ Expect s == '%t asdf %{getcwd()}' |
|
67 |
+ end |
|
68 |
+ |
|
69 |
+ it 'should empty out parts that do not pass their condition' |
|
70 |
+ call airline#parts#define_text('conditional', 'conditional') |
|
71 |
+ call airline#parts#define_condition('conditional', '0') |
|
72 |
+ let s = airline#section#create(['conditional']) |
|
73 |
+ Expect s == '%{0 ? airline#util#wrap("conditional",0) : ""}' |
|
74 |
+ end |
|
75 |
+ |
|
76 |
+ it 'should not draw two separators after another' |
|
77 |
+ let s = airline#section#create_right(['ffenc','%{strftime("%H:%M")}']) |
|
78 |
+ Expect s == '%{airline#util#prepend(airline#parts#ffenc(),0)}%{strftime("%H:%M")}' |
|
79 |
+ end |
|
80 |
+end |
|
81 |
+ |
... | ... |
@@ -0,0 +1,73 @@ |
1 |
+describe 'themes' |
|
2 |
+ after |
|
3 |
+ highlight clear Foo |
|
4 |
+ highlight clear Normal |
|
5 |
+ end |
|
6 |
+ |
|
7 |
+ it 'should extract correct colors' |
|
8 |
+ call airline#highlighter#reset_hlcache() |
|
9 |
+ highlight Foo ctermfg=1 ctermbg=2 |
|
10 |
+ let colors = airline#themes#get_highlight('Foo') |
|
11 |
+ Expect colors[2] == '1' |
|
12 |
+ Expect colors[3] == '2' |
|
13 |
+ end |
|
14 |
+ |
|
15 |
+ it 'should extract from normal if colors unavailable' |
|
16 |
+ call airline#highlighter#reset_hlcache() |
|
17 |
+ highlight Normal ctermfg=100 ctermbg=200 |
|
18 |
+ highlight Foo ctermbg=2 |
|
19 |
+ let colors = airline#themes#get_highlight('Foo') |
|
20 |
+ Expect colors[2] == '100' |
|
21 |
+ Expect colors[3] == '2' |
|
22 |
+ end |
|
23 |
+ |
|
24 |
+ it 'should flip target group if it is reversed' |
|
25 |
+ call airline#highlighter#reset_hlcache() |
|
26 |
+ highlight Foo ctermbg=222 ctermfg=103 term=reverse |
|
27 |
+ let colors = airline#themes#get_highlight('Foo') |
|
28 |
+ Expect colors[2] == '222' |
|
29 |
+ Expect colors[3] == '103' |
|
30 |
+ end |
|
31 |
+ |
|
32 |
+ it 'should pass args through correctly' |
|
33 |
+ call airline#highlighter#reset_hlcache() |
|
34 |
+ hi clear Normal |
|
35 |
+ let hl = airline#themes#get_highlight('Foo', 'bold', 'italic') |
|
36 |
+ Expect hl == ['', '', 'NONE', 'NONE', 'bold,italic'] |
|
37 |
+ |
|
38 |
+ let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold') |
|
39 |
+ Expect hl == ['', '', 'NONE', 'NONE', 'italic,bold'] |
|
40 |
+ end |
|
41 |
+ |
|
42 |
+ it 'should generate color map with mirroring' |
|
43 |
+ let map = airline#themes#generate_color_map( |
|
44 |
+ \ [ 1, 1, 1, 1, '1' ], |
|
45 |
+ \ [ 2, 2, 2, 2, '2' ], |
|
46 |
+ \ [ 3, 3, 3, 3, '3' ], |
|
47 |
+ \ ) |
|
48 |
+ Expect map.airline_a[0] == 1 |
|
49 |
+ Expect map.airline_b[0] == 2 |
|
50 |
+ Expect map.airline_c[0] == 3 |
|
51 |
+ Expect map.airline_x[0] == 3 |
|
52 |
+ Expect map.airline_y[0] == 2 |
|
53 |
+ Expect map.airline_z[0] == 1 |
|
54 |
+ end |
|
55 |
+ |
|
56 |
+ it 'should generate color map with full set of colors' |
|
57 |
+ let map = airline#themes#generate_color_map( |
|
58 |
+ \ [ 1, 1, 1, 1, '1' ], |
|
59 |
+ \ [ 2, 2, 2, 2, '2' ], |
|
60 |
+ \ [ 3, 3, 3, 3, '3' ], |
|
61 |
+ \ [ 4, 4, 4, 4, '4' ], |
|
62 |
+ \ [ 5, 5, 5, 5, '5' ], |
|
63 |
+ \ [ 6, 6, 6, 6, '6' ], |
|
64 |
+ \ ) |
|
65 |
+ Expect map.airline_a[0] == 1 |
|
66 |
+ Expect map.airline_b[0] == 2 |
|
67 |
+ Expect map.airline_c[0] == 3 |
|
68 |
+ Expect map.airline_x[0] == 4 |
|
69 |
+ Expect map.airline_y[0] == 5 |
|
70 |
+ Expect map.airline_z[0] == 6 |
|
71 |
+ end |
|
72 |
+end |
|
73 |
+ |
... | ... |
@@ -0,0 +1,54 @@ |
1 |
+call airline#init#bootstrap() |
|
2 |
+ |
|
3 |
+function! Util1() |
|
4 |
+ let g:count += 1 |
|
5 |
+endfunction |
|
6 |
+function! Util2() |
|
7 |
+ let g:count += 2 |
|
8 |
+endfunction |
|
9 |
+function! Util3(...) |
|
10 |
+ let g:count = a:0 |
|
11 |
+endfunction |
|
12 |
+ |
|
13 |
+describe 'util' |
|
14 |
+ before |
|
15 |
+ let g:count = 0 |
|
16 |
+ end |
|
17 |
+ |
|
18 |
+ it 'has append wrapper function' |
|
19 |
+ Expect airline#util#append('', 0) == '' |
|
20 |
+ Expect airline#util#append('1', 0) == ' 1' |
|
21 |
+ end |
|
22 |
+ |
|
23 |
+ it 'has prepend wrapper function' |
|
24 |
+ Expect airline#util#prepend('', 0) == '' |
|
25 |
+ Expect airline#util#prepend('1', 0) == '1 ' |
|
26 |
+ end |
|
27 |
+ |
|
28 |
+ it 'has getwinvar function' |
|
29 |
+ Expect airline#util#getwinvar(1, 'asdf', '123') == '123' |
|
30 |
+ call setwinvar(1, 'vspec', 'is cool') |
|
31 |
+ Expect airline#util#getwinvar(1, 'vspec', '') == 'is cool' |
|
32 |
+ end |
|
33 |
+ |
|
34 |
+ it 'has exec funcrefs helper functions' |
|
35 |
+ call airline#util#exec_funcrefs([function('Util1'), function('Util2')]) |
|
36 |
+ Expect g:count == 3 |
|
37 |
+ |
|
38 |
+ call airline#util#exec_funcrefs([function('Util3')], 1, 2, 3, 4) |
|
39 |
+ Expect g:count == 4 |
|
40 |
+ end |
|
41 |
+ |
|
42 |
+ it 'should ignore minwidth if less than 0' |
|
43 |
+ Expect airline#util#append('foo', -1) == ' foo' |
|
44 |
+ Expect airline#util#prepend('foo', -1) == 'foo ' |
|
45 |
+ Expect airline#util#wrap('foo', -1) == 'foo' |
|
46 |
+ end |
|
47 |
+ |
|
48 |
+ it 'should return empty if winwidth() > minwidth' |
|
49 |
+ Expect airline#util#append('foo', 99999) == '' |
|
50 |
+ Expect airline#util#prepend('foo', 99999) == '' |
|
51 |
+ Expect airline#util#wrap('foo', 99999) == '' |
|
52 |
+ end |
|
53 |
+end |
|
54 |
+ |
... | ... |
@@ -1,114 +0,0 @@ |
1 |
-=================== |
|
2 |
-DEPRECATION WARNING |
|
3 |
-=================== |
|
4 |
- |
|
5 |
-Plugin is currently in maintenance mode, no feature requests will be accepted. |
|
6 |
-Vim-powerline will be deprecated in favour of https://github.com/Lokaltog/powerline once it is ready. |
|
7 |
- |
|
8 |
-================= |
|
9 |
-Powerline for vim |
|
10 |
-================= |
|
11 |
- |
|
12 |
-:Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com) |
|
13 |
-:Source: https://github.com/Lokaltog/vim-powerline |
|
14 |
-:Version: β |
|
15 |
- |
|
16 |
-Introduction |
|
17 |
------------- |
|
18 |
- |
|
19 |
-Powerline is a utility plugin which allows you to create better-looking, |
|
20 |
-more functional vim statuslines. See the screenshots below for |
|
21 |
-a demonstration of the plugin's capabilities. |
|
22 |
- |
|
23 |
-It's recommended that you install the plugin using Pathogen_ or Vundle_. |
|
24 |
-After the plugin is installed update your help tags and see ``:help |
|
25 |
-Powerline`` for instructions on how to enable and configure the plugin. |
|
26 |
- |
|
27 |
-See the `Troubleshooting`_ section below if you're having any issues with |
|
28 |
-the plugin or the font patcher. |
|
29 |
- |
|
30 |
-**Note:** You need a patched font to be able to use the symbols in the |
|
31 |
-statusline. An experimental Python/fontforge-based font patcher is included |
|
32 |
-in the ``fontpatcher`` directory. See ``fontpatcher/README.rst`` for usage |
|
33 |
-instructions. |
|
34 |
- |
|
35 |
-.. _Pathogen: https://github.com/tpope/vim-pathogen |
|
36 |
-.. _Vundle: https://github.com/gmarik/vundle |
|
37 |
- |
|
38 |
-Screenshots |
|
39 |
------------ |
|
40 |
- |
|
41 |
-.. image:: http://i.imgur.com/MsuIB.png |
|
42 |
- |
|
43 |
-Troubleshooting |
|
44 |
---------------- |
|
45 |
- |
|
46 |
-I can't see the fancy symbols, what's wrong? |
|
47 |
- Make sure that you have ``let g:Powerline_symbols = 'fancy'`` in your |
|
48 |
- ``vimrc`` file. The settings may be loaded too late if you have this in |
|
49 |
- ``gvimrc``, so always put this in your ``vimrc``. |
|
50 |
- |
|
51 |
- Clear the cache using ``:PowerlineClearCache`` and restart vim. |
|
52 |
- |
|
53 |
- Make sure that you've configured gvim or your terminal emulator to use |
|
54 |
- a patched font. |
|
55 |
- |
|
56 |
- Make sure that vim is compiled with the ``--with-features=big`` flag. |
|
57 |
- |
|
58 |
-The fancy symbols look a bit blurry or "off"! |
|
59 |
- Make sure that you have patched all variants of your font (i.e. both the |
|
60 |
- regular and the bold font files). |
|
61 |
- |
|
62 |
-I'm unable to patch my font, what should I do? |
|
63 |
- Font patching is only known to work on most Linux and OS X machines. If |
|
64 |
- you have followed the instructions in the fontpatcher README and still |
|
65 |
- have problems, please submit an issue on GitHub. |
|
66 |
- |
|
67 |
- You can download some community-contributed patched fonts from the |
|
68 |
- `Powerline wiki`_ if you don't want to mess around with the font |
|
69 |
- patcher. |
|
70 |
- |
|
71 |
-The Syntastic/Fugitive statusline flags don't work! |
|
72 |
- These flags should work without any configuration. If you installed |
|
73 |
- either plugin after Powerline, you'll have to clear the cache using |
|
74 |
- ``:PowerlineClearCache`` and restart vim. |
|
75 |
- |
|
76 |
-The colors are weird in the default OS X Terminal app! |
|
77 |
- The default OS X Terminal app is known to have some issues with the |
|
78 |
- Powerline colors. Please use another terminal emulator. iTerm2 should |
|
79 |
- work fine. |
|
80 |
- |
|
81 |
- The arrows may have the wrong colors if you have changed the "minimum |
|
82 |
- contrast" slider in the color tab of your OS X settings. |
|
83 |
- |
|
84 |
-The statusline has strange characters like ``^B`` in it! |
|
85 |
- Please add ``set encoding=utf-8`` to your ``vimrc``. |
|
86 |
- |
|
87 |
- You may also need to set your ``LANG`` and ``LC_*`` environment |
|
88 |
- variables to a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your |
|
89 |
- Linux distro's documentation for information about setting these |
|
90 |
- variables correctly. |
|
91 |
- |
|
92 |
-The statusline has a lot of ``^`` or underline characters in it! |
|
93 |
- You need to configure the ``fillchars`` setting to disable statusline |
|
94 |
- fillchars (see ``:h fillchars`` for details). Add this to your |
|
95 |
- ``vimrc`` to solve this issue:: |
|
96 |
- |
|
97 |
- set fillchars+=stl:\ ,stlnc:\ |
|
98 |
- |
|
99 |
-The statusline is hidden/only appears in split windows! |
|
100 |
- Make sure that you have ``set laststatus=2`` in your ``vimrc``. |
|
101 |
- |
|
102 |
-I'm using tmux and Powerline looks like crap, what's wrong? |
|
103 |
- You need to tell tmux that it has 256-color capabilities. Add this to |
|
104 |
- your ``.tmux.conf`` to solve this issue:: |
|
105 |
- |
|
106 |
- set -g default-terminal "screen-256color" |
|
107 |
- |
|
108 |
- If you use iTerm2, make sure that you have enabled the setting 'Set |
|
109 |
- locale variables automatically' in Profiles > Terminal > Environment. |
|
110 |
- |
|
111 |
-If you have any other issues and you can't find the answer in the docs, |
|
112 |
-please submit an issue on GitHub. |
|
113 |
- |
|
114 |
-.. _`Powerline wiki`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts |
... | ... |
@@ -1,184 +0,0 @@ |
1 |
-" Powerline - The ultimate statusline utility |
|
2 |
-" |
|
3 |
-" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com> |
|
4 |
-" Source repository: https://github.com/Lokaltog/vim-powerline |
|
5 |
- |
|
6 |
-" Script variables {{{ |
|
7 |
- let g:Pl#OLD_STL = '' |
|
8 |
- let g:Pl#THEME = [] |
|
9 |
- let g:Pl#THEME_CALLBACKS = [] |
|
10 |
- let g:Pl#HL = [] |
|
11 |
- |
|
12 |
- " Cache revision, this must be incremented whenever the cache format is changed |
|
13 |
- let s:CACHE_REVISION = 7 |
|
14 |
-" }}} |
|
15 |
-" Script initialization {{{ |
|
16 |
- function! Pl#LoadCache() " {{{ |
|
17 |
- if filereadable(g:Powerline_cache_file) && g:Powerline_cache_enabled |
|
18 |
- exec 'source' escape(g:Powerline_cache_file, ' \') |
|
19 |
- |
|
20 |
- if ! exists('g:Powerline_cache_revision') || g:Powerline_cache_revision != s:CACHE_REVISION |
|
21 |
- " Cache revision differs, cache is invalid |
|
22 |
- unlet! g:Powerline_cache_revision |
|
23 |
- |
|
24 |
- return 0 |
|
25 |
- endif |
|
26 |
- |
|
27 |
- " Create highlighting groups |
|
28 |
- for hi_cmd in g:Pl#HL |
|
29 |
- exec hi_cmd |
|
30 |
- endfor |
|
31 |
- |
|
32 |
- " Run theme callbacks |
|
33 |
- for callback in g:Pl#THEME_CALLBACKS |
|
34 |
- " Substitute {{NEWLINE}} with newlines (strings must be |
|
35 |
- " stored without newlines characters to avoid vim errors) |
|
36 |
- exec substitute(callback[0], "{{NEWLINE}}", "\n", 'g') |
|
37 |
- exec substitute(callback[1], "{{NEWLINE}}", "\n", 'g') |
|
38 |
- endfor |
|
39 |
- |
|
40 |
- return 1 |
|
41 |
- endif |
|
42 |
- |
|
43 |
- return 0 |
|
44 |
- endfunction " }}} |
|
45 |
- function! Pl#ClearCache() " {{{ |
|
46 |
- if filereadable(g:Powerline_cache_file) |
|
47 |
- " Delete the cache file |
|
48 |
- call delete(g:Powerline_cache_file) |
|
49 |
- endif |
|
50 |
- |
|
51 |
- echo 'Powerline cache cleared. Please restart vim for the changes to take effect.' |
|
52 |
- endfunction " }}} |
|
53 |
- function! Pl#ReloadColorscheme() " {{{ |
|
54 |
- call Pl#ClearCache() |
|
55 |
- |
|
56 |
- " The colorscheme and theme files must be manually sourced because |
|
57 |
- " vim won't reload previously autoloaded files |
|
58 |
- " |
|
59 |
- " This is a bit hackish, but it works |
|
60 |
- unlet! g:Powerline#Colorschemes#{g:Powerline_colorscheme}#colorscheme |
|
61 |
- exec "source" split(globpath(&rtp, 'autoload/Powerline/Colorschemes/'. g:Powerline_colorscheme .'.vim', 1), '\n')[0] |
|
62 |
- |
|
63 |
- unlet! g:Powerline#Themes#{g:Powerline_theme}#theme |
|
64 |
- exec "source" split(globpath(&rtp, 'autoload/Powerline/Themes/'. g:Powerline_theme .'.vim', 1), '\n')[0] |
|
65 |
- |
|
66 |
- let g:Pl#THEME = [] |
|
67 |
- |
|
68 |
- call Pl#Load() |
|
69 |
- endfunction " }}} |
|
70 |
- function! Pl#Load() " {{{ |
|
71 |
- if empty(g:Pl#OLD_STL) |
|
72 |
- " Store old statusline |
|
73 |
- let g:Pl#OLD_STL = &statusline |
|
74 |
- endif |
|
75 |
- |
|
76 |
- if ! Pl#LoadCache() |
|
77 |
- try |
|
78 |
- " Autoload the theme dict first |
|
79 |
- let raw_theme = g:Powerline#Themes#{g:Powerline_theme}#theme |
|
80 |
- catch |
|
81 |
- echom 'Invalid Powerline theme! Please check your theme and colorscheme settings.' |
|
82 |
- |
|
83 |
- return |
|
84 |
- endtry |
|
85 |
- |
|
86 |
- " Create list with parsed statuslines |
|
87 |
- for buffer_statusline in raw_theme |
|
88 |
- unlet! mode_statuslines |
|
89 |
- let mode_statuslines = Pl#Parser#GetStatusline(buffer_statusline.segments) |
|
90 |
- |
|
91 |
- if ! empty(buffer_statusline.callback) |
|
92 |
- " The callback function passes its arguments on to |
|
93 |
- " Pl#StatuslineCallback along with the normal/current mode |
|
94 |
- " statusline. |
|
95 |
- let s:cb_func = "function! PowerlineStatuslineCallback_". buffer_statusline.callback[1] ."(...)\n" |
|
96 |
- let s:cb_func .= "return Pl#StatuslineCallback(". string(mode_statuslines['n']) .", a:000)\n" |
|
97 |
- let s:cb_func .= "endfunction" |
|
98 |
- |
|
99 |
- " The callback expression should be used to initialize any |
|
100 |
- " variables that will use the callback function. The |
|
101 |
- " expression requires a %s which will be replaced by the |
|
102 |
- " callback function name. |
|
103 |
- let s:cb_expr = printf(buffer_statusline.callback[2], 'PowerlineStatuslineCallback_'. buffer_statusline.callback[1]) |
|
104 |
- |
|
105 |
- exec s:cb_func |
|
106 |
- exec s:cb_expr |
|
107 |
- |
|
108 |
- " Newlines must be substituted with another character |
|
109 |
- " because vim doesn't like newlines in strings |
|
110 |
- call add(g:Pl#THEME_CALLBACKS, [substitute(s:cb_func, "\n", "{{NEWLINE}}", 'g'), substitute(s:cb_expr, "\n", "{{NEWLINE}}", 'g')]) |
|
111 |
- |
|
112 |
- unlet! s:cb_func s:cb_expr |
|
113 |
- |
|
114 |
- continue |
|
115 |
- endif |
|
116 |
- |
|
117 |
- " Store the statuslines for matching specific buffers |
|
118 |
- call add(g:Pl#THEME, { |
|
119 |
- \ 'matches': buffer_statusline.matches, |
|
120 |
- \ 'mode_statuslines': mode_statuslines |
|
121 |
- \ }) |
|
122 |
- endfor |
|
123 |
- |
|
124 |
- if ! g:Powerline_cache_enabled |
|
125 |
- " Don't cache anything if caching is disabled or cache file isn't writeable |
|
126 |
- return |
|
127 |
- endif |
|
128 |
- |
|
129 |
- " Prepare commands and statuslines for caching |
|
130 |
- let cache = [ |
|
131 |
- \ 'let g:Powerline_cache_revision = '. string(s:CACHE_REVISION), |
|
132 |
- \ 'let g:Pl#HL = '. string(g:Pl#HL), |
|
133 |
- \ 'let g:Pl#THEME = '. string(g:Pl#THEME), |
|
134 |
- \ 'let g:Pl#THEME_CALLBACKS = '. string(g:Pl#THEME_CALLBACKS), |
|
135 |
- \ ] |
|
136 |
- |
|
137 |
- call writefile(cache, g:Powerline_cache_file) |
|
138 |
- endif |
|
139 |
- endfunction " }}} |
|
140 |
-" }}} |
|
141 |
-" Statusline updater {{{ |
|
142 |
- function! Pl#Statusline(statusline, current) " {{{ |
|
143 |
- let mode = mode() |
|
144 |
- |
|
145 |
- if ! a:current |
|
146 |
- let mode = 'N' " Normal (non-current) |
|
147 |
- elseif mode =~# '\v(v|V|)' |
|
148 |
- let mode = 'v' " Visual mode |
|
149 |
- elseif mode =~# '\v(s|S|)' |
|
150 |
- let mode = 's' " Select mode |
|
151 |
- elseif mode =~# '\vi' |
|
152 |
- let mode = 'i' " Insert mode |
|
153 |
- elseif mode =~# '\v(R|Rv)' |
|
154 |
- let mode = 'r' " Replace mode |
|
155 |
- else |
|
156 |
- " Fallback to normal mode |
|
157 |
- let mode = 'n' " Normal (current) |
|
158 |
- endif |
|
159 |
- |
|
160 |
- return g:Pl#THEME[a:statusline].mode_statuslines[mode] |
|
161 |
- endfunction " }}} |
|
162 |
- function! Pl#StatuslineCallback(statusline, args) " {{{ |
|
163 |
- " Replace %1, %2, etc. in the statusline with the callback args |
|
164 |
- return substitute( |
|
165 |
- \ a:statusline, |
|
166 |
- \ '\v\%(\d+)', |
|
167 |
- \ '\=a:args[submatch(1)]', |
|
168 |
- \ 'g') |
|
169 |
- endfunction " }}} |
|
170 |
- function! Pl#UpdateStatusline(current, ...) " {{{ |
|
171 |
- if empty(g:Pl#THEME) |
|
172 |
- " Load statuslines if they aren't loaded yet |
|
173 |
- call Pl#Load() |
|
174 |
- endif |
|
175 |
- |
|
176 |
- for i in range(len(g:Pl#THEME)) |
|
177 |
- if Pl#Match#Validate(g:Pl#THEME[i], a:0 ? a:1 : 0) |
|
178 |
- " Update window-local statusline |
|
179 |
- call setwinvar(a:0 ? a:1 : 0, '&statusline', |
|
180 |
- \ '%!Pl#Statusline('. i .','. a:current .')') |
|
181 |
- endif |
|
182 |
- endfor |
|
183 |
- endfunction " }}} |
|
184 |
-" }}} |
... | ... |
@@ -1,145 +0,0 @@ |
1 |
-function! Pl#Colorscheme#Init(hi) " {{{ |
|
2 |
- let colorscheme = {} |
|
3 |
- |
|
4 |
- for hi in a:hi |
|
5 |
- " Ensure that the segments are a list |
|
6 |
- let segments = type(hi[0]) == type('') ? [ hi[0] ] : hi[0] |
|
7 |
- let mode_hi_dict = hi[1] |
|
8 |
- |
|
9 |
- for segment in segments |
|
10 |
- let colorscheme[segment] = mode_hi_dict |
|
11 |
- endfor |
|
12 |
- endfor |
|
13 |
- |
|
14 |
- return colorscheme |
|
15 |
-endfunction " }}} |
|
16 |
-function! Pl#Colorscheme#Apply(colorscheme, buffer_segments) " {{{ |
|
17 |
- " Set color parameters for all segments in a:buffer_segments |
|
18 |
- |
|
19 |
- " TODO This function should be recursive and work on both segments and groups |
|
20 |
- " TODO We could probably handle the NS stuff here... |
|
21 |
- |
|
22 |
- try |
|
23 |
- let colorscheme = g:Powerline#Colorschemes#{a:colorscheme}#colorscheme |
|
24 |
- catch |
|
25 |
- echom 'Color scheme "'. a:colorscheme .'" doesn''t exist!' |
|
26 |
- |
|
27 |
- return |
|
28 |
- endtry |
|
29 |
- |
|
30 |
- let buffer_segments = a:buffer_segments |
|
31 |
- |
|
32 |
- " This is a bit complex, I'll walk you through exactly what happens here... |
|
33 |
- " |
|
34 |
- " First of all we loop through the buffer_segments, which are the segments that |
|
35 |
- " this specific buffer will have. |
|
36 |
- for buffer_segment in buffer_segments |
|
37 |
- " The buffer_segment consists of a 'matches' list and a 'segments' list. |
|
38 |
- " The 'matches' list has conditions to limit this statusline to specific buffers/windows. |
|
39 |
- " The 'segments' list has each segment and segment group for this buffer |
|
40 |
- for segment in buffer_segment.segments |
|
41 |
- let type = get(segment, 'type', '') |
|
42 |
- |
|
43 |
- if type == 'segment_group' |
|
44 |
- " We're going to handle segment groups different from single segments. Segment groups |
|
45 |
- " have child segments which may have their own highlighting (e.g. fileinfo.flags), |
|
46 |
- " and these child segments may be grouped (e.g. fileinfo.flags.ro) to provide very |
|
47 |
- " specific highlighting. So here we'll handle all that: |
|
48 |
- |
|
49 |
- " Set the default/fallback colors for this group |
|
50 |
- for i in range(len(segment.variants), 0, -1) |
|
51 |
- " Check for available highlighting for the main group segment |
|
52 |
- " |
|
53 |
- " This works like the segment highlighting below |
|
54 |
- " TODO Create a function for this |
|
55 |
- let seg_variants = join(segment.variants[0:i], '.') |
|
56 |
- |
|
57 |
- let seg_name = i > 0 ? segment.name .'.'. seg_variants : segment.name |
|
58 |
- let seg_ns_name = len(segment.ns) > 0 ? segment.ns .':'. seg_name : seg_name |
|
59 |
- |
|
60 |
- if has_key(colorscheme, seg_ns_name) |
|
61 |
- " We have a namespaced highlight group |
|
62 |
- let segment.colors = colorscheme[seg_ns_name] |
|
63 |
- break |
|
64 |
- elseif has_key(colorscheme, seg_name) |
|
65 |
- " We have a non-namespaced group |
|
66 |
- let segment.colors = colorscheme[seg_name] |
|
67 |
- break |
|
68 |
- endif |
|
69 |
- endfor |
|
70 |
- |
|
71 |
- " The reason why we need to deepcopy the group's segments is that the child segments |
|
72 |
- " all point to the same base segments and that screws up highlighting if we highlight |
|
73 |
- " some child segments with different namespaced colors |
|
74 |
- let segment.segments = deepcopy(segment.segments) |
|
75 |
- |
|
76 |
- " Apply colors to each child segment |
|
77 |
- for child_segment in segment.segments |
|
78 |
- " Check if this child segment is grouped (e.g. fileinfo.flags.group.subgroup) |
|
79 |
- " We're going to prioritize the most specific grouping and then work back to the |
|
80 |
- " most common group (e.g. fileinfo.flags) |
|
81 |
- |
|
82 |
- " FIXME We don't have the variants from before because group children aren't run through Pl#Segment#Get |
|
83 |
- let child_segment.variants = [seg_name] + split(child_segment.name, '\.') |
|
84 |
- |
|
85 |
- " Use the parent group's namespace |
|
86 |
- let child_segment.ns = segment.ns |
|
87 |
- |
|
88 |
- for i in range(len(child_segment.variants), 0, -1) |
|
89 |
- " Check for available highlighting for the main group segment |
|
90 |
- let child_seg_name = join(child_segment.variants[0:i], '.') |
|
91 |
- |
|
92 |
- let child_seg_ns_name = len(child_segment.ns) > 0 ? child_segment.ns .':'. child_seg_name : child_seg_name |
|
93 |
- |
|
94 |
- if has_key(colorscheme, child_seg_ns_name) |
|
95 |
- " We have a namespaced highlight group |
|
96 |
- let child_segment.colors = colorscheme[child_seg_ns_name] |
|
97 |
- break |
|
98 |
- elseif has_key(colorscheme, child_seg_name) |
|
99 |
- " We have a non-namespaced group |
|
100 |
- let child_segment.colors = colorscheme[child_seg_name] |
|
101 |
- break |
|
102 |
- endif |
|
103 |
- endfor |
|
104 |
- endfor |
|
105 |
- elseif type == 'segment' |
|
106 |
- for i in range(len(segment.variants), 0, -1) |
|
107 |
- " Check for available highlighting |
|
108 |
- " |
|
109 |
- " This is done in the following manner, using the segment gundo:static_filename.text.buffer as an example: |
|
110 |
- " |
|
111 |
- " * Look for the hl group: gundo:static_filename.text.buffer |
|
112 |
- " * Look for the hl group: static_filename.text.buffer |
|
113 |
- " * Look for the hl group: gundo:static_filename.text |
|
114 |
- " * Look for the hl group: static_filename.text |
|
115 |
- " * Look for the hl group: gundo:static_filename |
|
116 |
- " * Look for the hl group: static_filename |
|
117 |
- " * Return the segment without highlighting, causing an error in the parser |
|
118 |
- let seg_variants = join(segment.variants[0:i], '.') |
|
119 |
- |
|
120 |
- let seg_name = i > 0 ? segment.name .'.'. seg_variants : segment.name |
|
121 |
- let seg_ns_name = len(segment.ns) > 0 ? segment.ns .':'. seg_name : seg_name |
|
122 |
- |
|
123 |
- if has_key(colorscheme, seg_ns_name) |
|
124 |
- " We have a namespaced highlight group |
|
125 |
- let segment.colors = colorscheme[seg_ns_name] |
|
126 |
- break |
|
127 |
- elseif has_key(colorscheme, seg_name) |
|
128 |
- " We have a non-namespaced group |
|
129 |
- let segment.colors = colorscheme[seg_name] |
|
130 |
- break |
|
131 |
- endif |
|
132 |
- endfor |
|
133 |
- endif |
|
134 |
- |
|
135 |
- unlet! segment |
|
136 |
- endfor |
|
137 |
- endfor |
|
138 |
- |
|
139 |
- " Good luck parsing this return value |
|
140 |
- " |
|
141 |
- " It's a huge dict with all segments for all buffers with their respective syntax highlighting. |
|
142 |
- " It will be parsed by the main Powerline code, where all the data will be shortened to a simple |
|
143 |
- " array consiting of a statusline for each mode, with generated highlighting groups and dividers. |
|
144 |
- return buffer_segments |
|
145 |
-endfunction " }}} |
... | ... |
@@ -1,140 +0,0 @@ |
1 |
-" cterm -> gui color dict {{{ |
|
2 |
-let s:cterm2gui_dict = { |
|
3 |
- \ 16: 0x000000, 17: 0x00005f, 18: 0x000087, 19: 0x0000af, 20: 0x0000d7, 21: 0x0000ff, |
|
4 |
- \ 22: 0x005f00, 23: 0x005f5f, 24: 0x005f87, 25: 0x005faf, 26: 0x005fd7, 27: 0x005fff, |
|
5 |
- \ 28: 0x008700, 29: 0x00875f, 30: 0x008787, 31: 0x0087af, 32: 0x0087d7, 33: 0x0087ff, |
|
6 |
- \ 34: 0x00af00, 35: 0x00af5f, 36: 0x00af87, 37: 0x00afaf, 38: 0x00afd7, 39: 0x00afff, |
|
7 |
- \ 40: 0x00d700, 41: 0x00d75f, 42: 0x00d787, 43: 0x00d7af, 44: 0x00d7d7, 45: 0x00d7ff, |
|
8 |
- \ 46: 0x00ff00, 47: 0x00ff5f, 48: 0x00ff87, 49: 0x00ffaf, 50: 0x00ffd7, 51: 0x00ffff, |
|
9 |
- \ 52: 0x5f0000, 53: 0x5f005f, 54: 0x5f0087, 55: 0x5f00af, 56: 0x5f00d7, 57: 0x5f00ff, |
|
10 |
- \ 58: 0x5f5f00, 59: 0x5f5f5f, 60: 0x5f5f87, 61: 0x5f5faf, 62: 0x5f5fd7, 63: 0x5f5fff, |
|
11 |
- \ 64: 0x5f8700, 65: 0x5f875f, 66: 0x5f8787, 67: 0x5f87af, 68: 0x5f87d7, 69: 0x5f87ff, |
|
12 |
- \ 70: 0x5faf00, 71: 0x5faf5f, 72: 0x5faf87, 73: 0x5fafaf, 74: 0x5fafd7, 75: 0x5fafff, |
|
13 |
- \ 76: 0x5fd700, 77: 0x5fd75f, 78: 0x5fd787, 79: 0x5fd7af, 80: 0x5fd7d7, 81: 0x5fd7ff, |
|
14 |
- \ 82: 0x5fff00, 83: 0x5fff5f, 84: 0x5fff87, 85: 0x5fffaf, 86: 0x5fffd7, 87: 0x5fffff, |
|
15 |
- \ 88: 0x870000, 89: 0x87005f, 90: 0x870087, 91: 0x8700af, 92: 0x8700d7, 93: 0x8700ff, |
|
16 |
- \ 94: 0x875f00, 95: 0x875f5f, 96: 0x875f87, 97: 0x875faf, 98: 0x875fd7, 99: 0x875fff, |
|
17 |
- \ 100: 0x878700, 101: 0x87875f, 102: 0x878787, 103: 0x8787af, 104: 0x8787d7, 105: 0x8787ff, |
|
18 |
- \ 106: 0x87af00, 107: 0x87af5f, 108: 0x87af87, 109: 0x87afaf, 110: 0x87afd7, 111: 0x87afff, |
|
19 |
- \ 112: 0x87d700, 113: 0x87d75f, 114: 0x87d787, 115: 0x87d7af, 116: 0x87d7d7, 117: 0x87d7ff, |
|
20 |
- \ 118: 0x87ff00, 119: 0x87ff5f, 120: 0x87ff87, 121: 0x87ffaf, 122: 0x87ffd7, 123: 0x87ffff, |
|
21 |
- \ 124: 0xaf0000, 125: 0xaf005f, 126: 0xaf0087, 127: 0xaf00af, 128: 0xaf00d7, 129: 0xaf00ff, |
|
22 |
- \ 130: 0xaf5f00, 131: 0xaf5f5f, 132: 0xaf5f87, 133: 0xaf5faf, 134: 0xaf5fd7, 135: 0xaf5fff, |
|
23 |
- \ 136: 0xaf8700, 137: 0xaf875f, 138: 0xaf8787, 139: 0xaf87af, 140: 0xaf87d7, 141: 0xaf87ff, |
|
24 |
- \ 142: 0xafaf00, 143: 0xafaf5f, 144: 0xafaf87, 145: 0xafafaf, 146: 0xafafd7, 147: 0xafafff, |
|
25 |
- \ 148: 0xafd700, 149: 0xafd75f, 150: 0xafd787, 151: 0xafd7af, 152: 0xafd7d7, 153: 0xafd7ff, |
|
26 |
- \ 154: 0xafff00, 155: 0xafff5f, 156: 0xafff87, 157: 0xafffaf, 158: 0xafffd7, 159: 0xafffff, |
|
27 |
- \ 160: 0xd70000, 161: 0xd7005f, 162: 0xd70087, 163: 0xd700af, 164: 0xd700d7, 165: 0xd700ff, |
|
28 |
- \ 166: 0xd75f00, 167: 0xd75f5f, 168: 0xd75f87, 169: 0xd75faf, 170: 0xd75fd7, 171: 0xd75fff, |
|
29 |
- \ 172: 0xd78700, 173: 0xd7875f, 174: 0xd78787, 175: 0xd787af, 176: 0xd787d7, 177: 0xd787ff, |
|
30 |
- \ 178: 0xd7af00, 179: 0xd7af5f, 180: 0xd7af87, 181: 0xd7afaf, 182: 0xd7afd7, 183: 0xd7afff, |
|
31 |
- \ 184: 0xd7d700, 185: 0xd7d75f, 186: 0xd7d787, 187: 0xd7d7af, 188: 0xd7d7d7, 189: 0xd7d7ff, |
|
32 |
- \ 190: 0xd7ff00, 191: 0xd7ff5f, 192: 0xd7ff87, 193: 0xd7ffaf, 194: 0xd7ffd7, 195: 0xd7ffff, |
|
33 |
- \ 196: 0xff0000, 197: 0xff005f, 198: 0xff0087, 199: 0xff00af, 200: 0xff00d7, 201: 0xff00ff, |
|
34 |
- \ 202: 0xff5f00, 203: 0xff5f5f, 204: 0xff5f87, 205: 0xff5faf, 206: 0xff5fd7, 207: 0xff5fff, |
|
35 |
- \ 208: 0xff8700, 209: 0xff875f, 210: 0xff8787, 211: 0xff87af, 212: 0xff87d7, 213: 0xff87ff, |
|
36 |
- \ 214: 0xffaf00, 215: 0xffaf5f, 216: 0xffaf87, 217: 0xffafaf, 218: 0xffafd7, 219: 0xffafff, |
|
37 |
- \ 220: 0xffd700, 221: 0xffd75f, 222: 0xffd787, 223: 0xffd7af, 224: 0xffd7d7, 225: 0xffd7ff, |
|
38 |
- \ 226: 0xffff00, 227: 0xffff5f, 228: 0xffff87, 229: 0xffffaf, 230: 0xffffd7, 231: 0xffffff, |
|
39 |
- \ 232: 0x080808, 233: 0x121212, 234: 0x1c1c1c, 235: 0x262626, 236: 0x303030, 237: 0x3a3a3a, |
|
40 |
- \ 238: 0x444444, 239: 0x4e4e4e, 240: 0x585858, 241: 0x626262, 242: 0x6c6c6c, 243: 0x767676, |
|
41 |
- \ 244: 0x808080, 245: 0x8a8a8a, 246: 0x949494, 247: 0x9e9e9e, 248: 0xa8a8a8, 249: 0xb2b2b2, |
|
42 |
- \ 250: 0xbcbcbc, 251: 0xc6c6c6, 252: 0xd0d0d0, 253: 0xdadada, 254: 0xe4e4e4, 255: 0xeeeeee |
|
43 |
-\ } |
|
44 |
-" }}} |
|
45 |
-" Allocated color dict {{{ |
|
46 |
-let s:allocated_colors = { |
|
47 |
- \ 'NONE': 'NONE', |
|
48 |
- \ } |
|
49 |
-" }}} |
|
50 |
-function! s:Cterm2GUI(cterm) " {{{ |
|
51 |
- if toupper(a:cterm) == 'NONE' |
|
52 |
- return 'NONE' |
|
53 |
- endif |
|
54 |
- |
|
55 |
- if ! has_key(s:cterm2gui_dict, a:cterm) |
|
56 |
- return 0xff0000 |
|
57 |
- endif |
|
58 |
- |
|
59 |
- return s:cterm2gui_dict[a:cterm] |
|
60 |
-endfunction " }}} |
|
61 |
-function! Pl#Hi#Segments(segments, mode_colors) " {{{ |
|
62 |
- let mode_translate = { |
|
63 |
- \ 'normal': 'n', |
|
64 |
- \ 'noncurrent': 'N', |
|
65 |
- \ 'insert': 'i', |
|
66 |
- \ 'visual': 'v', |
|
67 |
- \ 'replace': 'r', |
|
68 |
- \ 'select': 's', |
|
69 |
- \ } |
|
70 |
- |
|
71 |
- let attributes = ['bold', 'italic', 'underline'] |
|
72 |
- |
|
73 |
- let segments = a:segments |
|
74 |
- let mode_hi_dict = {} |
|
75 |
- |
|
76 |
- " Mode dict |
|
77 |
- for [mode, colors] in items(a:mode_colors) |
|
78 |
- if has_key(mode_translate, mode) |
|
79 |
- let mode = mode_translate[mode] |
|
80 |
- endif |
|
81 |
- |
|
82 |
- unlet! fg |
|
83 |
- let fg = s:allocated_colors[colors[0]] |
|
84 |
- |
|
85 |
- let hi = { |
|
86 |
- \ 'cterm': [fg['cterm'], ''], |
|
87 |
- \ 'gui' : [fg['gui'], ''], |
|
88 |
- \ 'attr' : [] |
|
89 |
- \ } |
|
90 |
- |
|
91 |
- if exists('colors[1]') |
|
92 |
- if type(colors[1]) == type([]) |
|
93 |
- " We don't have a BG color, but we have attributes |
|
94 |
- let hi.attr = colors[1] |
|
95 |
- else |
|
96 |
- " The second parameter is the background color |
|
97 |
- unlet! bg |
|
98 |
- let bg = s:allocated_colors[colors[1]] |
|
99 |
- |
|
100 |
- let hi.cterm[1] = bg['cterm'] |
|
101 |
- let hi.gui[1] = bg['gui'] |
|
102 |
- endif |
|
103 |
- endif |
|
104 |
- |
|
105 |
- if exists('colors[2]') && type(colors[2]) == type([]) |
|
106 |
- " The third parameter is always an attribute list |
|
107 |
- let hi.attr = colors[2] |
|
108 |
- endif |
|
109 |
- |
|
110 |
- let mode_hi_dict[mode] = { |
|
111 |
- \ 'ctermfg': (empty(hi['cterm'][0]) ? '' : (string(hi['cterm'][0]) == 'NONE' ? 'NONE' : hi['cterm'][0])), |
|
112 |
- \ 'ctermbg': (empty(hi['cterm'][1]) ? '' : (string(hi['cterm'][1]) == 'NONE' ? 'NONE' : hi['cterm'][1])), |
|
113 |
- \ 'guifg' : (empty(hi['gui'][0]) ? '' : (string(hi['gui'][0]) == 'NONE' ? 'NONE' : hi['gui'][0])), |
|
114 |
- \ 'guibg' : (empty(hi['gui'][1]) ? '' : (string(hi['gui'][1]) == 'NONE' ? 'NONE' : hi['gui'][1])), |
|
115 |
- \ 'attr' : (! len(hi['attr']) ? 'NONE' : join(hi['attr'], ',')) |
|
116 |
- \ } |
|
117 |
- endfor |
|
118 |
- |
|
119 |
- return [segments, mode_hi_dict] |
|
120 |
-endfunction " }}} |
|
121 |
-function! Pl#Hi#Allocate(colors) " {{{ |
|
122 |
- for [key, color] in items(a:colors) |
|
123 |
- if type(color) == type(0) |
|
124 |
- " Only terminal color |
|
125 |
- let cterm = color |
|
126 |
- let gui = s:Cterm2GUI(color) |
|
127 |
- elseif type(color) == type([]) && len(color) == 2 |
|
128 |
- " Terminal and GUI colors |
|
129 |
- let cterm = color[0] |
|
130 |
- let gui = color[1] |
|
131 |
- endif |
|
132 |
- |
|
133 |
- let s:allocated_colors[key] = { |
|
134 |
- \ 'cterm': cterm, |
|
135 |
- \ 'gui': gui, |
|
136 |
- \ } |
|
137 |
- |
|
138 |
- unlet! color |
|
139 |
- endfor |
|
140 |
-endfunction " }}} |
... | ... |
@@ -1,43 +0,0 @@ |
1 |
-function! Pl#Match#Add(pat, expr) " {{{ |
|
2 |
- return [a:pat, a:expr] |
|
3 |
-endfunction " }}} |
|
4 |
-function! Pl#Match#Any(...) " {{{ |
|
5 |
- let matches = [] |
|
6 |
- |
|
7 |
- for match_name in a:000 |
|
8 |
- if empty(match_name) |
|
9 |
- " Skip empty match parameters |
|
10 |
- continue |
|
11 |
- endif |
|
12 |
- |
|
13 |
- if has_key(g:Powerline#Matches#matches, match_name) |
|
14 |
- call add(matches, g:Powerline#Matches#matches[match_name]) |
|
15 |
- endif |
|
16 |
- |
|
17 |
- unlet! match_name |
|
18 |
- endfor |
|
19 |
- |
|
20 |
- return ['match', 'any', matches] |
|
21 |
-endfunction " }}} |
|
22 |
-function! Pl#Match#Validate(theme, window) " {{{ |
|
23 |
- let match = a:theme.matches[1] |
|
24 |
- |
|
25 |
- if match == 'none' |
|
26 |
- return 0 |
|
27 |
- elseif match == 'any' |
|
28 |
- let matches = a:theme.matches[2] |
|
29 |
- |
|
30 |
- if ! len(matches) |
|
31 |
- " Empty match array matches everything |
|
32 |
- return 1 |
|
33 |
- endif |
|
34 |
- |
|
35 |
- for [eval, re] in matches |
|
36 |
- if match(eval(eval), '\v\C'. re) != -1 |
|
37 |
- return 1 |
|
38 |
- endif |
|
39 |
- endfor |
|
40 |
- |
|
41 |
- return 0 |
|
42 |
- endif |
|
43 |
-endfunction " }}} |
... | ... |
@@ -1,40 +0,0 @@ |
1 |
-let s:segment_mods = [] |
|
2 |
- |
|
3 |
-function! Pl#Mod#AddSegmentMod(action, properties) " {{{ |
|
4 |
- call add(s:segment_mods, [a:action, a:properties]) |
|
5 |
-endfunction " }}} |
|
6 |
-function! Pl#Mod#ApplySegmentMods(theme) " {{{ |
|
7 |
- let theme = deepcopy(a:theme) |
|
8 |
- |
|
9 |
- for mod in s:segment_mods |
|
10 |
- let [action, properties] = mod |
|
11 |
- |
|
12 |
- " We have to loop through the segments instead of using index() because some |
|
13 |
- " segments are lists! |
|
14 |
- let target_seg_idx = -1 |
|
15 |
- |
|
16 |
- for i in range(0, len(theme) - 1) |
|
17 |
- unlet! segment |
|
18 |
- let segment = theme[i] |
|
19 |
- |
|
20 |
- if type(segment) == type(properties.target_segment) && segment == properties.target_segment |
|
21 |
- let target_seg_idx = i |
|
22 |
- break |
|
23 |
- endif |
|
24 |
- endfor |
|
25 |
- |
|
26 |
- if action == 'insert_segment' |
|
27 |
- " Insert segment |
|
28 |
- if target_seg_idx != -1 |
|
29 |
- call insert(theme, properties.new_segment, (properties.where == 'before' ? target_seg_idx : target_seg_idx + 1)) |
|
30 |
- endif |
|
31 |
- elseif action == 'remove_segment' |
|
32 |
- " Remove segment |
|
33 |
- if target_seg_idx != -1 |
|
34 |
- call remove(theme, target_seg_idx) |
|
35 |
- endif |
|
36 |
- endif |
|
37 |
- endfor |
|
38 |
- |
|
39 |
- return theme |
|
40 |
-endfunction " }}} |
... | ... |
@@ -1,371 +0,0 @@ |
1 |
-let g:Pl#Parser#Symbols = { |
|
2 |
- \ 'compatible': { |
|
3 |
- \ 'dividers': [ '', [0x2502], '', [0x2502] ] |
|
4 |
- \ , 'symbols' : { |
|
5 |
- \ 'BRANCH': 'BR:' |
|
6 |
- \ , 'RO' : 'RO' |
|
7 |
- \ , 'FT' : 'FT' |
|
8 |
- \ , 'LINE' : 'LN' |
|
9 |
- \ } |
|
10 |
- \ }, |
|
11 |
- \ 'unicode': { |
|
12 |
- \ 'dividers': [ [0x25b6], [0x276f], [0x25c0], [0x276e] ] |
|
13 |
- \ , 'symbols' : { |
|
14 |
- \ 'BRANCH': [0x26a1] |
|
15 |
- \ , 'RO' : [0x2613] |
|
16 |
- \ , 'FT' : [0x2691] |
|
17 |
- \ , 'LINE' : [0x204b] |
|
18 |
- \ }, |
|
19 |
- \ }, |
|
20 |
- \ 'fancy': { |
|
21 |
- \ 'dividers': [ [0x2b80], [0x2b81], [0x2b82], [0x2b83] ] |
|
22 |
- \ , 'symbols' : { |
|
23 |
- \ 'BRANCH': [0x2b60] |
|
24 |
- \ , 'RO' : [0x2b64] |
|
25 |
- \ , 'FT' : [0x2b62, 0x2b63] |
|
26 |
- \ , 'LINE' : [0x2b61] |
|
27 |
- \ } |
|
28 |
- \ } |
|
29 |
-\ } |
|
30 |
- |
|
31 |
-" Handle symbol overrides |
|
32 |
-for [s:key, s:value] in items(g:Powerline_symbols_override) |
|
33 |
- let g:Pl#Parser#Symbols[g:Powerline_symbols].symbols[s:key] = s:value |
|
34 |
- |
|
35 |
- unlet! s:key s:value |
|
36 |
-endfor |
|
37 |
- |
|
38 |
-" Handle divider overrides |
|
39 |
-if len(g:Powerline_dividers_override) == 4 |
|
40 |
- let g:Pl#Parser#Symbols[g:Powerline_symbols].dividers = g:Powerline_dividers_override |
|
41 |
-endif |
|
42 |
- |
|
43 |
-let s:LEFT_SIDE = 0 |
|
44 |
-let s:RIGHT_SIDE = 2 |
|
45 |
- |
|
46 |
-let s:PADDING = 1 |
|
47 |
- |
|
48 |
-let s:EMPTY_SEGMENT = { 'type': 'empty' } |
|
49 |
- |
|
50 |
-let s:HARD_DIVIDER = 0 |
|
51 |
-let s:SOFT_DIVIDER = 1 |
|
52 |
- |
|
53 |
-function! Pl#Parser#GetStatusline(segments) " {{{ |
|
54 |
- let statusline = { |
|
55 |
- \ 'n': '' |
|
56 |
- \ , 'N': '' |
|
57 |
- \ , 'v': '' |
|
58 |
- \ , 'i': '' |
|
59 |
- \ , 'r': '' |
|
60 |
- \ , 's': '' |
|
61 |
- \ } |
|
62 |
- |
|
63 |
- " Run through the different modes and create the statuslines |
|
64 |
- for mode in keys(statusline) |
|
65 |
- " Create an empty statusline list |
|
66 |
- let stl = [] |
|
67 |
- |
|
68 |
- call extend(stl, s:ParseSegments(mode, s:LEFT_SIDE, a:segments)) |
|
69 |
- |
|
70 |
- let statusline[mode] .= join(stl, '') |
|
71 |
- endfor |
|
72 |
- |
|
73 |
- return statusline |
|
74 |
-endfunction " }}} |
|
75 |
-function! Pl#Parser#ParseChars(arg) " {{{ |
|
76 |
- " Handles symbol arrays which can be either an array of hex values, |
|
77 |
- " or a string. Will convert the hex array to a string, or return the |
|
78 |
- " string as-is. |
|
79 |
- let arg = a:arg |
|
80 |
- |
|
81 |
- if type(arg) == type([]) |
|
82 |
- " Hex array |
|
83 |
- call map(arg, 'nr2char(v:val)') |
|
84 |
- |
|
85 |
- return join(arg, '') |
|
86 |
- endif |
|
87 |
- |
|
88 |
- " Anything else, just return it as it is |
|
89 |
- return arg |
|
90 |
-endfunction " }}} |
|
91 |
-function! s:ParseSegments(mode, side, segments, ...) " {{{ |
|
92 |
- let mode = a:mode |
|
93 |
- let side = a:side |
|
94 |
- let segments = a:segments |
|
95 |
- |
|
96 |
- let level = exists('a:1') ? a:1 : 0 |
|
97 |
- let base_color = exists('a:2') ? a:2 : {} |
|
98 |
- |
|
99 |
- let ret = [] |
|
100 |
- |
|
101 |
- for i in range(0, len(segments) - 1) |
|
102 |
- unlet! seg_prev seg_curr seg_next |
|
103 |
- |
|
104 |
- " Prepare some resources (fetch previous, current and next segment) |
|
105 |
- let seg_curr = deepcopy(get(segments, i)) |
|
106 |
- |
|
107 |
- " Find previous segment |
|
108 |
- let seg_prev = s:EMPTY_SEGMENT |
|
109 |
- |
|
110 |
- " If we're currently at i = 0 we have to start on 0 or else we will start on the last segment (list[-1]) |
|
111 |
- let range_start = (i == 0 ? i : i - 1) |
|
112 |
- for j in range(range_start, 0, -1) |
|
113 |
- let seg = deepcopy(get(segments, j)) |
|
114 |
- if get(seg, 'name') ==# 'TRUNCATE' |
|
115 |
- " Skip truncate segments |
|
116 |
- continue |
|
117 |
- endif |
|
118 |
- |
|
119 |
- " Look ahead for another segment that's visible in this mode |
|
120 |
- if index(get(seg, 'modes'), mode) != -1 |
|
121 |
- " Use this segment |
|
122 |
- let seg_prev = seg |
|
123 |
- |
|
124 |
- break |
|
125 |
- endif |
|
126 |
- endfor |
|
127 |
- |
|
128 |
- "" Find next segment |
|
129 |
- let seg_next = s:EMPTY_SEGMENT |
|
130 |
- |
|
131 |
- " If we're currently at i = len(segments) - 1 we have to start on i or else we will get an error because the index doesn't exist |
|
132 |
- let range_start = (i == len(segments) - 1 ? i : i + 1) |
|
133 |
- for j in range(range_start, len(segments) - 1, 1) |
|
134 |
- let seg = deepcopy(get(segments, j)) |
|
135 |
- if get(seg, 'name') ==# 'TRUNCATE' |
|
136 |
- " Skip truncate segments |
|
137 |
- continue |
|
138 |
- endif |
|
139 |
- |
|
140 |
- " Look ahead for another segment that's visible in this mode |
|
141 |
- if index(get(seg, 'modes'), mode) != -1 |
|
142 |
- " Use this segment |
|
143 |
- let seg_next = seg |
|
144 |
- |
|
145 |
- break |
|
146 |
- endif |
|
147 |
- endfor |
|
148 |
- |
|
149 |
- if index(get(seg_curr, 'modes', []), mode) == -1 |
|
150 |
- " The segment is invisible in this mode, skip it |
|
151 |
- " FIXME When two segments after each other are hidden, a gap appears where the segments would be, this is probably due to segment padding |
|
152 |
- continue |
|
153 |
- endif |
|
154 |
- |
|
155 |
- " Handle the different segment types |
|
156 |
- if seg_curr.type == 'segment' |
|
157 |
- if seg_curr.name ==# 'TRUNCATE' |
|
158 |
- " Truncate statusline |
|
159 |
- call add(ret, '%<') |
|
160 |
- elseif seg_curr.name ==# 'SPLIT' |
|
161 |
- " Split statusline |
|
162 |
- |
|
163 |
- " Switch sides |
|
164 |
- let side = s:RIGHT_SIDE |
|
165 |
- |
|
166 |
- " Handle highlighting |
|
167 |
- let mode_colors = get(seg_curr.colors, mode, seg_curr.colors['n']) |
|
168 |
- let hl_group = s:HlCreate(mode_colors) |
|
169 |
- |
|
170 |
- " Add segment text |
|
171 |
- call add(ret, '%#'. hl_group .'#%=') |
|
172 |
- else |
|
173 |
- " Add segment text |
|
174 |
- let text = seg_curr.text |
|
175 |
- |
|
176 |
- " Decide on whether to use the group's colors or the segment's colors |
|
177 |
- let colors = get(seg_curr, 'colors', base_color) |
|
178 |
- |
|
179 |
- " Fallback to normal (current) highlighting if we don't have mode-specific highlighting |
|
180 |
- let mode_colors = get(colors, mode, get(colors, 'n', {})) |
|
181 |
- |
|
182 |
- if empty(mode_colors) |
|
183 |
- echom 'Segment doesn''t have any colors! NS: "'. seg_curr.ns .'" SEG: "'. seg_curr.name .'"' |
|
184 |
- |
|
185 |
- continue |
|
186 |
- endif |
|
187 |
- |
|
188 |
- " Check if we're in a group (level > 0) |
|
189 |
- if level > 0 |
|
190 |
- " If we're in a group we don't have dividers between |
|
191 |
- " segments, so we should only pad one side, but only pad |
|
192 |
- " if the segment doesn't have Pl#Segment#NoPadding() set |
|
193 |
- let padding_right = (seg_curr.padding && side == s:LEFT_SIDE ? repeat(' ', s:PADDING) : '') |
|
194 |
- let padding_left = (seg_curr.padding && side == s:RIGHT_SIDE ? repeat(' ', s:PADDING) : '') |
|
195 |
- |
|
196 |
- " Check if we lack a bg/fg color for this segment |
|
197 |
- " If we do, use the bg/fg color from base_color |
|
198 |
- let base_color_mode = ! has_key(base_color, mode) ? base_color['n'] : base_color[mode] |
|
199 |
- |
|
200 |
- for col in ['ctermbg', 'ctermfg', 'guibg', 'guifg'] |
|
201 |
- if empty(mode_colors[col]) |
|
202 |
- let mode_colors[col] = base_color_mode[col] |
|
203 |
- endif |
|
204 |
- endfor |
|
205 |
- else |
|
206 |
- "" If we're outside a group we have dividers and must pad both sides |
|
207 |
- let padding_left = repeat(' ', s:PADDING) |
|
208 |
- let padding_right = repeat(' ', s:PADDING) |
|
209 |
- endif |
|
210 |
- |
|
211 |
- " Get main hl group for segment |
|
212 |
- let hl_group = s:HlCreate(mode_colors) |
|
213 |
- |
|
214 |
- " Prepare segment text |
|
215 |
- let text = '%(%#'. hl_group .'#'. padding_left . text . padding_right . '%)' |
|
216 |
- |
|
217 |
- if level == 0 |
|
218 |
- " Add divider to single segments |
|
219 |
- let text = s:AddDivider(text, side, mode, colors, seg_prev, seg_curr, seg_next) |
|
220 |
- endif |
|
221 |
- |
|
222 |
- call add(ret, text) |
|
223 |
- endif |
|
224 |
- elseif seg_curr.type == 'segment_group' |
|
225 |
- " Recursively parse segment group |
|
226 |
- let func_params = [mode, side, seg_curr.segments, level + 1] |
|
227 |
- |
|
228 |
- if has_key(seg_curr, 'colors') |
|
229 |
- " Pass the base colors on to the child segments |
|
230 |
- call add(func_params, seg_curr.colors) |
|
231 |
- endif |
|
232 |
- |
|
233 |
- " Get segment group string |
|
234 |
- let text = join(call('s:ParseSegments', func_params), '') |
|
235 |
- |
|
236 |
- " Pad on the opposite side of the divider |
|
237 |
- let padding_right = (side == s:RIGHT_SIDE ? repeat(' ', s:PADDING) : '') |
|
238 |
- let padding_left = (side == s:LEFT_SIDE ? repeat(' ', s:PADDING) : '') |
|
239 |
- |
|
240 |
- let text = s:AddDivider(padding_left . text . padding_right, side, mode, seg_curr.colors, seg_prev, seg_curr, seg_next) |
|
241 |
- |
|
242 |
- call add(ret, text) |
|
243 |
- endif |
|
244 |
- endfor |
|
245 |
- |
|
246 |
- return ret |
|
247 |
-endfunction " }}} |
|
248 |
-function! s:HlCreate(hl) " {{{ |
|
249 |
- " Create a short and unique highlighting group name |
|
250 |
- " It uses the hex values of all the color properties and an attribute flag at the end |
|
251 |
- " NONE colors are translated to NN for cterm and NNNNNN for gui colors |
|
252 |
- let hi_group = printf('Pl%s%s%s%s%s' |
|
253 |
- \ , (a:hl['ctermfg'] == 'NONE' ? 'NN' : printf('%02x', a:hl['ctermfg'])) |
|
254 |
- \ , (a:hl['guifg'] == 'NONE' ? 'NNNNNN' : printf('%06x', a:hl['guifg'] )) |
|
255 |
- \ , (a:hl['ctermbg'] == 'NONE' ? 'NN' : printf('%02x', a:hl['ctermbg'])) |
|
256 |
- \ , (a:hl['guibg'] == 'NONE' ? 'NNNNNN' : printf('%06x', a:hl['guibg'] )) |
|
257 |
- \ , substitute(a:hl['attr'], '\v([a-zA-Z])[a-zA-Z]*,?', '\1', 'g') |
|
258 |
- \ ) |
|
259 |
- |
|
260 |
- if ! s:HlExists(hi_group) |
|
261 |
- let ctermbg = a:hl['ctermbg'] == 'NONE' ? 'NONE' : printf('%d', a:hl['ctermbg']) |
|
262 |
- if (has('win32') || has('win64')) && !has('gui_running') && ctermbg != 'NONE' && ctermbg > 128 |
|
263 |
- let ctermbg -= 128 |
|
264 |
- endif |
|
265 |
- let hi_cmd = printf('hi %s ctermfg=%s ctermbg=%s cterm=%s guifg=%s guibg=%s gui=%s' |
|
266 |
- \ , hi_group |
|
267 |
- \ , a:hl['ctermfg'] == 'NONE' ? 'NONE' : printf('%d', a:hl['ctermfg']) |
|
268 |
- \ , ctermbg |
|
269 |
- \ , a:hl['attr'] |
|
270 |
- \ , (a:hl['guifg'] == 'NONE' ? 'NONE' : printf('#%06x', a:hl['guifg'])) |
|
271 |
- \ , (a:hl['guibg'] == 'NONE' ? 'NONE' : printf('#%06x', a:hl['guibg'])) |
|
272 |
- \ , a:hl['attr'] |
|
273 |
- \ ) |
|
274 |
- |
|
275 |
- exec hi_cmd |
|
276 |
- |
|
277 |
- " Add command to Pl#HL list for caching |
|
278 |
- call add(g:Pl#HL, hi_cmd) |
|
279 |
- endif |
|
280 |
- |
|
281 |
- " Return only the highlighting group name |
|
282 |
- return hi_group |
|
283 |
-endfunction " }}} |
|
284 |
-function! s:HlExists(hl) " {{{ |
|
285 |
- if ! hlexists(a:hl) |
|
286 |
- return 0 |
|
287 |
- endif |
|
288 |
- |
|
289 |
- redir => hlstatus |
|
290 |
- silent exec 'hi' a:hl |
|
291 |
- redir END |
|
292 |
- |
|
293 |
- return (hlstatus !~ 'cleared') |
|
294 |
-endfunction " }}} |
|
295 |
-function! s:AddDivider(text, side, mode, colors, prev, curr, next) " {{{ |
|
296 |
- let seg_prev = a:prev |
|
297 |
- let seg_curr = a:curr |
|
298 |
- let seg_next = a:next |
|
299 |
- |
|
300 |
- " Set default color/type for the divider |
|
301 |
- let div_colors = get(a:colors, a:mode, a:colors['n']) |
|
302 |
- let div_type = s:SOFT_DIVIDER |
|
303 |
- |
|
304 |
- " Define segment to compare |
|
305 |
- let cmp_seg = a:side == s:LEFT_SIDE ? seg_next : seg_prev |
|
306 |
- |
|
307 |
- let cmp_all_colors = get(cmp_seg, 'colors', {}) |
|
308 |
- let cmp_colors = get(cmp_all_colors, a:mode, get(cmp_all_colors, 'n', {})) |
|
309 |
- |
|
310 |
- if ! empty(cmp_colors) |
|
311 |
- " Compare the highlighting groups |
|
312 |
- " |
|
313 |
- " If the background color for cterm is equal, use soft divider with the current segment's highlighting |
|
314 |
- " If not, use hard divider with a new highlighting group |
|
315 |
- " |
|
316 |
- " Note that if the previous/next segment is the split, a hard divider is always used |
|
317 |
- if get(div_colors, 'ctermbg') != get(cmp_colors, 'ctermbg') || get(seg_next, 'name') ==# 'SPLIT' || get(seg_prev, 'name') ==# 'SPLIT' |
|
318 |
- let div_type = s:HARD_DIVIDER |
|
319 |
- |
|
320 |
- " Create new highlighting group |
|
321 |
- if div_colors['attr'] =~ 'reverse' && cmp_colors['attr'] =~ 'reverse' |
|
322 |
- " Use FG = CURRENT FG, BG = CMP FG |
|
323 |
- let div_colors['ctermbg'] = get(cmp_colors, 'ctermfg') |
|
324 |
- let div_colors['guibg'] = get(cmp_colors, 'guifg') |
|
325 |
- |
|
326 |
- let div_colors['attr'] = div_colors['attr'] =~ 'bold' ? 'bold' : 'NONE' |
|
327 |
- elseif div_colors['attr'] =~ 'reverse' |
|
328 |
- " Use FG = CURRENT FG, BG = CMP BG |
|
329 |
- let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg') |
|
330 |
- let div_colors['guibg'] = get(cmp_colors, 'guibg') |
|
331 |
- |
|
332 |
- let div_colors['attr'] = div_colors['attr'] =~ 'bold' ? 'bold' : 'NONE' |
|
333 |
- elseif cmp_colors['attr'] =~ 'reverse' |
|
334 |
- " Use FG = CMP FG, BG = CURRENT BG : reversed |
|
335 |
- let div_colors['ctermfg'] = get(cmp_colors, 'ctermfg') |
|
336 |
- let div_colors['guifg'] = get(cmp_colors, 'guifg') |
|
337 |
- |
|
338 |
- let div_colors['attr'] = 'reverse' |
|
339 |
- |
|
340 |
- else |
|
341 |
- " Use FG = CURRENT BG, BG = CMP BG |
|
342 |
- let div_colors['ctermfg'] = get(div_colors, 'ctermbg') |
|
343 |
- let div_colors['guifg'] = get(div_colors, 'guibg') |
|
344 |
- |
|
345 |
- let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg') |
|
346 |
- let div_colors['guibg'] = get(cmp_colors, 'guibg') |
|
347 |
- |
|
348 |
- let div_colors['attr'] = 'NONE' |
|
349 |
- endif |
|
350 |
- endif |
|
351 |
- endif |
|
352 |
- |
|
353 |
- " Prepare divider |
|
354 |
- let divider_raw = deepcopy(g:Pl#Parser#Symbols[g:Powerline_symbols].dividers[a:side + div_type]) |
|
355 |
- let divider = Pl#Parser#ParseChars(divider_raw) |
|
356 |
- |
|
357 |
- " Don't add dividers for segments adjacent to split (unless it's a hard divider) |
|
358 |
- if ((get(seg_next, 'name') ==# 'SPLIT' || get(seg_prev, 'name') ==# 'SPLIT') && div_type != s:HARD_DIVIDER) |
|
359 |
- return '' |
|
360 |
- endif |
|
361 |
- |
|
362 |
- if a:side == s:LEFT_SIDE |
|
363 |
- " Left side |
|
364 |
- " Divider to the right |
|
365 |
- return printf('%%(%s%%#%s#%s%%)', a:text, s:HlCreate(div_colors), divider) |
|
366 |
- else |
|
367 |
- " Right side |
|
368 |
- " Divider to the left |
|
369 |
- return printf('%%(%%#%s#%s%s%%)', s:HlCreate(div_colors), divider, a:text) |
|
370 |
- endif |
|
371 |
-endfunction " }}} |
... | ... |
@@ -1,188 +0,0 @@ |
1 |
-let s:default_modes = ['n', 'N', 'v', 'i', 'r', 's'] |
|
2 |
- |
|
3 |
-function! s:CheckConditions(params) " {{{ |
|
4 |
- " Check conditions for a segment/group |
|
5 |
- " Integer parameters are always conditions |
|
6 |
- for param in a:params |
|
7 |
- if type(param) == type(0) && param == 0 |
|
8 |
- " Break here if it's an integer parameter and it's false (0) |
|
9 |
- return 0 |
|
10 |
- endif |
|
11 |
- unlet! param |
|
12 |
- endfor |
|
13 |
- |
|
14 |
- return 1 |
|
15 |
-endfunction " }}} |
|
16 |
-function! Pl#Segment#Create(name, ...) " {{{ |
|
17 |
- " Check condition parameters |
|
18 |
- if ! s:CheckConditions(a:000) |
|
19 |
- return {} |
|
20 |
- endif |
|
21 |
- |
|
22 |
- let name = a:name |
|
23 |
- let modes = s:default_modes |
|
24 |
- let padding = 1 |
|
25 |
- let segments = [] |
|
26 |
- |
|
27 |
- for param in a:000 |
|
28 |
- " Lookup modes for this segment/group |
|
29 |
- if type(param) == type([]) && param[0] == 'modes' |
|
30 |
- let modes = param[1] |
|
31 |
- elseif type(param) == type([]) && param[0] == 'nopadding' |
|
32 |
- let padding = 0 |
|
33 |
- elseif type(a:1) == type([]) && a:1[0] == 'segment' |
|
34 |
- call add(segments, param[1]) |
|
35 |
- endif |
|
36 |
- |
|
37 |
- unlet! param |
|
38 |
- endfor |
|
39 |
- |
|
40 |
- if type(a:1) == type([]) && a:1[0] == 'segment' |
|
41 |
- " This is a segment group |
|
42 |
- return ['segment_group', { |
|
43 |
- \ 'type': 'segment_group' |
|
44 |
- \ , 'name': name |
|
45 |
- \ , 'segments': segments |
|
46 |
- \ , 'modes': modes |
|
47 |
- \ , 'padding': padding |
|
48 |
- \ }] |
|
49 |
- else |
|
50 |
- " This is a single segment |
|
51 |
- let text = a:1 |
|
52 |
- |
|
53 |
- " Search/replace symbols |
|
54 |
- for [key, symbol] in items(g:Pl#Parser#Symbols[g:Powerline_symbols].symbols) |
|
55 |
- let text = substitute( |
|
56 |
- \ text, |
|
57 |
- \ '\v\$('. key .')', |
|
58 |
- \ '\=Pl#Parser#ParseChars(g:Pl#Parser#Symbols[g:Powerline_symbols].symbols[submatch(1)])', |
|
59 |
- \ 'g') |
|
60 |
- |
|
61 |
- unlet! key symbol |
|
62 |
- endfor |
|
63 |
- |
|
64 |
- return ['segment', { |
|
65 |
- \ 'type': 'segment' |
|
66 |
- \ , 'name': name |
|
67 |
- \ , 'text': text |
|
68 |
- \ , 'modes': modes |
|
69 |
- \ , 'padding': padding |
|
70 |
- \ }] |
|
71 |
- endif |
|
72 |
- |
|
73 |
-endfunction " }}} |
|
74 |
-function! Pl#Segment#Init(params) " {{{ |
|
75 |
- " Check condition parameters |
|
76 |
- if ! s:CheckConditions(a:params) |
|
77 |
- return {} |
|
78 |
- endif |
|
79 |
- |
|
80 |
- let segments = {} |
|
81 |
- let ns = '' |
|
82 |
- |
|
83 |
- for param in a:params |
|
84 |
- if type(param) == type('') |
|
85 |
- " String parameters is the namespace |
|
86 |
- let ns = param |
|
87 |
- elseif type(param) == type([]) |
|
88 |
- " The data dict is in param[1] |
|
89 |
- " By default we don't have a namespace for the segment |
|
90 |
- let segment = param[1] |
|
91 |
- |
|
92 |
- if ! empty(ns) |
|
93 |
- " Update segment so that it includes the namespace |
|
94 |
- " Add the namespace to the segment dict key |
|
95 |
- let segment.ns = ns |
|
96 |
- let segment.name = join([segment.ns, segment.name], ':') |
|
97 |
- endif |
|
98 |
- |
|
99 |
- let key = segment.name |
|
100 |
- |
|
101 |
- let segments[key] = segment |
|
102 |
- endif |
|
103 |
- |
|
104 |
- unlet! param |
|
105 |
- endfor |
|
106 |
- |
|
107 |
- return segments |
|
108 |
-endfunction " }}} |
|
109 |
-function! Pl#Segment#Modes(modes) " {{{ |
|
110 |
- " Handle modes for both segments and groups |
|
111 |
- let modes = split(a:modes, '\zs') |
|
112 |
- |
|
113 |
- if modes[0] == '!' |
|
114 |
- " Filter modes (e.g. "!nr" will ignore the segment in normal and replace modes) |
|
115 |
- let modes = filter(deepcopy(s:default_modes), 'v:val !~# "['. join(modes[1:]) .']"') |
|
116 |
- endif |
|
117 |
- |
|
118 |
- return ['modes', modes] |
|
119 |
-endfunction " }}} |
|
120 |
-function! Pl#Segment#NoPadding() " {{{ |
|
121 |
- return ['nopadding'] |
|
122 |
-endfunction " }}} |
|
123 |
-function! Pl#Segment#Split(...) " {{{ |
|
124 |
- return a:0 ? a:1 .':SPLIT' : 'SPLIT' |
|
125 |
-endfunction " }}} |
|
126 |
-function! Pl#Segment#Truncate() " {{{ |
|
127 |
- return 'TRUNCATE' |
|
128 |
-endfunction " }}} |
|
129 |
-function! Pl#Segment#Get(name) " {{{ |
|
130 |
- " Return a segment data dict |
|
131 |
- let args = [] |
|
132 |
- |
|
133 |
- " Check for printf segments (lists) |
|
134 |
- if type(a:name) == type([]) |
|
135 |
- " We're dealing with a segment with printf arguments |
|
136 |
- let seg_orig_name = a:name[0] |
|
137 |
- let args = a:name[1:] |
|
138 |
- else |
|
139 |
- let seg_orig_name = a:name |
|
140 |
- endif |
|
141 |
- |
|
142 |
- " Fetch namespace and variants for storing in the segment dict |
|
143 |
- let seg_ns = '' |
|
144 |
- let seg_variants = [] |
|
145 |
- |
|
146 |
- " Retrieve color scheme variants |
|
147 |
- let seg_name_split = split(seg_orig_name, '\v\.') |
|
148 |
- if len(seg_name_split) > 1 |
|
149 |
- let seg_variants = seg_name_split[1:] |
|
150 |
- endif |
|
151 |
- |
|
152 |
- " Retrieve segment name and namespace |
|
153 |
- " Use the first piece of the split string, we can't have variants in the final segment name |
|
154 |
- let seg_name_split = split(seg_name_split[0], '\v:') |
|
155 |
- let seg_name = seg_name_split[0] |
|
156 |
- |
|
157 |
- if len(seg_name_split) > 1 |
|
158 |
- let seg_ns = seg_name_split[0] |
|
159 |
- let seg_name = seg_name_split[-1] |
|
160 |
- endif |
|
161 |
- |
|
162 |
- try |
|
163 |
- " If we have a namespace, try to use the namespaced segment first (i.e. search for the segment in the namespaced file first) |
|
164 |
- let return_segment = deepcopy(g:Powerline#Segments#{seg_ns}#segments[seg_ns .':'. seg_name]) |
|
165 |
- catch |
|
166 |
- try |
|
167 |
- " We didn't find a namespaced segment, fall back to common segments |
|
168 |
- let return_segment = deepcopy(g:Powerline#Segments#segments[seg_name]) |
|
169 |
- catch |
|
170 |
- " Didn't find the segment among the common segments either, just skip it |
|
171 |
- return {} |
|
172 |
- endtry |
|
173 |
- endtry |
|
174 |
- |
|
175 |
- if len(args) && has_key(return_segment, 'text') |
|
176 |
- " Handle segment printf arguments |
|
177 |
- " printf doesn't accept lists as its second argument, so we have to work around that |
|
178 |
- let return_segment.text = call('printf', [ return_segment.text ] + args) |
|
179 |
- endif |
|
180 |
- |
|
181 |
- " Assign namespace, name and variants |
|
182 |
- let return_segment.ns = seg_ns |
|
183 |
- let return_segment.name = seg_name |
|
184 |
- let return_segment.orig_name = seg_orig_name |
|
185 |
- let return_segment.variants = seg_variants |
|
186 |
- |
|
187 |
- return return_segment |
|
188 |
-endfunction " }}} |
... | ... |
@@ -1,100 +0,0 @@ |
1 |
-function! Pl#Theme#Create(...) " {{{ |
|
2 |
- let buffer_segments = [] |
|
3 |
- |
|
4 |
- for buffer_segment in a:000 |
|
5 |
- " Remove empty segments (e.g. 'Pl#Theme#Function's) |
|
6 |
- if empty(buffer_segment) |
|
7 |
- continue |
|
8 |
- endif |
|
9 |
- |
|
10 |
- call add(buffer_segments, buffer_segment) |
|
11 |
- endfor |
|
12 |
- |
|
13 |
- let buffer_segments = Pl#Colorscheme#Apply(g:Powerline_colorscheme, buffer_segments) |
|
14 |
- |
|
15 |
- return buffer_segments |
|
16 |
-endfunction " }}} |
|
17 |
-function! Pl#Theme#Callback(name, expr) " {{{ |
|
18 |
- return ['callback', a:name, a:expr] |
|
19 |
-endfunction " }}} |
|
20 |
-function! Pl#Theme#Buffer(ns, ...) " {{{ |
|
21 |
- let segments = [] |
|
22 |
- let ns = ! empty(a:ns) ? a:ns .':' : '' |
|
23 |
- |
|
24 |
- " Match namespace parameter by default |
|
25 |
- let matches = Pl#Match#Any(a:ns) |
|
26 |
- let callback = [] |
|
27 |
- |
|
28 |
- let args = a:000 |
|
29 |
- let args = Pl#Mod#ApplySegmentMods(args) |
|
30 |
- |
|
31 |
- " Fetch segment data dicts |
|
32 |
- for item in args |
|
33 |
- if type(item) == type([]) |
|
34 |
- if item[0] == 'match' |
|
35 |
- " Match item, overrides default namespace match |
|
36 |
- let matches = item |
|
37 |
- |
|
38 |
- unlet! item |
|
39 |
- continue |
|
40 |
- elseif item[0] == 'callback' |
|
41 |
- " Store the item as a callback expression |
|
42 |
- let matches = ['match', 'none'] |
|
43 |
- let callback = [a:ns, item[1], item[2]] |
|
44 |
- |
|
45 |
- unlet! item |
|
46 |
- continue |
|
47 |
- endif |
|
48 |
- |
|
49 |
- " printf segment, append ns to first item in list |
|
50 |
- let item[0] = ns . item[0] |
|
51 |
- else |
|
52 |
- let item = ns . item |
|
53 |
- endif |
|
54 |
- |
|
55 |
- let segment = Pl#Segment#Get(item) |
|
56 |
- |
|
57 |
- if ! empty(segment) |
|
58 |
- " Skip empty (possible disabled) segments |
|
59 |
- call add(segments, segment) |
|
60 |
- endif |
|
61 |
- |
|
62 |
- unlet! item |
|
63 |
- endfor |
|
64 |
- |
|
65 |
- return { |
|
66 |
- \ 'matches': matches |
|
67 |
- \ , 'callback': callback |
|
68 |
- \ , 'segments': segments |
|
69 |
- \ } |
|
70 |
-endfunction " }}} |
|
71 |
-function! Pl#Theme#InsertSegment(new_segment, where, target_segment) " {{{ |
|
72 |
- " It's very important to NOT refer to the theme dict until everything's loaded! |
|
73 |
- " |
|
74 |
- " Because these functions are called from the vimrc, we need to put the |
|
75 |
- " actions in a list which will be parsed later. |
|
76 |
- " |
|
77 |
- " These functions don't accept a name parameter, because they work on the |
|
78 |
- " currently selected theme (will change any selected theme) |
|
79 |
- call Pl#Mod#AddSegmentMod('insert_segment', { |
|
80 |
- \ 'new_segment': a:new_segment, |
|
81 |
- \ 'where': a:where, |
|
82 |
- \ 'target_segment': a:target_segment |
|
83 |
- \ }) |
|
84 |
-endfunction " }}} |
|
85 |
-function! Pl#Theme#RemoveSegment(target_segment) " {{{ |
|
86 |
- " It's very important to NOT refer to the theme dict until everything's loaded! |
|
87 |
- " |
|
88 |
- " Because these functions are called from the vimrc, we need to put the |
|
89 |
- " actions in a list which will be parsed later. |
|
90 |
- " |
|
91 |
- " These functions don't accept a name parameter, because they work on the |
|
92 |
- " currently selected theme (will change any selected theme) |
|
93 |
- call Pl#Mod#AddSegmentMod('remove_segment', { |
|
94 |
- \ 'target_segment': a:target_segment |
|
95 |
- \ }) |
|
96 |
-endfunction " }}} |
|
97 |
-function! Pl#Theme#ReplaceSegment(old_segment, new_segment) " {{{ |
|
98 |
- call Pl#Theme#InsertSegment(a:new_segment, 'after', a:old_segment) |
|
99 |
- call Pl#Theme#RemoveSegment(a:old_segment) |
|
100 |
-endfunction " }}} |
... | ... |
@@ -1,166 +0,0 @@ |
1 |
-call Pl#Hi#Allocate({ |
|
2 |
- \ 'black' : 16, |
|
3 |
- \ 'white' : 231, |
|
4 |
- \ |
|
5 |
- \ 'darkestgreen' : 22, |
|
6 |
- \ 'darkgreen' : 28, |
|
7 |
- \ 'mediumgreen' : 70, |
|
8 |
- \ 'brightgreen' : 148, |
|
9 |
- \ |
|
10 |
- \ 'darkestcyan' : 23, |
|
11 |
- \ 'mediumcyan' : 117, |
|
12 |
- \ |
|
13 |
- \ 'darkestblue' : 24, |
|
14 |
- \ 'darkblue' : 31, |
|
15 |
- \ |
|
16 |
- \ 'darkestred' : 52, |
|
17 |
- \ 'darkred' : 88, |
|
18 |
- \ 'mediumred' : 124, |
|
19 |
- \ 'brightred' : 160, |
|
20 |
- \ 'brightestred' : 196, |
|
21 |
- \ |
|
22 |
- \ 'darkestpurple' : 55, |
|
23 |
- \ 'mediumpurple' : 98, |
|
24 |
- \ 'brightpurple' : 189, |
|
25 |
- \ |
|
26 |
- \ 'brightorange' : 208, |
|
27 |
- \ 'brightestorange': 214, |
|
28 |
- \ |
|
29 |
- \ 'gray0' : 233, |
|
30 |
- \ 'gray1' : 235, |
|
31 |
- \ 'gray2' : 236, |
|
32 |
- \ 'gray3' : 239, |
|
33 |
- \ 'gray4' : 240, |
|
34 |
- \ 'gray5' : 241, |
|
35 |
- \ 'gray6' : 244, |
|
36 |
- \ 'gray7' : 245, |
|
37 |
- \ 'gray8' : 247, |
|
38 |
- \ 'gray9' : 250, |
|
39 |
- \ 'gray10' : 252, |
|
40 |
- \ }) |
|
41 |
- |
|
42 |
-let g:Powerline#Colorschemes#default#colorscheme = Pl#Colorscheme#Init([ |
|
43 |
- \ Pl#Hi#Segments(['SPLIT'], { |
|
44 |
- \ 'n': ['white', 'gray2'], |
|
45 |
- \ 'N': ['white', 'gray0'], |
|
46 |
- \ 'i': ['white', 'darkestblue'], |
|
47 |
- \ }), |
|
48 |
- \ |
|
49 |
- \ Pl#Hi#Segments(['mode_indicator'], { |
|
50 |
- \ 'n': ['darkestgreen', 'brightgreen', ['bold']], |
|
51 |
- \ 'i': ['darkestcyan', 'white', ['bold']], |
|
52 |
- \ 'v': ['darkred', 'brightorange', ['bold']], |
|
53 |
- \ 'r': ['white', 'brightred', ['bold']], |
|
54 |
- \ 's': ['white', 'gray5', ['bold']], |
|
55 |
- \ }), |
|
56 |
- \ |
|
57 |
- \ Pl#Hi#Segments(['branch', 'scrollpercent', 'raw', 'filesize'], { |
|
58 |
- \ 'n': ['gray9', 'gray4'], |
|
59 |
- \ 'N': ['gray4', 'gray1'], |
|
60 |
- \ 'i': ['mediumcyan', 'darkblue'], |
|
61 |
- \ }), |
|
62 |
- \ |
|
63 |
- \ Pl#Hi#Segments(['fileinfo', 'filename'], { |
|
64 |
- \ 'n': ['white', 'gray4', ['bold']], |
|
65 |
- \ 'N': ['gray7', 'gray0', ['bold']], |
|
66 |
- \ 'i': ['white', 'darkblue', ['bold']], |
|
67 |
- \ }), |
|
68 |
- \ |
|
69 |
- \ Pl#Hi#Segments(['fileinfo.filepath'], { |
|
70 |
- \ 'n': ['gray10'], |
|
71 |
- \ 'N': ['gray5'], |
|
72 |
- \ 'i': ['mediumcyan'], |
|
73 |
- \ }), |
|
74 |
- \ |
|
75 |
- \ Pl#Hi#Segments(['static_str'], { |
|
76 |
- \ 'n': ['white', 'gray4'], |
|
77 |
- \ 'N': ['gray7', 'gray1'], |
|
78 |
- \ 'i': ['white', 'darkblue'], |
|
79 |
- \ }), |
|
80 |
- \ |
|
81 |
- \ Pl#Hi#Segments(['fileinfo.flags'], { |
|
82 |
- \ 'n': ['brightestred', ['bold']], |
|
83 |
- \ 'N': ['darkred'], |
|
84 |
- \ 'i': ['brightestred', ['bold']], |
|
85 |
- \ }), |
|
86 |
- \ |
|
87 |
- \ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { |
|
88 |
- \ 'n': ['gray8', 'gray2'], |
|
89 |
- \ 'i': ['mediumcyan', 'darkestblue'], |
|
90 |
- \ }), |
|
91 |
- \ |
|
92 |
- \ Pl#Hi#Segments(['lineinfo'], { |
|
93 |
- \ 'n': ['gray2', 'gray10', ['bold']], |
|
94 |
- \ 'N': ['gray7', 'gray1', ['bold']], |
|
95 |
- \ 'i': ['darkestcyan', 'mediumcyan', ['bold']], |
|
96 |
- \ }), |
|
97 |
- \ |
|
98 |
- \ Pl#Hi#Segments(['errors'], { |
|
99 |
- \ 'n': ['brightestorange', 'gray2', ['bold']], |
|
100 |
- \ 'i': ['brightestorange', 'darkestblue', ['bold']], |
|
101 |
- \ }), |
|
102 |
- \ |
|
103 |
- \ Pl#Hi#Segments(['lineinfo.line.tot'], { |
|
104 |
- \ 'n': ['gray6'], |
|
105 |
- \ 'N': ['gray5'], |
|
106 |
- \ 'i': ['darkestcyan'], |
|
107 |
- \ }), |
|
108 |
- \ |
|
109 |
- \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { |
|
110 |
- \ 'n': ['white', 'brightred', ['bold']], |
|
111 |
- \ }), |
|
112 |
- \ |
|
113 |
- \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { |
|
114 |
- \ 'n': ['white', 'mediumred', ['bold']], |
|
115 |
- \ 'N': ['brightred', 'darkestred', ['bold']], |
|
116 |
- \ }), |
|
117 |
- \ |
|
118 |
- \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { |
|
119 |
- \ 'n': ['white', 'darkred'], |
|
120 |
- \ 'N': ['brightred', 'darkestred'], |
|
121 |
- \ }), |
|
122 |
- \ |
|
123 |
- \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { |
|
124 |
- \ 'n': ['white', 'darkred'], |
|
125 |
- \ 'N': ['white', 'darkestred'], |
|
126 |
- \ }), |
|
127 |
- \ |
|
128 |
- \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { |
|
129 |
- \ 'n': ['white', 'mediumgreen', ['bold']], |
|
130 |
- \ 'N': ['mediumgreen', 'darkestgreen', ['bold']], |
|
131 |
- \ }), |
|
132 |
- \ |
|
133 |
- \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { |
|
134 |
- \ 'n': ['brightgreen', 'darkgreen'], |
|
135 |
- \ 'N': ['mediumgreen', 'darkestgreen'], |
|
136 |
- \ }), |
|
137 |
- \ |
|
138 |
- \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { |
|
139 |
- \ 'n': ['white', 'darkgreen'], |
|
140 |
- \ 'N': ['white', 'darkestgreen'], |
|
141 |
- \ }), |
|
142 |
- \ |
|
143 |
- \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { |
|
144 |
- \ 'n': ['brightpurple', 'darkestpurple'], |
|
145 |
- \ }), |
|
146 |
- \ |
|
147 |
- \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], { |
|
148 |
- \ 'n': ['white', 'mediumpurple'], |
|
149 |
- \ }), |
|
150 |
- \ |
|
151 |
- \ Pl#Hi#Segments(['ctrlp:item'], { |
|
152 |
- \ 'n': ['darkestpurple', 'white', ['bold']], |
|
153 |
- \ }), |
|
154 |
- \ |
|
155 |
- \ Pl#Hi#Segments(['ctrlp:marked'], { |
|
156 |
- \ 'n': ['brightestred', 'darkestpurple', ['bold']], |
|
157 |
- \ }), |
|
158 |
- \ |
|
159 |
- \ Pl#Hi#Segments(['ctrlp:count'], { |
|
160 |
- \ 'n': ['darkestpurple', 'white'], |
|
161 |
- \ }), |
|
162 |
- \ |
|
163 |
- \ Pl#Hi#Segments(['ctrlp:SPLIT'], { |
|
164 |
- \ 'n': ['white', 'darkestpurple'], |
|
165 |
- \ }), |
|
166 |
- \ ]) |
... | ... |
@@ -1,154 +0,0 @@ |
1 |
- |
|
2 |
-" Solarized color scheme for Powerline |
|
3 |
-" N = no focus |
|
4 |
-" 16 hex colors as defined on http://ethanschoonover.com/solarized |
|
5 |
-call Pl#Hi#Allocate({ |
|
6 |
- \ 'base03' : [8, 0x002b36], |
|
7 |
- \ 'base02' : [0, 0x073642], |
|
8 |
- \ 'base01' : [10, 0x586e75], |
|
9 |
- \ 'base00' : [11, 0x657b83], |
|
10 |
- \ 'base0' : [12, 0x839496], |
|
11 |
- \ 'base1' : [14, 0x93a1a1], |
|
12 |
- \ 'base2' : [7, 0xeee8d5], |
|
13 |
- \ 'base3' : [15, 0xfdf6e3], |
|
14 |
- \ 'yellow' : [3, 0xb58900], |
|
15 |
- \ 'orange' : [9, 0xcb4b16], |
|
16 |
- \ 'red' : [1, 0xdc322f], |
|
17 |
- \ 'magenta' : [5, 0xd33682], |
|
18 |
- \ 'violet' : [13, 0x6c71c4], |
|
19 |
- \ 'blue' : [4, 0x268bd2], |
|
20 |
- \ 'cyan' : [6, 0x2aa198], |
|
21 |
- \ 'green' : [2, 0x859900], |
|
22 |
- \ }) |
|
23 |
- |
|
24 |
-let g:Powerline#Colorschemes#solarized#colorscheme = Pl#Colorscheme#Init([ |
|
25 |
- \ Pl#Hi#Segments(['SPLIT'], { |
|
26 |
- \ 'n': ['base3', 'base2'], |
|
27 |
- \ 'N': ['base3', 'base2'], |
|
28 |
- \ 'i': ['base3', 'base2'], |
|
29 |
- \ }), |
|
30 |
- \ |
|
31 |
- \ Pl#Hi#Segments(['mode_indicator'], { |
|
32 |
- \ 'n': ['base2', 'blue', ['bold']], |
|
33 |
- \ 'i': ['base3', 'orange', ['bold']], |
|
34 |
- \ 'v': ['base3', 'magenta', ['bold']], |
|
35 |
- \ 'r': ['base3', 'violet', ['bold']], |
|
36 |
- \ 's': ['base3', 'yellow', ['bold']], |
|
37 |
- \ }), |
|
38 |
- \ |
|
39 |
- \ Pl#Hi#Segments(['branch'], { |
|
40 |
- \ 'n': ['base2', 'base02'], |
|
41 |
- \ 'N': ['base02', 'base1'], |
|
42 |
- \ 'i': ['base2', 'base00'], |
|
43 |
- \ }), |
|
44 |
- \ |
|
45 |
- \ Pl#Hi#Segments(['scrollpercent', 'raw', 'filesize'], { |
|
46 |
- \ 'n': ['base2', 'base0'], |
|
47 |
- \ 'N': ['base00', 'base2'], |
|
48 |
- \ 'i': ['base2', 'base1'], |
|
49 |
- \ }), |
|
50 |
- \ |
|
51 |
- \ Pl#Hi#Segments(['fileinfo', 'filename'], { |
|
52 |
- \ 'n': ['base2', 'base01', ['bold']], |
|
53 |
- \ 'N': ['base01', 'base2' ], |
|
54 |
- \ 'i': ['base3', 'base1', ['bold']], |
|
55 |
- \ }), |
|
56 |
- \ |
|
57 |
- \ Pl#Hi#Segments(['fileinfo.filepath'], { |
|
58 |
- \ 'n': ['base1'], |
|
59 |
- \ 'N': ['base1'], |
|
60 |
- \ 'i': ['base01'], |
|
61 |
- \ }), |
|
62 |
- \ |
|
63 |
- \ Pl#Hi#Segments(['static_str'], { |
|
64 |
- \ 'n': ['base3', 'green'], |
|
65 |
- \ 'N': ['base02', 'base01'], |
|
66 |
- \ 'i': ['base3', 'blue'], |
|
67 |
- \ }), |
|
68 |
- \ |
|
69 |
- \ Pl#Hi#Segments(['fileinfo.flags'], { |
|
70 |
- \ 'n': ['base3'], |
|
71 |
- \ 'N': ['base00'], |
|
72 |
- \ 'i': ['base3'], |
|
73 |
- \ }), |
|
74 |
- \ |
|
75 |
- \ Pl#Hi#Segments(['currenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { |
|
76 |
- \ 'n': ['base00', 'base2'], |
|
77 |
- \ 'i': ['base0', 'base2'], |
|
78 |
- \ }), |
|
79 |
- \ |
|
80 |
- \ Pl#Hi#Segments(['lineinfo'], { |
|
81 |
- \ 'n': ['base2', 'base01', ['bold']], |
|
82 |
- \ 'N': ['base02', 'base0'], |
|
83 |
- \ 'i': ['base2', 'base00', ['bold']], |
|
84 |
- \ }), |
|
85 |
- \ |
|
86 |
- \ Pl#Hi#Segments(['errors'], { |
|
87 |
- \ 'n': ['red', 'base2', ['bold']], |
|
88 |
- \ 'i': ['red', 'base2', ['bold']], |
|
89 |
- \ }), |
|
90 |
- \ |
|
91 |
- \ Pl#Hi#Segments(['lineinfo.line.tot'], { |
|
92 |
- \ 'n': ['base3'], |
|
93 |
- \ 'N': ['base02'], |
|
94 |
- \ 'i': ['base3'], |
|
95 |
- \ }), |
|
96 |
- \ |
|
97 |
- \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { |
|
98 |
- \ 'n': ['base3', 'red', ['bold']], |
|
99 |
- \ }), |
|
100 |
- \ |
|
101 |
- \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { |
|
102 |
- \ 'n': ['base3', 'red', ['bold']], |
|
103 |
- \ 'N': ['base02', 'base01', ['bold']], |
|
104 |
- \ }), |
|
105 |
- \ |
|
106 |
- \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { |
|
107 |
- \ 'n': ['base3', 'base00'], |
|
108 |
- \ 'N': ['base0', 'base02'], |
|
109 |
- \ }), |
|
110 |
- \ |
|
111 |
- \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { |
|
112 |
- \ 'n': ['base3', 'base02'], |
|
113 |
- \ 'N': ['base0', 'base03'], |
|
114 |
- \ }), |
|
115 |
- \ |
|
116 |
- \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { |
|
117 |
- \ 'n': ['base2', 'green', ['bold']], |
|
118 |
- \ 'N': ['base02', 'base1'], |
|
119 |
- \ }), |
|
120 |
- \ |
|
121 |
- \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { |
|
122 |
- \ 'n': ['base3', 'base01'], |
|
123 |
- \ 'N': ['base02', 'base01'], |
|
124 |
- \ }), |
|
125 |
- \ |
|
126 |
- \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { |
|
127 |
- \ 'n': ['base2', 'base2'], |
|
128 |
- \ 'N': ['base2', 'base2'], |
|
129 |
- \ }), |
|
130 |
- \ |
|
131 |
- \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { |
|
132 |
- \ 'n': ['base03', 'base01'], |
|
133 |
- \ }), |
|
134 |
- \ |
|
135 |
- \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], { |
|
136 |
- \ 'n': ['base3', 'base00'], |
|
137 |
- \ }), |
|
138 |
- \ |
|
139 |
- \ Pl#Hi#Segments(['ctrlp:item'], { |
|
140 |
- \ 'n': ['base3', 'violet', ['bold']], |
|
141 |
- \ }), |
|
142 |
- \ |
|
143 |
- \ Pl#Hi#Segments(['ctrlp:marked'], { |
|
144 |
- \ 'n': ['base1', 'base01', ['bold']], |
|
145 |
- \ }), |
|
146 |
- \ |
|
147 |
- \ Pl#Hi#Segments(['ctrlp:count'], { |
|
148 |
- \ 'n': ['base3', 'violet'], |
|
149 |
- \ }), |
|
150 |
- \ |
|
151 |
- \ Pl#Hi#Segments(['ctrlp:SPLIT'], { |
|
152 |
- \ 'n': ['base3', 'base03'], |
|
153 |
- \ }), |
|
154 |
- \ ]) |
... | ... |
@@ -1,195 +0,0 @@ |
1 |
-" Authors: |
|
2 |
-" @stephenmckinney |
|
3 |
-" |
|
4 |
-" This colorscheme is based on Solarized-dark colors, setting the specific |
|
5 |
-" values for the Solarized palette, using the terminal's 16 ansi |
|
6 |
-" color values. It combines Solarized with Powerline native colors. |
|
7 |
-call Pl#Hi#Allocate({ |
|
8 |
- \ 'black' : 16, |
|
9 |
- \ 'white' : 231, |
|
10 |
- \ |
|
11 |
- \ 'darkestgreen' : 22, |
|
12 |
- \ 'darkgreen' : 28, |
|
13 |
- \ 'mediumgreen' : 70, |
|
14 |
- \ 'brightgreen' : 148, |
|
15 |
- \ |
|
16 |
- \ 'darkestcyan' : 23, |
|
17 |
- \ 'mediumcyan' : 117, |
|
18 |
- \ |
|
19 |
- \ 'darkestblue' : 24, |
|
20 |
- \ 'darkblue' : 31, |
|
21 |
- \ |
|
22 |
- \ 'darkestred' : 52, |
|
23 |
- \ 'darkred' : 88, |
|
24 |
- \ 'mediumred' : 124, |
|
25 |
- \ 'brightred' : 160, |
|
26 |
- \ 'brightestred' : 196, |
|
27 |
- \ |
|
28 |
- \ 'darkestpurple' : 55, |
|
29 |
- \ 'mediumpurple' : 98, |
|
30 |
- \ 'brightpurple' : 189, |
|
31 |
- \ |
|
32 |
- \ 'brightorange' : 208, |
|
33 |
- \ 'brightestorange': 214, |
|
34 |
- \ |
|
35 |
- \ 'gray0' : 233, |
|
36 |
- \ 'gray1' : 235, |
|
37 |
- \ 'gray2' : 236, |
|
38 |
- \ 'gray3' : 239, |
|
39 |
- \ 'gray4' : 240, |
|
40 |
- \ 'gray5' : 241, |
|
41 |
- \ 'gray6' : 244, |
|
42 |
- \ 'gray7' : 245, |
|
43 |
- \ 'gray8' : 247, |
|
44 |
- \ 'gray9' : 250, |
|
45 |
- \ 'gray10' : 252, |
|
46 |
- \ |
|
47 |
- \ 'base03' : [8, 0x002b36], |
|
48 |
- \ 'base02' : [0, 0x073642], |
|
49 |
- \ 'base01' : [10, 0x586e75], |
|
50 |
- \ 'base00' : [11, 0x657b83], |
|
51 |
- \ 'base0' : [12, 0x839496], |
|
52 |
- \ 'base1' : [14, 0x93a1a1], |
|
53 |
- \ 'base2' : [7, 0xeee8d5], |
|
54 |
- \ 'base3' : [15, 0xfdf6e3], |
|
55 |
- \ 'yellow' : [3, 0xb58900], |
|
56 |
- \ 'orange' : [9, 0xcb4b16], |
|
57 |
- \ 'red' : [1, 0xdc322f], |
|
58 |
- \ 'magenta' : [5, 0xd33682], |
|
59 |
- \ 'violet' : [13, 0x6c71c4], |
|
60 |
- \ 'blue' : [4, 0x268bd2], |
|
61 |
- \ 'cyan' : [6, 0x2aa198], |
|
62 |
- \ 'green' : [2, 0x859900], |
|
63 |
- \ }) |
|
64 |
- |
|
65 |
-let g:Powerline#Colorschemes#solarized16#colorscheme= Pl#Colorscheme#Init([ |
|
66 |
- \ Pl#Hi#Segments(['SPLIT'], { |
|
67 |
- \ 'n': ['white', 'base02'], |
|
68 |
- \ 'N': ['white', 'base02'], |
|
69 |
- \ }), |
|
70 |
- \ |
|
71 |
- \ Pl#Hi#Segments(['mode_indicator'], { |
|
72 |
- \ 'n': ['darkestgreen', 'brightgreen', ['bold']], |
|
73 |
- \ 'i': ['darkestcyan', 'white', ['bold']], |
|
74 |
- \ 'v': ['red', 'brightorange', ['bold']], |
|
75 |
- \ 'r': ['white', 'violet', ['bold']], |
|
76 |
- \ 's': ['white', 'gray5', ['bold']], |
|
77 |
- \ }), |
|
78 |
- \ |
|
79 |
- \ Pl#Hi#Segments(['branch', 'raw', 'filesize'], { |
|
80 |
- \ 'n': ['base03', 'blue'], |
|
81 |
- \ 'N': ['base00', 'base03'], |
|
82 |
- \ }), |
|
83 |
- \ |
|
84 |
- \ Pl#Hi#Segments(['fileinfo', 'filename', 'filepath'], { |
|
85 |
- \ 'n': ['base3', 'darkestblue', ['bold']], |
|
86 |
- \ 'N': ['base0', 'base02', ['bold']], |
|
87 |
- \ }), |
|
88 |
- \ |
|
89 |
- \ Pl#Hi#Segments(['fileinfo.filepath'], { |
|
90 |
- \ 'n': ['base2'], |
|
91 |
- \ 'N': ['base00'], |
|
92 |
- \ }), |
|
93 |
- \ |
|
94 |
- \ Pl#Hi#Segments(['static_str'], { |
|
95 |
- \ 'n': ['base3', 'violet'], |
|
96 |
- \ 'N': ['base1', 'base02'], |
|
97 |
- \ 'i': ['white', 'base02'], |
|
98 |
- \ }), |
|
99 |
- \ |
|
100 |
- \ Pl#Hi#Segments(['fileinfo.flags'], { |
|
101 |
- \ 'n': ['base03', ['bold']], |
|
102 |
- \ 'N': ['gray5'], |
|
103 |
- \ 'i': ['base03', ['bold']], |
|
104 |
- \ }), |
|
105 |
- \ |
|
106 |
- \ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { |
|
107 |
- \ 'n': ['base1', 'base02'], |
|
108 |
- \ 'N': ['base00', 'base03'], |
|
109 |
- \ }), |
|
110 |
- \ |
|
111 |
- \ Pl#Hi#Segments(['scrollpercent'], { |
|
112 |
- \ 'n': ['base1', 'base02', ['bold']], |
|
113 |
- \ 'N': ['base00', 'base03'], |
|
114 |
- \ }), |
|
115 |
- \ |
|
116 |
- \ Pl#Hi#Segments(['lineinfo'], { |
|
117 |
- \ 'n': ['gray2', 'gray10', ['bold']], |
|
118 |
- \ 'N': ['gray7', 'gray1', ['bold']], |
|
119 |
- \ 'i': ['darkestcyan', 'mediumcyan', ['bold']], |
|
120 |
- \ }), |
|
121 |
- \ |
|
122 |
- \ Pl#Hi#Segments(['errors'], { |
|
123 |
- \ 'n': ['orange', 'base02', ['bold']], |
|
124 |
- \ 'N': ['gray5', 'base03', ['bold']], |
|
125 |
- \ }), |
|
126 |
- \ |
|
127 |
- \ Pl#Hi#Segments(['lineinfo.line.tot'], { |
|
128 |
- \ 'n': ['gray6'], |
|
129 |
- \ 'N': ['gray5'], |
|
130 |
- \ 'i': ['darkestcyan'], |
|
131 |
- \ }), |
|
132 |
- \ |
|
133 |
- \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { |
|
134 |
- \ 'n': ['base3', 'red', ['bold']], |
|
135 |
- \ }), |
|
136 |
- \ |
|
137 |
- \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { |
|
138 |
- \ 'n': ['base3', 'darkblue', ['bold']], |
|
139 |
- \ 'N': ['base1', 'base03', ['bold']], |
|
140 |
- \ }), |
|
141 |
- \ |
|
142 |
- \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { |
|
143 |
- \ 'n': ['white', 'base02'], |
|
144 |
- \ 'N': ['gray5', 'base02'], |
|
145 |
- \ }), |
|
146 |
- \ |
|
147 |
- \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { |
|
148 |
- \ 'n': ['white', 'base02'], |
|
149 |
- \ 'N': ['white', 'base02'], |
|
150 |
- \ }), |
|
151 |
- \ |
|
152 |
- \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { |
|
153 |
- \ 'n': ['base3', 'darkestblue', ['bold']], |
|
154 |
- \ 'N': ['base01', 'base02', ['bold']], |
|
155 |
- \ }), |
|
156 |
- \ |
|
157 |
- \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { |
|
158 |
- \ 'n': ['base3', 'blue'], |
|
159 |
- \ 'N': ['gray5', 'base02'], |
|
160 |
- \ }), |
|
161 |
- \ |
|
162 |
- \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { |
|
163 |
- \ 'n': ['gray3', 'base02'], |
|
164 |
- \ 'N': ['gray3', 'base02'], |
|
165 |
- \ }), |
|
166 |
- \ |
|
167 |
- \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { |
|
168 |
- \ 'n': ['green', 'base02'], |
|
169 |
- \ }), |
|
170 |
- \ |
|
171 |
- \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next'], { |
|
172 |
- \ 'n': ['green', 'base02'], |
|
173 |
- \ }), |
|
174 |
- \ |
|
175 |
- \ Pl#Hi#Segments(['ctrlp:item', 'ctrlp:pwd'], { |
|
176 |
- \ 'n': ['base2', 'darkestblue', ['bold']], |
|
177 |
- \ }), |
|
178 |
- \ |
|
179 |
- \ Pl#Hi#Segments(['ctrlp:marked'], { |
|
180 |
- \ 'n': ['green', 'base02'], |
|
181 |
- \ }), |
|
182 |
- \ |
|
183 |
- \ Pl#Hi#Segments(['ctrlp:count'], { |
|
184 |
- \ 'n': ['base0', 'base02'], |
|
185 |
- \ }), |
|
186 |
- \ |
|
187 |
- \ Pl#Hi#Segments(['ctrlp:SPLIT'], { |
|
188 |
- \ 'n': ['white', 'base02'], |
|
189 |
- \ }), |
|
190 |
- \ |
|
191 |
- \ Pl#Hi#Segments(['status'], { |
|
192 |
- \ 'n': ['green', 'base02'], |
|
193 |
- \ 'N': ['gray5', 'base02'], |
|
194 |
- \ }), |
|
195 |
-\ ]) |
... | ... |
@@ -1,195 +0,0 @@ |
1 |
-" Authors: |
|
2 |
-" @skwp |
|
3 |
-" |
|
4 |
-" This colorscheme is based on Solarized-dark colors, combined |
|
5 |
-" with Powerline native colors |
|
6 |
-call Pl#Hi#Allocate({ |
|
7 |
- \ 'black' : 16, |
|
8 |
- \ 'white' : 231, |
|
9 |
- \ |
|
10 |
- \ 'darkestgreen' : 22, |
|
11 |
- \ 'darkgreen' : 28, |
|
12 |
- \ 'mediumgreen' : 70, |
|
13 |
- \ 'brightgreen' : 148, |
|
14 |
- \ |
|
15 |
- \ 'darkestcyan' : 23, |
|
16 |
- \ 'mediumcyan' : 117, |
|
17 |
- \ |
|
18 |
- \ 'darkestblue' : 24, |
|
19 |
- \ 'darkblue' : 31, |
|
20 |
- \ |
|
21 |
- \ 'darkestred' : 52, |
|
22 |
- \ 'darkred' : 88, |
|
23 |
- \ 'mediumred' : 124, |
|
24 |
- \ 'brightred' : 160, |
|
25 |
- \ 'brightestred' : 196, |
|
26 |
- \ |
|
27 |
- \ 'darkestpurple' : 55, |
|
28 |
- \ 'mediumpurple' : 98, |
|
29 |
- \ 'brightpurple' : 189, |
|
30 |
- \ |
|
31 |
- \ 'brightorange' : 208, |
|
32 |
- \ 'brightestorange': 214, |
|
33 |
- \ |
|
34 |
- \ 'gray0' : 233, |
|
35 |
- \ 'gray1' : 235, |
|
36 |
- \ 'gray2' : 236, |
|
37 |
- \ 'gray3' : 239, |
|
38 |
- \ 'gray4' : 240, |
|
39 |
- \ 'gray5' : 241, |
|
40 |
- \ 'gray6' : 244, |
|
41 |
- \ 'gray7' : 245, |
|
42 |
- \ 'gray8' : 247, |
|
43 |
- \ 'gray9' : 250, |
|
44 |
- \ 'gray10' : 252, |
|
45 |
- \ |
|
46 |
- \ 'base03' : [234, 0x002b36], |
|
47 |
- \ 'base02' : [235, 0x073642], |
|
48 |
- \ 'base01' : [240, 0x586e75], |
|
49 |
- \ 'base00' : [241, 0x657b83], |
|
50 |
- \ 'base0' : [244, 0x839496], |
|
51 |
- \ 'base1' : [245, 0x93a1a1], |
|
52 |
- \ 'base2' : [254, 0xeee8d5], |
|
53 |
- \ 'base3' : [230, 0xfdf6e3], |
|
54 |
- \ 'yellow' : [136, 0xb58900], |
|
55 |
- \ 'orange' : [166, 0xcb4b16], |
|
56 |
- \ 'red' : [160, 0xdc322f], |
|
57 |
- \ 'magenta' : [125, 0xd33682], |
|
58 |
- \ 'violet' : [61, 0x6c71c4], |
|
59 |
- \ 'blue' : [33, 0x268bd2], |
|
60 |
- \ 'cyan' : [37, 0x2aa198], |
|
61 |
- \ 'green' : [64, 0x859900], |
|
62 |
- \ }) |
|
63 |
- |
|
64 |
-let g:Powerline#Colorschemes#solarized256#colorscheme = Pl#Colorscheme#Init([ |
|
65 |
- \ Pl#Hi#Segments(['SPLIT'], { |
|
66 |
- \ 'n': ['white', 'base02'], |
|
67 |
- \ 'N': ['white', 'base02'], |
|
68 |
- \ }), |
|
69 |
- \ |
|
70 |
- \ Pl#Hi#Segments(['mode_indicator'], { |
|
71 |
- \ 'n': ['darkestgreen', 'brightgreen', ['bold']], |
|
72 |
- \ 'i': ['darkestcyan', 'white', ['bold']], |
|
73 |
- \ 'v': ['red', 'brightorange', ['bold']], |
|
74 |
- \ 'r': ['white', 'violet', ['bold']], |
|
75 |
- \ 's': ['white', 'gray5', ['bold']], |
|
76 |
- \ }), |
|
77 |
- \ |
|
78 |
- \ Pl#Hi#Segments(['branch', 'raw', 'filesize'], { |
|
79 |
- \ 'n': ['base03', 'blue'], |
|
80 |
- \ 'N': ['gray5', 'base03'], |
|
81 |
- \ }), |
|
82 |
- \ |
|
83 |
- \ Pl#Hi#Segments(['scrollpercent'], { |
|
84 |
- \ 'n': ['gray7', 'gray2'], |
|
85 |
- \ 'N': ['base2', 'base02'], |
|
86 |
- \ }), |
|
87 |
- \ |
|
88 |
- \ Pl#Hi#Segments(['fileinfo', 'filename', 'filepath'], { |
|
89 |
- \ 'n': ['base2', 'darkestblue', ['bold']], |
|
90 |
- \ 'N': ['base1', 'base02', ['bold']], |
|
91 |
- \ }), |
|
92 |
- \ |
|
93 |
- \ Pl#Hi#Segments(['fileinfo.filepath'], { |
|
94 |
- \ 'n': ['gray10'], |
|
95 |
- \ 'N': ['gray5'], |
|
96 |
- \ 'i': ['mediumcyan'], |
|
97 |
- \ }), |
|
98 |
- \ |
|
99 |
- \ Pl#Hi#Segments(['static_str'], { |
|
100 |
- \ 'n': ['base3', 'violet'], |
|
101 |
- \ 'N': ['base1', 'base02'], |
|
102 |
- \ 'i': ['white', 'base02'], |
|
103 |
- \ }), |
|
104 |
- \ |
|
105 |
- \ Pl#Hi#Segments(['fileinfo.flags'], { |
|
106 |
- \ 'n': ['base03', ['bold']], |
|
107 |
- \ 'N': ['gray5'], |
|
108 |
- \ 'i': ['base03', ['bold']], |
|
109 |
- \ }), |
|
110 |
- \ |
|
111 |
- \ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { |
|
112 |
- \ 'n': ['gray5', 'gray2'], |
|
113 |
- \ 'i': ['mediumcyan', 'base02'], |
|
114 |
- \ }), |
|
115 |
- \ |
|
116 |
- \ Pl#Hi#Segments(['lineinfo'], { |
|
117 |
- \ 'n': ['gray2', 'gray10', ['bold']], |
|
118 |
- \ 'N': ['gray7', 'gray1', ['bold']], |
|
119 |
- \ 'i': ['darkestcyan', 'mediumcyan', ['bold']], |
|
120 |
- \ }), |
|
121 |
- \ |
|
122 |
- \ Pl#Hi#Segments(['errors'], { |
|
123 |
- \ 'n': ['orange', 'base02', ['bold']], |
|
124 |
- \ 'N': ['gray5', 'base03', ['bold']], |
|
125 |
- \ }), |
|
126 |
- \ |
|
127 |
- \ Pl#Hi#Segments(['lineinfo.line.tot'], { |
|
128 |
- \ 'n': ['gray6'], |
|
129 |
- \ 'N': ['gray5'], |
|
130 |
- \ 'i': ['darkestcyan'], |
|
131 |
- \ }), |
|
132 |
- \ |
|
133 |
- \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { |
|
134 |
- \ 'n': ['base3', 'red', ['bold']], |
|
135 |
- \ }), |
|
136 |
- \ |
|
137 |
- \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { |
|
138 |
- \ 'n': ['base3', 'darkblue', ['bold']], |
|
139 |
- \ 'N': ['base1', 'base03', ['bold']], |
|
140 |
- \ }), |
|
141 |
- \ |
|
142 |
- \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { |
|
143 |
- \ 'n': ['white', 'base02'], |
|
144 |
- \ 'N': ['gray5', 'base02'], |
|
145 |
- \ }), |
|
146 |
- \ |
|
147 |
- \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { |
|
148 |
- \ 'n': ['white', 'base02'], |
|
149 |
- \ 'N': ['white', 'base02'], |
|
150 |
- \ }), |
|
151 |
- \ |
|
152 |
- \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { |
|
153 |
- \ 'n': ['gray10', 'darkestblue', ['bold']], |
|
154 |
- \ 'N': ['gray3', 'base02', ['bold']], |
|
155 |
- \ }), |
|
156 |
- \ |
|
157 |
- \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { |
|
158 |
- \ 'n': ['base3', 'blue'], |
|
159 |
- \ 'N': ['gray5', 'base02'], |
|
160 |
- \ }), |
|
161 |
- \ |
|
162 |
- \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { |
|
163 |
- \ 'n': ['gray3', 'base02'], |
|
164 |
- \ 'N': ['gray3', 'base02'], |
|
165 |
- \ }), |
|
166 |
- \ |
|
167 |
- \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { |
|
168 |
- \ 'n': ['green', 'base03'], |
|
169 |
- \ }), |
|
170 |
- \ |
|
171 |
- \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], { |
|
172 |
- \ 'n': ['green', 'base02'], |
|
173 |
- \ }), |
|
174 |
- \ |
|
175 |
- \ Pl#Hi#Segments(['ctrlp:item'], { |
|
176 |
- \ 'n': ['base2', 'darkestblue', ['bold']], |
|
177 |
- \ }), |
|
178 |
- \ |
|
179 |
- \ Pl#Hi#Segments(['ctrlp:marked'], { |
|
180 |
- \ 'n': ['brightgreen', 'base03', ['bold']], |
|
181 |
- \ }), |
|
182 |
- \ |
|
183 |
- \ Pl#Hi#Segments(['ctrlp:count'], { |
|
184 |
- \ 'n': ['base0', 'base03'], |
|
185 |
- \ }), |
|
186 |
- \ |
|
187 |
- \ Pl#Hi#Segments(['ctrlp:SPLIT'], { |
|
188 |
- \ 'n': ['white', 'base03'], |
|
189 |
- \ }), |
|
190 |
- \ |
|
191 |
- \ Pl#Hi#Segments(['status'], { |
|
192 |
- \ 'n': ['green', 'base02'], |
|
193 |
- \ 'N': ['gray5', 'base02'], |
|
194 |
- \ }), |
|
195 |
-\ ]) |
... | ... |
@@ -1,141 +0,0 @@ |
1 |
-" Recalculate the trailing whitespace warning when idle, and after saving |
|
2 |
-autocmd CursorHold,BufWritePost,InsertLeave * unlet! b:statusline_trailing_space_warning |
|
3 |
- |
|
4 |
-function! Powerline#Functions#GetFilepath() " {{{ |
|
5 |
- " Recalculate the filepath when cwd changes. |
|
6 |
- let cwd = getcwd() |
|
7 |
- if exists("b:Powerline_cwd") && cwd != b:Powerline_cwd |
|
8 |
- unlet! b:Powerline_filepath |
|
9 |
- endif |
|
10 |
- let b:Powerline_cwd = cwd |
|
11 |
- |
|
12 |
- if exists('b:Powerline_filepath') |
|
13 |
- return b:Powerline_filepath |
|
14 |
- endif |
|
15 |
- |
|
16 |
- let dirsep = has('win32') && ! &shellslash ? '\' : '/' |
|
17 |
- let filepath = expand('%:p') |
|
18 |
- |
|
19 |
- if empty(filepath) |
|
20 |
- return '' |
|
21 |
- endif |
|
22 |
- |
|
23 |
- let ret = '' |
|
24 |
- |
|
25 |
- if g:Powerline_stl_path_style == 'short' |
|
26 |
- " Display a short path where the first directory is displayed with its |
|
27 |
- " full name, and the subsequent directories are shortened to their |
|
28 |
- " first letter, i.e. "/home/user/foo/foo/bar/baz.vim" becomes |
|
29 |
- " "~/foo/f/b/baz.vim" |
|
30 |
- " |
|
31 |
- " This displays the shortest possible path, relative to ~ or the |
|
32 |
- " current directory. |
|
33 |
- let mod = (exists('+acd') && &acd) ? ':~:h' : ':~:.:h' |
|
34 |
- let fpath = split(fnamemodify(filepath, mod), dirsep) |
|
35 |
- let fpath_shortparts = map(fpath[1:], 'v:val[0]') |
|
36 |
- let ret = join(extend([fpath[0]], fpath_shortparts), dirsep) . dirsep |
|
37 |
- elseif g:Powerline_stl_path_style == 'relative' |
|
38 |
- " Display a relative path, similar to the %f statusline item |
|
39 |
- let ret = fnamemodify(filepath, ':~:.:h') . dirsep |
|
40 |
- elseif g:Powerline_stl_path_style == 'full' |
|
41 |
- " Display the full path, similar to the %F statusline item |
|
42 |
- let ret = fnamemodify(filepath, ':h') . dirsep |
|
43 |
- endif |
|
44 |
- |
|
45 |
- if ret == ('.' . dirsep) |
|
46 |
- let ret = '' |
|
47 |
- endif |
|
48 |
- |
|
49 |
- let b:Powerline_filepath = ret |
|
50 |
- return ret |
|
51 |
-endfunction " }}} |
|
52 |
-function! Powerline#Functions#GetShortPath(threshold) " {{{ |
|
53 |
- let fullpath = split(expand('%:~'), '[/\\]') |
|
54 |
- |
|
55 |
- if len(fullpath) > a:threshold |
|
56 |
- let fullpath = [fullpath[0], '…'] + fullpath[-a:threshold + 1 :] |
|
57 |
- endif |
|
58 |
- |
|
59 |
- return join(fullpath, '/') |
|
60 |
-endfunction " }}} |
|
61 |
-function! Powerline#Functions#GetMode() " {{{ |
|
62 |
- let mode = mode() |
|
63 |
- |
|
64 |
- if mode ==# 'v' |
|
65 |
- let mode = get(g:, "Powerline_mode_v", "VISUAL") |
|
66 |
- elseif mode ==# 'V' |
|
67 |
- let mode = get(g:, "Powerline_mode_V", "V⋅LINE") |
|
68 |
- elseif mode ==# '' |
|
69 |
- let mode = get(g:, "Powerline_mode_cv", "V⋅BLOCK") |
|
70 |
- elseif mode ==# 's' |
|
71 |
- let mode = get(g:, "Powerline_mode_s", "SELECT") |
|
72 |
- elseif mode ==# 'S' |
|
73 |
- let mode = get(g:, "Powerline_mode_S", "S⋅LINE") |
|
74 |
- elseif mode ==# '' |
|
75 |
- let mode = get(g:, "Powerline_mode_cs", "S⋅BLOCK") |
|
76 |
- elseif mode =~# '\vi' |
|
77 |
- let mode = get(g:, "Powerline_mode_i", "INSERT") |
|
78 |
- elseif mode =~# '\v(R|Rv)' |
|
79 |
- let mode = get(g:, "Powerline_mode_R", "REPLACE") |
|
80 |
- else |
|
81 |
- " Fallback to normal mode |
|
82 |
- let mode = get(g:, "Powerline_mode_n", "NORMAL") |
|
83 |
- endif |
|
84 |
- |
|
85 |
- return mode |
|
86 |
-endfunction " }}} |
|
87 |
-function! Powerline#Functions#GetFilesize() " {{{ |
|
88 |
- let bytes = getfsize(expand("%:p")) |
|
89 |
- |
|
90 |
- if bytes <= 0 |
|
91 |
- return '' |
|
92 |
- endif |
|
93 |
- |
|
94 |
- if bytes < 1024 |
|
95 |
- return bytes . 'B' |
|
96 |
- else |
|
97 |
- return (bytes / 1024) . 'kB' |
|
98 |
- endif |
|
99 |
-endfunction "}}} |
|
100 |
-function! Powerline#Functions#GetCharCode() " {{{ |
|
101 |
- " Get the output of :ascii |
|
102 |
- redir => ascii |
|
103 |
- silent! ascii |
|
104 |
- redir END |
|
105 |
- |
|
106 |
- if match(ascii, 'NUL') != -1 |
|
107 |
- return 'NUL' |
|
108 |
- endif |
|
109 |
- |
|
110 |
- " Zero pad hex values |
|
111 |
- let nrformat = '0x%02x' |
|
112 |
- |
|
113 |
- let encoding = (&fenc == '' ? &enc : &fenc) |
|
114 |
- |
|
115 |
- if encoding == 'utf-8' |
|
116 |
- " Zero pad with 4 zeroes in unicode files |
|
117 |
- let nrformat = '0x%04x' |
|
118 |
- endif |
|
119 |
- |
|
120 |
- " Get the character and the numeric value from the return value of :ascii |
|
121 |
- " This matches the two first pieces of the return value, e.g. |
|
122 |
- " "<F> 70" => char: 'F', nr: '70' |
|
123 |
- let [str, char, nr; rest] = matchlist(ascii, '\v\<(.{-1,})\>\s*([0-9]+)') |
|
124 |
- |
|
125 |
- " Format the numeric value |
|
126 |
- let nr = printf(nrformat, nr) |
|
127 |
- |
|
128 |
- return "'". char ."' ". nr |
|
129 |
-endfunction "}}} |
|
130 |
-function! Powerline#Functions#GetWSMarker() " {{{ |
|
131 |
- " Return '...' if trailing white space is detected |
|
132 |
- " Return '' otherwise |
|
133 |
- if ! exists("b:statusline_trailing_space_warning") |
|
134 |
- if search('\s$', 'nw') != 0 |
|
135 |
- let b:statusline_trailing_space_warning = ' … ' |
|
136 |
- else |
|
137 |
- let b:statusline_trailing_space_warning = '' |
|
138 |
- endif |
|
139 |
- endif |
|
140 |
- return b:statusline_trailing_space_warning |
|
141 |
-endfunction " }}} |
... | ... |
@@ -1,12 +0,0 @@ |
1 |
-function! Powerline#Functions#ft_man#GetName() " {{{ |
|
2 |
- let matches = matchlist(getline(1), '\v^([a-zA-Z_\.\-]+)\((\d+)\)') |
|
3 |
- |
|
4 |
- if ! len(matches) |
|
5 |
- return 'n/a' |
|
6 |
- endif |
|
7 |
- |
|
8 |
- let file = tolower(matches[1]) |
|
9 |
- let num = matches[2] |
|
10 |
- |
|
11 |
- return file |
|
12 |
-endfunction " }}} |
... | ... |
@@ -1,17 +0,0 @@ |
1 |
-function! Powerline#Functions#hgrev#Status(symbol) " {{{ |
|
2 |
- if ! exists('*HGRev') |
|
3 |
- " HGRev hasn't been loaded yet |
|
4 |
- return '' |
|
5 |
- endif |
|
6 |
- if !exists("b:statusline_hg_status") |
|
7 |
- silent execute "RefreshMercurialRev" |
|
8 |
- endif |
|
9 |
- let b:statusline_hg_status=HGRev() |
|
10 |
- if b:statusline_hg_status != '-' |
|
11 |
- let ret = "\u26A1". '' . substitute(b:statusline_hg_status, '^[^ ]*', '\1', 'g') |
|
12 |
- let ret=substitute(ret,' M$','+','g') |
|
13 |
- else |
|
14 |
- let ret='' |
|
15 |
- endif |
|
16 |
- return ret |
|
17 |
-endfunction " }}} |
... | ... |
@@ -1,16 +0,0 @@ |
1 |
-function! Powerline#Functions#syntastic#GetErrors(line_symbol) " {{{ |
|
2 |
- if ! exists('g:syntastic_stl_format') |
|
3 |
- " Syntastic hasn't been loaded yet |
|
4 |
- return '' |
|
5 |
- endif |
|
6 |
- |
|
7 |
- " Temporarily change syntastic output format |
|
8 |
- let old_stl_format = g:syntastic_stl_format |
|
9 |
- let g:syntastic_stl_format = '%E{ ERRORS (%e) '. a:line_symbol .' %fe }%W{ WARNINGS (%w) '. a:line_symbol .' %fw }' |
|
10 |
- |
|
11 |
- let ret = SyntasticStatuslineFlag() |
|
12 |
- |
|
13 |
- let g:syntastic_stl_format = old_stl_format |
|
14 |
- |
|
15 |
- return ret |
|
16 |
-endfunction " }}} |
... | ... |
@@ -1,13 +0,0 @@ |
1 |
-let g:Powerline#Matches#matches = { |
|
2 |
- \ 'command_t' : Pl#Match#Add('bufname(winbufnr(a:window))', '^GoToFile$'), |
|
3 |
- \ 'bt_help' : Pl#Match#Add('getwinvar(a:window, "&bt")' , '^help$'), |
|
4 |
- \ 'ft_man' : Pl#Match#Add('getwinvar(a:window, "&ft")' , '^man$'), |
|
5 |
- \ 'ft_qf' : Pl#Match#Add('getwinvar(a:window, "&ft")' , '^qf$'), |
|
6 |
- \ 'ft_vimpager' : Pl#Match#Add('getwinvar(a:window, "&ft")' , 'vimpager'), |
|
7 |
- \ 'gundo_preview' : Pl#Match#Add('bufname(winbufnr(a:window))', '^__Gundo_Preview__$'), |
|
8 |
- \ 'gundo_tree' : Pl#Match#Add('bufname(winbufnr(a:window))', '^__Gundo__$'), |
|
9 |
- \ 'lustyexplorer' : Pl#Match#Add('bufname(winbufnr(a:window))', '\[LustyExplorer\-Buffers\]'), |
|
10 |
- \ 'minibufexplorer' : Pl#Match#Add('bufname(winbufnr(a:window))', '^\-MiniBufExplorer\-$'), |
|
11 |
- \ 'tagbar' : Pl#Match#Add('getwinvar(a:window, "&ft")' , '^tagbar$'), |
|
12 |
- \ 'nerdtree' : Pl#Match#Add('getwinvar(a:window, "&ft")' , '^nerdtree$'), |
|
13 |
-\ } |
... | ... |
@@ -1,30 +0,0 @@ |
1 |
-let g:Powerline#Segments#segments = Pl#Segment#Init([ |
|
2 |
- \ Pl#Segment#Create('SPLIT' , '__split__'), |
|
3 |
- \ Pl#Segment#Create('TRUNCATE', '__truncate__'), |
|
4 |
- \ |
|
5 |
- \ Pl#Segment#Create('paste_indicator' , '%{&paste ? "PASTE" : ""}', Pl#Segment#Modes('!N')), |
|
6 |
- \ Pl#Segment#Create('mode_indicator' , '%{Powerline#Functions#GetMode()}', Pl#Segment#Modes('!N')), |
|
7 |
- \ Pl#Segment#Create('fileinfo', |
|
8 |
- \ Pl#Segment#Create('flags.ro' , '%{&readonly ? "$RO" : ""}'), |
|
9 |
- \ Pl#Segment#Create('filepath' , '%{Powerline#Functions#GetFilepath()}', Pl#Segment#NoPadding()), |
|
10 |
- \ Pl#Segment#Create('filename' , '%t'), |
|
11 |
- \ Pl#Segment#Create('flags.mod' , '%M'), |
|
12 |
- \ Pl#Segment#Create('flags.type' , '%H%W'), |
|
13 |
- \ ), |
|
14 |
- \ Pl#Segment#Create('filename' , '%t'), |
|
15 |
- \ Pl#Segment#Create('filesize' , '%{Powerline#Functions#GetFilesize()}', Pl#Segment#Modes('!N')), |
|
16 |
- \ Pl#Segment#Create('pwd' , '%{substitute(getcwd(), expand("$HOME"), "~", "g")}'), |
|
17 |
- \ Pl#Segment#Create('static_str' , '%%{"%s"}'), |
|
18 |
- \ Pl#Segment#Create('raw' , '%s'), |
|
19 |
- \ Pl#Segment#Create('fileformat' , '%{&fileformat}', Pl#Segment#Modes('!N')), |
|
20 |
- \ Pl#Segment#Create('fileencoding' , '%{(&fenc == "" ? &enc : &fenc)}', Pl#Segment#Modes('!N')), |
|
21 |
- \ Pl#Segment#Create('filetype' , '%{strlen(&ft) ? &ft : "no ft"}', Pl#Segment#Modes('!N')), |
|
22 |
- \ Pl#Segment#Create('scrollpercent' , '%3p%%'), |
|
23 |
- \ Pl#Segment#Create('lineinfo', |
|
24 |
- \ Pl#Segment#Create('line.cur' , '$LINE %3l'), |
|
25 |
- \ Pl#Segment#Create('line.tot' , ':%-2v', Pl#Segment#NoPadding()), |
|
26 |
- \ ), |
|
27 |
- \ Pl#Segment#Create('charcode' , '%{Powerline#Functions#GetCharCode()}', Pl#Segment#Modes('!N')), |
|
28 |
- \ Pl#Segment#Create('currhigroup' , '%{synIDattr(synID(line("."), col("."), 1), "name")}', Pl#Segment#Modes('!N')), |
|
29 |
- \ Pl#Segment#Create('ws_marker' , '%{Powerline#Functions#GetWSMarker()}', Pl#Segment#Modes('!N')), |
|
30 |
-\ ]) |
... | ... |
@@ -1,20 +0,0 @@ |
1 |
-if !exists("g:Powerline#Segments#ctrlp#segments#focus ") |
|
2 |
- let g:Powerline#Segments#ctrlp#segments#focus = '%{"%0"}' |
|
3 |
-endif |
|
4 |
-if !exists("g:Powerline#Segments#ctrlp#segments#prev ") |
|
5 |
- let g:Powerline#Segments#ctrlp#segments#prev = '%-3{"%3"}' |
|
6 |
-endif |
|
7 |
-if !exists("g:Powerline#Segments#ctrlp#segments#next ") |
|
8 |
- let g:Powerline#Segments#ctrlp#segments#next = '%-3{"%5"}' |
|
9 |
-endif |
|
10 |
- |
|
11 |
-let g:Powerline#Segments#ctrlp#segments = Pl#Segment#Init(['ctrlp' |
|
12 |
- \ , Pl#Segment#Create('focus', g:Powerline#Segments#ctrlp#segments#focus) |
|
13 |
- \ , Pl#Segment#Create('byfname', '%{"%1"}') |
|
14 |
- \ , Pl#Segment#Create('prev', g:Powerline#Segments#ctrlp#segments#prev) |
|
15 |
- \ , Pl#Segment#Create('item', '%-9{"%4"}') |
|
16 |
- \ , Pl#Segment#Create('next', g:Powerline#Segments#ctrlp#segments#next) |
|
17 |
- \ , Pl#Segment#Create('marked', '%{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)}') |
|
18 |
- \ |
|
19 |
- \ , Pl#Segment#Create('count', '%-6{"%0"}') |
|
20 |
-\ ]) |
... | ... |
@@ -1,5 +0,0 @@ |
1 |
-let g:Powerline#Segments#syntastic#segments = Pl#Segment#Init(['syntastic', |
|
2 |
- \ (exists('g:loaded_syntastic_plugin') && g:loaded_syntastic_plugin == 1), |
|
3 |
- \ |
|
4 |
- \ Pl#Segment#Create('errors', '%{Powerline#Functions#syntastic#GetErrors("$LINE")}', Pl#Segment#Modes('!N')) |
|
5 |
-\ ]) |
... | ... |
@@ -1,6 +0,0 @@ |
1 |
-let g:Powerline#Segments#tagbar#segments = Pl#Segment#Init(['tagbar', |
|
2 |
- \ (exists(':Tagbar') > 0), |
|
3 |
- \ |
|
4 |
- \ Pl#Segment#Create('currenttag', '%{tagbar#currenttag("%s", "")}', Pl#Segment#Modes('!N')), |
|
5 |
- \ Pl#Segment#Create('fullcurrenttag', '%{tagbar#currenttag("%s", "", "f")}', Pl#Segment#Modes('!N')) |
|
6 |
-\ ]) |
... | ... |
@@ -1,116 +0,0 @@ |
1 |
-let g:Powerline#Themes#default#theme = Pl#Theme#Create( |
|
2 |
- \ Pl#Theme#Buffer('' |
|
3 |
- \ , 'paste_indicator' |
|
4 |
- \ , 'mode_indicator' |
|
5 |
- \ , 'fugitive:branch' |
|
6 |
- \ , 'hgrev:branch' |
|
7 |
- \ , 'fileinfo' |
|
8 |
- \ , 'syntastic:errors' |
|
9 |
- \ , Pl#Segment#Truncate() |
|
10 |
- \ , 'tagbar:currenttag' |
|
11 |
- \ , Pl#Segment#Split() |
|
12 |
- \ , 'rvm:string' |
|
13 |
- \ , 'virtualenv:statusline' |
|
14 |
- \ , 'fileformat' |
|
15 |
- \ , 'fileencoding' |
|
16 |
- \ , 'filetype' |
|
17 |
- \ , 'scrollpercent' |
|
18 |
- \ , 'lineinfo' |
|
19 |
- \ ), |
|
20 |
- \ |
|
21 |
- \ Pl#Theme#Buffer('command_t' |
|
22 |
- \ , ['static_str.name', 'Command-T'] |
|
23 |
- \ , Pl#Segment#Truncate() |
|
24 |
- \ , Pl#Segment#Split() |
|
25 |
- \ , ['raw.line', '%10(Match #%l%)'] |
|
26 |
- \ ), |
|
27 |
- \ |
|
28 |
- \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree') |
|
29 |
- \ , ['static_str.name', 'Gundo'] |
|
30 |
- \ , ['static_str.buffer', 'Undo tree'] |
|
31 |
- \ , Pl#Segment#Truncate() |
|
32 |
- \ , Pl#Segment#Split() |
|
33 |
- \ ), |
|
34 |
- \ |
|
35 |
- \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview') |
|
36 |
- \ , ['static_str.name', 'Gundo'] |
|
37 |
- \ , ['static_str.buffer', 'Diff preview'] |
|
38 |
- \ , Pl#Segment#Truncate() |
|
39 |
- \ , Pl#Segment#Split() |
|
40 |
- \ ), |
|
41 |
- \ |
|
42 |
- \ Pl#Theme#Buffer('bt_help' |
|
43 |
- \ , ['static_str.name', 'Help'] |
|
44 |
- \ , 'filename' |
|
45 |
- \ , Pl#Segment#Truncate() |
|
46 |
- \ , Pl#Segment#Split() |
|
47 |
- \ , 'scrollpercent' |
|
48 |
- \ ), |
|
49 |
- \ |
|
50 |
- \ Pl#Theme#Buffer('ft_vimpager' |
|
51 |
- \ , ['static_str.name', 'Pager'] |
|
52 |
- \ , 'filename' |
|
53 |
- \ , Pl#Segment#Truncate() |
|
54 |
- \ , Pl#Segment#Split() |
|
55 |
- \ , 'scrollpercent' |
|
56 |
- \ ), |
|
57 |
- \ |
|
58 |
- \ Pl#Theme#Buffer('lustyexplorer' |
|
59 |
- \ , ['static_str.name', 'LustyExplorer'] |
|
60 |
- \ , ['static_str.buffer', 'Buffer list'] |
|
61 |
- \ , Pl#Segment#Truncate() |
|
62 |
- \ , Pl#Segment#Split() |
|
63 |
- \ ), |
|
64 |
- \ |
|
65 |
- \ Pl#Theme#Buffer('ft_man' |
|
66 |
- \ , ['static_str.name', 'Man page'] |
|
67 |
- \ , 'filename' |
|
68 |
- \ , Pl#Segment#Truncate() |
|
69 |
- \ , Pl#Segment#Split() |
|
70 |
- \ , 'scrollpercent' |
|
71 |
- \ ), |
|
72 |
- \ |
|
73 |
- \ Pl#Theme#Buffer('minibufexplorer' |
|
74 |
- \ , ['static_str.name', 'MiniBufExplorer'] |
|
75 |
- \ , Pl#Segment#Truncate() |
|
76 |
- \ , Pl#Segment#Split() |
|
77 |
- \ ), |
|
78 |
- \ |
|
79 |
- \ Pl#Theme#Buffer('ft_qf' |
|
80 |
- \ , ['static_str.name', 'Quickfix'] |
|
81 |
- \ , Pl#Segment#Truncate() |
|
82 |
- \ , Pl#Segment#Split() |
|
83 |
- \ ), |
|
84 |
- \ |
|
85 |
- \ Pl#Theme#Buffer('tagbar' |
|
86 |
- \ , ['static_str.name', 'Tagbar'] |
|
87 |
- \ , ['static_str.buffer', 'Tree'] |
|
88 |
- \ , Pl#Segment#Truncate() |
|
89 |
- \ , Pl#Segment#Split() |
|
90 |
- \ ), |
|
91 |
- \ |
|
92 |
- \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"') |
|
93 |
- \ , 'ctrlp:prev' |
|
94 |
- \ , 'ctrlp:item' |
|
95 |
- \ , 'ctrlp:next' |
|
96 |
- \ , 'ctrlp:marked' |
|
97 |
- \ , Pl#Segment#Truncate() |
|
98 |
- \ , Pl#Segment#Split() |
|
99 |
- \ , 'ctrlp:focus' |
|
100 |
- \ , 'ctrlp:byfname' |
|
101 |
- \ , 'pwd' |
|
102 |
- \ ), |
|
103 |
- \ |
|
104 |
- \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"') |
|
105 |
- \ , 'ctrlp:count' |
|
106 |
- \ , Pl#Segment#Truncate() |
|
107 |
- \ , Pl#Segment#Split() |
|
108 |
- \ , 'pwd' |
|
109 |
- \ ), |
|
110 |
- \ |
|
111 |
- \ Pl#Theme#Buffer('nerdtree' |
|
112 |
- \ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}'] |
|
113 |
- \ , Pl#Segment#Truncate() |
|
114 |
- \ , Pl#Segment#Split() |
|
115 |
- \ ) |
|
116 |
-\ ) |
... | ... |
@@ -1,114 +0,0 @@ |
1 |
-" Authors: |
|
2 |
-" @stephenmckinney |
|
3 |
-" |
|
4 |
-let g:Powerline#Themes#solarized16#theme = Pl#Theme#Create( |
|
5 |
- \ Pl#Theme#Buffer('' |
|
6 |
- \ , 'fugitive:branch' |
|
7 |
- \ , 'fileinfo' |
|
8 |
- \ , 'flags.mod' |
|
9 |
- \ , 'syntastic:errors' |
|
10 |
- \ , Pl#Segment#Truncate() |
|
11 |
- \ , Pl#Segment#Split() |
|
12 |
- \ , 'sass:status' |
|
13 |
- \ , 'rvm:string' |
|
14 |
- \ , 'filetype' |
|
15 |
- \ , 'scrollpercent' |
|
16 |
- \ , 'paste_indicator' |
|
17 |
- \ ), |
|
18 |
- \ |
|
19 |
- \ Pl#Theme#Buffer('command_t' |
|
20 |
- \ , ['static_str.name', 'Command-T'] |
|
21 |
- \ , Pl#Segment#Truncate() |
|
22 |
- \ , Pl#Segment#Split() |
|
23 |
- \ , ['raw.line', '%10(Match #%l%)'] |
|
24 |
- \ ), |
|
25 |
- \ |
|
26 |
- \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree') |
|
27 |
- \ , ['static_str.name', 'Gundo'] |
|
28 |
- \ , ['static_str.buffer', 'Undo tree'] |
|
29 |
- \ , Pl#Segment#Truncate() |
|
30 |
- \ , Pl#Segment#Split() |
|
31 |
- \ ), |
|
32 |
- \ |
|
33 |
- \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview') |
|
34 |
- \ , ['static_str.name', 'Gundo'] |
|
35 |
- \ , ['static_str.buffer', 'Diff preview'] |
|
36 |
- \ , Pl#Segment#Truncate() |
|
37 |
- \ , Pl#Segment#Split() |
|
38 |
- \ ), |
|
39 |
- \ |
|
40 |
- \ Pl#Theme#Buffer('bt_help' |
|
41 |
- \ , ['static_str.name', 'Help'] |
|
42 |
- \ , 'filename' |
|
43 |
- \ , Pl#Segment#Truncate() |
|
44 |
- \ , Pl#Segment#Split() |
|
45 |
- \ , 'scrollpercent' |
|
46 |
- \ ), |
|
47 |
- \ |
|
48 |
- \ Pl#Theme#Buffer('ft_vimpager' |
|
49 |
- \ , ['static_str.name', 'Pager'] |
|
50 |
- \ , 'filename' |
|
51 |
- \ , Pl#Segment#Truncate() |
|
52 |
- \ , Pl#Segment#Split() |
|
53 |
- \ , 'scrollpercent' |
|
54 |
- \ ), |
|
55 |
- \ |
|
56 |
- \ Pl#Theme#Buffer('lustyexplorer' |
|
57 |
- \ , ['static_str.name', 'LustyExplorer'] |
|
58 |
- \ , ['static_str.buffer', 'Buffer list'] |
|
59 |
- \ , Pl#Segment#Truncate() |
|
60 |
- \ , Pl#Segment#Split() |
|
61 |
- \ ), |
|
62 |
- \ |
|
63 |
- \ Pl#Theme#Buffer('ft_man' |
|
64 |
- \ , ['static_str.name', 'Man page'] |
|
65 |
- \ , 'filename' |
|
66 |
- \ , Pl#Segment#Truncate() |
|
67 |
- \ , Pl#Segment#Split() |
|
68 |
- \ , 'scrollpercent' |
|
69 |
- \ ), |
|
70 |
- \ |
|
71 |
- \ Pl#Theme#Buffer('minibufexplorer' |
|
72 |
- \ , ['static_str.name', 'MiniBufExplorer'] |
|
73 |
- \ , Pl#Segment#Truncate() |
|
74 |
- \ , Pl#Segment#Split() |
|
75 |
- \ ), |
|
76 |
- \ |
|
77 |
- \ Pl#Theme#Buffer('ft_qf' |
|
78 |
- \ , ['static_str.name', 'Quickfix'] |
|
79 |
- \ , Pl#Segment#Truncate() |
|
80 |
- \ , Pl#Segment#Split() |
|
81 |
- \ ), |
|
82 |
- \ |
|
83 |
- \ Pl#Theme#Buffer('tagbar' |
|
84 |
- \ , ['static_str.name', 'Tagbar'] |
|
85 |
- \ , ['static_str.buffer', 'Tree'] |
|
86 |
- \ , Pl#Segment#Truncate() |
|
87 |
- \ , Pl#Segment#Split() |
|
88 |
- \ ), |
|
89 |
- \ |
|
90 |
- \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"') |
|
91 |
- \ , 'ctrlp:prev' |
|
92 |
- \ , 'ctrlp:item' |
|
93 |
- \ , 'ctrlp:next' |
|
94 |
- \ , 'ctrlp:marked' |
|
95 |
- \ , Pl#Segment#Truncate() |
|
96 |
- \ , Pl#Segment#Split() |
|
97 |
- \ , 'ctrlp:focus' |
|
98 |
- \ , 'ctrlp:byfname' |
|
99 |
- \ , 'pwd' |
|
100 |
- \ ), |
|
101 |
- \ |
|
102 |
- \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"') |
|
103 |
- \ , 'ctrlp:count' |
|
104 |
- \ , Pl#Segment#Truncate() |
|
105 |
- \ , Pl#Segment#Split() |
|
106 |
- \ , 'pwd' |
|
107 |
- \ ), |
|
108 |
- \ |
|
109 |
- \ Pl#Theme#Buffer('nerdtree' |
|
110 |
- \ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}'] |
|
111 |
- \ , Pl#Segment#Truncate() |
|
112 |
- \ , Pl#Segment#Split() |
|
113 |
- \ ) |
|
114 |
-\ ) |
... | ... |
@@ -1,119 +0,0 @@ |
1 |
-" Authors: |
|
2 |
-" @skwp |
|
3 |
-" |
|
4 |
-" Disabled: |
|
5 |
-" Add the following line into the first theme group to see the highlight |
|
6 |
-" group |
|
7 |
-" \ , 'currhigroup' |
|
8 |
-" |
|
9 |
-" Line info taken out - I know which line number I'm on from the gutter |
|
10 |
-"\ , 'lineinfo' |
|
11 |
-let g:Powerline#Themes#solarized256#theme = Pl#Theme#Create( |
|
12 |
- \ Pl#Theme#Buffer('' |
|
13 |
- \ , 'fugitive:branch' |
|
14 |
- \ , 'fileinfo' |
|
15 |
- \ , 'flags.mod' |
|
16 |
- \ , 'syntastic:errors' |
|
17 |
- \ , Pl#Segment#Truncate() |
|
18 |
- \ , Pl#Segment#Split() |
|
19 |
- \ , 'sass:status' |
|
20 |
- \ , 'rvm:string' |
|
21 |
- \ , 'paste_indicator' |
|
22 |
- \ ), |
|
23 |
- \ |
|
24 |
- \ Pl#Theme#Buffer('command_t' |
|
25 |
- \ , ['static_str.name', 'Command-T'] |
|
26 |
- \ , Pl#Segment#Truncate() |
|
27 |
- \ , Pl#Segment#Split() |
|
28 |
- \ , ['raw.line', '%10(Match #%l%)'] |
|
29 |
- \ ), |
|
30 |
- \ |
|
31 |
- \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree') |
|
32 |
- \ , ['static_str.name', 'Gundo'] |
|
33 |
- \ , ['static_str.buffer', 'Undo tree'] |
|
34 |
- \ , Pl#Segment#Truncate() |
|
35 |
- \ , Pl#Segment#Split() |
|
36 |
- \ ), |
|
37 |
- \ |
|
38 |
- \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview') |
|
39 |
- \ , ['static_str.name', 'Gundo'] |
|
40 |
- \ , ['static_str.buffer', 'Diff preview'] |
|
41 |
- \ , Pl#Segment#Truncate() |
|
42 |
- \ , Pl#Segment#Split() |
|
43 |
- \ ), |
|
44 |
- \ |
|
45 |
- \ Pl#Theme#Buffer('bt_help' |
|
46 |
- \ , ['static_str.name', 'Help'] |
|
47 |
- \ , 'filename' |
|
48 |
- \ , Pl#Segment#Truncate() |
|
49 |
- \ , Pl#Segment#Split() |
|
50 |
- \ , 'scrollpercent' |
|
51 |
- \ ), |
|
52 |
- \ |
|
53 |
- \ Pl#Theme#Buffer('ft_vimpager' |
|
54 |
- \ , ['static_str.name', 'Pager'] |
|
55 |
- \ , 'filename' |
|
56 |
- \ , Pl#Segment#Truncate() |
|
57 |
- \ , Pl#Segment#Split() |
|
58 |
- \ , 'scrollpercent' |
|
59 |
- \ ), |
|
60 |
- \ |
|
61 |
- \ Pl#Theme#Buffer('lustyexplorer' |
|
62 |
- \ , ['static_str.name', 'LustyExplorer'] |
|
63 |
- \ , ['static_str.buffer', 'Buffer list'] |
|
64 |
- \ , Pl#Segment#Truncate() |
|
65 |
- \ , Pl#Segment#Split() |
|
66 |
- \ ), |
|
67 |
- \ |
|
68 |
- \ Pl#Theme#Buffer('ft_man' |
|
69 |
- \ , ['static_str.name', 'Man page'] |
|
70 |
- \ , 'filename' |
|
71 |
- \ , Pl#Segment#Truncate() |
|
72 |
- \ , Pl#Segment#Split() |
|
73 |
- \ , 'scrollpercent' |
|
74 |
- \ ), |
|
75 |
- \ |
|
76 |
- \ Pl#Theme#Buffer('minibufexplorer' |
|
77 |
- \ , ['static_str.name', 'MiniBufExplorer'] |
|
78 |
- \ , Pl#Segment#Truncate() |
|
79 |
- \ , Pl#Segment#Split() |
|
80 |
- \ ), |
|
81 |
- \ |
|
82 |
- \ Pl#Theme#Buffer('ft_qf' |
|
83 |
- \ , ['static_str.name', 'Quickfix'] |
|
84 |
- \ , Pl#Segment#Truncate() |
|
85 |
- \ , Pl#Segment#Split() |
|
86 |
- \ ), |
|
87 |
- \ |
|
88 |
- \ Pl#Theme#Buffer('tagbar' |
|
89 |
- \ , ['static_str.name', 'Tagbar'] |
|
90 |
- \ , ['static_str.buffer', 'Tree'] |
|
91 |
- \ , Pl#Segment#Truncate() |
|
92 |
- \ , Pl#Segment#Split() |
|
93 |
- \ ), |
|
94 |
- \ |
|
95 |
- \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"') |
|
96 |
- \ , 'ctrlp:prev' |
|
97 |
- \ , 'ctrlp:item' |
|
98 |
- \ , 'ctrlp:next' |
|
99 |
- \ , 'ctrlp:marked' |
|
100 |
- \ , Pl#Segment#Truncate() |
|
101 |
- \ , Pl#Segment#Split() |
|
102 |
- \ , 'ctrlp:focus' |
|
103 |
- \ , 'ctrlp:byfname' |
|
104 |
- \ , 'pwd' |
|
105 |
- \ ), |
|
106 |
- \ |
|
107 |
- \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"') |
|
108 |
- \ , 'ctrlp:count' |
|
109 |
- \ , Pl#Segment#Truncate() |
|
110 |
- \ , Pl#Segment#Split() |
|
111 |
- \ , 'pwd' |
|
112 |
- \ ), |
|
113 |
- \ |
|
114 |
- \ Pl#Theme#Buffer('nerdtree' |
|
115 |
- \ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}'] |
|
116 |
- \ , Pl#Segment#Truncate() |
|
117 |
- \ , Pl#Segment#Split() |
|
118 |
- \ ) |
|
119 |
-\ ) |
... | ... |
@@ -1,439 +0,0 @@ |
1 |
-*Powerline.txt* For Vim version 7.3. Last change: 2011 Nov 23 |
|
2 |
- |
|
3 |
- ______ |
|
4 |
- _________ \ /__ |
|
5 |
- \_____ \______ _ _____________ / /'__' ___ ____ |
|
6 |
- | ___/ _ \ \/ \/ / __ \_ ___\ / | |/ \_/ __ \ |
|
7 |
- | | | (_) \ _ / ___/| | / /__| | | \ ___/ |
|
8 |
- '___' \____/ \/ \/ \___ |__' /___ /'__'__| /\___ \ |
|
9 |
- \/ / / \/ \/ |
|
10 |
- | / |
|
11 |
- |/ |
|
12 |
- ' |
|
13 |
- |
|
14 |
-============================================================================== |
|
15 |
-CONTENTS *Powerline-contents* |
|
16 |
- |
|
17 |
- 1. Introduction ....................... |Powerline-introduction| |
|
18 |
- 2. Usage .............................. |Powerline-usage| |
|
19 |
- 3. Requirements ....................... |Powerline-requirements| |
|
20 |
- 3.1 Recommended settings ........... |Powerline-recommended-settings| |
|
21 |
- 4. Configuration ...................... |Powerline-configuration| |
|
22 |
- 4.1 Powerline_cache_file ........... |Powerline_cache_file| |
|
23 |
- 4.1.1 Clearing the cache ....... |:PowerlineClearCache| |
|
24 |
- 4.1.2 Powerline_cache_dir ...... |Powerline_cache_dir| |
|
25 |
- 4.2 Powerline_cache_enabled ........ |Powerline_cache_enabled| |
|
26 |
- 4.3 Powerline_symbols .............. |Powerline_symbols| |
|
27 |
- 4.3.1 Compatible symbols ....... |Powerline-symbols-compatible| |
|
28 |
- 4.3.2 Fancy symbols ............ |Powerline-symbols-fancy| |
|
29 |
- 4.3.3 Overriding symbols ....... |Powerline_symbols_override| |
|
30 |
- 4.3.4 Overriding dividers ...... |Powerline_dividers_override| |
|
31 |
- 4.4 Powerline_theme ................ |Powerline_theme| |
|
32 |
- 4.5 Powerline_colorscheme .......... |Powerline_colorscheme| |
|
33 |
- 4.6 Powerline_stl_path_style ....... |Powerline_stl_path_style| |
|
34 |
- 5. Fonts .............................. |Powerline-fonts| |
|
35 |
- 6. Customization ...................... |Powerline-customization| |
|
36 |
- 6.1 Basic customization ............ |Powerline-basic-customization| |
|
37 |
- 6.2 Advanced customization ......... |Powerline-advanced-customization| |
|
38 |
- 6.2.1 Colorschemes ............. |Powerline-cust-colorschemes| |
|
39 |
- 6.2.2 Functions ................ |Powerline-cust-functions| |
|
40 |
- 6.2.3 Segments ................. |Powerline-cust-segments| |
|
41 |
- 6.2.4 Themes ................... |Powerline-cust-themes| |
|
42 |
- 7. License ............................ |Powerline-license| |
|
43 |
- 8. Known issues ....................... |Powerline-known-issues| |
|
44 |
- 9. Contributing ....................... |Powerline-contributing| |
|
45 |
- |
|
46 |
-============================================================================== |
|
47 |
-1. Introduction *Powerline* *Powerline-introduction* |
|
48 |
- |
|
49 |
-Powerline is a utility plugin which allows you to create better-looking, more |
|
50 |
-functional Vim statuslines. |
|
51 |
- |
|
52 |
-============================================================================== |
|
53 |
-2. Usage *Powerline-usage* |
|
54 |
- |
|
55 |
-Powerline is automatically enabled when it's installed, either by unzipping |
|
56 |
-the provided archive or by adding it as a Pathogen/Vundle bundle. |
|
57 |
- |
|
58 |
-Powerline replaces the standard Vim 'statusline' with a custom statusline made |
|
59 |
-up of Powerline segments. |
|
60 |
- |
|
61 |
-Powerline ignores any 'statusline' customizations you have defined in your |
|
62 |
-|vimrc|. If you remove Powerline, your 'statusline' customizations are |
|
63 |
-restored. |
|
64 |
- |
|
65 |
-============================================================================== |
|
66 |
-3. Requirements *Powerline-requirements* |
|
67 |
- |
|
68 |
-Powerline has been developed and tested in Vim 7.3, but it should run without |
|
69 |
-any problems in Vim 7.2. The default configuration requires a Unix-like system |
|
70 |
-to work properly. |
|
71 |
- |
|
72 |
-The plugin only works with Vim running in an 88/256-color terminal or Gvim. |
|
73 |
- |
|
74 |
-Vi-compatible mode must be disabled. |
|
75 |
- |
|
76 |
------------------------------------------------------------------------------- |
|
77 |
-3.1 Recommended settings *Powerline-recommended-settings* |
|
78 |
- |
|
79 |
-The following configuration options should be set in your |vimrc|: > |
|
80 |
- |
|
81 |
- set nocompatible " Disable vi-compatibility |
|
82 |
- set laststatus=2 " Always show the statusline |
|
83 |
- set encoding=utf-8 " Necessary to show Unicode glyphs |
|
84 |
- |
|
85 |
-Note: If you're using an 88/256-color terminal but still don't see the colored |
|
86 |
-statusline, you may have to set the following option as well: > |
|
87 |
- |
|
88 |
- set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors |
|
89 |
- |
|
90 |
-============================================================================== |
|
91 |
-4. Configuration *Powerline-configuration* |
|
92 |
- |
|
93 |
-Powerline will work fine without any user configuration, but default behavior |
|
94 |
-can be overridden by setting configuration variables globally in your |vimrc| |
|
95 |
-file. |
|
96 |
- |
|
97 |
------------------------------------------------------------------------------- |
|
98 |
-4.1 Powerline_cache_file *Powerline_cache_file* |
|
99 |
- |
|
100 |
-By default Powerline caches all the statuslines and colors in a cache file in |
|
101 |
-the plugin's directory (or the Vim directory, depending on the installation |
|
102 |
-method used). |
|
103 |
- |
|
104 |
-It's recommended that you enable the cache, as this dramatically improves Vim |
|
105 |
-startup time after the cache file has been generated (the plugin usually loads |
|
106 |
-within ~100ms without the cache and ~1ms with the cache). |
|
107 |
- |
|
108 |
-Note: The default cache filename includes the current theme, colorscheme and |
|
109 |
-symbol settings in order to tie the cache file to your current configuration, |
|
110 |
-so the cache file will be regenerated when you change any settings. This may |
|
111 |
-leave several old cache files in your Vim folder, and these may safely be |
|
112 |
-deleted. |
|
113 |
- |
|
114 |
-Defaults: "|Powerline_cache_dir|/Powerline_<theme>_<colorscheme>_<symbols>.cache" |
|
115 |
- |
|
116 |
------------------------------------------------------------------------------- |
|
117 |
-4.1.1 Powerline_cache_dir *Powerline_cache_dir* |
|
118 |
- |
|
119 |
-This is the directory used for |Powerline_cache_file|. |
|
120 |
- |
|
121 |
-Default: Plugin directory: > |
|
122 |
- |
|
123 |
- let g:Powerline_cache_dir = simplify(expand('<sfile>:p:h') .'/..') |
|
124 |
-< |
|
125 |
------------------------------------------------------------------------------- |
|
126 |
-4.1.2 Clearing the cache *:PowerlineClearCache* |
|
127 |
- |
|
128 |
-Powerline provides a command to easily clear the cache after changing your |
|
129 |
-settings or updating your theme. Simply run the following command to clear |
|
130 |
-your cache, and restart Vim afterwards: > |
|
131 |
- |
|
132 |
- :PowerlineClearCache |
|
133 |
-< |
|
134 |
------------------------------------------------------------------------------- |
|
135 |
-4.2 Powerline_cache_enabled *Powerline_cache_enabled* |
|
136 |
- |
|
137 |
-It's possible to disable statusline caching by setting this option to 0. This |
|
138 |
-is mostly useful when developing statuslines. |
|
139 |
- |
|
140 |
-Example: > |
|
141 |
- |
|
142 |
- let g:Powerline_cache_enabled = 0 |
|
143 |
-< |
|
144 |
- |
|
145 |
-Default: 1 |
|
146 |
- |
|
147 |
------------------------------------------------------------------------------- |
|
148 |
-4.3 Powerline_symbols *Powerline_symbols* |
|
149 |
- |
|
150 |
-This option defines which set of symbols and dividers you want to use. There |
|
151 |
-are currently three available options: "compatible", "unicode" and "fancy". |
|
152 |
- |
|
153 |
- TYPE DESCRIPTION ~ |
|
154 |
- compatible Doesn't use any special characters. |
|
155 |
- unicode Simulates icons and arrows using similar Unicode glyphs. |
|
156 |
- fancy Custom icons and arrows. Requires a patched font. |
|
157 |
- |
|
158 |
-Example: > |
|
159 |
- |
|
160 |
- let g:Powerline_symbols = 'fancy' |
|
161 |
-< |
|
162 |
- |
|
163 |
-Default: "compatible" |
|
164 |
- |
|
165 |
-Symbols can be inserted into statuslines by using the following variables |
|
166 |
-(just insert the variables as text in your segments): |
|
167 |
- |
|
168 |
- VARIABLE DESCRIPTION ~ |
|
169 |
- $BRANCH Inserts a branch symbol |
|
170 |
- $RO Inserts a read-only symbol |
|
171 |
- $FT Inserts a filetype symbol |
|
172 |
- $LINE Inserts a line number symbol |
|
173 |
- |
|
174 |
------------------------------------------------------------------------------- |
|
175 |
-4.3.1 Compatible symbols *Powerline-symbols-compatible* |
|
176 |
- |
|
177 |
-These symbols will work in any configuration, and do not require a special |
|
178 |
-font to work. This option will replace the fancy icons with plain text, and |
|
179 |
-the pointy dividers with straight lines. |
|
180 |
- |
|
181 |
------------------------------------------------------------------------------- |
|
182 |
-4.3.2 Fancy symbols *Powerline-symbols-fancy* |
|
183 |
- |
|
184 |
-These symbols require a custom font to work. A font patcher is provided for |
|
185 |
-adding the required symbols to any outline font and some bitmap fonts, see |
|
186 |
-|Powerline-fonts| and the provided README file for usage details. |
|
187 |
- |
|
188 |
------------------------------------------------------------------------------- |
|
189 |
-4.3.3 Overriding symbols *Powerline_symbols_override* |
|
190 |
- |
|
191 |
-You can override symbols by adding your symbols to the |
|
192 |
-g:Powerline_symbols_override dictionary. Example: If you want the branch |
|
193 |
-symbol to be "∓" (hex code 0x2213) and the line symbol to be "L" you can add |
|
194 |
-the following to your |vimrc|: > |
|
195 |
- |
|
196 |
- let g:Powerline_symbols_override = { |
|
197 |
- \ 'BRANCH': [0x2213], |
|
198 |
- \ 'LINE': 'L', |
|
199 |
- \ } |
|
200 |
-< |
|
201 |
------------------------------------------------------------------------------- |
|
202 |
-4.3.4 Overriding dividers *Powerline_dividers_override* |
|
203 |
- |
|
204 |
-If you for some reason want to override the dividers then you can set |
|
205 |
-g:Powerline_dividers_override to a list with exactly four elements: |
|
206 |
- |
|
207 |
- 1: Hard right-pointing arrow |
|
208 |
- 2: Soft right-pointing arrow |
|
209 |
- 3: Hard left-pointing arrow |
|
210 |
- 4: Soft left-pointing arrow |
|
211 |
- |
|
212 |
-Example: > |
|
213 |
- |
|
214 |
- let g:Powerline_dividers_override = ['>>', '>', '<<', '<'] |
|
215 |
-< |
|
216 |
- |
|
217 |
------------------------------------------------------------------------------- |
|
218 |
-4.3.5 Overriding mode names *Powerline_mode* |
|
219 |
- |
|
220 |
-You can change the names used for modes at the far left by setting some |
|
221 |
-variables in your |vimrc|. For example you can change "N" to "NORMAL" with: > |
|
222 |
- |
|
223 |
- let g:Powerline_mode_n = 'NORMAL' |
|
224 |
-< |
|
225 |
-The variables are all named beginning with 'g:Powerline_mode_', as follows: |
|
226 |
- |
|
227 |
-mode name default note ~ |
|
228 |
-Normal n ' N ' (surrounded by spaces) |
|
229 |
-Insert i INSERT |
|
230 |
-Replace R REPLACE |Replace-mode| |
|
231 |
-Visual v VISUAL |Visual-mode| |
|
232 |
-Visual linewise V V⋅LINE |
|
233 |
-Visual blockwise cv V⋅BLOCK |
|
234 |
-Select s SELECT |Select-mode| |
|
235 |
-Select linewise S S⋅LINE |
|
236 |
-Select blockwise cs S⋅BLOCK |
|
237 |
- |
|
238 |
------------------------------------------------------------------------------ |
|
239 |
-4.4 Powerline_theme *Powerline_theme* |
|
240 |
- |
|
241 |
-This option defines the theme Powerline uses. The available themes are located |
|
242 |
-in autoload/Powerline/Themes/. A theme is a pre-defined set of Powerline |
|
243 |
-segments which make up the statusline. |
|
244 |
- |
|
245 |
-Example: > |
|
246 |
- |
|
247 |
- let g:Powerline_theme = 'solarized256' |
|
248 |
-< |
|
249 |
- |
|
250 |
-Default: "default" |
|
251 |
- |
|
252 |
------------------------------------------------------------------------------- |
|
253 |
-4.5 Powerline_colorscheme *Powerline_colorscheme* |
|
254 |
- |
|
255 |
-This option defines the colorscheme Powerline uses. The available colorschemes |
|
256 |
-are located in autoload/Powerline/Colorschemes/. |
|
257 |
- |
|
258 |
-Example: > |
|
259 |
- |
|
260 |
- let g:Powerline_colorscheme = 'solarized256' |
|
261 |
-< |
|
262 |
- |
|
263 |
-Default: "default" |
|
264 |
- |
|
265 |
------------------------------------------------------------------------------- |
|
266 |
-4.6 Powerline_stl_path_style *Powerline_stl_path_style* |
|
267 |
- |
|
268 |
-There are currently four ways to display the current path and file name. The |
|
269 |
-default is to only display the file name like the %t statusline item. By |
|
270 |
-setting this configuration value you can choose from the following ways |
|
271 |
-display the current path and file name: |
|
272 |
- |
|
273 |
- VALUE DESCRIPTION ~ |
|
274 |
- filename Display only the file name using the %t statusline item. |
|
275 |
- short Display a short path. The home directory is substituted with |
|
276 |
- "~", the first directory is displayed with its full name, and |
|
277 |
- subsequent directories are shortened to their first letter. |
|
278 |
- I.e. "/home/user/foo/bar/baz.vim" becomes "~/f/b/baz.vim" and |
|
279 |
- "long/relative/path/foo/bar/baz.vim becomes |
|
280 |
- "long/r/p/f/b/baz.vim". |
|
281 |
- relative Display a relative path, similar to the %f statusline item. |
|
282 |
- full Display the full path, similar to the %F statusline item. |
|
283 |
- |
|
284 |
-Example: > |
|
285 |
- |
|
286 |
- let g:Powerline_stl_path_style = 'full' |
|
287 |
-< |
|
288 |
- |
|
289 |
-Default: "relative" |
|
290 |
- |
|
291 |
-============================================================================== |
|
292 |
-5. Fonts *Powerline-fonts* |
|
293 |
- |
|
294 |
-TODO |
|
295 |
- |
|
296 |
-============================================================================== |
|
297 |
-6. Customization *Powerline-customization* |
|
298 |
- |
|
299 |
-There are currently two ways of customizing Powerline: Basic customization |
|
300 |
-using a couple of functions to insert and remove existing segments from the |
|
301 |
-statusline, and advanced customization using your own autoload files. The |
|
302 |
-customization features of Powerline allow you to create your own statuslines |
|
303 |
-without ever touching the original source code. |
|
304 |
- |
|
305 |
------------------------------------------------------------------------------- |
|
306 |
-6.1 Basic customization *Powerline-basic-customization* |
|
307 |
- |
|
308 |
-Powerline provides the following functions to alter the default statusline |
|
309 |
-look. These functions should be called from your |vimrc| file or another file |
|
310 |
-which is sourced at Vim startup. |
|
311 |
- |
|
312 |
-Note: These functions are currently applied to all statuslines, so if you |
|
313 |
-insert a segment after a segment which is present in many statuslines (e.g. |
|
314 |
-the "filename" segment), all the statuslines will have the inserted segment. |
|
315 |
-This behavior may be changed in a future version of Powerline. |
|
316 |
- |
|
317 |
-Note: Remember to clear your cache with |:PowerlineClearCache| after changing |
|
318 |
-your statusline! |
|
319 |
- |
|
320 |
-Example: > |
|
321 |
- |
|
322 |
- " Insert the charcode segment after the filetype segment |
|
323 |
- call Pl#Theme#InsertSegment('charcode', 'after', 'filetype') |
|
324 |
- |
|
325 |
- " Replace the scrollpercent segment with the charcode segment |
|
326 |
- call Pl#Theme#ReplaceSegment('scrollpercent', 'fileinfo') |
|
327 |
-< |
|
328 |
- *Pl#Theme#InsertSegment* |
|
329 |
-Pl#Theme#InsertSegment({newsegment}, {location}, {targetsegment}) |
|
330 |
- |
|
331 |
-This function inserts {newsegment} before or after {targetsegment}. The |
|
332 |
-{location} parameter specifies the location of the new segment, valid values |
|
333 |
-are "before" and "after". You can see all the available segments in |
|
334 |
-autoload/Powerline/Segments.vim and the files specified in |
|
335 |
-|Powerline-cust-segments|. |
|
336 |
- |
|
337 |
-Pl#Theme#RemoveSegment({targetsegment}) *Pl#Theme#RemoveSegment* |
|
338 |
- |
|
339 |
-This function removes the {targetsegment} segment entirely. |
|
340 |
- |
|
341 |
-Pl#Theme#ReplaceSegment({oldsegment}, {newsegment}) *Pl#Theme#ReplaceSegment* |
|
342 |
- |
|
343 |
-This function replaces {oldsegment} with {newsegment}. |
|
344 |
- |
|
345 |
------------------------------------------------------------------------------- |
|
346 |
-6.2 Advanced customization *Powerline-advanced-customization* |
|
347 |
- |
|
348 |
-Because Powerline utilizes Vim's autoload functionality, you can easily create |
|
349 |
-your own segments, themes, functions and colorschemes without touching the |
|
350 |
-original source code. This is a bit more complex than using the utility |
|
351 |
-functions, but it allows you to do a lot more with your statusline. |
|
352 |
- |
|
353 |
-Your custom autoload files should be stored in your |runtimepath| (usually in |
|
354 |
-"~/.vim/autoload/Powerline/*"). |
|
355 |
- |
|
356 |
-Note: Remember to clear your cache with |:PowerlineClearCache| after changing |
|
357 |
-your statusline! |
|
358 |
- |
|
359 |
-6.2.1 Colorschemes *Powerline-cust-colorschemes* |
|
360 |
------------------------------------------------------------------------------- |
|
361 |
- |
|
362 |
-Colorschemes should be stored as separate files in |
|
363 |
-{runtimepath}/autoload/Powerline/Colorschemes/. |
|
364 |
- |
|
365 |
-SYNTAX ~ |
|
366 |
- |
|
367 |
-TODO |
|
368 |
- |
|
369 |
-EXAMPLE ~ |
|
370 |
- |
|
371 |
-TODO |
|
372 |
- |
|
373 |
-6.2.2 Functions *Powerline-cust-functions* |
|
374 |
------------------------------------------------------------------------------- |
|
375 |
- |
|
376 |
-Functions should be stored as separate files in |
|
377 |
-{runtimepath}/autoload/Powerline/Functions/. |
|
378 |
- |
|
379 |
-SYNTAX ~ |
|
380 |
- |
|
381 |
-TODO |
|
382 |
- |
|
383 |
-EXAMPLE ~ |
|
384 |
- |
|
385 |
-TODO |
|
386 |
- |
|
387 |
-6.2.3 Segments *Powerline-cust-segments* |
|
388 |
------------------------------------------------------------------------------- |
|
389 |
- |
|
390 |
-Segments should be stored as separate files in |
|
391 |
-{runtimepath}/autoload/Powerline/Segments/. |
|
392 |
- |
|
393 |
-SYNTAX ~ |
|
394 |
- |
|
395 |
-TODO |
|
396 |
- |
|
397 |
-EXAMPLE ~ |
|
398 |
- |
|
399 |
-TODO |
|
400 |
- |
|
401 |
-6.2.4 Themes *Powerline-cust-themes* |
|
402 |
------------------------------------------------------------------------------- |
|
403 |
- |
|
404 |
-Themes should be stored as separate files in |
|
405 |
-{runtimepath}/autoload/Powerline/Themes/. |
|
406 |
- |
|
407 |
-SYNTAX ~ |
|
408 |
- |
|
409 |
-TODO |
|
410 |
- |
|
411 |
-EXAMPLE ~ |
|
412 |
- |
|
413 |
-TODO |
|
414 |
- |
|
415 |
-============================================================================== |
|
416 |
-7. License *Powerline-license* |
|
417 |
- |
|
418 |
-Creative Commons Attribution-ShareAlike 3.0 Unported |
|
419 |
- |
|
420 |
-http://creativecommons.org/licenses/by-sa/3.0/ |
|
421 |
- |
|
422 |
-============================================================================== |
|
423 |
-8. Known issues *Powerline-known-issues* |
|
424 |
- |
|
425 |
-See the issue tracker at |
|
426 |
-https://github.com/Lokaltog/vim-powerline/issues |
|
427 |
- |
|
428 |
-============================================================================== |
|
429 |
-9. Contributing *Powerline-contributing* |
|
430 |
- |
|
431 |
-If you experience any bugs or have feature requests, please open an issue on |
|
432 |
-GitHub. Fork the source repository on GitHub and send a pull request if you |
|
433 |
-have any code improvements. |
|
434 |
- |
|
435 |
-Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com> |
|
436 |
-Source repository: https://github.com/Lokaltog/vim-powerline |
|
437 |
- |
|
438 |
-============================================================================== |
|
439 |
-vim:tw=78:sw=4:ts=8:ft=help:norl: |
... | ... |
@@ -1,319 +0,0 @@ |
1 |
-SplineFontDB: 3.0 |
|
2 |
-FontName: PowerlineSymbols |
|
3 |
-FullName: PowerlineSymbols |
|
4 |
-FamilyName: PowerlineSymbols |
|
5 |
-Weight: Medium |
|
6 |
-Copyright: |
|
7 |
-UComments: "2011-11-21: Created." |
|
8 |
-Version: 001.000 |
|
9 |
-ItalicAngle: 0 |
|
10 |
-UnderlinePosition: -98.6328 |
|
11 |
-UnderlineWidth: 48.8281 |
|
12 |
-Ascent: 800 |
|
13 |
-Descent: 200 |
|
14 |
-LayerCount: 2 |
|
15 |
-Layer: 0 0 "Back" 1 |
|
16 |
-Layer: 1 0 "Fore" 0 |
|
17 |
-XUID: [1021 211 26716215 11021609] |
|
18 |
-FSType: 0 |
|
19 |
-OS2Version: 0 |
|
20 |
-OS2_WeightWidthSlopeOnly: 0 |
|
21 |
-OS2_UseTypoMetrics: 1 |
|
22 |
-CreationTime: 1321867751 |
|
23 |
-ModificationTime: 1326665029 |
|
24 |
-OS2TypoAscent: 0 |
|
25 |
-OS2TypoAOffset: 1 |
|
26 |
-OS2TypoDescent: 0 |
|
27 |
-OS2TypoDOffset: 1 |
|
28 |
-OS2TypoLinegap: 90 |
|
29 |
-OS2WinAscent: 0 |
|
30 |
-OS2WinAOffset: 1 |
|
31 |
-OS2WinDescent: 0 |
|
32 |
-OS2WinDOffset: 1 |
|
33 |
-HheadAscent: 0 |
|
34 |
-HheadAOffset: 1 |
|
35 |
-HheadDescent: 0 |
|
36 |
-HheadDOffset: 1 |
|
37 |
-OS2Vendor: 'PfEd' |
|
38 |
-MarkAttachClasses: 1 |
|
39 |
-DEI: 91125 |
|
40 |
-Encoding: UnicodeFull |
|
41 |
-Compacted: 1 |
|
42 |
-UnicodeInterp: none |
|
43 |
-NameList: Adobe Glyph List |
|
44 |
-DisplaySize: -24 |
|
45 |
-AntiAlias: 1 |
|
46 |
-FitToEm: 1 |
|
47 |
-WinInfo: 0 31 18 |
|
48 |
-BeginPrivate: 0 |
|
49 |
-EndPrivate |
|
50 |
-BeginChars: 1114112 9 |
|
51 |
- |
|
52 |
-StartChar: uni2B80 |
|
53 |
-Encoding: 11136 11136 0 |
|
54 |
-Width: 621 |
|
55 |
-Flags: HMW |
|
56 |
-LayerCount: 2 |
|
57 |
-Fore |
|
58 |
-SplineSet |
|
59 |
-0 1000 m 1 |
|
60 |
- 621 379 l 1 |
|
61 |
- 0 -243 l 1 |
|
62 |
- 0 1000 l 1 |
|
63 |
-EndSplineSet |
|
64 |
-EndChar |
|
65 |
- |
|
66 |
-StartChar: uni2B81 |
|
67 |
-Encoding: 11137 11137 1 |
|
68 |
-Width: 621 |
|
69 |
-Flags: HMW |
|
70 |
-LayerCount: 2 |
|
71 |
-Fore |
|
72 |
-SplineSet |
|
73 |
-10 991 m 0 |
|
74 |
- 16 997 23 1000 32 1000 c 0 |
|
75 |
- 41 1000 48 996 54 990 c 2 |
|
76 |
- 613 400 l 2 |
|
77 |
- 619 394 621 386 621 378 c 0 |
|
78 |
- 621 370 618 362 613 357 c 2 |
|
79 |
- 54 -233 l 2 |
|
80 |
- 48 -239 41 -242 32 -242 c 0 |
|
81 |
- 23 -242 16 -240 10 -234 c 0 |
|
82 |
- 4 -228 0 -221 0 -212 c 0 |
|
83 |
- 0 -203 3 -196 8 -190 c 2 |
|
84 |
- 547 379 l 1 |
|
85 |
- 8 948 l 2 |
|
86 |
- 3 954 0 961 0 970 c 0 |
|
87 |
- 0 979 4 985 10 991 c 0 |
|
88 |
-EndSplineSet |
|
89 |
-EndChar |
|
90 |
- |
|
91 |
-StartChar: uni2B82 |
|
92 |
-Encoding: 11138 11138 2 |
|
93 |
-Width: 621 |
|
94 |
-Flags: HMW |
|
95 |
-LayerCount: 2 |
|
96 |
-Fore |
|
97 |
-SplineSet |
|
98 |
-621 1000 m 5 |
|
99 |
- 621 -243 l 5 |
|
100 |
- 0 379 l 5 |
|
101 |
- 621 1000 l 5 |
|
102 |
-EndSplineSet |
|
103 |
-EndChar |
|
104 |
- |
|
105 |
-StartChar: uni2B83 |
|
106 |
-Encoding: 11139 11139 3 |
|
107 |
-Width: 621 |
|
108 |
-Flags: HMW |
|
109 |
-LayerCount: 2 |
|
110 |
-Fore |
|
111 |
-SplineSet |
|
112 |
-612 991 m 0 |
|
113 |
- 618 985 621 979 621 970 c 0 |
|
114 |
- 621 961 619 954 613 948 c 2 |
|
115 |
- 74 379 l 1 |
|
116 |
- 613 -190 l 2 |
|
117 |
- 619 -196 621 -203 621 -212 c 0 |
|
118 |
- 621 -221 618 -228 612 -234 c 0 |
|
119 |
- 606 -240 598 -242 589 -242 c 0 |
|
120 |
- 580 -242 574 -239 568 -233 c 2 |
|
121 |
- 8 357 l 2 |
|
122 |
- 3 362 0 370 0 378 c 0 |
|
123 |
- 0 386 3 394 8 400 c 2 |
|
124 |
- 568 990 l 2 |
|
125 |
- 574 996 580 1000 589 1000 c 0 |
|
126 |
- 598 1000 606 997 612 991 c 0 |
|
127 |
-EndSplineSet |
|
128 |
-EndChar |
|
129 |
- |
|
130 |
-StartChar: uni2B61 |
|
131 |
-Encoding: 11105 11105 4 |
|
132 |
-Width: 555 |
|
133 |
-VWidth: 0 |
|
134 |
-Flags: HMW |
|
135 |
-LayerCount: 2 |
|
136 |
-Fore |
|
137 |
-SplineSet |
|
138 |
-0 800 m 5 |
|
139 |
- 92 800 l 5 |
|
140 |
- 92 513 l 5 |
|
141 |
- 253 513 l 5 |
|
142 |
- 253 444 l 5 |
|
143 |
- 0 444 l 5 |
|
144 |
- 0 800 l 5 |
|
145 |
-236 312 m 5 |
|
146 |
- 339 312 l 5 |
|
147 |
- 468 67 l 5 |
|
148 |
- 468 312 l 5 |
|
149 |
- 555 312 l 5 |
|
150 |
- 555 -44 l 5 |
|
151 |
- 453 -44 l 5 |
|
152 |
- 323 200 l 5 |
|
153 |
- 323 -44 l 5 |
|
154 |
- 236 -44 l 5 |
|
155 |
- 236 312 l 5 |
|
156 |
-EndSplineSet |
|
157 |
-EndChar |
|
158 |
- |
|
159 |
-StartChar: uni2B60 |
|
160 |
-Encoding: 11104 11104 5 |
|
161 |
-Width: 676 |
|
162 |
-Flags: HMW |
|
163 |
-LayerCount: 2 |
|
164 |
-Fore |
|
165 |
-SplineSet |
|
166 |
-0 197 m 1 |
|
167 |
- 94 207 419 279 419 384 c 2 |
|
168 |
- 419 537 l 1 |
|
169 |
- 278 501 l 1 |
|
170 |
- 478 794 l 1 |
|
171 |
- 677 501 l 1 |
|
172 |
- 536 537 l 1 |
|
173 |
- 536 384 l 2 |
|
174 |
- 536 196 208 126 208 21 c 2 |
|
175 |
- 208 -244 l 1 |
|
176 |
- 0 -244 l 1 |
|
177 |
- 0 197 l 1 |
|
178 |
-0 288 m 1 |
|
179 |
- 0 405 0 944 0 944 c 1 |
|
180 |
- 208 944 l 1 |
|
181 |
- 208 944 208 451 208 334 c 1 |
|
182 |
- 185 311 12 288 0 288 c 1 |
|
183 |
-EndSplineSet |
|
184 |
-EndChar |
|
185 |
- |
|
186 |
-StartChar: uni2B62 |
|
187 |
-Encoding: 11106 11106 6 |
|
188 |
-Width: 428 |
|
189 |
-VWidth: 0 |
|
190 |
-Flags: HMW |
|
191 |
-LayerCount: 2 |
|
192 |
-Fore |
|
193 |
-SplineSet |
|
194 |
-88 677 m 2 |
|
195 |
- 429 677 l 1 |
|
196 |
- 429 589 l 1 |
|
197 |
- 88 589 l 1 |
|
198 |
- 88 162 l 1 |
|
199 |
- 198 162 l 1 |
|
200 |
- 198 343 l 1 |
|
201 |
- 374 343 l 1 |
|
202 |
- 374 427 l 1 |
|
203 |
- 198 427 l 1 |
|
204 |
- 198 506 l 1 |
|
205 |
- 429 506 l 1 |
|
206 |
- 429 274 l 1 |
|
207 |
- 416 263 391 255 374 255 c 2 |
|
208 |
- 286 255 l 1 |
|
209 |
- 286 162 l 2 |
|
210 |
- 286 114 246 74 198 74 c 2 |
|
211 |
- 88 74 l 2 |
|
212 |
- 40 74 0 114 0 162 c 2 |
|
213 |
- 0 589 l 2 |
|
214 |
- 0 637 40 677 88 677 c 2 |
|
215 |
-EndSplineSet |
|
216 |
-EndChar |
|
217 |
- |
|
218 |
-StartChar: uni2B63 |
|
219 |
-Encoding: 11107 11107 7 |
|
220 |
-Width: 428 |
|
221 |
-VWidth: 0 |
|
222 |
-Flags: HMW |
|
223 |
-LayerCount: 2 |
|
224 |
-Fore |
|
225 |
-SplineSet |
|
226 |
-0 677 m 5 |
|
227 |
- 341 677 l 6 |
|
228 |
- 389 677 429 637 429 589 c 6 |
|
229 |
- 429 506 l 6 |
|
230 |
- 429 458 389 418 341 418 c 6 |
|
231 |
- 287 418 l 5 |
|
232 |
- 287 162 l 6 |
|
233 |
- 287 114 247 74 199 74 c 6 |
|
234 |
- 89 74 l 6 |
|
235 |
- 41 74 1 114 1 162 c 6 |
|
236 |
- 1 274 l 6 |
|
237 |
- 0 274 l 6 |
|
238 |
- 0 506 l 5 |
|
239 |
- 89 506 l 5 |
|
240 |
- 89 162 l 5 |
|
241 |
- 199 162 l 5 |
|
242 |
- 199 506 l 5 |
|
243 |
- 341 506 l 5 |
|
244 |
- 341 589 l 5 |
|
245 |
- 0 589 l 5 |
|
246 |
- 0 677 l 5 |
|
247 |
-EndSplineSet |
|
248 |
-EndChar |
|
249 |
- |
|
250 |
-StartChar: uni2B64 |
|
251 |
-Encoding: 11108 11108 8 |
|
252 |
-Width: 546 |
|
253 |
-VWidth: 0 |
|
254 |
-Flags: HMW |
|
255 |
-LayerCount: 2 |
|
256 |
-Fore |
|
257 |
-SplineSet |
|
258 |
-273 733 m 4 |
|
259 |
- 429 733 430 538 430 538 c 5 |
|
260 |
- 430 420 l 5 |
|
261 |
- 547 420 l 5 |
|
262 |
- 547 303 l 5 |
|
263 |
- 547 303 546 -9 273 -9 c 4 |
|
264 |
- 0 -9 0 303 0 303 c 5 |
|
265 |
- 0 420 l 5 |
|
266 |
- 117 420 l 5 |
|
267 |
- 117 538 l 5 |
|
268 |
- 117 538 117 733 273 733 c 4 |
|
269 |
-273 655 m 4 |
|
270 |
- 195 655 195 576 195 420 c 5 |
|
271 |
- 352 420 l 5 |
|
272 |
- 352 576 351 655 273 655 c 4 |
|
273 |
-273 342 m 4 |
|
274 |
- 195 342 195 147 273 147 c 4 |
|
275 |
- 351 147 351 342 273 342 c 4 |
|
276 |
-EndSplineSet |
|
277 |
-EndChar |
|
278 |
-EndChars |
|
279 |
-BitmapFont: 10 10 8 2 1 |
|
280 |
-BDFChar: 0 11136 6 0 4 -2 7 |
|
281 |
-JAC+4q"X@:^jlCb |
|
282 |
-BDFChar: 1 11137 6 0 4 -2 7 |
|
283 |
-J3Y4g#RCta5_&h7 |
|
284 |
-BDFChar: 2 11138 6 1 5 -2 7 |
|
285 |
-#T,OGq"T(n(^L*A |
|
286 |
-BDFChar: 3 11139 6 1 5 -2 7 |
|
287 |
-#S8+DJ:Km-&-r79 |
|
288 |
-BDFChar: 4 11105 6 1 4 -1 7 |
|
289 |
-J:N1>!0GR3O8o7\ |
|
290 |
-BDFChar: 5 11104 7 0 5 -2 7 |
|
291 |
-^rY<PaN2`d^q]pM |
|
292 |
-BDFChar: 6 11106 4 1 5 -1 6 |
|
293 |
-G^u0KJ=)F+ |
|
294 |
-BDFChar: 7 11107 4 0 5 -1 6 |
|
295 |
-p]QtGOH>Q3 |
|
296 |
-BDFChar: 8 11108 5 0 5 0 6 |
|
297 |
-0M"b4bku\c |
|
298 |
-EndBitmapFont |
|
299 |
-BitmapFont: 12 10 10 2 1 |
|
300 |
-BDFChar: 0 11136 7 0 6 -2 11 |
|
301 |
-!!%Pbi:-O>r:od>^jlCb |
|
302 |
-BDFChar: 1 11137 7 0 6 -3 11 |
|
303 |
-!!%O7+:ne]":,P]5_&h7 |
|
304 |
-BDFChar: 2 11138 7 0 6 -2 11 |
|
305 |
-!!!-1*'AWHr-UUH$j6P1 |
|
306 |
-BDFChar: 3 11139 7 0 6 -2 11 |
|
307 |
-!!!--&0O5gJ3Y4g#Qt,- |
|
308 |
-BDFChar: 4 11105 7 0 5 0 8 |
|
309 |
-J:N1>!$jBP,QIfE |
|
310 |
-BDFChar: 5 11104 8 0 8 -3 11 |
|
311 |
-z^];.Ma8juqa8j9]a8jQehuLOm^];.Mz |
|
312 |
-BDFChar: 6 11106 5 1 6 0 8 |
|
313 |
-!-j$]R"1Qc?iU0, |
|
314 |
-BDFChar: 7 11107 5 0 5 0 7 |
|
315 |
-p]QtGOH>Q3 |
|
316 |
-BDFChar: 8 11108 7 0 5 0 8 |
|
317 |
-0M"`*r63C_GQ7^D |
|
318 |
-EndBitmapFont |
|
319 |
-EndSplineFont |
... | ... |
@@ -1,164 +0,0 @@ |
1 |
-====================== |
|
2 |
-Powerline font patcher |
|
3 |
-====================== |
|
4 |
- |
|
5 |
-:Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com) |
|
6 |
- |
|
7 |
-Description |
|
8 |
------------ |
|
9 |
- |
|
10 |
-This font patcher creates dividers and symbols for use with Powerline. The |
|
11 |
-script requires Python 2 and FontForge compiled with Python bindings. |
|
12 |
- |
|
13 |
-Patched fonts are renamed by default (" for Powerline" is added to the font |
|
14 |
-name) so they don't conflict with existing fonts. Use the ``--no-rename`` |
|
15 |
-option to disable font renaming. |
|
16 |
- |
|
17 |
-Glyph table |
|
18 |
------------ |
|
19 |
- |
|
20 |
-All the glyphs are stored in the ``U+2B60``-``U+2BFF`` range ("Misc symbols |
|
21 |
-and arrows"). |
|
22 |
- |
|
23 |
-+------------+-------------------+ |
|
24 |
-| Code point | Description | |
|
25 |
-+============+===================+ |
|
26 |
-| ``U+2B60`` | Branch symbol | |
|
27 |
-+------------+-------------------+ |
|
28 |
-| ``U+2B61`` | LN (line) symbol | |
|
29 |
-+------------+-------------------+ |
|
30 |
-| ``U+2B62`` | FT symbol, part 1 | |
|
31 |
-+------------+-------------------+ |
|
32 |
-| ``U+2B63`` | FT symbol, part 2 | |
|
33 |
-+------------+-------------------+ |
|
34 |
-| ``U+2B64`` | Padlock (closed) | |
|
35 |
-+------------+-------------------+ |
|
36 |
-| ``U+2B80`` | Hard right arrow | |
|
37 |
-+------------+-------------------+ |
|
38 |
-| ``U+2B81`` | Soft right arrow | |
|
39 |
-+------------+-------------------+ |
|
40 |
-| ``U+2B82`` | Hard left arrow | |
|
41 |
-+------------+-------------------+ |
|
42 |
-| ``U+2B83`` | Soft left arrow | |
|
43 |
-+------------+-------------------+ |
|
44 |
- |
|
45 |
-=================== |
|
46 |
-Font patching guide |
|
47 |
-=================== |
|
48 |
- |
|
49 |
-There's a `GitHub wiki page`_ dedicated to community-contributed patched |
|
50 |
-fonts. You may download one of the fonts on that page if you don't want to |
|
51 |
-patch the fonts yourself. |
|
52 |
- |
|
53 |
-If you do patch a font that's not included in the wiki (and you have |
|
54 |
-permission to distribute it), please include it on the wiki page. |
|
55 |
- |
|
56 |
-**Note:** The fonts in the wiki may be outdated, and may have different |
|
57 |
-glyphs than the ones provided in the latest version of Powerline. It's |
|
58 |
-recommended that you always patch your fonts yourself if you have the |
|
59 |
-required software. |
|
60 |
- |
|
61 |
-.. _`GitHub wiki page`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts |
|
62 |
- |
|
63 |
-Linux |
|
64 |
------ |
|
65 |
- |
|
66 |
-1. Install fontforge with Python bindings. For Ubuntu users the required |
|
67 |
- package is ``python-fontforge``, for Arch Linux users the required |
|
68 |
- package is ``fontforge``. It should be something similar for other |
|
69 |
- distros. |
|
70 |
- |
|
71 |
-2. Run the font patcher:: |
|
72 |
- |
|
73 |
- $ /path/to/fontpatcher MyFontFile.ttf |
|
74 |
- |
|
75 |
-3. Copy the font file into ``~/.fonts`` (or another X font directory):: |
|
76 |
- |
|
77 |
- $ cp MyFontFile-Powerline.otf ~/.fonts |
|
78 |
- |
|
79 |
- **Note:** If the font is a pure bitmap font (e.g. a PCF font) it will be |
|
80 |
- stored in the BDF format. This is usually not a problem, and you may |
|
81 |
- convert the font back to the PCF format using ``bdftopcf`` if you want |
|
82 |
- to. All other fonts will be stored in the OTF format regardless of the |
|
83 |
- original format. |
|
84 |
- |
|
85 |
-4. Update your font cache:: |
|
86 |
- |
|
87 |
- $ sudo fc-cache -vf |
|
88 |
- |
|
89 |
- **Note:** If you use vim in rxvt-unicode in the client/daemon mode, you |
|
90 |
- may need to close all running terminals as well for the font to be |
|
91 |
- updated. |
|
92 |
- |
|
93 |
-5. **For gvim users:** Update the GUI font in your ``vimrc`` file:: |
|
94 |
- |
|
95 |
- set guifont=MyFont\ for\ Powerline |
|
96 |
- |
|
97 |
- **For terminal users:** Update your terminal configuration to use the |
|
98 |
- patched font. |
|
99 |
- |
|
100 |
-6. Update your ``vimrc`` configuration to use the new symbols:: |
|
101 |
- |
|
102 |
- let g:Powerline_symbols = 'fancy' |
|
103 |
- |
|
104 |
-7. Make sure that the cache file is deleted:: |
|
105 |
- |
|
106 |
- $ rm /tmp/Powerline.cache |
|
107 |
- |
|
108 |
-8. Start vim and enjoy your new statusline! |
|
109 |
- |
|
110 |
-OS X |
|
111 |
----- |
|
112 |
- |
|
113 |
-1. Check if you have a FontForge version with Python support by running |
|
114 |
- ``fontforge -version``. You should see something like this:: |
|
115 |
- |
|
116 |
- $ fontforge -version |
|
117 |
- Copyright (c) 2000-2011 by George Williams. |
|
118 |
- Executable based on sources from 13:48 GMT 22-Feb-2011-D. |
|
119 |
- Library based on sources from 13:48 GMT 22-Feb-2011. |
|
120 |
- fontforge 20110222 |
|
121 |
- libfontforge 20110222 |
|
122 |
- |
|
123 |
- Make sure that the executable version number doesn't have ``NoPython`` in |
|
124 |
- it. If everything looks OK, skip ahead to step 4. |
|
125 |
- |
|
126 |
-2. If you have FontForge but with ``NoPython`` in the version number, please |
|
127 |
- try to update to a later version:: |
|
128 |
- |
|
129 |
- $ brew uninstall fontforge |
|
130 |
- $ brew update |
|
131 |
- $ brew install --use-gcc fontforge |
|
132 |
- |
|
133 |
- **Note:** You may have to use ``--use-clang`` instead of ``--use-gcc`` |
|
134 |
- when compiling FontForge. |
|
135 |
- |
|
136 |
-3. If you don't have FontForge, install it with Homebrew:: |
|
137 |
- |
|
138 |
- $ brew update |
|
139 |
- $ brew install --use-gcc fontforge |
|
140 |
- |
|
141 |
-4. Patch your fonts by passing the ``fontpatcher`` script as a parameter to |
|
142 |
- FontForge:: |
|
143 |
- |
|
144 |
- $ fontforge -script /path/to/fontpatcher MyFontFile.ttf |
|
145 |
- |
|
146 |
-5. Install the font by double-clicking the font file in Finder and click |
|
147 |
- "Install this font" from the preview window. |
|
148 |
- |
|
149 |
-6. **For gvim users:** Update the GUI font in your ``vimrc`` file:: |
|
150 |
- |
|
151 |
- set guifont=MyFont\ for\ Powerline |
|
152 |
- |
|
153 |
- **For terminal users:** Update your terminal configuration to use the |
|
154 |
- patched font. |
|
155 |
- |
|
156 |
-7. Update your ``vimrc`` configuration to use the new symbols:: |
|
157 |
- |
|
158 |
- let g:Powerline_symbols = 'fancy' |
|
159 |
- |
|
160 |
-8. Make sure that the cache file is deleted:: |
|
161 |
- |
|
162 |
- $ rm /tmp/Powerline.cache |
|
163 |
- |
|
164 |
-9. Start vim and enjoy your new statusline! |
... | ... |
@@ -1,240 +0,0 @@ |
1 |
-#!/usr/bin/env python |
|
2 |
- |
|
3 |
-"""Font patcher for Powerline. |
|
4 |
- |
|
5 |
-Creates dividers and symbols for use with Powerline. Requires FontForge with Python bindings. |
|
6 |
- |
|
7 |
-Stores glyphs in the 2b60-2bff Unicode range ("Misc symbols and arrows"). |
|
8 |
- |
|
9 |
-[2b60] Branch symbol |
|
10 |
-[2b61] LN (line) symbol |
|
11 |
-[2b62] FT symbol 1 |
|
12 |
-[2b63] FT symbol 2 |
|
13 |
-[2b64] Padlock (closed) symbol |
|
14 |
-[2b80] Hard right arrow |
|
15 |
-[2b81] Soft right arrow |
|
16 |
-[2b82] Hard left arrow |
|
17 |
-[2b83] Soft left arrow |
|
18 |
-""" |
|
19 |
- |
|
20 |
-from __future__ import division |
|
21 |
- |
|
22 |
-import argparse |
|
23 |
-import os |
|
24 |
-import sys |
|
25 |
-import re |
|
26 |
- |
|
27 |
-try: |
|
28 |
- import fontforge |
|
29 |
- import psMat |
|
30 |
-except ImportError: |
|
31 |
- sys.stderr.write('The required FontForge modules could not be loaded.\n\n') |
|
32 |
- |
|
33 |
- if sys.version_info.major > 2: |
|
34 |
- sys.stderr.write('FontForge only supports Python 2. Please run this script with the Python 2 executable - e.g. "python2 {0}"\n'.format(sys.argv[0])) |
|
35 |
- else: |
|
36 |
- sys.stderr.write('You need FontForge with Python bindings for this script to work.\n') |
|
37 |
- |
|
38 |
- sys.exit(1) |
|
39 |
- |
|
40 |
-# Handle command-line arguments |
|
41 |
-parser = argparse.ArgumentParser(description='Font patcher for Powerline. Creates dividers and symbols in FontForge-compatible font files. Requires FontForge with Python bindings. Stores glyphs in the U+2B80-U+2BFF range ("Miscellaneous symbols and arrows"). Stores the patched font as a new, renamed font file by default.') |
|
42 |
- |
|
43 |
-parser.add_argument('fonts', help='font file to patch', metavar='font', nargs='+') |
|
44 |
-parser.add_argument('--no-rename', help='don\'t add " for Powerline" to the font name', default=True, action='store_false', dest='rename') |
|
45 |
-parser.add_argument('--symbol-font', help='font file with symbols', metavar='font', dest='symbol_font', default='{0}/PowerlineSymbols.sfd'.format(sys.path[0])) |
|
46 |
-parser.add_argument('--fix-mono', help='fixes some mono-fonts which have glyphs of 0 widths', default=False, action='store_true', dest='fixmono') |
|
47 |
-parser.add_argument('--fix-win', help='modifies font names such that Windows correctly recognizes font families', default=False, action='store_true', dest='fixwin') |
|
48 |
- |
|
49 |
-args = parser.parse_args() |
|
50 |
- |
|
51 |
-SYM_ATTR = { |
|
52 |
- # Right/left-aligned glyphs will have their advance width reduced in order to overlap the next glyph slightly |
|
53 |
- 0x2b60: { 'align': 'c', 'stretch': 'y' , 'overlap': False }, |
|
54 |
- 0x2b61: { 'align': 'c', 'stretch': '' , 'overlap': False }, |
|
55 |
- 0x2b62: { 'align': 'r', 'stretch': '' , 'overlap': False }, |
|
56 |
- 0x2b63: { 'align': 'l', 'stretch': '' , 'overlap': False }, |
|
57 |
- 0x2b64: { 'align': 'c', 'stretch': '' , 'overlap': False }, |
|
58 |
- 0x2b80: { 'align': 'l', 'stretch': 'xy', 'overlap': True }, |
|
59 |
- 0x2b81: { 'align': 'l', 'stretch': 'xy', 'overlap': True }, |
|
60 |
- 0x2b82: { 'align': 'r', 'stretch': 'xy', 'overlap': True }, |
|
61 |
- 0x2b83: { 'align': 'r', 'stretch': 'xy', 'overlap': True }, |
|
62 |
-} |
|
63 |
- |
|
64 |
-# Open symbol font |
|
65 |
-try: |
|
66 |
- symbols = fontforge.open(args.symbol_font) |
|
67 |
-except EnvironmentError: |
|
68 |
- sys.exit(1) |
|
69 |
- |
|
70 |
-# Patch provided fonts |
|
71 |
-for font_path in args.fonts: |
|
72 |
- try: |
|
73 |
- font = fontforge.open(font_path) |
|
74 |
- except EnvironmentError: |
|
75 |
- sys.exit(1) |
|
76 |
- |
|
77 |
- # Rename font |
|
78 |
- if args.rename: |
|
79 |
- font.familyname += ' for Powerline' |
|
80 |
- font.fullname += ' for Powerline' |
|
81 |
- font.fontname += 'ForPowerline' |
|
82 |
- font.appendSFNTName('English (US)', 'Preferred Family', font.familyname) |
|
83 |
- font.appendSFNTName('English (US)', 'Compatible Full', font.fullname) |
|
84 |
- if args.fixwin: |
|
85 |
- font.fontname = re.sub(r'\W', '', font.familyname) |
|
86 |
- |
|
87 |
- # Force the em size to be equal |
|
88 |
- symbols.em = font.em |
|
89 |
- |
|
90 |
- # Initial font dimensions |
|
91 |
- font_dim = { |
|
92 |
- 'xmin' : 0, |
|
93 |
- 'ymin' : -font.descent, |
|
94 |
- 'xmax' : 0, |
|
95 |
- 'ymax' : font.ascent, |
|
96 |
- |
|
97 |
- 'width' : 0, |
|
98 |
- 'height': 0, |
|
99 |
- } |
|
100 |
- |
|
101 |
- # Find the biggest char width and height |
|
102 |
- # |
|
103 |
- # 0x00-0x17f is the Latin Extended-A range |
|
104 |
- # 0x2500-0x2600 is the box drawing range |
|
105 |
- for glyph in range(0x00, 0x17f) + range(0x2500, 0x2600): |
|
106 |
- try: |
|
107 |
- (xmin, ymin, xmax, ymax) = font[glyph].boundingBox() |
|
108 |
- except TypeError: |
|
109 |
- continue |
|
110 |
- |
|
111 |
- if font_dim['width'] == 0: |
|
112 |
- font_dim['width'] = font[glyph].width |
|
113 |
- |
|
114 |
- if ymin < font_dim['ymin']: font_dim['ymin'] = ymin |
|
115 |
- if ymax > font_dim['ymax']: font_dim['ymax'] = ymax |
|
116 |
- if xmax > font_dim['xmax']: font_dim['xmax'] = xmax |
|
117 |
- |
|
118 |
- # Calculate font height |
|
119 |
- font_dim['height'] = abs(font_dim['ymin']) + font_dim['ymax'] |
|
120 |
- |
|
121 |
- # Update the font encoding to ensure that the Unicode glyphs are available |
|
122 |
- font.encoding = 'ISO10646' |
|
123 |
- |
|
124 |
- # Fetch this property before adding outlines |
|
125 |
- onlybitmaps = font.onlybitmaps |
|
126 |
- |
|
127 |
- def get_dim(glyph): |
|
128 |
- bbox = glyph.boundingBox() |
|
129 |
- |
|
130 |
- return { |
|
131 |
- 'xmin' : bbox[0], |
|
132 |
- 'ymin' : bbox[1], |
|
133 |
- 'xmax' : bbox[2], |
|
134 |
- 'ymax' : bbox[3], |
|
135 |
- |
|
136 |
- 'width' : bbox[2] + (-bbox[0]), |
|
137 |
- 'height': bbox[3] + (-bbox[1]), |
|
138 |
- } |
|
139 |
- |
|
140 |
- # Create glyphs from symbol font |
|
141 |
- for sym_glyph in symbols.glyphs(): |
|
142 |
- sym_attr = SYM_ATTR[sym_glyph.unicode] |
|
143 |
- |
|
144 |
- # Prepare symbol glyph dimensions |
|
145 |
- sym_dim = get_dim(sym_glyph) |
|
146 |
- |
|
147 |
- # Select and copy symbol from its encoding point |
|
148 |
- symbols.selection.select(sym_glyph.encoding) |
|
149 |
- symbols.copy() |
|
150 |
- |
|
151 |
- # Select and paste symbol to its unicode code point |
|
152 |
- font.selection.select(sym_glyph.unicode) |
|
153 |
- font.paste() |
|
154 |
- |
|
155 |
- # Now that we have copy/pasted the glyph, it's time to scale and move it |
|
156 |
- |
|
157 |
- # Handle glyph stretching |
|
158 |
- if 'x' in sym_attr['stretch']: |
|
159 |
- # Stretch the glyph horizontally |
|
160 |
- scale_ratio = font_dim['width'] / sym_dim['width'] |
|
161 |
- |
|
162 |
- font.transform(psMat.scale(scale_ratio, 1)) |
|
163 |
- if 'y' in sym_attr['stretch']: |
|
164 |
- # Stretch the glyph vertically |
|
165 |
- scale_ratio = font_dim['height'] / sym_dim['height'] |
|
166 |
- |
|
167 |
- font.transform(psMat.scale(1, scale_ratio)) |
|
168 |
- |
|
169 |
- # Use the dimensions from the pasted and stretched glyph |
|
170 |
- sym_dim = get_dim(font[sym_glyph.unicode]) |
|
171 |
- |
|
172 |
- # Center-align the glyph vertically |
|
173 |
- font_ycenter = font_dim['height'] / 2 |
|
174 |
- sym_ycenter = sym_dim['height'] / 2 |
|
175 |
- |
|
176 |
- # First move it to the ymax (top) |
|
177 |
- font.transform(psMat.translate(0, font_dim['ymax'] - sym_dim['ymax'])) |
|
178 |
- |
|
179 |
- # Then move it the y center difference |
|
180 |
- font.transform(psMat.translate(0, sym_ycenter - font_ycenter)) |
|
181 |
- |
|
182 |
- # Ensure that the glyph doesn't extend outside the font's bounding box |
|
183 |
- if sym_dim['width'] > font_dim['width']: |
|
184 |
- # The glyph is too wide, scale it down to fit |
|
185 |
- scale_matrix = psMat.scale(font_dim['width'] / sym_dim['width'], 1) |
|
186 |
- |
|
187 |
- font.transform(scale_matrix) |
|
188 |
- |
|
189 |
- # Use the dimensions from the stretched glyph |
|
190 |
- sym_dim = get_dim(font[sym_glyph.unicode]) |
|
191 |
- |
|
192 |
- # Handle glyph alignment |
|
193 |
- if sym_attr['align'] == 'c': |
|
194 |
- # Center align |
|
195 |
- align_matrix = psMat.translate(font_dim['width'] / 2 - sym_dim['width'] / 2 , 0) |
|
196 |
- elif sym_attr['align'] == 'r': |
|
197 |
- # Right align |
|
198 |
- align_matrix = psMat.translate(font_dim['width'] - sym_dim['width'], 0) |
|
199 |
- else: |
|
200 |
- # No alignment (left alignment) |
|
201 |
- align_matrix = psMat.translate(0, 0) |
|
202 |
- |
|
203 |
- font.transform(align_matrix) |
|
204 |
- |
|
205 |
- if sym_attr['overlap'] is True: |
|
206 |
- overlap_width = font.em / 48 |
|
207 |
- |
|
208 |
- # Stretch the glyph slightly horizontally if it should overlap |
|
209 |
- font.transform(psMat.scale((sym_dim['width'] + overlap_width) / sym_dim['width'], 1)) |
|
210 |
- |
|
211 |
- if sym_attr['align'] == 'l': |
|
212 |
- # The glyph should be left-aligned, so it must be moved overlap_width to the left |
|
213 |
- # This only applies to left-aligned glyphs because the glyph is scaled to the right |
|
214 |
- font.transform(psMat.translate(-overlap_width, 0)) |
|
215 |
- |
|
216 |
- # Ensure the font is considered monospaced on Windows |
|
217 |
- font[sym_glyph.unicode].width = font_dim['width'] |
|
218 |
- |
|
219 |
- if font.bitmapSizes and not onlybitmaps: |
|
220 |
- # If this is an outline font with bitmaps, regenerate bitmaps for the changed glyphs |
|
221 |
- font.selection.changed() |
|
222 |
- |
|
223 |
- for size in font.bitmapSizes: |
|
224 |
- font.regenBitmaps((size, )) |
|
225 |
- |
|
226 |
- output_name, extension = os.path.split(font_path)[1].rsplit('.', 1) |
|
227 |
- if extension.lower() not in ['ttf', 'otf']: |
|
228 |
- # Default to OpenType if input is not TrueType/OpenType |
|
229 |
- extension = 'otf' |
|
230 |
- if args.fixmono: |
|
231 |
- for glyph in font.glyphs(): |
|
232 |
- if glyph.width == 0: glyph.width = font_dim['width'] |
|
233 |
- |
|
234 |
- if onlybitmaps: |
|
235 |
- # Generate BDF font |
|
236 |
- font.generate('{0}-Powerline.bdf'.format(output_name, bitmap_type='bdf')) |
|
237 |
- else: |
|
238 |
- # Generate OTF/TTF font |
|
239 |
- font.generate('{0}-Powerline.{1}'.format(output_name, extension)) |
|
240 |
- |
... | ... |
@@ -1,78 +0,0 @@ |
1 |
-" Powerline - The ultimate statusline utility |
|
2 |
-" |
|
3 |
-" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com> |
|
4 |
-" Source repository: https://github.com/Lokaltog/vim-powerline |
|
5 |
- |
|
6 |
-" Script initialization {{{ |
|
7 |
- if exists('g:Powerline_loaded') || &compatible || version < 702 |
|
8 |
- finish |
|
9 |
- endif |
|
10 |
- |
|
11 |
- let g:Powerline_loaded = 1 |
|
12 |
-" }}} |
|
13 |
-" Commands {{{ |
|
14 |
- command! PowerlineClearCache call Pl#ClearCache() |
|
15 |
- command! PowerlineReloadColorscheme call Pl#ReloadColorscheme() |
|
16 |
-" }}} |
|
17 |
-" Set default options {{{ |
|
18 |
- for [s:key, s:value] in items({ |
|
19 |
- \ 'theme' : 'default' |
|
20 |
- \ , 'colorscheme' : 'default' |
|
21 |
- \ , 'symbols' : 'compatible' |
|
22 |
- \ , 'symbols_override' : {} |
|
23 |
- \ , 'dividers_override': [] |
|
24 |
- \ , 'stl_path_style' : 'relative' |
|
25 |
- \ , 'cache_enabled' : 1 |
|
26 |
- \ }) |
|
27 |
- |
|
28 |
- if ! exists('g:Powerline_' . s:key) |
|
29 |
- exec printf('let g:Powerline_%s = %s', s:key, string(s:value)) |
|
30 |
- endif |
|
31 |
- |
|
32 |
- unlet! s:key s:value |
|
33 |
- endfor |
|
34 |
- |
|
35 |
- if ! exists('g:Powerline_cache_dir') |
|
36 |
- let g:Powerline_cache_dir = simplify(expand('<sfile>:p:h') .'/..') |
|
37 |
- endif |
|
38 |
- |
|
39 |
- if ! exists('g:Powerline_cache_file') |
|
40 |
- exec 'let g:Powerline_cache_file = '. string(printf('%s/Powerline_%s_%s_%s.cache' |
|
41 |
- \ , g:Powerline_cache_dir |
|
42 |
- \ , g:Powerline_theme |
|
43 |
- \ , g:Powerline_colorscheme |
|
44 |
- \ , g:Powerline_symbols |
|
45 |
- \ )) |
|
46 |
- endif |
|
47 |
-" }}} |
|
48 |
-" Autocommands {{{ |
|
49 |
- function! s:Startup() |
|
50 |
- augroup PowerlineMain |
|
51 |
- autocmd! |
|
52 |
- |
|
53 |
- " Reload statuslines when changing color scheme |
|
54 |
- autocmd ColorScheme * |
|
55 |
- \ call Pl#Load() |
|
56 |
- |
|
57 |
- autocmd BufEnter,WinEnter,FileType,BufUnload,CmdWinEnter * |
|
58 |
- \ call Pl#UpdateStatusline(1) |
|
59 |
- |
|
60 |
- autocmd BufLeave,WinLeave,CmdWinLeave * |
|
61 |
- \ call Pl#UpdateStatusline(0) |
|
62 |
- |
|
63 |
- autocmd BufWritePost */autoload/Powerline/Colorschemes/*.vim |
|
64 |
- \ :PowerlineReloadColorscheme |
|
65 |
- augroup END |
|
66 |
- |
|
67 |
- let curwindow = winnr() |
|
68 |
- for window in range(1, winnr('$')) |
|
69 |
- call Pl#UpdateStatusline(window == curwindow, window) |
|
70 |
- endfor |
|
71 |
- endfunction |
|
72 |
- |
|
73 |
- augroup PowerlineStartup |
|
74 |
- autocmd! |
|
75 |
- |
|
76 |
- autocmd VimEnter * call s:Startup() |
|
77 |
- augroup END |
|
78 |
-" }}} |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-" Version 2017-12-30.1 - cscope |
|
1 |
+" Version 2018-04-24.1 - vim-airline with powerlineish theme |
|
2 | 2 |
set nocompatible " Use Vim defaults, forget compatibility with vi. |
3 | 3 |
set bs=2 " allow backspacing over everything in insert mode |
4 | 4 |
set wildmenu " Allows command-line completion with tab |
... | ... |
@@ -272,5 +272,15 @@ if has("cscope") |
272 | 272 |
set cscopeverbose |
273 | 273 |
endif |
274 | 274 |
|
275 |
+" I use 12p Roboto Mono from https://github.com/powerline/fonts |
|
276 |
+" On iTerm2, Preferences -> Profiles -> Text -> Font |
|
277 |
+ |
|
278 |
+" When using vim-powerline |
|
279 |
+let g:Powerline_symbols = 'fancy' |
|
280 |
+ |
|
281 |
+" When using vim-airline |
|
282 |
+let g:airline_powerline_fonts = 1 |
|
283 |
+let g:airline_theme = 'powerlineish' |
|
284 |
+ |
|
275 | 285 |
" Install Pathogen for this next call to work |
276 | 286 |
call pathogen#infect() |
277 | 287 |