1000 Commits

Author SHA1 Message Date
kazukazuinaina
a6886f2997 [add] fail fast options 2021-01-02 16:09:32 +09:00
kazukazuinaina
1962371666 add vim9script branch in CI
NOTE: CI didn't work without explicitly specifying the branch.
2021-01-02 15:58:54 +09:00
kazukazuinaina
2062dd2f98 delete travis.yml 2021-01-02 15:54:05 +09:00
kazukazuinaina
0e91eeb548 [add] github-actions
Note: According to an email from travis-ci, travis-ci.org will be officially closed down completely on December 31st, 2020
2021-01-02 15:51:33 +09:00
Christian
4b02724d0c highglighter: Vim9 script correctly convert hex string to number 2020-11-27 10:43:54 +01:00
Christian
f54f7859a3 tabline: disable Vim9 script add_tab_label 2020-11-27 10:43:54 +01:00
Christian
4bce179ed3 themes: fix syntax errors in Vim9 script for patch func 2020-11-27 10:43:54 +01:00
Christian
2083bfe890 highlighter: correctly get the colors from global palette for Vim9 2020-11-27 10:43:54 +01:00
Christian
084dfe017d highlighter: cast Vim9 variables to correct type 2020-11-27 10:43:54 +01:00
Christian
ad7dcbdece tabline: disable Vim9 script functions that do not work currently 2020-11-27 10:43:54 +01:00
Christian
bb204d1fee tabline: fix vim9 syntax error in group_of_bufnr 2020-11-27 10:43:53 +01:00
Christian
a678556366 dark: convert theme to Vim9 script 2020-11-27 10:43:53 +01:00
Christian
def61b1450 themes: fix Vim9 syntax error in patch func 2020-11-27 10:43:53 +01:00
Christian
3de44bc58f themes: fix Vim9 syntax error in get_highlight2 2020-11-27 10:43:53 +01:00
Christian
dcb36f0480 themes: fix vim9 syntax errors in generate_color_map 2020-11-27 10:43:53 +01:00
Christian
21f329cd70 themes: Vim9 script implementation of patch 2020-11-27 10:43:53 +01:00
Christian
0eee611a0e themes: Vim9 script implementation of get_highlight and get_highlight2 2020-11-27 10:43:53 +01:00
Christian
4e4663c71c themes: Vim9 script implementation of generate_color_map 2020-11-27 10:43:52 +01:00
Christian
0a80997100 themes: prepare for vim9script implementation 2020-11-27 10:43:52 +01:00
Christian
f08b7912c6 themes: add modeline 2020-11-27 10:43:52 +01:00
Christian
d49b655e72 tabline: fix possible vim9script error in init func 2020-11-27 10:43:52 +01:00
Christian
70dc69fcd8 tabline: fix errors in Vim9script get_buffer_name 2020-11-27 10:43:52 +01:00
Christian
cdb265c410 tabline: fix errors in Vim9script title function 2020-11-27 10:43:52 +01:00
Christian
de3dbfcb3c tabline: fix errors in Vim9script load_theme 2020-11-27 10:43:51 +01:00
Christian
cc2a836b9a tabline: Vim9 script implementation of add_tab_label 2020-11-27 10:43:51 +01:00
Christian
6ff95bac4e tabline: Vim9 script implementation of add_label 2020-11-27 10:43:51 +01:00
Christian
c8c30c9e3e tabline: Vim9 script implementation of group_of_bufnr 2020-11-27 10:43:51 +01:00
Christian
a77cd28ecc tabline: Vim9 script implementation of new_builder 2020-11-27 10:43:51 +01:00
Christian
6a6945d45d tabline: Vim9 script implementation of get_buffer_name func 2020-11-27 10:43:51 +01:00
Christian
d5ffa5fd58 tabline: Vim9 script implementation of #title func 2020-11-27 10:43:50 +01:00
Christian
b10c1107e1 tabline: init function, do call autocommand functions 2020-11-27 10:43:50 +01:00
Christian
4f59fef538 move script local variable current_tabcnt to top 2020-11-27 10:43:50 +01:00
Christian
e59a654d17 tabline: Vim9 script implementation of get() 2020-11-27 10:43:50 +01:00
Christian
18ae588bad tabline: remove bang attribute in load_theme func definition 2020-11-27 10:43:50 +01:00
Christian
86c466d81e tabline: fix vim9 error in enable func 2020-11-27 10:43:50 +01:00
Christian
c08b1c0c75 tabline: fix vim9 error in toggle_on func 2020-11-27 10:43:49 +01:00
Christian
3d536ef950 tabline: fix vim9 error in init func 2020-11-27 10:43:49 +01:00
Christian
02aaaf94e8 tabline: Vim9 script implementation of load_theme 2020-11-27 10:43:49 +01:00
Christian
bbc70019f6 tabline: Vim9 script implementation of enable 2020-11-27 10:43:49 +01:00
Christian
0bc7ff3629 tabline: Vim9 script implementation of redraw 2020-11-27 10:43:49 +01:00
Christian
7880f0a73c tabline: Vim9 script implementation of update_tabline 2020-11-27 10:43:49 +01:00
Christian
5502e5302d tabline: Vim9 script implementation of toggle_on 2020-11-27 10:43:48 +01:00
Christian
59c906da4d tabline: Vim9 script implementation of toggle_off 2020-11-27 10:43:48 +01:00
Christian
19f8be42b6 tabline: Vim9 script implementation of #init function 2020-11-27 10:43:48 +01:00
Christian
e81d400b09 tabline: check existence of "e" flag in guioptions 2020-11-27 10:43:48 +01:00
Christian
5062eeeaed tabline: add foldmarkers and remove some empty lines 2020-11-27 10:43:48 +01:00
Christian
e6bd342293 tabline: prepare for vim9script implementation 2020-11-27 10:43:48 +01:00
Christian
caaa553ce9 tabline: set expandtab and foldmarker to modeline 2020-11-27 10:43:47 +01:00
Christian
b4e38be8b8 highlighter: fix indentation (tabs) 2020-11-27 10:43:47 +01:00
Christian
252b89bb1f default tabline formmatter: fix indentation 2020-11-27 10:43:47 +01:00
Christian
b271c279d6 default tablineformmter: get rid of s: vars in legacy implementation 2020-11-27 10:43:44 +01:00
Christian
9387517f01 default tablineformatter: implement as vim9 script 2020-11-27 10:42:16 +01:00
Christian
8ec6f1e40f tabline formatter: prepare for vim9 script implementation 2020-11-27 10:42:13 +01:00
Christian
0d0c380940 highlighter: fix a couple of vim9script errors and fix indentation 2020-11-27 10:40:38 +01:00
Christian
9f7557df44 highlighter: remove ! from :def in vim9script 2020-11-27 10:40:38 +01:00
Christian
f615f8bad3 autoload: bufnr argument of #highlight function is actually a string 2020-11-27 10:40:38 +01:00
Christian
f5e2f97003 highlighter: vim9 script implementation of #highlight() 2020-11-27 10:40:38 +01:00
Christian
14fd943dc6 highlighter: vim9 script implementation of highlight_modified_inactive 2020-11-27 10:40:37 +01:00
Christian
e9d4ff75da highlighter: vim9 script implementation of add_accent 2020-11-27 10:40:37 +01:00
Christian
9b32ed3229 highlighter: remove ! from :def in vim9script 2020-11-27 10:40:37 +01:00
Christian
58b2a8bbc8 highlighter: add foldmarker at final endif 2020-11-27 10:40:37 +01:00
Christian
5ac55ea4e5 highlighter: vim9 script implementation of add_separator 2020-11-27 10:40:37 +01:00
Christian
56ba4b34a7 highlighter: vim9 fix duplicate variable name in s:exec_separator function 2020-11-27 10:40:37 +01:00
Christian
798a346a91 highlighter: vim9 script implementation of load_theme 2020-11-27 10:40:36 +01:00
Christian
4f8675434a highlighter: get rid of superflous l: var prefix 2020-11-27 10:40:36 +01:00
Christian
5391b3e246 highlighter: vim9 script implementation of s:exec_separator 2020-11-27 10:40:36 +01:00
Christian
7310ca6cbf highlighter: run ex command with leading colon in vim9 function #exec 2020-11-27 10:40:36 +01:00
Christian
9ae38b43e4 highlighter: vim9 script implementation of s:GetHiCmd 2020-11-27 10:40:36 +01:00
Christian
2441084898 highlighter: vim9 script implementation of s:CheckDefined 2020-11-27 10:40:36 +01:00
Christian
d9947beb0f highlighter: vim9 script implementation of #exec 2020-11-27 10:40:36 +01:00
Christian
a6b7267979 highlighter: vim9 script implementation of s:hl_group_exists 2020-11-27 10:40:35 +01:00
Christian
90de76359f highlighter: use synIDtrans() in s:hl_group_exists (legacy vimscript)
When checking the defined foreground color in the function that checks
whether a highlighting group exists, it should follow the syntax group
links and check the final color.
2020-11-27 10:40:35 +01:00
Christian
0238d386bb highlighter: vim9 script implementation of get_highlight2 2020-11-27 10:40:35 +01:00
Christian
19861861fd highlighter: vim9 script implementation of get_highlight 2020-11-27 10:40:35 +01:00
Christian
687fb52d9f fix indentation of legacy vimscript (remove tabs) 2020-11-27 10:40:35 +01:00
Christian
aa8bd171f3 highlighter: vim9 script implementation of reset_hlcache 2020-11-27 10:40:35 +01:00
Christian
b152059a98 highlighter: vim9 script implementation of s:get_array 2020-11-27 10:40:34 +01:00
Christian
4d75c9940c highlighter: vim9 script implementation of s:get_syn 2020-11-27 10:40:34 +01:00
Christian
ae3af85ca2 highlighter: remove a couple of empty lines in legacy vimscript implementation 2020-11-27 10:40:34 +01:00
Christian
a9f525f8da highlighter: vim9 script implementation of s:group_not_done 2020-11-27 10:40:34 +01:00
Christian
3e93c212cc highlighter: vim9 script implementation of s:gui2cui 2020-11-27 10:40:34 +01:00
Christian
a8afa434e3 highlighter: Add condition for new vim9 script implementation
Add a new condition that will contain the new vim9script implementation
of the highlighter logic. Not done yet.

To test it out, you need a recent Vim 8.2 and in addition set the
configuration variable

    :let g:airline_experimental=1

Implementation for all the functions will follow.
2020-11-27 10:40:34 +01:00
Christian
b0d4a44f0c add foldmarker to highlighter.vim 2020-11-27 10:40:33 +01:00
Christian
0abcdbeba5 convert msdos.vim 2020-11-27 10:40:33 +01:00
Christian
609205f1e8 remove trailing whitespace 2020-11-27 10:40:33 +01:00
Christian
06117a61e1 highlighter: windows terminal is not old win_term 2020-11-27 09:49:17 +01:00
Christian Brabandt
79eac1558a Merge pull request #2293 from srinivas32/master
added power support arch ppc64le on yml file.
2020-11-27 08:32:38 +01:00
Christian Brabandt
157af8ad8b tabline: use airline#util#strcharpart instead on relying on stpart() with char index 2020-11-26 14:00:29 +01:00
Christian Brabandt
cbf0a8e69a tabline: use strpart() with chars if possible (fixes #2297) 2020-11-26 10:04:43 +01:00
Christian Brabandt
a168ca7a28 tabline: get rid of s:vars in default formatter 2020-11-26 10:04:43 +01:00
Christian Brabandt
a48f67657f Merge pull request #2295 from nbCloud91/patch-1
coc_status should show with autochdir
2020-11-21 20:03:04 +01:00
nbCloud91
332fff9206 coc_status should show with autochdir
coc_status should be visible even with autochdir setting on.
2020-11-21 20:47:17 +05:30
srinivas32
c378a0aeb7 added power support arch ppc64le on yml file.
Added power support for the travis.yml file with ppc64le. This is part of the Ubuntu distribution for ppc64le.
2020-11-20 13:27:49 +05:30
Christian
91a8ada0f9 doc: document tabline highlighting groups (closes #2285) 2020-11-19 14:17:22 +01:00
Christian
beb20cb49f doc: mention that the tabline mappings are not automatically created
related: #2290
2020-11-19 13:52:08 +01:00
Christian Brabandt
536667191d Merge pull request #2287 from timfeirg/master
buf_diagnostics_count is deprecated. Use 'vim.lsp.diagnostic.get_count'
2020-11-14 12:11:18 +01:00
timfeirg
5eae08609e fix deprecation warning
code is copied from https://github.com/vim-airline/vim-airline/issues/2289
originally contributed by @cmccannbrite
2020-11-14 17:01:19 +08:00
Christian Brabandt
731bdb11d2 Merge pull request #2286 from jan-xyz/patch-1
remove work-around for vista.vim
2020-11-10 08:47:56 +01:00
Jan Steinke
df096e16ae remove unnecessary indirection 2020-11-10 08:40:42 +01:00
Jan Steinke
7091b8a6ff remove work-around for vista.vim 2020-11-09 20:17:05 +01:00
Christian Brabandt
9267cef0f8 Merge pull request #2282 from martskins/handle-lcn-not-running
Check LanguageClient-neovim's status before getting diagnostics
2020-11-09 18:35:51 +01:00
Christian Brabandt
bb760710cc Merge pull request #2283 from Kamilcuk/master
Fix typo in checking if gen_tags plugin is loaded
2020-11-09 18:26:12 +01:00
Kamil Cukrowski
f6f8666533 Fix bug in checking if gen_tags plugin is loaded 2020-11-08 11:01:26 +01:00
Martin Asquino
bd5ae9c584 Check LanguageClient-neovim's status before getting diagnostics 2020-11-07 12:59:13 +00:00
Christian Brabandt
5f2421fa39 Merge pull request #2276 from kazukazuinaina/fix_indent_bookmark_extension
[fix] bookmark extension's indentation and add abort
2020-11-06 09:11:35 +01:00
Christian Brabandt
3f4b811510 Merge pull request #2278 from kazukazuinaina/fix_short_path_space
[fix] short path formatter's space
2020-11-06 09:10:34 +01:00
kazukazuinaina
1ed922265a [fix] short path formatter's space 2020-11-05 23:44:29 +09:00
kazukazuinaina
83804f3c6d [fix] bookmark extension's indentation and add abort 2020-11-05 23:14:13 +09:00
Christian Brabandt
d64e5f8dd7 extensions: fix E715
Make sure, that the get() function returns the correct variable type
2020-11-05 10:36:03 +01:00
Christian Brabandt
dcebc6d2aa Merge pull request #2273 from NFrid/master
add more customization options for keymap extension
2020-11-05 09:23:58 +01:00
Nick Friday
193460137a [add#keymap] more customization
Added more customization for keymap extension
2020-11-04 20:46:00 +03:00
Christian Brabandt
44b7b72938 Merge pull request #2266 from vim-airline/refactor_airline_gui_mode
Get rid of g:airline_gui_mode
2020-10-30 09:18:29 +01:00
Christian Brabandt
c8c0e7d9ff Get rid of g:airline_gui_mode
This is needed for Neovim, because an external UI could be attached to
the same neovim server, so it does not make sense to define highlighting
groups with either only the cterm or the guifg attribute set.

So refactor the code slightly got get rid of this variable (and since
this variable is not needed anymore, we can also get rid of the guienter
and OptionSet autocommand).

fixes: #2261
2020-10-30 08:32:35 +01:00
Christian Brabandt
38c9f9ca3d Merge pull request #2256 from Kamilcuk/master
Add gen_tags.vim plugin support
2020-10-29 13:41:35 +01:00
Kamil Cukrowski
42b31b966b Add gen_tags.vim plugin support
Display a "Gen. gen_tags" text in section x when gen_tags
is generating tags, similar to gutentags support.
2020-10-22 00:16:05 +02:00
Christian Brabandt
8608270bd3 Merge pull request #2257 from weirane/nroff-wordcount
Add nroff to wordcount
2020-10-18 16:48:42 +02:00
Christian Brabandt
85c64a668d Merge pull request #2259 from subnut/master
Improve the documentation of localsearch extension
2020-10-18 16:48:20 +02:00
Subhaditya Nath
34968bf65c Improve the documentation of localsearch extension
Fixed the copy-paste error mentioned by @chrisbra at
https://github.com/vim-airline/vim-airline/pull/2240#discussion_r494570378

Also improved the wording a bit
2020-10-17 20:05:22 +05:30
Wang Ruochen
19ab70ee87 Add nroff to wordcount 2020-10-17 16:54:46 +08:00
Christian Brabandt
83bd08a97a Merge pull request #2243 from whisperity/battery-plugin-no-overwrite
[battery.vim] Change indicator to not overwrite position section
2020-10-14 09:04:46 +02:00
Christian Brabandt
14abb40287 Merge pull request #2255 from JNRowe/master
Fix doc for enabling wordcount’s reading time support
2020-10-14 09:04:08 +02:00
James Rowe
4e03ac85f9 Fix doc for enabling wordcount’s reading time support 2020-10-13 18:19:02 +01:00
IK
9c0a85de2f Merge pull request #2254 from kazukazuinaina/fix_localsearch_url
[fix] localsearch's url and add abort in autoload function
2020-10-14 01:45:56 +09:00
kazukazuinaina
659693c250 [fix] localsearch's url and add abort in autoload function 2020-10-14 01:17:00 +09:00
Whisperity
2762f7e6e5 [battery.vim] Move indicator to non-overwriting position if window big enough 2020-10-12 17:58:47 +02:00
IK
06747d11be Merge pull request #2250 from kazukazuinaina/fix_variable_scope
[fix] Variable's Scope in ctrlspace's extension
2020-10-12 17:48:01 +09:00
Christian Brabandt
7087c475be Merge pull request #2253 from adrian5/master
Fix wording/typos in doc
2020-10-12 10:18:53 +02:00
adrian5
2ad2eeb9ca Fix wording/typos in doc 2020-10-11 16:05:44 +02:00
kazukazuinaina
0a5753813c [fix] Variable Scope in ctrlspace's extension 2020-10-10 02:08:23 +09:00
Christian Brabandt
aa773f5cdf Merge pull request #2248 from MuhammadMouradG/master
Fix buffer order in tabline with CtrlSpace plugin
2020-10-06 14:41:34 +02:00
MuhammadMouradG
f117de553b Fix buffer order in tabline with CtrlSpace plugin 2020-10-06 12:36:28 +00:00
Christian Brabandt
958ffe059a doc: fix grammatical typo
fixes: #2246
2020-10-05 10:50:05 +02:00
Christian Brabandt
9614105d09 Merge pull request #2240 from subnut/master
Add more customization for 'localsearch' extension
2020-09-26 08:50:14 +02:00
Subhaditya Nath
3fc5ad231c Add more customization for 'localsearch' extension
Now it can be configured to show only when localsearch is disabled. It
is useful if you mostly keep localsearch enabled and don't want to keep
seeing the extra 'LS' section, but still want to have some kind of a
visual indication about when localsearch is disabled.
2020-09-26 01:16:48 +05:30
Christian Brabandt
3740312de0 Merge pull request #2234 from kmoschcau/master
Improve the term extension and make it consistent
2020-09-16 11:59:03 +02:00
Moschcau, Kai
d40e5f9a1d Improve the term extension and make it consistent
This improves the term extension in a few ways.

First it fixes some vint warnings about case sensitive comparisons.

Next it makes the active and inactive variants consistent, as well as
making the line number display consistent to other buffer types. This
was one of the main reasons to do this, because the inclusion of the
Neoterm ID in a previous pull request made inactive terminal status
lines look really inconsistent compared to the active ones.

Further this now shows the Neoterm ID in both active and inactive
buffers in Airline section B. It also removes the now redundant
Neoterm IDs from the buffer name in both Neovim and Vim.

Finally the cosmetic buffer name is now used for both active and
inactive variants.
2020-09-16 09:41:18 +02:00
Christian Brabandt
bf4bba4c5a Merge pull request #2237 from kazukazuinaina/update_gitignore
[update] .gitignore
2020-09-15 14:15:31 +02:00
Christian Brabandt
3272a2d490 doc: mention coc explorer
related: #2235
2020-09-15 14:14:21 +02:00
Christian Brabandt
af556115de Merge pull request #2235 from andys8/patch-1
Support coc-explorer (file explorer extension)
2020-09-15 14:10:45 +02:00
Andy
98683125f6 Support coc-explorer (file explorer extension) 2020-09-15 13:44:05 +02:00
Nathan Lanza
27b52acee7 Only attempt to use dirvish if b:dirvish exists
This was causing persistent errors when you run, for example,

```
ls | nvim -c 'setf dirvish'
```

as dirvish will not yet have set that local variable yet airline will
attempt to use it.
2020-09-15 12:30:27 +02:00
Christian Brabandt
47c9205127 Merge pull request #2236 from chrisbra/fix_failing_test
fix failing test
2020-09-15 12:27:30 +02:00
Christian Brabandt
aed3523ee3 fix failing test 2020-09-15 12:22:41 +02:00
kazukazuinaina
30287992e2 [update] .gitignore 2020-09-15 18:18:07 +09:00
Christian Brabandt
f5693986c4 Merge pull request #2227 from kazukazuinaina/add_battery_extensions
[add] support for battery.vim
2020-09-09 09:03:30 +02:00
kazukazuinaina
2a69254d21 [add] support battery.vim 2020-09-08 01:26:24 +09:00
Christian Brabandt
51f599e2cf Merge pull request #2223 from arafel/magit_dictionary
vim-magit: Can't use an empty dictionary key
2020-09-03 12:46:56 +02:00
Paul Walker
dd5a3c91a1 vim-magit: Can't use an empty dictionary key 2020-09-03 10:51:23 +01:00
IK
2daabc2cce Merge pull request #2222 from kazukazuinaina/fix_nerdtree_setting_variables
[fix] document's typo about nerdtree_statusline
2020-09-03 17:34:31 +09:00
kazukazuinaina
7f91b54a44 [fix] document's typo about nerdtree_statusline 2020-09-03 17:20:52 +09:00
Christian Brabandt
c77d89046e doc: fix typo for show_buffers variable
related: #2218
2020-08-27 13:07:32 +02:00
Christian Brabandt
0f5eedff74 mode: keep hi setting when switching from 'n' to 'ni'
when using `Ctrl-O` from insert mode, the highlighting currently updates
from insert mode highlighting to normal mode highlighting.
Unfortunately, changing the highlighting can be a bit expansive, so
redefining the highlighting just for one simple command does not make
too much sense.

Instead, keep the insert mode highlighting, because that's kind of like
the major mode Vim is in currently. The mode message uses '(INSERT)' to
distinguish between a "normal" INSERT mode and this temporary INSERT
mode, so it should still be visually be distinguishable.

closes #2217
2020-08-26 22:46:05 +02:00
huanhuan_zhuang
5d3cfa4045 add 'g:airline#extensions#tabline#tabtitle_formatter' option
The option can be used to specify a customized format() function to display tab title in tab mode
2020-08-25 13:42:18 +02:00
Christian Brabandt
3a55368320 searchcount: Ignore errors from searchcount() function
If the search regex causes an error, an ugly error message is thrown,
so ignore errors in that case silently.

closes #2216
2020-08-25 13:36:03 +02:00
IK
ef4666bd86 Merge pull request #2210 from kr5hn4/patch-1
Update README.md
2020-08-21 03:38:30 +09:00
Krishna Biradar
a738664dcc Update README.md
Fix typo
2020-08-20 22:43:42 +05:30
Christian Brabandt
02c529efe4 Merge pull request #2205 from eevan78/master
Several fixes and improvements
2020-08-20 09:33:53 +02:00
eevan78
c1134da741 Fix po.vim
There is an extra '] ' in case when a display_limit is set. Also change messages == '0T' to messages ==# '0T'
2020-08-19 11:00:39 +04:00
IK
f84683a8c2 Merge pull request #2204 from kazukazuinaina/fix_vista_statusline
[adjust] vista's extension  width
2020-08-18 15:44:32 +09:00
eevan78
ad80550252 Initial Windows support for msgfmt
For now, it is tested successfully on the latest Vim 8.2 running on Windows 10.
Needs further change and testing for Neovim and older Vim versions.
2020-08-15 02:52:48 +04:00
eevan78
c78c1fb870 Make keymap extension follow the iminsert option
This small change makes keymap extension sensitive to <CTRL-^> in Insert mode.
2020-08-15 02:43:58 +04:00
eevan78
5770e8befd Small improvements of po extension
• Fixed shortening of message. It was not showing more than one digit for fuzzy and untranslated strings.
• Fixed case when starting translation (0 translated), and accomodated for some bigger po catalogs (more than 1000 strings)
• Add support for Windows (I use it on Windows, it works fine with latest Vim. Didn't test Neovim or older Vim versions, though)
• Add one extra space character to the right of the output string
2020-08-15 02:39:25 +04:00
kazukazuinaina
0cebac6bb0 [adjust] vista's extension width 2020-08-15 00:17:01 +09:00
IK
19d1990f86 Merge pull request #2202 from kazukazuinaina/fix_reading_time_doc
[fix] readingtime formatter's doc
2020-08-13 01:56:38 +09:00
kazukazuinaina
8e0d5cd95d [fix] readingtime formatter's doc 2020-08-13 01:52:50 +09:00
IK
f4aaa7c76f Merge pull request #2201 from kazukazuinaina/add_readingtime_doc
[add] readingtime formatter's document
2020-08-13 00:55:58 +09:00
kazukazuinaina
12f1934d38 [add] readingtime formatter's document 2020-08-13 00:23:51 +09:00
Christian Brabandt
6a1c2a74e9 Merge pull request #2125 from shaine/master
Use disabled style for inactive tabs
2020-08-12 15:43:05 +02:00
Christian Brabandt
a294f0cb7e Merge pull request #2183 from tooSadman/nvim-lsp-support
Added support for built-in nvim-lsp
2020-08-12 15:41:47 +02:00
Christian Brabandt
8037c373d0 Merge pull request #2195 from kazukazuinaina/add_wordcount_formatter_readingtime
[add] wordcount's reading time formatter
2020-08-12 15:40:26 +02:00
Christian Brabandt
21e47ca5b3 Disable whitespace checking for csv files
In addition, add a time limit of 500 ms for detecting the indent

fixes: #2200
2020-08-12 15:38:26 +02:00
kazukazuinaina
f26a01cd02 [add] wordcount's reading time formatter 2020-08-07 00:05:38 +09:00
IK
16935cc666 Merge pull request #2194 from kazukazuinaina/add_new_test
[add] new vim version's test
2020-08-06 18:47:28 +09:00
kazukazuinaina
8cd824b4ac [add] new vim version's test 2020-08-06 18:42:06 +09:00
IK
16f88fe363 Merge pull request #2193 from kazukazuinaina/add_short_path_doc
[add] short_path's doc in airline
2020-08-06 01:05:04 +09:00
kazukazuinaina
0e2cc23d49 [add] short_path's doc in airline 2020-08-05 14:15:14 +09:00
tooSadman
782774c0dc Added support for built-in nvim-lsp 2020-08-03 18:19:26 +03:00
Christian Brabandt
ffa44b8327 Merge pull request #2188 from kazukazuinaina/fix_searchcount_extension
[fixup] Release the search restriction and remove unnecessary functions
2020-08-03 15:20:49 +02:00
Christian Brabandt
e4077b1725 Merge pull request #2185 from dcousens/patch-1
Fix spelling typo in comment
2020-08-03 14:44:58 +02:00
Christian Brabandt
a836e09e91 Merge pull request #2187 from kazukazuinaina/add_section_c_short_path
[add] short_path formatter in section_c
2020-08-03 12:21:44 +02:00
kazukazuinaina
1ca2428f51 [fixup] Release the search restriction and remove unnecessary functions 2020-07-28 16:29:42 +09:00
IK
2a027e992d Merge pull request #2186 from kazukazuinaina/fix_searchcount_extension
[fix] searchcount's extension
2020-07-28 11:14:33 +09:00
kazukazuinaina
7ff5fdc349 fix CI 2020-07-23 16:11:19 +09:00
kazukazuinaina
b322ee6728 [add] short_path formatter in section_c
[update] test
2020-07-23 15:58:21 +09:00
kazukazuinaina
19fdf61efe [fix] CI's error 2020-07-21 14:41:15 +09:00
kazukazuinaina
13a92b1474 [fix] searchcount's extension 2020-07-21 14:08:21 +09:00
Daniel Cousens
7bb3ec24ba Fix spelling typo in comment 2020-07-20 21:41:59 +10:00
Christian Brabandt
7fc51f6952 Merge pull request #2181 from cdelledonne/master
Add support for cdelledonne/vim-cmake
2020-07-17 19:36:00 +02:00
Carlo Delle Donne
72a19ed9ed Add support for cdelledonne/vim-cmake 2020-07-17 15:14:40 +02:00
Christian Brabandt
b6d6485a90 Merge pull request #2176 from konafx/master
Add fern.vim support
2020-07-14 16:10:21 +02:00
konafx
a7716dec4d Add extension for fern.vim 2020-07-14 22:54:55 +09:00
Christian Brabandt
f655add4e9 hunks: do not add trailing whitespace when branch extension is disabled
fixes #2177
2020-07-14 14:03:17 +02:00
Christian Brabandt
767107070e Merge pull request #2175 from skeept/patch-1
don't rely on NR for checking that NrrRgn is loaded
2020-07-14 11:36:33 +02:00
skeept
c4ee72f2d9 don't rely on NR for checking that NrrRgn is loaded
This fixes issue when using Plug to conditionally loading NrrRgn:

Plug 'chrisbra/NrrwRgn', {'on': ['NR', 'NW', 'NRV', 'NW', 'NarrowRegion']}

The command will exist but the plugin has not been loaded yet which gives a warning message.
2020-07-09 11:16:23 -05:00
Christian Brabandt
768bd0f5c6 Merge pull request #2158 from larrybradley/fix-venv
Fix handling of virtualenv and poetv plugins
2020-07-09 08:42:32 +02:00
Christian Brabandt
08bab60614 Merge pull request #2174 from nomasprime/dynamically_resize_section_z
Dynamically resize section Z
2020-07-09 08:41:45 +02:00
Rick Jones
46c35b80a1 Make appending airline_right_alt_sep conditional on it not being empty (wordcount)
Was appending a redundant space when airline_right_alt_sep was empty.
2020-07-08 23:46:00 +01:00
Rick Jones
ee4afdeedb Dynamically resize section Z
Resolves: #2168
2020-07-08 23:46:00 +01:00
IK
2fec415a5d Merge pull request #2165 from kazukazuinaina/add_searchcount_document
[add] searchcount's document
2020-07-08 18:12:23 +09:00
kazukazuinaina
416897c73d [add] searchcount's document 2020-07-08 18:09:05 +09:00
Christian Brabandt
0a0d61af6c fzf: do not check for loaded fzf
closes #2163
2020-07-08 08:47:59 +02:00
Christian Brabandt
48d49075ec Merge pull request #2171 from nickspoons/omnisharp-extension
Add OmniSharp extension to display server status
2020-07-08 08:39:02 +02:00
nickspoons
fab4a02838 Add OmniSharp extension to display server status 2020-07-08 16:32:07 +12:00
Christian Brabandt
b843321428 Merge pull request #2166 from fvictorio/patch-1
Fix link to localsearch repo
2020-07-05 11:26:07 +02:00
Franco Victorio
7cd12641c7 Fix link to localsearch repo 2020-07-04 17:42:23 -03:00
Christian Brabandt
ba9b3e1839 Merge pull request #2161 from kazukazuinaina/add_support_searchcount
[RFC] Add support for searchcount extension
2020-06-29 09:25:56 +02:00
Christian Brabandt
cb03578a7c Merge pull request #2164 from Freed-Wu/master
Fix bug of keyboard_layout
2020-06-29 09:24:48 +02:00
wzy
b96e02c649 Fix bug of keyboard_layout
when `keyboard_layout==''`, `let keyboard_layout = split(keyboard_layout, '\.')[-1]` will return an error.
2020-06-29 13:44:13 +08:00
kazukazuinaina
2d9e88794d delete redrawstatus
This is unnecessary. Removing it will still work properly and improve performance.
2020-06-28 06:37:29 +09:00
kazukazuinaina
2c45d3c1aa [add] support fot searchcount extension 2020-06-28 05:57:55 +09:00
IK
d0aaa061c2 Merge pull request #2157 from kazukazuinaina/add_terminalMode_color_palette
[add] terminal mode's color palette
2020-06-26 17:55:02 +09:00
kazukazuinaina
476bba726c [add] terminal mode's color palette
Neovim returns a has('terminal') of 0.
Therefore, this conditional branch is not needed.
2020-06-25 00:33:27 +09:00
Christian Brabandt
8be6a2ecd5 Merge pull request #2156 from kazukazuinaina/add_fzf_extension_doc
[add] fzf integration's document
2020-06-22 08:41:50 +02:00
Christian Brabandt
bc8fdfe946 terminal: correctly shorten terminal tabline
If there is a single terminal window in  the current tabpage, the whole
long command will be displayed in the tabline, even when it should be
shortened by default.

By default the title will not be shown if there are several windows in
the current tabpage, but if there is only one single terminal window, it
will still be shown (and might be a bit long). But I guess, it is better
to just show a possible too long terminal window name, than not show
anything).

fixes #2126
2020-06-21 22:31:43 +02:00
kazukazuinaina
bcabad32cf [add] fzf integration's document 2020-06-20 07:43:19 +09:00
Larry Bradley
e352adda69 Fix handling of virtualenv and poetv plugins 2020-06-19 11:07:06 -04:00
Christian Brabandt
5ce3e63658 Merge pull request #2146 from noisysocks/master
Support fzf and fzf.vim
2020-06-19 11:45:34 +02:00
Christian Brabandt
e58c4a493c Merge pull request #2155 from kazukazuinaina/update_license_year
[update] wordcount's formatter's license year
2020-06-19 09:49:35 +02:00
kazukazuinaina
cc6d3a7df1 [update] wordcount's formatter's license year 2020-06-19 03:28:21 +09:00
Robert Anderson
88894aa0ad Support fzf and fzf.vim
Adds a slightly nicer statusline for the terminal buffers created by the
fzf and fzf.vim plugins.

https://github.com/junegunn/fzf
https://github.com/junegunn/fzf.vim
2020-06-13 10:31:29 +10:00
IK
ee85ed4c67 Merge pull request #2150 from kazukazuinaina/update_licence_year_extension
[update] license's year in airline's extension
2020-06-11 19:02:01 +09:00
kazukazuinaina
fab1ee3117 [update] license's year in airline's extension 2020-06-11 05:26:04 +09:00
Christian Brabandt
90f7210413 Merge pull request #2149 from nomasprime/add_update_highlights_docs
Add update highlights docs
2020-06-09 18:37:14 +02:00
Rick Jones
8177d63e07 Add update highlights docs
Resolves: #1404
2020-06-06 16:13:02 +01:00
IK
d221dc5312 Merge pull request #2143 from PratikBhusal/master
vim-dirvish: Fixed bugs, added include guards and documentation
2020-05-31 09:15:55 +09:00
PratikBhusal
de76234a0e vim-dirvish: Fixed bugs and added better include guards
Fixes issue #2142.

These changes primarily focused on making the include guards more robust
and simplify how the path for w:airline_section_c was generated.
Credits goes to @kazukazuinaina for improving on my original
implementation.
2020-05-30 00:25:56 -05:00
Christian Brabandt
0de31196b6 Merge pull request #2139 from PratikBhusal/master
Add vim-dirvish support
2020-05-29 23:12:46 +02:00
Christian Brabandt
6ddda74126 Merge pull request #2141 from kazukazuinaina/add_extension_unite_denite
[add] unite and denite's config
2020-05-29 23:11:50 +02:00
Christian Brabandt
64c0374423 Merge pull request #2138 from kazukazuinaina/update_CONTRIBUTING.md
[update] CONTRIBUTING.md
2020-05-29 23:11:07 +02:00
kazukazuinaina
b929452f32 [add] unite and denite's config
[add] document
2020-05-29 18:20:01 +09:00
Christian Brabandt
c744fb81b6 Merge pull request #2140 from xerus2000/patch-1
Update README.md
2020-05-27 11:50:16 +02:00
Janek
ba2c1b4e25 Update README.md 2020-05-27 10:45:28 +02:00
PratikBhusal
e0838c704a Added vim-dirvish support
Matched VCS format of Netrw to only show branch name.
Filetype hidden as it is a duplicate on the left side.
File encoding hidden as it does not matter in dirvish buffer.
Removed unnecessary current column information
2020-05-25 19:34:52 -05:00
kazukazuinaina
d232ec08b9 [update] CONTRIBUTING.md 2020-05-24 08:09:20 +09:00
IK
3fa0e0ce0c Merge pull request #2131 from kazukazuinaina/update-changelog
[update] CHANGELOG.md
2020-05-23 05:09:11 +09:00
IK
e23978fb68 Merge pull request #2137 from kazukazuinaina/refactoring_vimagit
[refactor] vimagit's extension
2020-05-22 23:21:46 +09:00
kazukazuinaina
a133605d01 [refactor] vimagit's extension 2020-05-21 15:19:25 +09:00
IK
f244ff9987 Merge pull request #2136 from kazukazuinaina/fix_endif
fix missing endif
2020-05-21 03:13:53 +09:00
kazukazuinaina
68024ec33d fix missing endif 2020-05-21 01:26:33 +09:00
kazukazuinaina
1e6f5c7705 [update] CHANGELOG.md 2020-05-07 00:44:11 +09:00
Christian Brabandt
aa46603214 Merge pull request #2128 from jolan78/master
fix for #2127
2020-05-04 14:19:44 +02:00
Christian Brabandt
ffdf52e38d Merge pull request #2129 from kazukazuinaina/fix_check_ycm_extension
abopt get() function
2020-05-04 14:19:14 +02:00
kazukazuinaina
1f1a71ae2b abopt get() function 2020-05-04 17:53:13 +09:00
jolan78
3b46a4d9a3 fix for #2127 2020-05-04 10:07:39 +02:00
Christian Brabandt
915c7cfcd7 Fix brocken CI test
because vim 7.4 does not know v:vim_did_enter

I am beginning to wonder, whether we should have vim8 as a minimal
requirement...
2020-05-04 08:10:33 +02:00
Christian Brabandt
0ac474fdc4 plugin: load vim-airline as optional package
allow to load vim-airline as opt package

Fixes: 2122
2020-05-04 07:48:13 +02:00
Shaine Hatch
62e7fc6ab1 Use disabled style for inactive tabs 2020-04-30 12:13:55 -06:00
Christian Brabandt
96d37d2fbe hunks: fix missing line continue character 2020-04-29 17:17:58 +02:00
Christian Brabandt
48064e24d5 hunks: only enable coc-git extension, if explicitly enabled by the user
As requested by the coc maintainer, this is explicitly disabled, unless
the user configures vim-airline to use it for the branch extension. This
is done, because the `CocAction('extensionStats')` function is known to
be slow and this may cause a slow startup.
2020-04-29 16:59:37 +02:00
Christian Brabandt
e7f78bbc0f Merge pull request #2124 from kazukazuinaina/add_vaffle_path
[add] vaffle's path section
2020-04-29 15:08:33 +02:00
kazukazuinaina
ad3132da33 [add] vaffle's path section 2020-04-29 21:37:36 +09:00
Christian Brabandt
ff3f66ed30 Merge pull request #2121 from kazukazuinaina/add_branch_setting_in_doc
[add] branch symbol's Explanation
2020-04-24 17:27:29 +02:00
kazukazuinaina
d2513b8460 [add] branch symbol's Explanation
[fix] document's position
2020-04-24 20:13:41 +09:00
Christian Brabandt
eff4828b37 README: fix saythanks link
unfortunately, saythanks broke and since it has been restored, the links
changed. So fix it here again.
2020-04-20 08:11:35 +02:00
Christian Brabandt
f00a9e6e7a Merge pull request #2119 from kazukazuinaina/update_coc_status_width
[adjust] coc_status's width
2020-04-20 07:57:16 +02:00
Christian Brabandt
76c1998753 extensions: prevent error about unknown function for ycm
if g:loaded_youcompleteme does not exists, the ycm extension will not be
loaded. However extensions.vim could still try to init the ycm
extension, which would lead to an error message:

  E117: unknown function airline#extensions#ycm#init

so make sure, it is only loaded, if ycm is loaded as well.
2020-04-20 07:54:00 +02:00
kazukazuinaina
379e0f5bc2 [adjust] coc_status's width 2020-04-18 17:48:26 +09:00
Christian Brabandt
2eb95b2e09 Merge pull request #2118 from kazukazuinaina/add_hunks_readme
[add] coc-git section in README
2020-04-17 12:22:06 +02:00
kazukazuinaina
cce6b55a27 [add] coc-git section in README 2020-04-17 16:57:54 +09:00
Christian Brabandt
c8fe296c52 Merge pull request #2117 from kazukazuinaina/update_ycm_extension
[add] ycm's toggle and doc
2020-04-17 09:40:05 +02:00
Christian Brabandt
0074044413 Merge pull request #2116 from kazukazuinaina/add_cursormode_toggle
[add] cursormode's toggle
2020-04-17 09:38:51 +02:00
kazukazuinaina
15a1a3ccc7 [add] ycm's toggle and doc 2020-04-15 12:08:09 +09:00
kazukazuinaina
37273299f7 [add] cursormode's toggle 2020-04-15 11:45:45 +09:00
Christian Brabandt
7c31850381 wordcount: only test against complete filetypes
Put a word-boundary regex atom before and after the current filetype, to
make sure that a `C` filetype won't be detected as a filetype that
enables the wordcount extension. (`c` matches asciidoc).
2020-04-14 19:53:18 +02:00
Christian Brabandt
12aa326dae Merge pull request #2113 from kazukazuinaina/add_zoomwintab_doc
[add] zoomwintab's document
2020-04-14 13:53:00 +02:00
kazukazuinaina
9840b26fa4 [add] zoomwintab's document
[fix] mistake plugin name

[add] zoomwintab's variable's config
2020-04-14 20:41:44 +09:00
Christian Brabandt
a100e89671 Merge pull request #2111 from troydm/master
zoomwintab extension added
2020-04-10 14:21:16 +02:00
troydm
487d21e7ff zoomwintab extension vint fix 2020-04-07 21:50:23 +03:00
troydm
5902a23e78 zoomwintab extension added 2020-04-07 21:33:28 +03:00
Christian Brabandt
87d4648172 Merge pull request #2108 from kazukazuinaina/add_coc_status_test
[add] some coc's test
2020-04-03 08:09:29 +02:00
kazukazuinaina
acd7e82d2b [add] some coc's test 2020-04-03 12:15:42 +09:00
Christian Brabandt
23374c491c Merge pull request #2106 from kazukazuinaina/add_vista_test
[add] vista's test
2020-04-02 18:04:11 +02:00
kazukazuinaina
576710f7a5 [add] vista's test 2020-04-03 01:00:55 +09:00
Christian Brabandt
adf2afae7c hunks: still some problems with coc-git integration
Fix remaining problems, test correctly for enabled coc-git plugin.
2020-04-01 10:49:00 +02:00
Christian Brabandt
29eec37c66 tabline: fix typo
related: #2103
2020-03-30 08:27:20 +02:00
Christian Brabandt
74ca43a9b6 [hunks] also cache coc git status 2020-03-29 19:37:44 +02:00
Christian Brabandt
5a490dd9ac hunks: remove test for empty branch for changes plugin
Because changes plugin does not rely on git
Also remove the test of the local variable for the changes plugin
whether it is enabled or not, this is taken care of in the changes
plugin
2020-03-29 19:37:44 +02:00
Christian Brabandt
c70f3da583 Merge pull request #2103 from kazukazuinaina/always_show_tab_count
[add] new option / always show tab count feature
2020-03-29 18:50:14 +02:00
kazukazuinaina
185bcc5e88 [add] new option / always show tab count feature 2020-03-30 01:06:06 +09:00
Christian Brabandt
c05fff8504 hunks: add abort keyword to function definitions 2020-03-29 17:30:29 +02:00
Christian Brabandt
a13bed2f51 hunks: integrate coc-git extension
The coc-git extension to coc does show similar statistics as e.g.
gitgutter, therefore, integrate the coc-git interface into the hunk
extension.

closes #2094
2020-03-29 17:30:29 +02:00
Christian Brabandt
02a0ab4b59 Merge pull request #2102 from kazukazuinaina/fix_coc_test
fix coc extension's unit test
2020-03-29 16:42:21 +02:00
kazukazuinaina
5b994f77b1 fix coc's unit test 2020-03-29 23:13:13 +09:00
Christian Brabandt
2f2003be52 Merge pull request #2098 from kazukazuinaina/add_check_vista_toggle
[add] check vista's toggle
2020-03-29 16:04:35 +02:00
Christian Brabandt
8a7172e1c2 Merge pull request #2099 from kazukazuinaina/fix_denite_extension
[fix] operator and [add] abort in autoload function
2020-03-29 16:04:08 +02:00
Christian Brabandt
99c2dfd569 coc: use bold accent for g:coc_status
fixes #2101
2020-03-29 16:03:00 +02:00
kazukazuinaina
f8a3afa4a1 [fix] operator and [add] abort in autoload function 2020-03-29 00:45:32 +09:00
kazukazuinaina
e671a68b48 [add] check vista's toggle 2020-03-28 18:15:29 +09:00
Christian Brabandt
0278e9095d Merge pull request #2093 from kazukazuinaina/add_wordcount_filetype
add plaintex filetype
2020-03-23 11:39:20 +01:00
kazukazuinaina
16223d0bc3 add plaintex filetype
re-order and update document
2020-03-20 22:41:50 +09:00
Christian Brabandt
119477060d Merge pull request #2090 from Freed-Wu/master
Add g:airline#extensions#capslock#sign
2020-03-20 14:13:56 +01:00
Christian Brabandt
352e6dd19d Merge pull request #2089 from kazukazuinaina/add_gina_copyright
[add] gina.vim's url
2020-03-20 14:13:09 +01:00
Christian Brabandt
b36542d509 Merge pull request #2092 from kazukazuinaina/fix_github_actions_url
[fix] github_actions's url
2020-03-20 14:12:49 +01:00
Freed-Wu
254d1a2d8d Add g:airline#extensions#capslock#symbol
Add help

Add linebreak and default
2020-03-20 11:02:34 +08:00
kazukazuinaina
dd72442fee [fix] github_actions's url 2020-03-18 02:52:17 +09:00
kazukazuinaina
b2cd5baa24 [add] gina.vim's url 2020-03-15 20:05:22 +09:00
Christian Brabandt
4e2546a209 Changelog: Mention coc.nvim improved integration from #2079 2020-03-02 13:18:28 +01:00
ckipp01
fe94d52c4c coc: add in coc_status to coc.nvim integration
Allow to show additional messages from coc.nvim in section_c

For ease of use, shorten the message for windows smaller than 81
characters.

closes #2079
2020-03-02 13:16:37 +01:00
Christian Brabandt
fdafa44b2f Merge pull request #2068 from fx-carton/master
Add support for vim-lsp
2020-03-02 13:05:19 +01:00
Christian Brabandt
418fb24982 Merge pull request #2083 from kazukazuinaina/add_check_ale_extension_toggle
[add] check ale's toggle
2020-03-02 13:04:25 +01:00
Serge Y. Stroobandt
3b339fee98 wordcount: Word count for the combined file types
[Pandoc flavoured Markdown](https://en.wikipedia.org/wiki/Markdown#CommonMark) has its [own file type in `vim`](https://github.com/vim-pandoc/vim-pandoc-syntax#standalone), namely `markdown.pandoc`.
Word count by default in `vim-airline` obviously would make a lot of sense for this popular file type.

Fix this, by making sure that the wordcount extensions will apply
correctly if any of the combined filetypes (e.g. either pandoc or
markdwon) matches the list of allowed filetypes.
2020-03-02 13:03:21 +01:00
François-Xavier Carton
0860036454 Add support for vim-lsp 2020-03-01 00:41:33 +01:00
kazukazuinaina
9e3a0626bf [add] check ale's toggle 2020-02-29 01:31:39 +09:00
Christian Brabandt
71a7e23f32 Merge pull request #2081 from kazukazuinaina/fix/scope
[fix] count variable's scope
2020-02-28 09:19:09 +01:00
kazukazuinaina
6115527e7e [fix] conut variable's scope 2020-02-28 17:14:45 +09:00
Christian Brabandt
774cd8b08f term: better formatting of neovim terminal
closes #2074
2020-02-27 13:37:50 +01:00
Christian Brabandt
bc19a18b3c Merge pull request #2070 from idbrii/focuslost_inactive_focusgained_ignore
Ignore FocusGained events for the current second
2020-02-27 13:17:27 +01:00
Christian Brabandt
256eb1b5a1 Merge pull request #2077 from kazukazuinaina/update/changelog
Changelog / add unit test section
2020-02-27 13:09:15 +01:00
kazukazuinaina
7e042e7b70 Changelog / add unit test section 2020-02-27 11:15:25 +09:00
David Briscoe
c2ff76829f Ignore FocusGained events for the current second
Fix #2062: restore g:airline_focuslost_inactive behaviour.

Only ignore focusgained events on Windows. If there are more problematic
platforms, we'll add them later.

Instead of ignoring the next x FocusGained events whenever we do call
system(), ignore them for the current second. That allows us to put a
hard limit on the duration of the ignore.

This seems like a much better solution than the previous one because it
also prevents ignore events from building up (s:focusgained_ignored was
often greater than 5).

Test (gvim 8.2.140 on Win10)
gvim.exe ~/.vim/bundle/airline/autoload/airline/extensions/branch.vim
:Gedit HEAD
check several parents and no regression of looping behaviour from #2053.

:let g:airline_focuslost_inactive = 1
:split
alt-tab several times and statusline is correctly dimmed and restored
each time.
2020-02-21 09:21:47 -08:00
Christian Brabandt
0b26834648 Merge pull request #2069 from kazukazuinaina/gina_refactoring
[update] gina's extensions
2020-02-21 09:07:35 +01:00
Christian Brabandt
d7692e1fe5 Merge pull request #2067 from JacksonBailey/improve-readme
Specify the full helptags command
2020-02-21 09:06:15 +01:00
Jackson Bailey
9bbeb75dd8 Specify the full helptags command 2020-02-20 13:34:29 -05:00
kazukazuinaina
fc09bf751a [update] gina's extensions in extensions dir
fix typo and add section_b

[add] extension gina

[add] unstaged extensions

[fix] typo

[Done] gina refactoring

[fix] document

[fix] gina's spell

[add] abort
2020-02-17 22:43:07 +09:00
Christian Brabandt
7e00ee1107 Merge pull request #2066 from kazukazuinaina/update_reviewdog_yml
[update] reviewdog.yml
2020-02-17 13:59:25 +01:00
Christian Brabandt
3fdfdc9963 Merge pull request #2059 from languitar/patch-1
Always obey the poetv#enabled setting
2020-02-17 13:58:31 +01:00
kazukazuinaina
7cc49c9386 [update] reviewdog.yml 2020-02-07 20:14:47 +09:00
Christian Brabandt
099dd92eeb Merge pull request #2065 from kazukazuinaina/fix_github_actions_url
[fix] github action's url in README
2020-02-07 09:14:19 +01:00
kazukazuinaina
0654fec1be [fix] github action's url in README 2020-02-07 17:10:15 +09:00
Christian Brabandt
985d15613e Merge pull request #2063 from kazukazuinaina/add_github_actions
[add] github actions
2020-02-07 08:39:54 +01:00
Christian Brabandt
73502997ff Merge branch 'master' into add_github_actions 2020-02-07 08:39:41 +01:00
Christian Brabandt
3481cebe22 Merge pull request #2064 from kazukazuinaina/update_travis_badge
[update]travis-ci's badge
2020-02-07 08:36:24 +01:00
kazukazuinaina
a6a3eab8d9 [add] github actions
[add] github actions's batch in README

[update] yml
2020-02-07 05:14:16 +09:00
kazukazuinaina
5e470bcf0b [update]travis-ci's badge 2020-02-07 04:59:37 +09:00
Johannes Wienke
5c1f3b426b Always obey the poetv#enabled setting
Do not silently enable an extension even though the `enabled` setting is false.

This would resolve #2058
2020-02-01 22:01:00 +01:00
Christian Brabandt
f659a98d50 completion: only return random theme, when it actually matches 2020-01-30 13:42:21 +01:00
Christian Brabandt
e22f735f80 Merge pull request #2055 from kazukazuinaina/fix_typo_in_doc
[fix] typo in doc
2020-01-29 08:14:17 +01:00
Christian Brabandt
abf54b60a4 Merge pull request #2053 from idbrii/fix-focusgained
branch: ignore upcoming FocusGained when updating
2020-01-29 08:13:53 +01:00
kazukazuinaina
24900181f4 [fix] typo in doc 2020-01-29 12:17:39 +09:00
David Briscoe
dd247a0f85 branch: ignore upcoming FocusGained when updating
closes #2029

airline#util#focusgain(1) was called too soon -- it's called before vim
loses focus and not after it gains focus. Instead, we ignore the next
FocusGained event.
2020-01-28 12:01:09 -08:00
Christian Brabandt
8fbb16f838 async: correctly use &shell and &shellcmdflag
instead of hardcoding to use 'sh' and '-c'
2020-01-28 16:04:53 +01:00
Christian Brabandt
a201689e38 async: correctly redirect error on powershell 2020-01-28 16:01:52 +01:00
Christian Brabandt
2e9d36e220 async: problem with powershell
also check for the powershell on windows.

closes #2050
2020-01-28 16:00:02 +01:00
Christian Brabandt
c3cda92272 Merge pull request #2049 from kazukazuinaina/fix_echo_extension_load
Fix echo extension load
2020-01-28 15:58:00 +01:00
Christian Brabandt
eb916c0c57 Merge pull request #2051 from kazukazuinaina/fix_nerdtree_url_in_doc
[fix] nerdtree's url in doc and README.md
2020-01-28 15:56:13 +01:00
Christian Brabandt
f4795532c6 branch: disable FocusGained handler when updating fugitive information
closes #2029
2020-01-28 15:54:53 +01:00
kazukazuinaina
52175cec3d [fix] nerdtree's url
[fix] nerdtree's url in README
2020-01-28 17:40:25 +09:00
kazukazuinaina
70c91d70c5 [fix] can display loaded extension in g:airline_extensions
[fix] continue check
2020-01-27 07:11:24 +09:00
Christian Brabandt
d4502d02a1 Merge pull request #2046 from dlukes/master
Deduplicate virtualenv identifier sections
2020-01-24 12:48:20 +01:00
David Lukes
ce45960049 Suggest fix for #2045 2020-01-24 12:46:07 +01:00
Christian Brabandt
1240403ce5 highlighter: fix obvious spelling error 2020-01-20 12:32:06 +01:00
Christian Brabandt
a676af7c8a highlighter: check for accents key
This is actually a work around for a broken installation. the dict p
should always contain the accents key (see `airline#themes#patch()`
function, that adds missing accents). So even if the theme does not
define the accents key, it should always exist.

However, an error while evaluating the statusline is extremely annoying,
so add some safeguards here and skip the following for loop.

related #2043
2020-01-20 12:28:04 +01:00
Christian Brabandt
62976a21b0 Merge pull request #2044 from kazukazuinaina/update_license_in_doc
update license year in doc/airline.txt
2020-01-20 08:24:51 +01:00
kazukazuinaina
4a4be9cd99 update license year in doc/airline.txt 2020-01-16 11:22:19 +09:00
Christian Brabandt
8d694cba9c Merge pull request #2042 from kazukazuinaina/fix_issue_2041
update &preview in extensions.vim
2020-01-13 11:37:02 +01:00
kazukazuinaina
f0317f6dd4 update preview in extensions.vim 2020-01-12 01:27:24 +09:00
Christian Brabandt
c1de3d3370 Merge pull request #2040 from kazukazuinaina/update_license_year_
update license's year in vim-airline
2020-01-06 10:18:28 +01:00
kazukazuinaina
cf6dcf5e19 update license's year in vim-airline 2020-01-06 11:22:49 +09:00
Christian Brabandt
66f77d4a77 Merge pull request #2038 from kazukazuinaina/update_changelog
add poetv in CHANGELOG.md
2020-01-03 08:33:37 +01:00
kazukazuinaina
07e16116fd add poetv in CHANGELOG.md 2020-01-03 15:06:38 +09:00
Christian Brabandt
0755196c4d Merge pull request #2035 from petobens/poetv
Add poetv extension
2019-12-30 21:38:47 +01:00
Christian Brabandt
3d0f51152a Merge pull request #2034 from kazukazuinaina/update_ci
update .travis.yml
2019-12-30 21:37:58 +01:00
kazukazuinaina
48917f34a3 update .travis.yml
test

update

aaa

update

update ci

fix commit

update vim

update

update .travis.yml

update travis.yml

update

update

update .travis.yml

fix syntax error

update Gem

update path

delete bundle install

add license
2019-12-31 02:31:15 +09:00
petobens
98f03df8e5 Add poetv extension 2019-12-30 10:37:03 -03:00
Christian Brabandt
d199186df0 Merge pull request #2033 from jonathf/index_from_1
Adding option: `buffers#buffer_idx_mode = 3`
2019-12-27 16:31:31 +01:00
Jonathan Feinberg
892c9ad6b5 Adding option: buffers#buffer_idx_mode = 3
By using `buffer_idx_mode = 3`, indexing will start at 1, instead of 11.
2019-12-27 13:00:50 +01:00
Christian Brabandt
5a87ca631a Merge pull request #2027 from midchildan/feat-buffer-disable
allow disabling airline per-buffer
2019-12-27 08:47:45 +01:00
Christian Brabandt
c6283b5185 Merge pull request #2026 from midchildan/fix-airline-inactive
fix missing check for w:airline_disable_statusline
2019-12-27 08:47:20 +01:00
Christian Brabandt
dee74777db Merge pull request #2031 from kazukazuinaina/add_vaffle_extension
Add support for Vaffle
2019-12-27 08:27:27 +01:00
kazukazuinaina
61bcec3b57 add vaffle extension 2019-12-26 17:03:15 +09:00
midchildan
9779a7a340 allow disabling airline per-buffer 2019-12-22 21:26:59 +09:00
midchildan
bc0e2a3438 fix missing check for w:airline_disable_statusline 2019-12-22 20:06:35 +09:00
Christian Brabandt
b93492b40b Merge pull request #2024 from kazukazuinaina/fix_untracked_branch_check
fix untrack branch check about gina
2019-12-19 11:44:50 +01:00
kazukazuinaina
be85daa23f fix untrack branch check about gina 2019-12-19 15:43:50 +09:00
Christian Brabandt
3b6b2474a2 Merge pull request #2023 from kazukazuinaina/update_ISSUE_TEMPLETE
add screen shot section in ISSUE_TEMPLETE.md
2019-12-18 10:05:31 +01:00
kazukazuinaina
6f440ff679 add screen shot section 2019-12-18 16:46:54 +09:00
Christian Brabandt
98326670b6 Merge pull request #2022 from kazukazuinaina/can_choice_gina_statusline
can choice to use gina's extension
2019-12-17 19:19:42 +01:00
kazukazuinaina
44b1e3df5d can choice to use gina's extension
fix typo

add v:version >= 800and remove v:version > 704

fix CI error
2019-12-18 00:44:47 +09:00
Christian Brabandt
929cf2e21f Merge pull request #2021 from kazukazuinaina/add_try_catch_in_gina_branch
add try catch in gina.vim's extension in branch.vim
2019-12-15 16:19:51 +01:00
Christian Brabandt
aee2c7f91d Merge pull request #2020 from kazukazuinaina/fix_typo_in_tabline_vim
fix typo in tabline.vim
2019-12-15 16:17:59 +01:00
Christian Brabandt
e142bbd1bf Merge pull request #2017 from kazukazuinaina/update_changelog
update changelog
2019-12-15 16:17:31 +01:00
kazukazuinaina
d4e2bfe892 add try catch in gina.vim's extension in branch.vim 2019-12-15 23:08:31 +09:00
kazukazuinaina
60aaed01ae fix typo in tabline.vim 2019-12-15 21:28:51 +09:00
kazukazuinaina
f1c48e9820 update changelog 2019-12-14 04:38:58 +09:00
Christian Brabandt
72286b27cc Merge pull request #2016 from kazukazuinaina/add_gina_support_for_branch
add gina support for vim-airline's branch
2019-12-13 20:19:08 +01:00
kazukazuinaina
f8e1f85fde add gina support for vim-airline's branch
add check gina in util.vim

fix typo

add gina check

fix typo

add gina.vim's url in doc

fix typo

delete v:version > 800

fix error
2019-12-14 04:10:46 +09:00
Christian Brabandt
9f00b402c5 plugin: save/restore cpo setting
This has been missing way too long. It should always be set to a sane
vim default, as documented (:h write-plugin). So add it as well.
2019-12-13 10:17:15 +01:00
Christian Brabandt
5f9ae83f44 config: allow to disable setting the statusline option
closes #2013
2019-12-13 09:59:45 +01:00
Christian Brabandt
e395afed51 vista: init extension on VimEnter
closes #2009
2019-12-13 08:56:26 +01:00
Christian Brabandt
30725e6eb2 Merge pull request #2010 from kazukazuinaina/add_gina_new_extension
add gina's some extensions
2019-12-13 08:45:36 +01:00
Christian Brabandt
9c3f84fc67 tabline: skip expansive BufAdd call on Session load
closes #2015
2019-12-13 08:44:15 +01:00
Christian Brabandt
758c83acbf tabline: simplify autocommand condition 2019-12-12 09:58:21 +01:00
Christian Brabandt
58b9b3ec81 netrw: do not error out when g:netrw_sort_by is not defined 2019-12-11 23:36:15 +01:00
Christian Brabandt
6ef37e4b3e Merge pull request #2012 from kazukazuinaina/update_vista_vim_url
update vista.vim's url in document
2019-12-10 16:15:49 +01:00
Christian Brabandt
c24f3c7c4d whitespace: do not detect '=======' as conflict marker for rst files
closes #2014
2019-12-10 16:14:08 +01:00
kazukazuinaina
f472e1bafb update vista.vim's url in document 2019-12-09 00:51:18 +09:00
kazukazuinaina
b1ca153b72 add gina's some extensions
add gina-ls
2019-12-06 17:26:08 +09:00
Christian Brabandt
2daef1bcb8 Merge pull request #2007 from kazukazuinaina/add_gina_branch
add :Gina branch command support
2019-12-02 10:10:05 +01:00
kazukazuinaina
806f071348 add :Gina branch command support 2019-12-02 11:54:38 +09:00
Christian Brabandt
ce932f3825 Revert "themes: drop simple colorscheme - theme mappings"
This reverts commit 47be64d7f2.

closes #2006
2019-11-29 08:27:13 +01:00
Christian Brabandt
47be64d7f2 themes: drop simple colorscheme - theme mappings
vim-airline by default already tries to load theme names, that have the
same name as the colorscheme. Therefore, it does not make sense, to add
mappings that result in the same theme name.

So drop the base16, wombat, zenburn and solarized keys
2019-11-27 13:52:21 +01:00
Christian Brabandt
81fdc3b988 plugin: make use of rand() function from vim 8.1.2342 2019-11-25 17:13:33 +01:00
Christian Brabandt
19c655b420 plugin: do not trigger redraws for popup windows
coc.nvim might set the filetype of the poppup window, which might
trigger a redraw of the statusline, causing the current window to become
inactive.

So bail out early, if the current buffer is a popup buffer. It cannot
have a statusline anyhow.

fixes #1930 (but this time for Vim)
2019-11-25 16:24:58 +01:00
Christian Brabandt
b9eb941201 Merge pull request #2002 from kazukazuinaina/update_gitignore
add .DS_Store in .gitignore
2019-11-21 17:48:24 +01:00
kazukazuinaina
6bc040a3a5 add .DS_Store in .gitignore 2019-11-20 12:21:42 +09:00
Christian Brabandt
29549aa55a Merge pull request #1997 from kazukazuinaina/fix_typo_NERDTree
substitute/NERDtree/NERDTree
2019-11-15 08:26:03 +01:00
kazukazuinaina
17ec87f503 substitute/NERDtree/NERDTree 2019-11-15 15:50:36 +09:00
Christian Brabandt
e3e2b1af44 Merge pull request #1996 from kazukazuinaina/update_NERDTree_statusline
update nerdtree's statusline
2019-11-13 22:33:01 +01:00
kazukazuinaina
8a3eeddc80 update nerdtree's statusline
add let g:airline#extensions#nerdtree_statusline's documentation
2019-11-11 21:11:36 +09:00
Christian Brabandt
e4e4ba3c7b Changelog: fix link to github 2019-11-10 16:49:29 +01:00
Christian Brabandt
ad716f1df4 Changelog: Prepare for release 0.11 2019-11-08 20:19:06 +01:00
Christian Brabandt
664426be21 doc: mention all supported plugins
Also, in the extensions mention the required vim plugin
2019-11-08 20:18:04 +01:00
Christian Brabandt
5b9cbc1a57 ctrlspace: cleanup s:var usage 2019-11-08 19:58:22 +01:00
Christian Brabandt
a66f7ae13e Merge pull request #1995 from kazukazuinaina/add_fugitive_statusline
add fugitive statusline
2019-11-10 08:45:25 +01:00
kazukazuinaina
073d760689 add fugitive statusline 2019-11-10 09:47:43 +09:00
Christian Brabandt
f2241b61b2 bufferline: get rid of static s: variable 2019-11-05 11:32:10 +01:00
Christian Brabandt
15c540dc94 doc: rewrap help doc to fit into a 80 column shell
needs to be reformated a bit, especially if the signcolumn is on, this
would have ugly wraps.

Also, the documentation at :h airline-default-sections mentions readonly
for the gutter part, which is wrong. So correct this (related #1994)
2019-11-05 11:32:10 +01:00
Christian Brabandt
d17fcbf72f Merge pull request #1990 from kazukazuinaina/update_airline.txt
update ale's url
2019-10-31 12:46:36 +01:00
kazukazuinaina
98b95e6399 update ale's url 2019-10-31 17:56:42 +09:00
Christian Brabandt
a0e9b383c6 tabline: add buffer number to unique_tail formmater
fixes #1987
2019-10-25 17:20:34 +02:00
kazukazuinaina
62ec219601 gina: Enable gina.vim, only for Vim > 7.4.1898
gina.vim needs the `<mods>` feature to work correctly. Therefore check
that Vim has at least patch 7.4.1898 included before using and accessing
the gina plugin.

fixes #1984
2019-10-24 12:57:33 +02:00
Christian Brabandt
6eda2735aa Merge pull request #1986 from kazukazuinaina/add_update_statusline_check
add check to statusline's update
2019-10-24 09:38:01 +02:00
kazukazuinaina
0cba7d3ed6 add check to statusline's update 2019-10-24 16:19:58 +09:00
Christian Brabandt
3736132370 Merge pull request #1982 from kazukazuinaina/update_airline.txt
update airline.txt about airline-term
2019-10-23 13:07:13 +02:00
kazukazuinaina
390908dead update airline.txt about airline-term
fix mistake

delete space

fix format
2019-10-17 17:58:00 +09:00
Christian Brabandt
6d665580a3 term: allow to disable the term extension
closes #1981
2019-10-16 18:07:35 +02:00
Christian Brabandt
297ca3d004 Merge pull request #1980 from kazukazuinaina/update_airline.txt
update airline.txt
2019-10-11 17:09:32 +02:00
kazukazuinaina
4f0d2ebbb5 update airline.txt airline-predefined-parts confusing 2019-10-04 16:55:32 +09:00
kazukazuinaina
62f2dc02f0 Add support for gina.vim
add gina-tag command

add help about gina.vim

update CHANGELOG.md

closes #1979
2019-10-02 15:17:26 +02:00
Christian Brabandt
92c0a90b64 Update Changelog
This documents some of the changes that happend since the release
[v0.10](https://github.com/vim-airline/vim-airline/releases/tag/v0.10)
and is needed for the next release v0.11, planned around November 09th/10th

references #1975
2019-10-02 15:09:58 +02:00
Christian Brabandt
262fdc20d5 wordcount: use the short format for widths <= 85
Previously it used a width of >= 80 to display the long word count
format. However I personally found that a bit too wide, while other
sections will be shortened too much which does not really look nice.

Therefore, adjust the limit a bit, using the short word count format for
windows up to 85 characters.
2019-10-02 14:50:55 +02:00
Christian Brabandt
0b537b3065 Update the Changelog 2019-10-02 14:24:46 +02:00
Christian Brabandt
89d1d43165 Merge pull request #1966 from felleg/patch-1
Modified dark.vim commandline foreground color
2019-09-11 21:29:20 +02:00
Félix Léger
f4f9a8a241 Modified dark.vim commandline foreground color
The foreground color for `commandline` mode is the same as `normal` mode, which is easier to read against the green background
2019-09-11 15:25:52 -04:00
Christian Brabandt
63d8764f9d po: do not shorten empty fuzzy/untranslated messages 2019-09-09 09:39:41 +02:00
Christian Brabandt
6409c7b317 tabline: do not display neovim terminal there 2019-08-26 15:16:38 +02:00
Christian Brabandt
22f54d8528 sort airline#extensions#tabline#ignore_bufadd_pat 2019-08-26 15:14:21 +02:00
Christian Brabandt
018688a90f tabline: do not show defx buffers
fixes #1962
2019-08-26 15:11:50 +02:00
Christian Brabandt
d848de4918 branch: remove double '.' for string concatenation
fixes #1961
2019-08-22 07:56:51 +02:00
Christian Brabandt
57fb980df7 util: micro-optimization of existence check for vcscommand plugin 2019-08-20 22:30:20 +02:00
Christian Brabandt
5df9e23f14 util: micro-optimization of existence check for lawrencium 2019-08-20 22:28:49 +02:00
Christian Brabandt
0370a3b89b util: micro-optimization of existence check for fugitive 2019-08-20 22:28:49 +02:00
Christian Brabandt
51e74f1d1f util: micro-optimization of existence check for strcharpart() 2019-08-20 22:22:19 +02:00
Christian Brabandt
ccef93e887 util: micro-optimization of existence check for strchars() 2019-08-20 22:20:39 +02:00
Christian Brabandt
15322e41c7 util: Add comment header, declaring s:vars as constant 2019-08-20 22:19:48 +02:00
Christian Brabandt
486b68cb08 term: get rid of useless variable, add comment 2019-08-20 22:12:34 +02:00
Christian Brabandt
af96e9745f wordcount: only try to access buffer content in the actual current buffer
closes #1955
(this actually needs Vim patch 8.1.1372 to work properly)
2019-08-20 14:28:54 +02:00
Kai Moschcau
3f82d3a975 Improve multibyte character handling in branch ext
This fixes a bug that causes a mangled statusline. The bug occurs, when
the `displayed_head_limit` variable is set and causes the substring
expression to take a substring, which ends in the middle of a multi-byte
character.

This patch replaces the byte-based methods for measuring the
length of the branch name and creating a substring with methods that are
character-based and multi-byte aware.

It also has the nice side effect of making the length measuring more
accurate, by taking the actual display width of multi-byte characters
and the ambiwidth setting into account.

Since we need to take into account older Vim 7.4 (which might not have
the strcharpart() function), do introduce a compatibility wrapper in
airline#util that checks for the existence of the function before using
it. Older Vims will keep on using the byte-based index. I suppose Vim
7.4 before the strcharpart() function was available (patch 7.4.1730)
shouldn't be in use anymore.

closes #1948
2019-08-20 14:21:10 +02:00
Christian Brabandt
0f375addd2 term: differentiate different term modes
closes #1958
closes #1957
2019-08-20 14:01:09 +02:00
Christian Brabandt
a40184536b Merge pull request #1951 from liujoey/master
add neoterm support
2019-08-11 14:38:52 +02:00
Liu, Joey
67a97c1ea0 add neoterm support
it shows neoterm_id on a inactive neoterm window
2019-08-02 13:23:42 -04:00
Christian Brabandt
c213f2ac44 Merge pull request #1947 from matoruru/patch-1
Updata a url in airline.txt
2019-07-27 11:13:37 +02:00
matoruru
770d57a01d Updata a url in airline.txt
"neoclide/coc" -> "neoclide/coc.nvim"
2019-07-27 12:06:26 +09:00
s1341
3f7222e488 Add support for vim-tabws tabline
closes #1938
2019-07-23 09:40:18 +02:00
shmaryar
28dcb68bf3 Add vista.vim (https://github.com/liuchengxu/vista.vim) integration 2019-07-23 09:38:14 +02:00
Christian Brabandt
28cd6253e9 Remove rvm dependency on ruby 1.9.3
looks like this no longer runs on travis-ci, so disableing it for now
2019-07-23 09:36:35 +02:00
Christian Brabandt
2db9b27e39 async: Better fix for #1936
fix #1936 in a different way
2019-06-14 10:30:05 +02:00
Christian Brabandt
71c80aaf54 async: Check existence of buffer before accessing it
fixes #1936
2019-06-14 09:40:30 +02:00
Christian Brabandt
63a75aca2a term: Make terminal extension work on entering it
does not work with Neovim since TermOpen is not used (see #1828 for the
bug)
2019-06-12 11:36:47 +02:00
Christian Brabandt
73b4e4233c Remove Neovim Workaround, as bug has been fixed 2019-06-12 11:26:09 +02:00
Christian Brabandt
28453d7038 Support Multiple Cursor mode
Detect the use of plugin https://github.com/mg979/vim-visual-multi
and show mode "MULTI" when it is active.

closes #1933
2019-06-11 09:48:08 +02:00
Christian Brabandt
826561daf3 say thanks 2019-06-04 08:30:57 +02:00
Christian Brabandt
48d9d5e901 neovim: Do not react on BufWinEnter for floating windows
closes #1930
2019-06-03 10:35:58 +02:00
Christian Brabandt
7d5302b51f plugin: make the on_window_changed function take the autocommand as argument
This is just for making it easier to debug why the plugin update called
2019-06-03 08:30:27 +02:00
Christian Brabandt
3921bc13a3 async: do not clean up job dir for running jobs
closed #1929
2019-06-03 08:22:39 +02:00
Christian Brabandt
c7b8a56b22 Merge pull request #1928 from cometsong/cometsong-readme-link
Update README.md: new link(38) to vim-ctrlspace
2019-05-30 19:32:02 +02:00
Benjamin Leopold
a0c9198fa2 Update README.md: update link(38) to vim-ctrlspace 2019-05-30 10:17:56 -04:00
Christian Brabandt
4a1ac56286 Define coc functions as empty by default
fixes #1926
2019-05-29 21:04:32 +02:00
Christian Brabandt
b19dc8fc65 Merge pull request #1925 from peng1999/master
Coc integration
2019-05-29 17:30:24 +02:00
Peng Guanwen
b3ecf49f86 Coc integration 2019-05-29 21:20:20 +08:00
Christian Brabandt
193e350440 Check existence of variable before trying to set it
closes #1924
2019-05-24 08:14:25 +02:00
Christian Brabandt
3abbfabf55 Merge pull request #1922 from petobens/master
Extend denite statusline to denite-filter buffer
2019-05-22 15:39:21 +02:00
petobens
f07889c266 Extend denite statusline to denite-filter buffer
Closes https://github.com/vim-airline/vim-airline/issues/1920
2019-05-22 10:33:03 -03:00
Christian Brabandt
7b20361baf denite: correctly test denite version
references #1918
2019-05-14 16:31:52 +02:00
kazukazuinaina
03f63eb666 adopt denite ver3.0
closes #1918
2019-05-13 15:17:17 +02:00
Christian Brabandt
9a1acf144f async: Correctly reset dirty flag 2019-05-08 17:22:34 +02:00
Christian Brabandt
79f91649b6 branch: Check untracked and dirty only wehn the fugitive/lawrencium plugins are installed 2019-05-08 13:57:25 +02:00
Christian Brabandt
1b41629214 async: do not show dirty sign for error messages
closes #1915
2019-05-08 13:51:50 +02:00
Christian Brabandt
ea7f5d5313 extensions: show loaded extension once (at most once)
could happen, that extensions are shown several times, if airline is
available in your &rtp several times (for whatever reason)
2019-05-03 12:43:21 +02:00
Christian Brabandt
cd2884abf1 bookmark: do not error out, if the plugin isn't installed
fixes #1912
2019-05-03 12:37:17 +02:00
Christian Brabandt
715274c3f9 Merge pull request #1912 from bpetri/master
vim-bookmark extension
2019-05-03 12:00:57 +02:00
Bjoern Petri
f1529ce051 vim-bookmark extension 2019-05-03 10:44:09 +02:00
Christian Brabandt
a26a460698 branch: configure what additional checks to run
Allow to customize, whether to check the untracked status of a file or
whether the current repository is clean.

fixes #1910
2019-05-02 08:14:57 +02:00
Christian Brabandt
cc8f47e248 async: fix small problems with dirty jobs 2019-05-02 07:57:10 +02:00
Christian Brabandt
2db882e9b8 async: check dictionary keys before trying to access them 2019-05-01 07:45:06 +02:00
Christian Brabandt
8169aa25af init: make sure the dirty symbol is defined
references #1907
2019-04-30 17:36:31 +02:00
Christian Brabandt
7469672a46 extensions: Allow customization of filetypes
Define the variable :let g:airline_filetype_overrides to allow for
specific customization how a specific filetype will be displayed.

For e.g. a German display, you can use: >

    :let g:airline_filetype_overrides = {'help': ['Hilfe', ':%f']}
<

This defines how section a and b will look like for a window with that
specific filetype.

Closes #1888
2019-04-30 17:28:51 +02:00
Christian Brabandt
170b6d4c26 extensions: sort filetype_overrides 2019-04-30 16:54:48 +02:00
Christian Brabandt
d1e82c71a3 branch: check existence of dirty key before accessing it
closes #1907
2019-04-30 16:33:05 +02:00
Christian Brabandt
28ed36a9ec whitespace: fix small problems from conflicts test 2019-04-26 22:08:26 +02:00
Christian Brabandt
1fedd3a2b7 updated Changelog 2019-04-26 14:42:35 +02:00
Christian Brabandt
538326ceac whitespace: Also check for Git conflict markers 2019-04-26 14:38:13 +02:00
Christian Brabandt
d4f645777e Updated documentation 2019-04-26 13:56:02 +02:00
Christian Brabandt
a753422549 main: Make :AirlineRefresh! skip recrecrating highlighting groups
When `g:skip_empty_sections` is set, `:AirlineRefresh` can be called
very often and cause slow down, because it forcefully re-creates the
highlighting groups. This is mostly not needed for the redraw to happen,
therefore, add the `<bang>` attribute to the command, making it skip to
re-create the highlighting groups and have all extensions that rely on a
forced update use the `!` form.

Should be much fast then.

fixes #1908
2019-04-26 10:16:40 +02:00
Christian Brabandt
fdd75df927 async: cleanup logic for nvim/vim8/vim7 2019-04-25 15:07:12 +02:00
Christian Brabandt
6b213e1071 branch: make it work with vim74
closes #1907
2019-04-25 14:43:56 +02:00
Christian Brabandt
9c1486522a branch: ignore submodules for git when determing clean state 2019-04-25 08:47:05 +02:00
Christian Brabandt
11cd15d218 async: fnameescape filename
A buffer name wich special characters such as Command-T [Files] will
cause E94 when trying to call setbufvar() on it. That is because the
'[]' is special in buffer names. Therefore, fnameescape the buffer name.

This should prevent 'E94: No matching buffer for
/home/louis/git/minivimrc/Command-T [Files]' errors.

closes #1906
2019-04-25 07:41:56 +02:00
Christian Brabandt
1297773a26 branch: skip untracked files for clean state 2019-04-25 07:35:41 +02:00
Christian Brabandt
a8b0c5f760 branch: skip for non-empty &buftype buffers 2019-04-25 07:32:13 +02:00
Christian Brabandt
ffd8c406ab branch: Make the branch extension available with 80 char wide windows 2019-04-24 16:12:54 +02:00
Christian Brabandt
9f193de600 branch: Remove spurious dirty var 2019-04-24 15:51:43 +02:00
Christian Brabandt
28bebd35ea fugitiveline: use correct fugitive functions 2019-04-24 15:48:16 +02:00
Christian Brabandt
3ac318bfd3 fugitive: replace old buffer().commit() function by new global function
as requested by the exception thrown:
fugitive: A third-party plugin or vimrc is calling
fugitive#buffer().commit() which has been removed. Replace it with
matchstr(FugitiveParse()[0], '^\x\+')
2019-04-24 15:29:51 +02:00
Christian Brabandt
9112675ad8 branch: display dirty state
If the repository is considered dirty, do display the
g:airline_symbols.dirty symbol right after the branch name.
2019-04-24 15:16:57 +02:00
Christian Brabandt
a8c96d7c07 async: Move function definition so it is valid for nvim 2019-04-24 13:27:25 +02:00
Christian Brabandt
941341d085 branch: simplify async logic a bit 2019-04-24 13:25:31 +02:00
Christian Brabandt
ead2cd63bb term: only strip first letter from name, if it starts with '!' 2019-04-18 15:52:54 +02:00
Christian Brabandt
704e58e1b7 Fix failing test and make it aware of tablabel_right 2019-04-17 13:24:19 +02:00
Christian Brabandt
6acb234a12 tabline: Use separate hi group for label on right
if the same highlighting group is used on the left and right for the
label, the `airline_tablabel_to_airline_tabmod` will be overwritten on
the right side, causing the fg/bg colors to be wrong, because on the
right side they have to be the opposite of the left side.

So use a separate highlighting group for the tablabel on the right.

closes #1902
2019-04-17 09:04:56 +02:00
Christian Brabandt
d1d9548b8e themes: correctly catch not-found in init function
plugin/airline.vim was calling airline#switch_theme() without actually
catching the 'not-found' exception.

Therefore, in case of errors, explicitly switch to a dark theme.

closes #1903
2019-04-17 08:27:30 +02:00
Christian Brabandt
773f0e3637 Merge pull request #1898 from clobrano/short-path-formatter
Add formatter for short paths
2019-04-15 10:07:19 +02:00
Carlo Lobrano
0f1aec97da Add documentation for short_path formatter 2019-04-14 10:03:24 +02:00
Carlo Lobrano
ebb8f0c2b1 Add formatter for short paths
Add new formatter that shows the file path up to the first parent directory
2019-04-10 22:17:43 +02:00
Christian Brabandt
cbf264ff5f Merge pull request #1897 from shayneholmes/wordcount-formatters
Search for wordcount formatters with extension
2019-04-09 20:56:34 +02:00
Shayne Holmes
979e04a6ec Search for wordcount formatters with extension
Autoload expects the autoload scripts to have the '.vim' extension.

Fixes #1986.
2019-04-09 11:52:40 -07:00
Christian Brabandt
86e73cade7 Get a random number from win32 cmd.exe 2019-03-26 21:53:47 +01:00
Christian Brabandt
4265798d4b style: rename inconsistent function names 2019-03-26 21:10:45 +01:00
Christian Brabandt
148eb6bb28 Allow to switch to a random theme
You can now specify the special theme name `random` and vim-airline will
load a random theme from the ones installed. This works from either your
.vimrc as well as when calling `:AirlineTheme` command directly.

closes vim-airline/vim-airline-themes#170
2019-03-26 21:03:13 +01:00
Christian Brabandt
a6fb6d9da0 Extensions: indicate, if an extension is external
Show in :AirlineExtensions if the extension comes bundled with airline
or from an external source.

closes #1890
2019-03-26 08:41:36 +01:00
Christian Brabandt
1fb184305b fugitiveline: simplify modify logic
The 'autochdir' option could be toggled on later in a session.
So do not set the has_autochdir flag once the file is read, but evaluate
it every time the corresponding function is called.

While at it, get rid of the s:fmod variable. Instead let a helper
function return the correct modifier flags depending on the value of the
'autochdir' option.
2019-03-25 12:34:09 +01:00
Christian Brabandt
c8a36e14e9 Updated Copyright Statements 2019-03-25 12:29:47 +01:00
Christian Brabandt
45205aa4a3 wordcount: expose filetype list to global scope
allows better configuration of filetypes to be wordcounted.

fixes #1887
2019-03-19 08:28:51 +01:00
Christian Brabandt
b84e548522 Make displaying the tab count optional
Set the g:airline#extensions#tabline#show_tab_count to zero to disable.

fixes complaints at #1882
2019-03-16 09:32:35 +01:00
Christian Brabandt
6ab14bf474 tabline: add consistent tab label to the end
closes #1882
closes #1883
2019-03-08 14:05:38 +01:00
Christian Brabandt
1c3ae6077a Merge pull request #1879 from gmolau/Fix-syntastic-formatting
Fix the formatting of syntastic error messages
2019-02-22 07:49:52 +01:00
Christian Brabandt
eb0ddf61dc Merge pull request #1877 from maxnordlund/resepct-minwidth-for-vcs
Respect minwidth for hunks and branch parts
2019-02-22 07:49:28 +01:00
Georg Molau
395fccfda7 Fix the formatting of syntastic error messages
The magic flags were in the wrong order, %e is the number of errors, it
should go in the parentheses after the # symbol. %fe is the line number
of the first error. Same for the warnings.
2019-02-22 00:53:41 +01:00
Max Nordlund gmail
b69aa396c1 Remove trailing whitespace 2019-02-21 11:59:04 +01:00
Max Nordlund gmail
61ca196d73 Move formatting of branch name into get_head
This allows for advanced customization where the shortening of the
branch name is up to the caller, unlike before.

This change is observable from the outside, and as such can be
dangerous. But AFAIK it does not change the default behavior.
2019-02-21 11:59:04 +01:00
Max Nordlund gmail
5f769dbed9 Expose get_hunks for advanced customization 2019-02-21 11:59:04 +01:00
Max Nordlund gmail
45ff435378 Honor minwidth for hunks and branch parts
This removes the hardcoded minwidth limits for both the `hunks` and
`branch` parts. It replaces these with safe accesses to the `minwidth`
setting as done by `airline#parts#define_minwidth`.
2019-02-20 12:36:40 +01:00
Christian Brabandt
448aa43ec4 Merge pull request #1875 from petobens/master
Fix denite extension
2019-02-12 11:15:14 +01:00
petobens
cc7b3c1636 Fix denite extension 2019-02-11 09:22:43 -03:00
Christian Brabandt
1471330825 Adjust buffer numbers for buf_idx_mode v2 slightly
fixes #1823
2019-02-08 07:55:35 +01:00
Christian Brabandt
05572482b8 tabline: add forgotten changes from commit cd1d8c2a96
I accidentally missed including some more changes for buffer_idx_mode=2.
So add those files now.
2019-02-07 08:17:33 +01:00
Christian Brabandt
cd1d8c2a96 Introduce buffer_idx_mode v2
fixes #1823
2019-02-07 08:11:47 +01:00
Christian Brabandt
624d2f1438 tabline: AirlineSelectTab still wrong sometimes
Partly revert commit 105e9daaf7
and fix #1857 another way, by making sure, that buffers are not taking
away from the s:current_visible_buffers list.

Fixes #1857
Fixes #1872
2019-02-06 22:42:10 +01:00
Christian Brabandt
767c1efd10 bufferline: catch invalid modelines 2019-02-05 08:35:57 +01:00
Christian Brabandt
999c40fcf3 tabline: simplify creation of maps
instead of typing all the mapping commands, create a loop that will
create the new maps.
2019-02-04 21:59:40 +01:00
Christian Brabandt
105e9daaf7 tabline: Make the PlugAirlineSelectTab buffers work as expected
for bufferlist.

fixes #1857
2019-02-04 21:47:11 +01:00
Christian Brabandt
4078688305 README.md: move section header 2019-02-04 10:38:11 +01:00
Christian Brabandt
96d42317b1 Update README.md 2019-02-04 10:37:34 +01:00
Christian Brabandt
23a8a7e04d doc: ammend doc about statusline on top 2019-02-04 09:55:48 +01:00
Christian Brabandt
25e384f236 wordcount: move User autocommand to plugin
Do not scatter the autocommands around, but rather move the auto command
to the main plugin file. The function that handles the auto command will
be created in the autoload script.

Also add a call to force updating the tabline, if g:airline_statusline_ontop
is defined.

In addition, the wordcount() extension did not correctly notice
block-wise visual mode, so while creating the airline#mode_changed()
function, make the mode also detect blockwise visual mode correctly.
2019-02-04 08:25:45 +01:00
Christian Brabandt
8867301f78 plugin: Move tabline_update function to autoload 2019-02-04 08:23:58 +01:00
Christian Brabandt
840bf02baf autoload: Fix typo in comment 2019-02-04 08:21:39 +01:00
Christian Brabandt
fd5bde1a3a allow to show the statusline on top
This is an experimental feature that allows to display the statusline in
the tabline. It might still be a bit rough, but seems to work so far.

Remaining problem:
- Mode changes are not immediately detected, only after moving the
  cursor

fixes #1388
closes #1867
2019-02-03 17:30:55 +01:00
Christian Brabandt
58bbc512f9 tabline: Only define Terminal autocommand if vim supports it
fixes the broken CI test which runs in a vim that does not come with
terminal support
2019-02-03 10:43:23 +01:00
Christian Brabandt
1d03b9dc62 tabline: invalidate buffer list on Terminal Enter
should workaround and fix #1853 in a better way
2019-02-03 10:36:07 +01:00
Christian Brabandt
916d023c35 buflist: do not consider empty buffers to be excluded
currently, empty buffer names were still considered to match against the
exclude_path setting. That does not make sense, so skip the check for
empty bufnames.
2019-02-02 22:43:27 +01:00
Christian Brabandt
0a1f4cc910 doc: clarify usage about AirlineSelectTab mappings
closes #1857
2019-02-02 22:22:25 +01:00
Christian Brabandt
5415c5e6ec tabline: Fix broken call to formatter 2019-02-02 21:57:15 +01:00
Christian Brabandt
a30df884f4 Update Changelog to link to correct diff on github 2019-02-02 18:17:08 +01:00
Christian Brabandt
54584a2bb2 fugitive: mark fugitive like buffers with "[git]"
closes #1852
2019-02-02 18:04:53 +01:00
Christian Brabandt
dc7d991007 Tabline: Make specifying formatter more easy
closes #1863
2019-02-02 17:45:55 +01:00
Christian Brabandt
d372b5bc46 tabnr formmatter: fix style 2019-02-02 17:45:33 +01:00
Christian Brabandt
98bc6abde3 languageclient: check for existence of 'result' key
fixes #1861
2019-01-28 11:21:32 +01:00
Christian Brabandt
9355e683cd Merge pull request #1865 from w0rp/patch-1
Remove incorrect copyright attribution
2019-01-28 11:15:46 +01:00
w0rp
54dba2a92b Remove incorrect copyright attribution
I have never touched anything in this file, nor in the LanguageClient plugin, so the copyright attribution is incorrect. @neersighted may also wish to be removed from the list here.
2019-01-28 10:11:43 +00:00
Christian Brabandt
a829ec4861 Merge pull request #1864 from petpetpetpet/more_efficient_ale_line_numbers
More efficient ale line number function.
2019-01-28 10:57:13 +01:00
Christian Brabandt
d3859dc5dd Merge pull request #1862 from mbbill/master
Fixed t:undotree undefined error
2019-01-28 10:55:44 +01:00
petpetpet
57c061dcb0 Added a hook to the new ALE api to grab line numbers. Should be more
efficient.
2019-01-27 13:57:18 +00:00
Ming, Bai
6601474bf5 Fixed t:undotree undefined error
the ```t:undotree.GetStatusLine()``` is appended to the status line when ```t:undotree``` exists, but it seems like the ```statusline``` will be executed when ```t:undtree``` is no longer available during window destruction.
2019-01-22 14:52:39 -08:00
Christian Brabandt
e0bde5dea4 Merge pull request #1859 from knatsakis/no-ctrlp-memleak
Fix ctrlp memory leak
2019-01-21 11:21:34 +01:00
Konstantinos Natsakis
53aa65a5ce Fix ctrlp memory leak 2019-01-17 15:34:19 +02:00
petobens
fa5910eb14 extensions: Add defx support
closes #1850
2019-01-11 10:49:31 +01:00
Christian Brabandt
d68c9bbeb2 tabline: make middle-click work as expected in neovim
closes: #1854
2019-01-11 10:44:10 +01:00
Christian Brabandt
70b86537bd Merge pull request #1855 from arjanvandervelde/patch-1
make VimLeave autocmd nested
2019-01-11 10:41:20 +01:00
Arjan van der Velde
2d3bbbff43 make VimLeave autocmd nested
add "nested" to autocmd to make it play well w/ YouCompleteMe

see 109a019279/README.md (ycm-does-not-shut-down-when-i-quit-vim)
2019-01-10 23:15:30 -05:00
Christian Brabandt
6fd5b6ae56 tabline: Fix redrawtabline typo 2019-01-09 08:26:07 +01:00
Christian Brabandt
4604f6d465 tabline: Use :redrawtabline if available
this needs patch 8.1.706 and is a less hacky approach to force updating
the tabline
2019-01-09 07:42:32 +01:00
Christian Brabandt
72888d87ea Revert "Make plugin reloadable"
This reverts commit 56197d5104.

fixes #1844
2018-12-18 16:13:03 +01:00
Christian Brabandt
56197d5104 Make plugin reloadable
there was a call to s:init() missing in the toggle function.
Without it, it wouldn't reload correctly, since the s:initialized
variable would never be set to 1 again. So load it when setting up
everything correctly.

fixes #1842
2018-12-17 22:23:40 +01:00
Christian Brabandt
c0f96df97f Update metadata (copyright)
also remove trailing empty lines in test files
2018-12-15 19:56:30 +01:00
Christian Brabandt
39ac0a93e5 document changelog for new release 2018-12-15 19:45:50 +01:00
Christian Brabandt
e3cfd3643b wordcount: prevent use of unused variable 2018-12-10 09:11:10 +01:00
Christian Brabandt
3d9071e6b6 themes: Load dark theme, when default colorscheme is loaded 2018-12-03 18:29:26 +01:00
Christian Brabandt
bd468dacfe Revert TermOpen autocommand for Neovim
closes #1828
2018-11-22 08:31:14 +01:00
Christian Brabandt
c047abfe96 Add inactive statusline for terminal 2018-11-20 16:32:55 +01:00
Christian Brabandt
bc63a60b0f terminal: return proper terminal name 2018-11-20 16:11:34 +01:00
Christian Brabandt
f9ccb57e76 Make terminal extension work with Neovim 2018-11-20 15:55:11 +01:00
Christian Brabandt
31f5a9307d Make terminal statusline work for inactive window 2018-11-20 15:48:28 +01:00
Christian Brabandt
fa11b8855b Test for TerminalOpen Autocommand before using it 2018-11-20 15:28:29 +01:00
Christian Brabandt
904ac4eb0b plugin: Reload terminal extension on :term command 2018-11-20 14:51:22 +01:00
Christian Brabandt
ada0ba8ae3 doc: reorder extension configurations alphabetically 2018-11-14 09:28:16 +01:00
Christian Brabandt
426c8bb8ef doc: update documentation 2018-11-14 08:26:18 +01:00
Christian Brabandt
df0c1731db Add :AirlineExtensions command
This shows whether or not an extensions has been loaded.
2018-11-14 08:06:39 +01:00
Christian Brabandt
f6a95d3a6f Fix wrong extension name for unicode 2018-11-14 07:41:48 +01:00
Christian Brabandt
ffac12cbbe theme: do not show not-found warning
Only show the "airline theme not found" warning message, when the user
actually used `:AirlineTheme foobar`, not when called by an autocommand
that tries to switch themes when the Vim colorscheme changed.

fixes #1824
2018-11-14 07:36:45 +01:00
Christian Brabandt
b2e1dbad6f use tr() instead of substitute
should be a bit faster
2018-11-13 22:54:49 +01:00
Christian Brabandt
b3a574b4a3 Fix error in airline#add_statusline_funcref 2018-11-13 22:53:13 +01:00
Christian Brabandt
7f6dfbefd1 theme: only define g:autoload_theme if loading was successfully
fixes the test
2018-11-13 22:39:36 +01:00
Christian Brabandt
5b1c92979c Fix error in airline#add_statusline_funcref 2018-11-13 22:36:43 +01:00
Christian Brabandt
9dc546c699 use tr() instead of substitute
should be a bit faster
2018-11-13 22:29:32 +01:00
Christian Brabandt
14691bb00e themes: load them explicitly rather than implictly
While this adds a bit more code it makes it possible to distinguish
between themes not found and errors in themes.

Use :verbose AirlineTheme <foobar>
to also see the error message in case of errors.
2018-11-13 22:27:02 +01:00
Christian Brabandt
b20e181bc8 Add a separate function for returning all available themes 2018-11-13 22:14:51 +01:00
Christian Brabandt
49671d0a11 terminal: do not reset airline theme on TerminalOpen
remove autocommand, that would overwrite the airline theme on :term

(e.g. After a :AirlineTheme monochrome and then using `:term` the
autocommand would reset the theme back to the one given in the .vimrc)
2018-11-13 22:01:36 +01:00
Christian Brabandt
cd0b15b195 plugin: use airline#util#warning instead of echo consistently 2018-11-13 21:37:52 +01:00
Christian Brabandt
c3ee263d5b whitespace: use airline#util#warning instead of echo consistently 2018-11-13 21:37:52 +01:00
Christian Brabandt
2eaf57ece8 xtabline: use airline#util#warning instead of echo conistently 2018-11-13 21:37:52 +01:00
Christian Brabandt
c850f485ad autoload: use airline#util#warning instead of echo 2018-11-13 21:37:48 +01:00
Christian Brabandt
464633baad themes: Do not try to load the palette twice
This will be done explicitly by the switch_theme() function
2018-11-13 21:17:48 +01:00
Christian Brabandt
d441b3f7b6 util: use correct endfunction style 2018-11-13 21:11:04 +01:00
Christian Brabandt
f05f649be8 highlighter: even further refinement of when to skip groups 2018-11-13 13:57:15 +01:00
Christian Brabandt
cfd373a5a2 highlighter: Better check, when to skip groups
Groupnames like 'airline_c1_to_airline_x_inactive' still have to be
processed, so do not skip them.

Also for the tabline, '_inactive' groups are not used, so skip them
2018-11-13 13:48:26 +01:00
Christian Brabandt
6ceaffc49a documentation: Mention AirlineModeChanged
In 781c40bb3d the AirlineModeChanged user-defined
autocommand has been introduced. However it was forgotten to mention
this actually in the documentation.

So here we go.

closes #1774
2018-11-13 09:19:56 +01:00
Christian Brabandt
78e67897a4 highlight: fix previous commit differently
Actually we can restrict the loop condition to only run 5 times instead
of 6 (which was an oversight).
2018-11-13 09:06:39 +01:00
Christian Brabandt
e66d65ebf4 highlighter: break out of loop at the end
thanks for mentioning @jottkaerr at
4d8a06a5a9 (commitcomment-31275754)
2018-11-13 08:50:10 +01:00
Christian Brabandt
4d8a06a5a9 highlighter: get rid of s:Get() function
Replace by a function that retuns the to be executed highlighting string

Should in theory be a bit faster, since the same function does not have
to be called 5 times per highlighting group.

It probably is not much better, but here are some random numbers:

Profiling:

Previously:
count  total (s)   self (s)
  199   0.022973   0.009909     let cmd = printf('hi %s %s %s %s %s %s %s %s', a:group, s:Get(colors, 0, 'guifg=')…

New:
count  total (s)   self (s)
   79   0.010166   0.000862     let cmd = printf('hi %s%s', a:group, s:GetHiCmd(colors))
2018-11-12 17:59:02 +01:00
Christian Brabandt
6c6c6c104f highlighter: exec_separator will re-create '_to_' groups
so we don't need to re-create them in the main for loop of
airline#highlighter#highlight() and so skip those groups.
2018-11-12 05:18:53 +01:00
Christian Brabandt
f3d6a3542a Revert "highlighter: also check separator groups for being defined"
This reverts commit 99971aa24d.
2018-11-11 21:18:13 +01:00
Christian Brabandt
e8fd2057a8 doc: Mention how to add funtions for inactive statuslines 2018-11-08 17:20:41 +01:00
Christian Brabandt
8c36d2b595 allow to use alternative seperators for inactive windows
closes #1236
2018-11-08 17:09:17 +01:00
Christian Brabandt
a993ae5d42 builder: don't call add_separtor twice 2018-11-08 16:44:26 +01:00
Christian Brabandt
f08078d683 autoload: add comments 2018-11-08 16:20:37 +01:00
Christian Brabandt
99971aa24d highlighter: also check separator groups for being defined
Make sure, to also check, if the separator groups have already been
defined. Once they are defined initially, they are usually available in
the palette group. So do not redefine them once they have been created
initially.

references #1779
2018-11-08 15:31:58 +01:00
Christian Brabandt
d57344a3c3 highlighter: skip more buffer related hi groups
Previously, we only checked for if the name starts with 'airline_c'

But there could as well be highlighting groups starting being called
'airline_b_to_airline_c5', but if buffer 5 is no longer visible in the
current viewport, then we do not need to recreate those groups.
2018-11-08 13:32:20 +01:00
Christian Brabandt
496de8b745 highlighter: do not skip empty c_sections
currently, if the matchstr() evaluates to '', it would skip the required
section, because bnr would be evaluated to zero and since there is no
buffer zero, skip that highlighting group.

Make sure, to only skip the highlighting group if the buffer number is
actually > 0
2018-11-08 12:40:46 +01:00
Christian Brabandt
71dc6f0257 highlighter: fix regex typo 2018-11-08 12:24:02 +01:00
Christian Brabandt
09b5eb952c highlighter: Only recreate hi groups for visible buffers
In a long editing session, there could happen to accumulate several
highlighting groups for buffers that might no longer be visible.

Therefore, only re-create the highlighting group for buffers that are
actually displayed in the current tabpage. If not, skip them.

references #1779
2018-11-08 12:20:55 +01:00
Christian Brabandt
a334a89e59 plugin: better check for timer and funcref 2018-11-08 07:54:01 +01:00
Christian Brabandt
ce6cf6f07e Check that funcrefs() actually exists
closes #1819
2018-11-07 17:55:11 +01:00
Christian Brabandt
b7367c605a highlighter: do not redefine the same groups several times
previously, it could happen that the same highlighting group was defined
several times, because it was available in several modes within
g:airline#theme[mode]. So the second one would always win.

Therefore, loop through all modes in reverse order and define the group
and remember what group has already been defined. If we happen to have
to re-define the same group, skip it. Since we are traversing the list
in reverse order, this should make sure the last definition wins.

This has the benefit of being more performant and hopefully helps with
e.g. #1779 and similar issues.
2018-11-07 14:25:40 +01:00
Christian Brabandt
18200bfad3 modes: do not add special sections to accents 2018-11-07 13:49:22 +01:00
Christian Brabandt
33a633766d main: do not trigger FocusGained on startup
commit f045452743 introduced the
FocusGained autocommand. Unfortunately, for some systems this might
trigger already at startup, resulting in an unwanted redraw that might
clear the intro screen.

Therefore, add a timer, that enables the FocusGained autocommand after 5
seconds. The 5 seconds is somewhat arbritrarely, but we could change it
later if it turns out to be not useable.

fixes #1817
2018-11-07 10:46:57 +01:00
Christian Brabandt
776f7aa948 Merge pull request #1816 from amiller27/numbered-ctrlspace-tabs
Add option for numbered tabs
2018-11-01 16:10:16 +01:00
Aaron Miller
62f3d1d412 Add option for numbered tabs
Cleaned up variable name, added documentation
2018-11-01 10:44:44 -04:00
Christian Brabandt
6516b1b4dc po: only reset cache if window width changed 2018-11-01 11:18:04 +01:00
Christian Brabandt
fc021cf4e8 po: only substitute, if value is present in string 2018-11-01 11:14:57 +01:00
Christian Brabandt
6508558c3d po: shorten and reformat message format for smaller windows 2018-11-01 10:40:41 +01:00
Christian Brabandt
08e9aa5386 Merge pull request #1810 from LarsMichelsen/visualize_checking
Visualize that ale is currently checking the current buffer
2018-10-22 08:59:52 +02:00
Lars Michelsen
0609a1f945 Visualize that ale is currently checking the current buffer
At the moment you can never be sure whether you look at the results
that ale just produced after your last changes or you are looking at
outdated information.

Instead of showing the last results while ale executes checks on the
current buffer it can now show a specific indicator.

This commit introduces the new config variable
`g:airline#extensions#ale#checking_symbol` which defaults to "...". In
case you don't want to see this, you may set it to an empty string.
2018-10-18 21:33:15 +02:00
Christian Brabandt
2e99805dbf Fix failing test 2018-10-16 12:13:24 +02:00
Christian Brabandt
726b730f0a highlight: correctly cache and restore reverse attributes for highlighting colors
references #1779
2018-10-16 12:03:31 +02:00
Christian Brabandt
7e004804d1 Merge pull request #1811 from LarsMichelsen/update_post_ale
Improve update logic after ale finished
2018-10-16 10:56:49 +02:00
Christian Brabandt
d81cdacb1e better disabled highlighting for inactive windows on FocusLost
This will make sure that the current window will be highlighted as
expected, even if there are no other windows and all highlighting groups
will be correctly re-created as 'inactive'

references #1807
2018-10-16 10:49:17 +02:00
Christian Brabandt
c44bbc66f5 main: make sure winnr is available in s:context for check_mode function 2018-10-16 10:26:26 +02:00
Christian Brabandt
61e2c7f86a Merge pull request #1813 from fishioon/master
Remove trailing space
2018-10-15 15:53:12 +02:00
fish
4d825bdb64 Remove trailing space 2018-10-15 20:35:28 +08:00
Christian Brabandt
07ac69570b main: make FocusLost autocommand configurable
references #1807
2018-10-15 14:23:45 +02:00
Christian Brabandt
68f5f1e50d mode: Update doc, sort dict 2018-10-15 14:17:49 +02:00
Lars Michelsen
3f34ff56b8 Improve update logic after ale finished
Previously the ale refresh was triggered after user interactions only.
When linting takes some time and the user is not actively working the
ale information was not updated while the things ale directly controls
were updated. This change makes showing linting results a loot smoother.
2018-10-14 20:19:39 +02:00
Christian Brabandt
f045452743 main: disable airline on FocusLost
When switching away from Vim and your terminal supports the FocusLost
autocommand, set the statusline to inactive, so it won't distract you
too much when working with another application.

In the gui, the FocusLost autocommand should always trigger.

This is now the default, if people start complaining, that behaviour
should probably be made configurable.

closes #1807
2018-10-03 12:31:45 +02:00
Christian Brabandt
13993d120e Merge pull request #1805 from doronbehar/exteralize-quickfix-type-func
Externalize quickfix function returning text
2018-10-02 20:17:56 +02:00
Doron Behar
7190164451 Externalize quickfix function returning text
Useful when one wants to use this function for something else and to
know if a QuickFix window is actually a Location list with qf as
`&filetype`.
2018-09-28 12:56:49 +03:00
Christian Brabandt
a0298263b7 autocomd: do not re-evaluate modelines
fixes #1804
2018-09-25 16:03:30 +02:00
Liam Fleming
2390022e33 wordcount: do not rely on english in old versions
for older Vims, the wordcount extension falls back to `g<c-g>` and
parses the messaage that is generated.

When doing so, it expects the English locale, which might not be true.
Therefore, try to regex parse the result without using the english words
(assuming the output is still in the same order as in English).
2018-09-23 20:10:32 +02:00
Christian Brabandt
57bbe050c7 Merge pull request #1801 from flemingfleming/wordcount-fixes
The rest of the wordcount fixes, and some improvements
2018-09-23 17:38:11 +02:00
Christian Brabandt
dd508340ea Merge pull request #1803 from dfalling/master
Add dictionary key check for d.severity
2018-09-23 17:37:25 +02:00
Dennis Falling
2f17e368b5 Add dictionary key check for d.severity 2018-09-23 10:50:15 -04:00
Liam Fleming
0f6cfcdfc2 wordcount: Fix the visual count matching pattern 2018-09-22 13:57:53 +01:00
Liam Fleming
264c1fefd2 wordcount: Compatibility fixes and General upkeep
Compatibility:
- Don't use a script-local function to update the format strings
- Protect against `:normal!' moving the cursor on on the wordcount check

Bugfix:
- Let to_string() try to return something for all values
  - Now returns correctly when passed both 0 and '0'

Upkeep:
- Simplify check again no valid key from winwidth()
- Old wordcount check: use matchstr() - more expressive and fewer steps
- Improve documentation style/clarity/detail
2018-09-22 03:34:27 +01:00
Christian Brabandt
ae024293e4 wordcount: fix wrong normal mode command 2018-09-21 21:37:21 +02:00
Christian Brabandt
ecf10d0e58 wordcount: check that the retun value has the dict key
else it will throw an error.
2018-09-21 11:49:42 +02:00
Christian Brabandt
11e6492849 Merge pull request #1797 from flemingfleming/wordcount-improvements
wordcount: Update documentation
2018-09-20 17:34:02 +02:00
Liam Fleming
dcf76b0992 wordcount: Update documentation
- g:airline#extensions#wordcount#filetypes is now documented as a list
- New to_string() function for formatters
2018-09-20 15:51:41 +01:00
Christian Brabandt
82a6097b01 wordcount: work-around non-existing v:t_list
v:t_list is an internal variable describing the type of a list.
Unfortunately, this is not available in older vims. So let's fall back
to using `type([])`

see #1795
2018-09-20 11:44:17 +02:00
Christian Brabandt
7957bd1d32 wordcount: only add fmt function once to statusline functions
This prevents a warning message, when the function is tried to add
several times. Also while at it, add a '!' so that no error is thrown if
the file is sourced a second times.
2018-09-20 10:41:50 +02:00
Christian Brabandt
110594c91a tabline: remove spurious variable 2018-09-20 10:31:14 +02:00
Christian Brabandt
012229fe08 tabline: Ignore buffers in buflist matching ignore_bufadd_pat
closes #1777
2018-09-20 10:26:32 +02:00
Christian Brabandt
a60eabb82f tabline: do not show terminal buffers by default 2018-09-20 10:25:47 +02:00
Christian Brabandt
fce8585239 main: detect some more modes 2018-09-20 10:13:59 +02:00
Christian Brabandt
326b37cf13 help: document tag airline#extensions#tabline#exclude_buffers 2018-09-20 10:13:59 +02:00
Christian Brabandt
1b8ecb6336 Merge pull request #1796 from flemingfleming/wordcount-improvements
[WIP] Rewrite wordcount plugin
2018-09-20 10:04:53 +02:00
Liam Fleming
0756b9a4aa wordcount: Re-enable updating the format string 2018-09-18 20:12:17 +01:00
Christian Brabandt
251ed064e8 Make mode return only single letter except for virt replace mode
commit bcd37fc115 changed the detection of modes slightly in that it
allowed not only single letters but also several letters.

While in theory, it might be okay to have extra modes displayed like
Insert Completion or Normal Insert, or Operator Pending, let's for now
just revert it to the default. We can always enhance it later if
requested.
2018-09-18 20:00:46 +02:00
Liam Fleming
c33c1de079 wordcount: Simplify update strategy
Checking for wordcount changes now uses a b:changedtick comparison in
the statusline funcref. The autocommand strategy that used to do this is
removed, simplifying the code.
2018-09-18 16:05:01 +01:00
Liam Fleming
9903fee60e wordcount: Optimise formatter calls, cleanup code
- Formatter is now only called when the wordcount changes
- ...#apply() now only compares against the filetype list when necessary
- Old format() function is no longer called for (unsupported) counting
  of visual words
- Misc code quality improvements
2018-09-18 15:13:43 +01:00
Liam Fleming
487d262901 wordcount: formatter: code quality improvements
- Rename new formatting function: transform() -> to_string()
- Optimise separator selection
- Other quality improvements
2018-09-18 02:04:35 +01:00
Christian Brabandt
a1c112cafd main: replace and virt replace mode should use same coloring
fixes #1794
2018-09-16 20:01:00 +02:00
Christian Brabandt
bcd37fc115 mode: add support for virt replace mode
fixes #1792
2018-09-16 18:25:27 +02:00
Christian Brabandt
aec0a1a15a languageclient: Check severity key before accessing it
closes #1793
2018-09-16 18:17:04 +02:00
Christian Brabandt
da8035d8a8 Merge pull request #1789 from danielwe/master
Fix bug introduced in #1788: Don't use the read-only `count` as local variable
2018-09-10 09:52:34 +02:00
Daniel Wennberg
cda5647a29 Don't use the read-only count as local variable
The variable name `count` is always equivalent to `v:count`, which is
a read-only variable and cannot be assigned to.
2018-09-09 23:51:11 -07:00
Christian Brabandt
f5676d1fa1 Merge pull request #1788 from hallettj/extension/languageclient
Extension to report errors and warnings from LanguageClient plugin
2018-09-10 07:36:15 +02:00
Jesse Hallett
a92b12e1c6 Implement extension to report errors and warnings from LanguageClient plugin 2018-09-09 23:53:08 -04:00
Christian Brabandt
d342c3cb1e Merge pull request #1785 from smancill/conditional-vimtex-loading
Load vimtex only when the extension is enabled
2018-09-07 08:01:33 +02:00
Sebastián Mancilla
c3434164b2 Load vimtex only when the extension is enabled
Do not force loading the full vimtex autoload script for all users.
First check if the extension is enabled.
2018-09-06 13:15:38 -03:00
Liam Fleming
8715d13cc5 wordcount: Refactor updating and autocmds
Various improvements:
 - Seperate out visual mode detection.
 - Use TextChanged rather than CursorMoved where supported.
 - Let users specify the filetypes for which wordcounting is enabled
   with a list rather than a pattern.
 - Move the filetype check to when airline is refreshed, as opposed to
   on every update; autocommands are not created if wordcounting is
   disabled
2018-07-28 19:26:24 +01:00
Liam Fleming
44da0a4761 wordcount: Replace formatter interface
Currently the formatter, and not the wordcount plugin, is responsible
for providing the wordcount as well as formatting it. The default
formatter allows visual mode word counting, although this is not
documented.

The new interface - a transform() function, allows the main wordcount
plugin to internalise this logic. Providing the wordcount simplifies
formatter implementations:
 - All formatters can display the visual wordcount.
 - Formatters do not have to worry about compatibility with different
   vim versions.

The old format() function can now be deprecated, although the wordcount
plugin retains compatibility with formatters using it. The default
formatter will also be used as a fallback if no suitable function is
found.

The default formatter is rewritten to use the new interface.
2018-07-28 18:24:12 +01:00
Christian Brabandt
c7fb175d35 Add a specific color for commandline mode
closes #1768

Colors for the other themes need to be defined however
2018-07-26 10:22:40 +02:00
Christian Brabandt
59f3669a42 Merge pull request #1770 from shyun3/pullreq
Add vim-grepper extension
2018-07-24 19:16:22 +02:00
Mo Hyun
60eb44c94e Fix build error 2018-07-23 14:27:59 -07:00
Mo Hyun
723987eca9 Add vim-grepper extension
- Displays a segment when a grepper search is running
2018-07-23 13:05:34 -07:00
Christian Brabandt
964f53a418 Merge pull request #1767 from tpope/fugitive-real-path
Update to new Fugitive real path API
2018-07-23 08:11:18 +02:00
Tim Pope
a8ccef61ba Update to new Fugitive real path API 2018-07-22 15:39:54 -04:00
Christian Brabandt
4cc255a384 tests: Fix tabline tests 2018-07-13 22:35:05 +02:00
Christian Brabandt
eac10a104f tests: add test for tabaline 2018-07-13 22:30:20 +02:00
Christian Brabandt
5aef1b90e5 tabline: Correctly trigger on BufDelete autocommand
fixes #399
2018-07-13 22:29:34 +02:00
Christian Brabandt
821372b9cf tabline: re-map tabline keys
fixes #1753
2018-07-13 21:33:03 +02:00
Christian Brabandt
db45cdd994 Merge pull request #1759 from tpope/fugitive-path
Fixes for fugitiveline
2018-07-13 21:22:42 +02:00
Liam Fleming
781c40bb3d Create AirlineModeChanged autocmd 2018-06-28 18:44:26 +01:00
Tim Pope
9bee0e923e Use FugitivePath in fugitiveline if available 2018-06-27 18:07:59 -04:00
Tim Pope
66e49d9a15 Fix fugitiveline when file is also branch name 2018-06-27 18:05:09 -04:00
Christian Brabandt
b790fd2120 Merge pull request #1750 from Mangero/arduino-whitespace
Add Arduino to list of C-like languages
2018-06-18 08:39:53 +02:00
Christian Brabandt
c3a814dbae Merge pull request #1749 from flemingfleming/autocmd-improvements
Autocmds: Move CursorMoved autocmd into the main augroup.
2018-06-18 08:39:17 +02:00
Mangero
a141918faa Add Arduino to list of C-like languages
Add 'arduino' filetype to list of C-like languages. This is needed in
order to avoid mix-indent-file warnings when using hard tabs for
indentation in Arduino source files (*.ino, *.pde) containing top level
block comments with leading space before a '*'.

Similar to: 460ed02864
Original fix: 8fde76dd63
2018-06-18 01:09:56 +02:00
Liam Fleming
11bc0ba843 Move CursorMoved autocmd to main augroup 2018-06-16 20:34:07 +01:00
Christian Brabandt
45c9621157 Merge pull request #1744 from flemingfleming/fix-function-signatures
add "!" to function signatures
2018-06-13 20:06:17 +02:00
Liam Fleming
feca81fb86 add "!" to function signatures 2018-06-13 17:52:13 +01:00
Christian Brabandt
4f95970228 branch: use :noa before calling async func
for some reasons, calling async functions might cause an error, if a
SourcePre command has been defined. So explicitly call the functions
using `:noa` modifier to prevent triggering the SourcePre autocommand.

fixes #1742
2018-06-11 14:45:29 +02:00
Christian Brabandt
7d871137be Correctly test for CompleteDone event 2018-06-09 10:50:25 +02:00
Christian Brabandt
6a05b92716 Merge pull request #1732 from shirohana/fix/integrate-with-ctrlspace
airline#extension#ctrlspace: Fix tabline didn't update when enable both buffers and tabs
2018-06-05 11:23:12 +02:00
Christian Brabandt
55716a1cc2 Remove wrong comment for TerminalOpen autocmd 2018-06-05 11:22:07 +02:00
Hana Shiro
acb93da0d8 Fix tabline didn't update when enable both buffers and tabs 2018-06-05 06:11:14 +08:00
Christian Brabandt
add75907d5 Merge pull request #1738 from shirohana/fix/ctrlspace-tabline-switching
airline#extensions#ctrlspace: Fix tabline didn't update when switch to tab which focused on non-listed buffer
2018-06-04 22:56:22 +02:00
Christian Brabandt
eab6d35852 terminal: Some improvements to Terminal detection
closes #1730

- Make sure to always call the term extension on TermOpen autocommands
- consistently use the airline_term highlighting group
- hard code the airline_term highlighting group, because by the time the
  function airline#themes#patch() is called the highlighting group
  airline_c would no be defined, so we cannot dynamically get those
  attributes
- In the documentation, mention how the g:airline_mode_map can be set
  including the terminal section
2018-06-04 22:44:46 +02:00
Christian Brabandt
1bb1ce594a Formatter: Use pathshorten() instead of substitute()
The default formatter uses a hand-build regexp for shortening the path
in the tabline. However, since it uses the \w  regex atom, this won't
match e.g. cyrillic letters.

To fix this, use the builtin pathshorten() function which does handle
this case correctly. For a test, use e.g. 'D/Учёба/t.c'

closes #1737
2018-06-04 21:59:16 +02:00
Christian Brabandt
044a90ed55 use get(v:, 'lang', '') instead of v:lang
closes #1735
2018-06-04 21:45:46 +02:00
Christian Brabandt
981b83003f fugitive: Use FugitiveHead() instead of fugitive#head
function if possible and use it instead of the fugitive#head
(which will always autload the fugitive plugin).
2018-06-04 18:32:30 +02:00
Christian Brabandt
a1680cc36d fugitive: Check for existence of FugitiveStatusline function
as per @tpopes advice.
2018-06-04 17:42:33 +02:00
Christian Brabandt
30a3c4f549 branch: fugitive renamed its functions
this caused that the branch extension was not correctly working anymore
because of a refactoring of fugitive tpope/vim-fugitive@5d11ff7

Solution: Move the existence check for the fugitive plugin into a
separate function and call it from there in all places that check the
fugitive plugin. Do the same for lawrencium and vcscommand check.

fixes #605 #1739
2018-06-04 17:38:49 +02:00
Hana Shiro
c7d4710f76 Refactor airline#extentions#tabline#ctrlspace#* 2018-06-02 23:41:15 +08:00
Hana Shiro
6e1e6686e7 Fix problems caused by #1524 2018-06-02 21:22:00 +08:00
Hana Shiro
a6e07b6a55 Remove unused catch block 2018-06-02 14:04:25 +08:00
Hana Shiro
4db6d11962 Fix indentation 2018-06-02 13:59:08 +08:00
Hana Shiro
ac799f6021 Rename parameters for better readability 2018-06-02 13:49:32 +08:00
Hana Shiro
92bf1b0b39 Use ternary-operator 2018-06-02 13:02:49 +08:00
Christian Brabandt
08570b6dcb doc: fix wrong double quote by single quote 2018-05-25 11:37:57 +02:00
Christian Brabandt
64e925d675 doc: document notexists symbol correctly
fixes #1729
2018-05-25 11:36:54 +02:00
Christian Brabandt
315cf0deec Merge pull request #1724 from lubomir/fix-doc
Fix documentation for syntastic format of warnings
2018-05-20 19:53:25 +02:00
Lubomír Sedlář
0f91e21710 Fix documentation for syntastic format of warnings 2018-05-17 10:34:04 +02:00
Christian Brabandt
02ffdfe0e5 Merge pull request #1722 from dkav/patch-1
Update README.md
2018-05-13 18:33:34 +02:00
Darren Kavanagh
a280ea4a18 Update README.md
Fix typo and grammar.
2018-05-12 18:59:29 -07:00
Christian Brabandt
a7b84f5b67 doc: fix tag airline#ignore_bufadd_pat 2018-05-11 22:36:44 +02:00
Christian Brabandt
b84e13f1d7 Blacklist startify for [noperm]
Startify unfortunately does not set the buftype option, so the
`[noperm]` would be shown, since the buffer is not really a file.
(see mhinz/vim-startify#324)

So allow to blacklist startify from this setting. To do so, the logic
from the tabline extension was refactored out into a separate function
that returns true, if the buffer matches
`g:airline#extensions#tabline#ignore_bufadd_pat` and that function is
then reused for the readonly() function as well.
2018-05-11 22:32:20 +02:00
Christian Brabandt
c7e05efb76 Only consider regular files for the '[noperm]'
Recently, NERDTree added the &readonly setting to its buffer.
Unfortunately, this caused airline to render the '[noperm]' string in
it.

Fix this by only making the readonly check for buffers that actually
represent files (e.g. the buftype option is empty).
2018-05-11 09:53:55 +02:00
Christian Brabandt
5a065e8b82 Merge pull request #1717 from iroedius/disable-trailing-check
allow to also disable trailing whitespace check per filetype
2018-04-28 09:16:32 +02:00
iroedius
15bc732df4 allow to also disable trailing whitespace check per filetype 2018-04-28 07:34:59 +02:00
Christian Brabandt
33310c5b24 whitespace: Allow to disable individual whitespace checks per filetype
closes #1716
2018-04-27 08:25:49 +02:00
Stanislav Gobunov
c4a4a20b8d xkblayout: Make Short codes configurable
airline#extensions#xkblayout#short_codes changed to global for easily redefine long named keyboard layout

closes #1713
2018-04-18 10:46:55 +02:00
Christian Brabandt
3ad4a18d85 xtabline doc: mention required tabline setting 2018-04-17 07:37:56 +02:00
Christian Brabandt
a76f523be5 bufferline: always add a space for the very first item
closes #1631
2018-04-15 10:16:28 +02:00
mg979
f7c818a0ff add xtabline extension 2018-04-14 14:03:21 +02:00
Christian Brabandt
d9acbc53b0 Reset g_airline_gui_mode on setting termguicolors
fixes #1663, should make sure that the separators are correctly
displayed even when setting 'termguicolors' later than expected.
2018-04-12 10:24:54 +02:00
Christian Brabandt
0df2c9b12e Merge pull request #1700 from mox-mox/master
Add extension for vim-localsearch
2018-04-09 13:27:44 +02:00
mox
00f718691a Adding localsearch extension (code and documentation). See https://github.com/mox-mox/vim-localsearch 2018-04-09 00:47:23 +02:00
Christian Brabandt
d66b507b02 Merge pull request #1683 from idbrii/add-custom-scm
Make branch detection customizable
2018-04-08 21:56:32 +02:00
David Briscoe
8209ca7da1 Make branch detection customizable
Instead of requiring each version control plugin to modify airline to
show the current branch, provide a customization function we can check
instead.

Following the example of airline_theme_patch_func, you define the
variable like so:

    let g:airline#extensions#branch#custom_head = 'david#svn#get_branch'

Custom functions should cache their value. They may need an autocmd to
invalidate their cache:

    " Use a buffer-unique group name to prevent clearing autocmds for other
    " buffers.
    exec 'augroup svndavid-'. bufnr("%")
        au!
        autocmd BufWinLeave <buffer> unlet! b:svndavid_branch
    augroup END

This change lets me integrate with vc.vim (I couldn't get VCSCommand
working for svn) or write my own thing for perforce.

Additionally, always load whole file and check for existence.

Instead of determining up front whether various scm plugins are
installed, check for them on use so they can be added after this script
is sourced.

This also mitigates the problem of checking for existence of autoload
functions (which are not loaded by exist()). Since we're checking
root-level functions, they're likely to be loaded once we're using any
part of the plugin.
2018-04-06 09:40:17 -07:00
Christian Brabandt
902921931e Simplify airline#init#gui_mode()
remove all the old code that is probably not used anymore
2018-04-06 02:21:20 +02:00
Christian Brabandt
ae394294c3 gutentags: output correct statusline message
fixes #1703
2018-04-06 02:14:10 +02:00
Christian Brabandt
bf3cc5ad9d NerdTree: make the statusline configurable
Use the g:NerdTreeStatusline variable for configuring the
NerdTree statusline in the NerdTree window

closes #1705
2018-04-06 01:52:23 +02:00
Christian Brabandt
47bdae9067 Merge pull request #1702 from mrmr1993/fix-buffer-counts
Fix buffer numbering to start from 1 with buffer_idx_mode
2018-04-03 03:16:38 +02:00
Christian Brabandt
2876715b56 Merge pull request #1704 from gf3/jsformatter-typescript
Support typescript in jsformatter
2018-04-03 03:16:19 +02:00
Gianni Chiappetta
023fe122c5 Support typescript in jsformatter 2018-04-02 11:29:18 -04:00
mrmr1993
fbf96559c9 Fix buffer numbering to start from 1 with buffer_idx_mode
275ec4fe63 broke this so that numbering
started from 0 instead of 1 with
g:airline#extensions#tabline#buffer_idx_mode = 1

Specifically, I overlooked that |index| actually tracked the index of
the current buffer in the buffer list *starting from 1*, whereas I
assumed it tracked the true index (starting from 0).
2018-04-02 01:04:43 +01:00
Christian Brabandt
2ba64a88fd Merge pull request #1691 from silenc3r/master
ALE: add option to disable line numbers
2018-04-01 14:13:29 +02:00
Christian Brabandt
f0b969549a Merge pull request #1693 from mrmr1993/current-tabs-visible-experiments
Rework tabline for tabs and buffers
2018-04-01 14:01:17 +02:00
mrmr1993
47c36d2819 Don't let the current buffer be -1 when calculating the tabline 2018-04-01 01:17:18 +01:00
mrmr1993
aee733aa87 Don't show titles in the tabline if there aren't any
airline#extensions#tabline#buflist#list doesn't pick up some buffers
(most notably Netrw buffers), so there are sometimes no buffers to show
and the tabline code fails with an error. This avoids that situation.

It would be better to detect these and show titles for them, but for now
this restores the old behaviour.
2018-04-01 01:05:51 +01:00
mrmr1993
c75106f12d Don't change remaining_space in tabline builder until necessary 2018-03-22 16:42:06 +00:00
mrmr1993
4b1913ad13 Use insert_section for overflow markers in tabline builder 2018-03-22 16:42:06 +00:00
mrmr1993
df2f380c9e Add get_separator_change_with_end to tabline builder 2018-03-22 16:14:18 +00:00
Christian Brabandt
b9f55455fb Revert "highlighter: Make the separators use a cterm background color"
This reverts commit e72a7e2c8d.
2018-03-20 15:30:02 +01:00
Christian Brabandt
d2ac3d5755 async: catch error when jobstart() fails
closes #1692
2018-03-20 14:01:46 +01:00
Christian Brabandt
e72a7e2c8d highlighter: Make the separators use a cterm background color
should fix: #1663
2018-03-19 22:24:57 +01:00
mrmr1993
2528de7d81 Add comments to tabline/builder 2018-03-19 16:21:43 +00:00
mrmr1993
7396dc7a10 Create helper function tabline_evaluated_length 2018-03-19 15:05:50 +00:00
mrmr1993
51bb8dd7e0 Move strchars into util.vim 2018-03-19 15:03:51 +00:00
mrmr1993
5b7b9cf656 Rename remaining tab -> title in tabline/builder 2018-03-19 15:03:51 +00:00
mrmr1993
0b47adf087 Rename tab -> title in tabline/builder method names 2018-03-19 14:36:02 +00:00
mrmr1993
3914d5b475 Rename skipped_tabs_marker to overflow_marker 2018-03-19 14:36:02 +00:00
Christian Brabandt
ecff00a559 tabline: do not show buffer label if show_buffers is zero
fixes #1689
2018-03-19 15:06:55 +01:00
Dawid Zych
18f93ac96b ALE: add option to disable line numbers 2018-03-19 11:28:45 +01:00
mrmr1993
75f53ef6e5 Rename last_{left,right}_group to {left,right}_group 2018-03-18 01:15:11 +00:00
mrmr1993
a2e0ed982f Rename left{,_alt}_sep_size to {,alt_}sep_size 2018-03-18 01:13:30 +00:00
mrmr1993
84bf60c405 Statusline: Use separator widths to calculate whether a title will fit 2018-03-18 00:52:34 +00:00
mrmr1993
896c14bded Reset _remaining_space if a title can't be inserted
This gives us a chance to add the title on the other side if it will
fit, so that we fill more space in the tabline.
2018-03-17 20:05:38 +00:00
Christian Brabandt
700c9b9740 tests: fix failing test 2018-03-15 22:09:02 +01:00
Ingo Heimbach
724beb0c73 Added a vim-gutentags extension
Added a segment that displays whether gutentags is running a ctags
instance.
2018-03-15 22:05:16 +01:00
Christian Brabandt
fb85c0a91a Merge pull request #1678 from mg979/buflist
Changed buflist.vim algorithm
2018-03-15 21:52:35 +01:00
mrmr1993
d13305fc5d Redraw buffer tabline when the terminal width changes 2018-03-15 20:44:51 +00:00
mrmr1993
7844d8bf72 Remove get_visible_buffers 2018-03-15 20:44:51 +00:00
mrmr1993
4a342afb90 Add an option to centre the active tab in the tabline 2018-03-15 20:44:51 +00:00
mrmr1993
275ec4fe63 Use tabline builder for buffers tabline 2018-03-15 20:44:51 +00:00
mrmr1993
d9e68039b8 Take the first tab number in tabline/builder.insert_tabs 2018-03-15 20:44:51 +00:00
mrmr1993
3cd8daa162 Add support for get_pretitle and get_posttitle to tabline builder 2018-03-15 20:44:51 +00:00
mrmr1993
e6b6f36d90 Remove %@...@ patterns in evaluate_tabline if has('tablineat') 2018-03-15 19:21:15 +00:00
mrmr1993
a7bff3b30b Pass number of tabs as an argument to insert_tabs 2018-03-15 18:21:29 +00:00
mrmr1993
5ecc25d6d6 Move tab_nr_type into tabs get_title 2018-03-15 18:14:50 +00:00
mrmr1993
6db0af6f8d Factor out tab insertion into its own function 2018-03-15 18:14:24 +00:00
mrmr1993
9b41fe5de9 Replace tabs tabline remaining_space with a member variable 2018-03-15 18:01:39 +00:00
mrmr1993
1328610188 Initialise tabs tabline builder variables in insert_tabs 2018-03-15 17:46:33 +00:00
mrmr1993
ada8cd7641 Use variables in the tabs tabline builder to track position 2018-03-15 17:41:08 +00:00
mrmr1993
349d01ba39 Generate tabs directly in tabline/builder.build 2018-03-15 17:38:19 +00:00
mrmr1993
3f87d28abb Move insert_tabs into tabs tabline builder prototype
Also move evaluate_tabline and strchars methods that it uses
2018-03-15 17:05:58 +00:00
mrmr1993
71814fb19f Add get_title and get_group to tabs tabline builder 2018-03-15 17:04:19 +00:00
mrmr1993
b99da65412 Create insert_tabs function on builder for tabs tabline 2018-03-15 16:58:04 +00:00
mrmr1993
6286b6d8d8 Move get_group into its own function for tabs 2018-03-15 16:58:04 +00:00
mrmr1993
5907d3909e Add dedicated tabline builder 2018-03-15 16:38:36 +00:00
mrmr1993
57f2619c67 Remove unused variable b_tabline 2018-03-15 15:42:51 +00:00
mrmr1993
1837b2ee39 Use the size of the seperators to get the tabline's remaining space 2018-03-15 15:42:51 +00:00
mrmr1993
d3ec54d42e Remove magic contant for skipped_tabs_marker in tabline calculation 2018-03-15 15:18:57 +00:00
mrmr1993
2b0fe51f99 Replace %= with empty string in evaluate_tabline 2018-03-15 14:36:39 +00:00
mrmr1993
a8f92cc68a Rename skipped_tabs_marker to overflow_marker
This is set to g:airline_symbols.ellipsis, which this commit also adds.
2018-03-15 14:21:16 +00:00
Christian Brabandt
4237bfb052 branch: allow multibyte chars in shortening algorithm
previously, the branch extension used name[0:6], however that would
break with multibyte characters, since this is a byte index and not a
character index.

fixes #1686
2018-03-14 21:33:25 +01:00
mrmr1993
88dedb586a Update tabs tabline when the width of the terminal changes 2018-03-14 15:25:03 +00:00
mrmr1993
5d2d764368 Use strchars to calculate string lengths
This also adds a compatability wrapper, so that versions older than
Vim 7.3 are supported.

This is inspired by, and includes s:strchars from, @ruipgpinheiro's
commit e2d1295a3d3708e8d2a5eb30cac840fc9520bb8b
2018-03-14 15:13:40 +00:00
mrmr1993
6819443d6a Fix typo in evaluating %( %) rules 2018-03-14 15:07:41 +00:00
mrmr1993
980e78b4bf Add configurable variable airline#extensions#tabline#skipped_tabs_marker 2018-03-14 15:07:32 +00:00
mrmr1993
7480245ebf Calculate used length of tabs directly as they are added 2018-03-14 14:51:09 +00:00
mrmr1993
f93894f6ac Move tab title generation into its own function 2018-03-14 13:55:30 +00:00
mrmr1993
e1a4cd764f Adjust tab columns to allow for ellipsis and the left/right split 2018-03-13 00:57:48 +00:00
mrmr1993
d29c7b27fa Evaluate tabline fragments to get the length of tab titles 2018-03-12 21:55:27 +00:00
mrmr1993
3305410982 Move tabline evaluation into its own function 2018-03-12 21:55:27 +00:00
mrmr1993
e0791cc1a0 Use the partially built tabline to calculate space left for tabs 2018-03-12 21:55:25 +00:00
mrmr1993
7a286639c5 Attach tabs to tabline last 2018-03-12 21:52:12 +00:00
mrmr1993
2711c73a47 Pass the available space for tabs as an argument to |get_visible_tabs| 2018-03-12 21:48:40 +00:00
mrmr1993
cf47d63f71 Fix formatting in clipped tab bar 2018-03-12 21:48:40 +00:00
mrmr1993
abd310bb31 Show current tab in the middle of the tabline
This is heavily based on 3cc1dcb697,
mostly by copying the get_visible_buffers function and making some
tweaks
2018-03-12 21:48:35 +00:00
mrmr1993
f60cf736db Add a get_tabs function to abstract over tabs 2018-03-12 21:47:08 +00:00
mg979
26aa528c42 Made s:variables local
Moved small functions out of main function
2018-03-07 02:21:52 +01:00
Christian Brabandt
958f78335e help: remove duplicate tag airline-bufferline
fixes #1681
2018-03-06 15:32:25 +01:00
Christian Brabandt
167602d5b9 tabline: get correct buffer name
When the uniq_tail formatter is used, the buffer name is not refreshed
when running through the duplicates. Fix that by getting the correct
buffer name again.

fixes #1680
2018-03-06 11:23:38 +01:00
Christian Brabandt
78c4438469 Merge pull request #1677 from Cimbali/master
Disable fugitiveline if bufferline is activated
2018-03-06 09:22:09 +01:00
Cimbali
9912ce13a4 Disable fugitiveline if bufferline is activated
This fixes the conflict of both plugins redifining the 'file' (or 'path')
function. Closes #1670.
As fugitiveline modifies the path display and bufferline replaces it,
the latter should be the plugin to be used if both are activated.
2018-03-05 11:56:03 +01:00
mg979
63111e9810 Removed fnamemodify() in path check for buflist.vim 2018-03-04 00:31:25 +01:00
mg979
2e2a66c5a0 Restored old variable name for g:airline#extensions#tabline#excludes
Made check case sensitive
2018-03-03 23:53:10 +01:00
mg979
3ebbc57725 Changed buflist.vim algorithm 2018-03-03 23:39:14 +01:00
Christian Brabandt
55a9721c22 Merge pull request #1651 from srini-x/master
Changing 'airline_tablabel' text and colors back to old style
2018-02-14 09:49:31 +01:00
srini-x
7f1cfb0c3f removing the hard-coded '[' and ']' around the tabline labels. 2018-02-13 17:48:21 -08:00
Christian Brabandt
85696f28a9 Merge pull request #1649 from CherryMan/master
tabline: fix tabline on :syn on
2018-02-10 20:50:58 +01:00
Christian Brabandt
e4968d7a40 Merge pull request #1660 from erfanio/fix_buffer_tabline
Fix white space in tabline when showing buffers
2018-02-10 20:49:47 +01:00
erfanio
8c634887bf Fix white space in tabline when showing buffers 2018-02-08 19:02:35 -08:00
Christian Brabandt
c2ffb8b3ec Merge pull request #1643 from ThomasFaivre/quickfix
quickfix: fix options initialization
2018-01-21 09:55:23 +01:00
Christian Brabandt
eb58badee2 Merge pull request #1647 from ThomasFaivre/get_mode
cursormode: allow custom mode names
2018-01-21 09:53:21 +01:00
Sheheryar Parvaz
8c1a7a5343 tabline: fix tabline on :syn on
better solution for #1590. Previous solution refreshes airline
completely which is much slower.
2018-01-20 23:27:32 -05:00
Thomas Faivre
dec9b8e65c cursormode: allow custom mode names
A new variable named cursormode_mode_func is used to store the function
returning the current mode. This allows more customization in the mapping.
The default value is the built-in mode function so there is no change in
behavior.
Add some documentation.

Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
2018-01-19 13:28:02 +01:00
Thomas Faivre
e5a51f9fca quickfix: fix options initialization
Options default value is hard coded making them override user values.

Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
2018-01-18 18:21:56 +01:00
Bailey Ling
e02176aca1 update changelog for 0.9 2018-01-15 13:18:51 -05:00
Christian Brabandt
b7d3feb4d2 tabline: correctly refresh on :syn commands
fixes #1590 and #1638
2018-01-10 08:41:04 +01:00
Christian Brabandt
a3bdb10aea Merge pull request #1634 from Cimbali/master
Fix over-caching of paths
2018-01-15 08:02:09 +01:00
Christian Brabandt
927c910af1 doc: Document, that the fugitive extension is needed 2018-01-10 08:14:48 +01:00
Cimbali
a104e40b10 Cache only git calls, not bufname and fnamemodify 2018-01-09 20:07:54 +01:00
Christian Brabandt
9a2ed35ff9 tabline: do not confuse Vim
looks like this:
```
let a=(condition ? s:var:'')
```
confuses older Vims and it complains about a missing colon. So make
parsing a bit easier and add a space in front of the second colon.

fixes #1629
2018-01-08 13:46:08 +01:00
Christian Brabandt
02816a3cb6 tabline: missing spaces
commit ab49a1c7ae changed that no leading whitespace was added.
While this removed a double space in front of the current active
selected buffer, it removed one space too much for the non-current
buffers in the bufferline.

So partly reverse it and only add the space, if the highlighting groups
between each item did not change.
2018-01-08 09:48:36 +01:00
Christian Brabandt
182675dc10 tabline: revert default buffer_idx_mode
commit 2e3cdeb unintentionally changed the default for the
buffer_idx_mode in the tabline.

Revert it back to be disabled by default

fixes #1628
2018-01-07 09:51:08 +01:00
Christian Brabandt
ab49a1c7ae tabline: do not add extra space before buffer name
there was a space too much added in the tabline. Fix that
2018-01-05 22:13:47 +01:00
Christian Brabandt
5db4c408bd Update copyright notifications 2018-01-05 10:37:59 +01:00
Christian Brabandt
6c4f3277f1 Add missing scriptencoding 2018-01-05 10:26:38 +01:00
Christian Brabandt
6cdcaf13b1 cursormode: disable by default
fixes #1625
2018-01-05 08:12:35 +01:00
Christian Brabandt
3a2323feac branch: shorten default master for smaller windows 2018-01-05 08:12:10 +01:00
Christian Brabandt
c76019ac9e Safety: Make sure g:airline_theme is defined before using it
fixes #1624
2018-01-04 23:54:12 +01:00
Christian Brabandt
a90ac37cb3 Changelog: slightly reorded items 2018-01-04 23:37:10 +01:00
Christian Brabandt
2ef81d4140 Changelog: Add links to the issues 2018-01-04 23:33:30 +01:00
Christian Brabandt
3b5f2bd470 async: Todo: Check if cwd option for Vim 8 is needed 2018-01-04 23:29:15 +01:00
Christian Brabandt
88130fd377 Updated Changelog 2018-01-04 23:27:05 +01:00
Michael Brailsford
7215a1fdd5 clarifying documentation
closes #1225
2018-01-04 21:31:16 +01:00
Eduardo Suarez-Santana
ebda798080 Cursormode integrated as extension 2018-01-04 21:24:27 +01:00
Christian Brabandt
c17ad9a123 Merge pull request #1426 from lynnard/master
Fix problems with AirlineSelect{Prev,Next}Tab
2018-01-04 21:15:00 +01:00
Christian Brabandt
73d8abff2f Merge pull request #1617 from kyleholzinger/master
Add formatter for js files
2018-01-04 21:14:00 +01:00
Christian Brabandt
4d0233ebdb plugin: correctly re-init on :syn-enable
should fix #1590 correctly
2018-01-04 21:09:26 +01:00
Christian Brabandt
d283a25e3f tabline: only show buffer label, if they were drawn
closes #1558
2018-01-04 20:56:09 +01:00
Christian Brabandt
ce83c39bed tabline: allow custom formatter for tabnr_type
closes #1418
2018-01-04 20:41:55 +01:00
Christian Brabandt
133a76d2d4 plugin: reset syntax highlighting on :syn off
hopefully fixes #1590
2018-01-04 20:07:15 +01:00
Christian Brabandt
c518f79aab tabline: allow to show buffers label at start 2018-01-04 19:38:07 +01:00
Christian Brabandt
9d28f0dcc7 tabline: allow to show current buffer/tab at first position
This will make highlighting more consistent. Always first item is the
one where the cursor is.
2018-01-04 19:32:29 +01:00
Christian Brabandt
30652c05c4 tabline: correct order of tab/buffer labels 2018-01-04 19:09:02 +01:00
Christian Brabandt
90cf752c90 tabline: add separate highlight group for labels 2018-01-04 18:57:28 +01:00
Christian Brabandt
3b631ef0c4 tabline: refactor label function 2018-01-04 18:43:03 +01:00
Christian Brabandt
3985ece131 tabline: add [buffers]/[tabs] labels consistently
previously, when both tabs and buffers were displayed in the tabline, it
was not immediately obvious which side belongs to a buffer and which one
to a tab. Therefore, add [buffers]/[tabs] labels consistently.
2018-01-04 18:34:48 +01:00
Christian Brabandt
45878a7947 tabline: remove l: prefix of function variables 2018-01-04 18:29:51 +01:00
Christian Brabandt
503b9977fb tabline: refactor s:variables 2018-01-04 18:20:25 +01:00
Christian Brabandt
69aa1e93b3 tabline: add more try/catch for mappings
similar to 2e3cdeb808 add a couple of more try catch statements
around the map_keys() function
2018-01-04 18:15:40 +01:00
Christian Brabandt
645f65d8d9 ctrlspace: wrong separator
under certains circumstances it could happen that for the vim-ctrlspace
tabline extension a tabline group was redefined which would cause a
separator having foreground and background color swapped. This was
caused by using the 'pos' parameter for the right side wrongly.

fixes #1559
2018-01-04 18:07:03 +01:00
Christian Brabandt
45236ba7c7 ctrlspace: refactor s:variables 2018-01-04 17:27:34 +01:00
Christian Brabandt
a25757ac64 tabline: Allow an alternate style for bufferlist
fixes #1608
2018-01-04 15:45:36 +01:00
Christian Brabandt
d78f686ce5 tabline: remove some more s:vars 2018-01-04 14:35:10 +01:00
Christian Brabandt
6ba65b2c8c tabline: remove s:show_tab_type variable 2018-01-04 14:30:16 +01:00
Christian Brabandt
708c76e22c tabline: do not cache s:buffer_idx_mode 2018-01-04 14:23:50 +01:00
Christian Brabandt
d03c3fa7b9 tabline: remove l: variable prefix 2018-01-04 14:20:36 +01:00
Christian Brabandt
72e457d8c2 tabline: remove static caching of s:vars
rather let them be defined whenever they are needed. They were only used
inside a single function anyhow, so it does not make sense to cache
them. In addition, having the user later change the variable won't work
as expected.
2018-01-04 14:11:13 +01:00
Christian Brabandt
2e3cdeb808 tabline: try/catch mapping of the keys
fixes #1621
2018-01-04 14:11:11 +01:00
Kyle Holzinger
66991f53fa add to docs 2017-12-28 16:08:32 -05:00
Kyle Holzinger
a3d5e84417 Add formatter for js files 2017-12-28 15:43:13 -05:00
Christian Brabandt
c386332570 Merge pull request #1619 from tracyone/doc
doc: update ctrlp.vim url
2017-12-28 11:20:23 +01:00
Christian Brabandt
125d3443e4 Merge pull request #1620 from Cimbali/master
Cache file names in fugitiveline extension
2017-12-28 11:20:05 +01:00
Cimbali
18da5aa699 Separate updating and displaying branch information
This will cause any calls that are not just head() to be delayed and
cached whenever possible.
2017-12-26 22:30:23 +01:00
Cimbali
1ee057362d Caching path simplified using fugitive 2017-12-26 22:30:23 +01:00
tracyone
450fa168ea doc: update ctrlp.vim url 2017-12-25 21:27:55 +08:00
Cimbali
e0dd3d8125 Rename merge file names
Clearer names that reference the HEADs of git: FETCH_HEAD, ORIG_HEAD and
MERGE_HEAD, rather than the names that fugitive uses for them.
2017-12-23 15:05:59 +01:00
Christian Brabandt
bc985301db Merge pull request #1603 from Cimbali/master
Improve fugitive integration
2017-12-21 09:09:44 +01:00
Christian Brabandt
6c8d0f5e6a Merge pull request #1605 from EdwardBetts/patch-2
Correct spelling mistake.
2017-11-27 09:27:58 +01:00
Christian Brabandt
77ab703a55 Merge pull request #1604 from EdwardBetts/patch-1
Correct spelling mistake.
2017-11-27 09:27:40 +01:00
Edward Betts
3b304f36ae Correct spelling mistake. 2017-11-25 21:14:31 +00:00
Edward Betts
7afc60af25 Correct spelling mistake. 2017-11-25 21:12:44 +00:00
Cimbali
e415c5301f Trusting fugitive instead of tracking paths manually
The initial reason in #237 is not valid anymore, as vim-gitgutter
functions as expected for editing files that are not part of a repo,
whether they are:
- in a different repo
- in a parent repo (cwd being a submodule)
- outside of the repo

Furthermore, removing this check allows to show relevant info for
specific fugitive file names that are fugitive://..../sha1//...
which are hard to parse manually, especially in complicated situations
such as submodules.
2017-11-22 23:55:22 +01:00
Cimbali
8c4bf37588 Configurability: parametrizable sha1 length 2017-11-22 23:01:54 +01:00
Cimbali
33663d7df2 Show buffer name relative to git folder 2017-11-22 23:00:58 +01:00
Cimbali
009f7932fb Show #branch#head() as "ref-or-sha1(current-branch)"
Only changes anything in the case of using fugitive to show a file that
is not from the current working directory.
2017-11-22 23:00:57 +01:00
Cimbali
f0093ceaa6 Remove code redundant with fugitive#head()
It which requires a path, and just performed the same as
fugitive#head() does internally.
2017-11-22 19:25:26 +01:00
Christian Brabandt
3e13bab201 Merge pull request #1600 from PratikBhusal/patch-1
Add function to show line number
2017-11-20 13:58:21 +01:00
Christian Brabandt
d719d0664a Merge pull request #1602 from jreybert/dev/vimagit
vimagit: let vimagit itself returns the current mode
2017-11-20 13:57:42 +01:00
Jerome Reybert
640d6762f7 vimagit: let vimagit itself returns the current mode
If current vimagit version does not provide vimagit#get_current_mode(),
internal string version is kept.
2017-11-20 13:47:48 +01:00
Pratik Bhusal
58328b347c Added function to show line number
The function shows the line number of the first error/warning that appears in the current buffer. If there are 20 warnings and the first warning exists on line 33, then vim-airline would show "W:20(L33)".

One can change how the line number is represented using: `g:airline#extensions#ale#open_lnum_symbol` and `airline#extensions#ale#close_lnum_symbol`
2017-11-18 14:24:47 -06:00
Christian Brabandt
4a1f65841c README: mention how to use pack feature for install
fixes #1594
2017-11-15 08:06:17 +01:00
Christian Brabandt
1f84ad886c README: still some problems 2017-11-15 07:58:22 +01:00
Christian Brabandt
c88dca5c96 README: still some problems with the table
(I hate markdown)
2017-11-15 07:54:50 +01:00
Christian Brabandt
dd368b3e31 README: one more fix for the table 2017-11-15 07:51:48 +01:00
Christian Brabandt
20a6fe2b9f README: Fix table 2017-11-14 23:44:52 +01:00
Christian Brabandt
f3aae5f72b README: show a screenshot and document what this plugin does
fixes #1589
2017-11-14 23:43:04 +01:00
Christian Brabandt
52ce640534 startup: remove workaround for skipping redraw
commit 7d082c03b2 added a workaround to skip
a few redraws on startup so that the intro message is not shown anymore.

However might cause problems, that some highlighting groups are not
correctly set. Also recent Vims (8.0.1290 and so on) do not seem to
suffer from the problem that an too early initializiation of airline
causes a redraw which skips the intro message.

Therefore, revert that commit.

Fixes #1585
2017-11-14 23:38:32 +01:00
Christian Brabandt
396cc92261 Merge pull request #1578 from ompugao/tabline_collapse_fname
collapse fname in tabline when using unique_tail formatter
2017-11-06 08:19:04 +01:00
Shohei Fujii
b044b4b204 collapse fname in tabline when using unique_tail formatter 2017-10-30 20:00:05 +09:00
Christian Brabandt
a1b7479b54 Merge pull request #1584 from Taikuh/wordcount_format
Add option to change wordcount display for the default formatter
2017-10-25 21:27:23 +02:00
Taikuh
ccc4c9f430 Add option to change wordcount display for the default formatter 2017-10-26 01:02:10 +08:00
Christian Brabandt
e72ec51e59 Merge pull request #1582 from 0x6a62/doc-typo
Fix typo
2017-10-23 08:57:57 +02:00
jb
78ca75af6e Fix typo 2017-10-21 13:29:17 -04:00
Christian Brabandt
6e2a9e38cd tabline: force redraw on BufAdd autocommands
closes #1580
2017-10-19 11:37:24 +02:00
Christian Brabandt
a5d9a4bcb2 Merge pull request #1577 from ompugao/skip_toggling_ctrlspace_if_not_installed
skip toggling ctrlspace tabline plugin when not installed
2017-10-16 10:57:20 +02:00
Shohei Fujii
7bf1d9b1fb skip toggling ctrlspace tabline plugin 2017-10-16 17:33:40 +09:00
Christian Brabandt
27acd851a7 cleanup term extension 2017-09-27 20:28:18 +02:00
Christian Brabandt
0ad4f97c1a Add a terminal statusline function for vim 2017-09-27 20:28:16 +02:00
Christian Brabandt
bd613e69b6 Merge pull request #1569 from yehuohan/master
Fix: Use the CS-symbol of ctrlspace which may be changed by user in ctrlspace-extension
2017-09-27 13:21:10 +02:00
yehuohan
4d645711e5 Fix: Use the CS-symbol of ctrlspace which may be change by user in ctrlspace-externsion 2017-09-27 16:17:50 +08:00
Christian Brabandt
031cb31056 branch: do not show errors for mq extensions
skip anything that matches abort

e.g. running hg qtop with Vims path outside of the repository returns
something like "abort: no repository found in ..."
in that case, do not show anything.
2017-09-22 21:39:17 +02:00
Christian Brabandt
9f186d899a branch: mq patch not correctly displayed
also make the branch extension make use of the specific code to handle
the mq output
2017-09-22 21:37:28 +02:00
Christian Brabandt
cfb107c75f Merge pull request #1564 from gidj/vcs-patch-fix
Use regex matching to prevent message from bubbling up
2017-09-18 19:54:38 +02:00
Gideon VanRiette
a763c6b53f Catch trailing whitespace when matching output 2017-09-18 09:02:39 -05:00
Christian Brabandt
8a3e3e2794 mq: remove trailing \n from system()
fixes #1563
2017-09-14 11:43:53 +02:00
Christian Brabandt
ea46192561 README: remove laststatus section
closes #1560
2017-09-05 07:25:26 +02:00
Christian Brabandt
81f089322a keymap: allow to disable extension by checking config var
closes #1556
2017-09-03 21:18:01 +02:00
Christian Brabandt
571f892fcd README: mention how to fix performance problems 2017-09-01 12:01:43 +02:00
Christian Brabandt
cdaa5117b0 highlighter: also return bold flag 2017-09-01 11:25:37 +02:00
Christian Brabandt
e7a5c97df1 readonly: remove modifiable check 2017-09-01 09:19:39 +02:00
Christian Brabandt
9e3fcc4cdb tagbar: only try loading the tagbar extension once
commit 232b641 did unfortunately disable tagbar completely, since
exists("*func") does not autoload the function.

So this time, try explicitly calling the function once, and if it does
not exists, it should be disabled and not cause any further errors.

closes #1555
2017-09-01 09:08:22 +02:00
Christian Brabandt
f0a508b121 async: nvim: use generic output handler 2017-08-30 13:15:55 +02:00
Christian Brabandt
942458f19b async: include stderr output in job output (Nvim)
references #1551
2017-08-29 12:56:15 +02:00
Christian Brabandt
d3f8873469 async: fix error, when mq is not enabled
fixes #1551
2017-08-29 12:47:29 +02:00
Christian Brabandt
09ab45a2fb async: add missing comma
fixes #1550
2017-08-29 11:53:20 +02:00
Christian Brabandt
195f2e1dae keymap: fix missing keymap symbol, fix wrong condition 2017-08-27 21:29:40 +02:00
Christian Brabandt
97f3f84881 Merge pull request #1549 from doronbehar/fix-doc-syntax2
Small fixes to syntax in documentation.
2017-08-27 20:58:19 +02:00
Doron Behar
c07b28d199 Small fixes to syntax in documentation. 2017-08-27 16:40:01 +03:00
Christian Brabandt
3b225a1322 keymap: add some more missing parts, fix missing printf 2017-08-26 21:14:35 +02:00
Christian Brabandt
f430246aff keymap: add missing part from #1546 2017-08-26 18:18:45 +02:00
Christian Brabandt
57cda93aad keymap: fix the style 2017-08-26 18:14:08 +02:00
Doron Behar
89e484ac59 Add keymap extension which shows keymap setting. 2017-08-26 18:09:20 +02:00
Christian Brabandt
20de588fd1 Merge pull request #1547 from kaidiren/master
fix: refresh airline when airline_skip_empty_sections enabled in plugin in ale
2017-08-26 15:43:21 +02:00
kaidiren
2b45581f1c fix: refresh airline when airline_skip_empty_sections enabled in plugin ale 2017-08-26 19:00:40 +08:00
Christian Brabandt
db907f5598 async: new function for validating directory
references #1544
2017-08-26 08:04:44 +02:00
Christian Brabandt
3e25ca5a5a async: Check directory before starting the job (Neovim)
fixes #1544
2017-08-26 07:58:39 +02:00
Christian Brabandt
e357f88de6 async: define config variable for older vims
references #1542
2017-08-25 18:50:15 +02:00
Christian Brabandt
f4caf598fa async: only use nvim functions, when actually using neovim
closes #1542
2017-08-25 16:48:45 +02:00
Christian Brabandt
42e5c82d64 Merge pull request #1535 from chrisbra/nvim_async
Improvement to async functionality
2017-08-25 14:37:47 +02:00
Christian Brabandt
5345c8fafa denite: Check filetype in mode function
references #1540
2017-08-25 08:38:31 +02:00
Christian Brabandt
9bd2c40e7d denite: remove FileType autocommand
closes #1540
2017-08-25 07:44:39 +02:00
Christian Brabandt
ab6acdee41 Merge pull request #1539 from icymind/master
add option 'keymap_ignored_filetypes' for tabline extensions
2017-08-24 18:15:18 +02:00
icymind
5df7d961bc amend doc 2017-08-25 00:00:50 +08:00
icymind
b6a98bcd10 add option 'keymap_ignored_filetypes' for tabline extensions 2017-08-24 23:22:16 +08:00
Christian Brabandt
b77f326b33 async: rename variable
rename g:airline#init#async variable to g:airline#init#vim_async
because that is what it is for: showing whether vim supports async. Is
not set vor nvim, because nvim always supports jobs.
2017-08-23 18:38:19 +02:00
Christian Brabandt
06272275b5 fix po output not visible for nvim
Apparently, the output of msgfmt goes to stderr. So catch that one as
well.
2017-08-23 18:37:28 +02:00
Christian Brabandt
2c05a48a26 async: Add comments, better conditions to detect vim/nvim 2017-08-23 18:37:26 +02:00
Christian Brabandt
4c74a95045 Refactor async functions
- create a new async module
- refactor async functions from branch.vim and po.vim to async.vim
- support nvim async correctly
2017-08-23 18:37:24 +02:00
Christian Brabandt
50bfe8dd68 First commit to handle nvim specific async code 2017-08-23 18:31:43 +02:00
Christian Brabandt
a01d03a78a branch: only do mq check once
but reset the check variable on Shell commands and when :AirlineRefresh
was called.

should make vim more performant

references #1536
2017-08-23 18:28:48 +02:00
Christian Brabandt
3ec22a524c branch: comment why the argument is not used for update_hg_branch 2017-08-23 18:23:28 +02:00
Christian Brabandt
8cd7e35027 branch: correctly reset cache variables 2017-08-23 18:03:23 +02:00
Christian Brabandt
e553433430 branch: when mq is disabled, do not run hg qtop anymore 2017-08-23 18:01:41 +02:00
Christian Brabandt
5147d385a5 branch: cache filename path
fixes #1536
2017-08-23 17:56:57 +02:00
Christian Brabandt
232b6415d9 tagbar: do not error out, if autoloaded function does not exist
tagbar is not loaded if filetype plugin is off, so do not try to call a
non-existent function than.
2017-08-23 15:54:06 +02:00
Christian Brabandt
e8b6312dd9 Backout the wrong commit for checking async feature in nvim
fixes #1532
2017-08-21 22:22:19 +02:00
Christian Brabandt
04bc544db2 po: rename variable correctly and add g: prefix 2017-08-21 21:29:16 +02:00
Christian Brabandt
5fc5a43802 init: rename variable 2017-08-21 21:26:35 +02:00
Christian Brabandt
c2b2351d99 async: Better check for nvim
closes neovim/neovim#7186
2017-08-21 21:23:34 +02:00
Christian Brabandt
470e9870f1 highlighter: do not consider 0 to be empty
fixes #1531
2017-08-20 22:47:02 +02:00
Christian Brabandt
e5f9ccad8e terminal: use mode() to detect terminal mode
workaround with index(term_list(), bufnr('')) > -1 not needed anymore,
since vim 8.0.936 will correctly return 't' for the mode() function in
the terminal.
2017-08-20 22:47:00 +02:00
Christian Brabandt
3535243c50 Merge pull request #1528 from doronbehar/fix-doc-syntax
Small fixes to syntax in help file.
2017-08-17 13:41:06 +02:00
Doron Behar
69ad039d07 Small fixes to syntax in help file. 2017-08-16 19:56:44 +03:00
Christian Brabandt
d8eb12845f hunks: do not cache for changes plugin 2017-08-14 08:13:19 +02:00
Christian Brabandt
a8c4424244 highligthing: Enable cacheing only when config is set.
This enables the highlighting caching only when the variable
g:airline_highlighting_cache is set to 1

Should make airline faster and more performant, because we can save a
lot of expensive C core calls. However, when redefining highlighting
groups, it might not correctly reset the cache.
2017-08-14 08:06:53 +02:00
Christian Brabandt
6ee75bdbde Fix failing tests 2017-08-11 12:55:44 +02:00
Christian Brabandt
a96681d459 highlighter: Cache syntax highlighting attributes
Should in theory improve performance by quiet a lot.
2017-08-11 11:26:35 +02:00
Christian Brabandt
e9a7a12d9e highlighter: improve performance of get_array() function 2017-08-11 11:05:56 +02:00
Christian Brabandt
c65d7fe36b highlighter: slight performance increase
do not access get() function twice. We can assign the result to a
variable and use it a second time. Should speed up the highligther part
of the code by a bit.

Since I was already touching s:Get(), also get rid of the default
parameter, as it always has been the empty string.
2017-08-11 10:46:03 +02:00
Christian Brabandt
96352f9b53 doc: fix typo 2017-08-08 16:03:11 +02:00
Christian Brabandt
2ec563bd57 syntastic: slightly tweak output format
also document how to use different syntastic statusline format

closes #1525
2017-08-08 14:57:04 +02:00
Christian Brabandt
83ceae726e syntastic: display line number for errors/warnings
line number was omitted from 2e3055541e, so add it back
in parenthesis.

fixes #1525
2017-08-08 12:59:15 +02:00
Christian Brabandt
711f50a567 Merge pull request #1524 from tenfyzhong/master
Fixes #1515. The tabline will no update when use ctrlspace together.
2017-08-08 09:34:11 +02:00
tenfy
c0695feb13 Fixes #1515. The tabline will no update when use ctrlspace together.
Do not update tabline when the new buffer is no add to BufferList yes.
It will update by other event later.
2017-08-08 15:07:54 +08:00
Christian Brabandt
4e24036782 Merge pull request #1523 from rlue/hotfix
Hotfix: Autoswitch theme for colorschemes with funny casing (like PaperColor)
2017-08-07 07:46:19 +02:00
Ryan Lue
039fd6b50f Fix airline#switch_matching_theme() to accommodate camelcased colorscheme names 2017-08-07 12:42:22 +08:00
Christian Brabandt
a2e20bc3ca spell: Display spelling language
fixes: #1521
2017-08-01 19:25:20 +02:00
Christian Brabandt
0c307d5f73 Better way to check for terminal buffer 2017-07-30 18:57:05 +02:00
Christian Brabandt
d54613d2dd Check for existence of term_list()
fixes #1518
2017-07-30 18:55:52 +02:00
Christian Brabandt
846d85aaa1 main: support for Vims terminal mode
Currently this is a hack, to get terminal mode from Vim.

However there is no better solution yet, since the API is not stable
here. Until then, just use the hack with
index(term_list(), bufnr('')) > -1
2017-07-30 09:51:23 +02:00
Christian Brabandt
72e5f04f7c Merge pull request #1513 from rdnetto/master
Neomake integration: if loclist is empty, fallback to quickfix
2017-07-21 12:28:55 +02:00
Reuben D'Netto
e79188c3bd Neomake integration: if loclist is empty, fallback to quickfix 2017-07-21 18:30:34 +10:00
Christian Brabandt
61c624ef6c unicode: Update Unicode extension
do not draw the complete statusline in a bright yellow. This might hurt
your eyes
2017-07-19 12:57:18 +02:00
Christian Brabandt
e03afa1733 doc: linenr and maxlinenr are swapped in documentation
fixes #1507
2017-07-07 22:33:47 +02:00
Christian Brabandt
afcda0510e Ale: Removing caching
fixes #1506
2017-07-06 12:14:49 +02:00
Christian Brabandt
b78c2ec475 Always enable airline by setting laststatus=2
Previously the user was expected to set 'laststatus' himself to 2 if he
wanted to have airline be shown by default.

However it doesn't make much sense to have airline installed but not
display the statusline. Therefore, set the 'laststatus' to 2, if it
isn't set to it already.
2017-07-02 20:42:32 +02:00
Christian Brabandt
4f43e5c93d Merge pull request #1503 from d10n/git-hunk-empty
Fix git hunk status disappearance on CursorHold
2017-07-01 21:44:30 +02:00
Christian Brabandt
0205baa963 Merge pull request #1504 from d10n/fix-typo
Fix typo
2017-07-01 21:43:03 +02:00
d10n
b6eaa60a88 Fix typo 2017-07-01 12:11:27 -04:00
d10n
39c61288e8 Fix git hunk status disappearance on CursorHold
When using vim-gitgutter and fugitive:

The hunks extension and the branch extension work as expected when the
file is first loaded; both parts are added to the statusline.

Once the cursor is moved and stopped for &updatetime ms:

1. The branch extension clears b:airline_head on CursorHold
2. Somehow (?) airline#statusline gets called on CursorHold
3. The hunks extension returns '' when b:airline_head is empty, causing
the hunks to be removed from the statusline.

It doesn't make sense to clear airline_head just because the cursor
moved, and the commit message adding the line doesn't say why:
13297cee03

Commit 174b7e1962 relies on airline_head
being set.

Debug detail:

Executing CursorHold Auto commands for "*"
autocommand unlet! b:airline_head
[...]
continuing in CursorHold Auto commands for "*"
calling function airline#statusline(1)
[...]
line 1:   return exists('*airline#extensions#branch#head') && empty(get(b:, 'airline_head', ''))
function airline#extensions#hunks#get_hunks[13]..<SNR>32_get_hunks[14]..<SNR>32_get_hunks_gitgutter[1]..<SNR>32_is_branch_empty returning #1
function airline#extensions#hunks#get_hunks[13]..<SNR>32_get_hunks[14]..<SNR>32_get_hunks_gitgutter returning ''
function airline#extensions#hunks#get_hunks[13]..<SNR>32_get_hunks returning ''
function airline#extensions#hunks#get_hunks returning ''

:au CursorHold
--- Auto-Commands ---
gitgutter  CursorHold
    *         call gitgutter#process_buffer(bufnr(''), 1)
CursorHold
    *         unlet! b:airline_head
airline_whitespace  CursorHold
    *         call <sid>ws_refresh()

------------------------

Sample vimrc:

set nocompatible

if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | q | doautocmd WinEnter
endif

autocmd VimEnter *
  \  if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
  \|   PlugInstall --sync | q
  \| endif

call plug#begin('~/.vim/bundle/')
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
call plug#end()
set laststatus=2
set updatetime=250
let g:airline_theme = 'dark'
2017-07-01 11:57:08 -04:00
Christian Brabandt
72ca1c344f Merge pull request #1502 from DavidAntaramian/master
Fix misspelling of trailing_fmt
2017-07-01 07:18:02 +02:00
David Antaramian
42522f994a Fixes typo introduced in a10d321
Commmit a10d321809 introduced a small typo
spelling a previously set variable `trailing_fmt` as `trailing_fm`. This
causes Vim to report `trailing_fm` as an undefined variable. In this
change, the variable is properly referenced as `trailing_fmt`.
2017-06-30 18:45:21 -04:00
Christian Brabandt
a10d321809 whitespace: move s:variables around
Will make sure, that even after setting the whitespace extension
variables, they are taken correctly into account.
2017-06-30 21:37:37 +02:00
Christian Brabandt
a914cfb754 backout b2f301f73c
Backout commit b2f301f73c

First of all, it caused flicker (which is caused by a Vim bug:
https://groups.google.com/d/msg/vim_dev/fdgPqmYZwOk/KJzR4l9wAwAJA)

and then the cache was not reset when editing a new file.

So let's just revert that commit, although it does affect performance.

fixes #1499
2017-06-28 21:10:57 +02:00
Christian Brabandt
313a6fcad2 tabline: prevent flicker on Windows
calling settabvar() while evaluating the 'tabline' setting apparently
causes flicker on Windows. Fall back to using `:let t:var` to store the
content in the current tabpage.

This is not as good as using `settabvar()` since we cannot store the
title for other tabs, but at least it should prevent the flicker and at
the same time at least cache the title for the current tabpage.
2017-06-27 18:28:28 +02:00
Christian Brabandt
825aec9e4d Revert "highlight: skip processing the same hi group twice"
This reverts commit feee9bcf3c.

It brakes CI and shouldn't be needed
2017-06-27 14:44:49 +02:00
Christian Brabandt
62952b3887 tabline: only map keys if not done yet
Should improve performance by not steadily remapping keys
2017-06-27 14:44:03 +02:00
Christian Brabandt
b2f301f73c tabline: Cache title as tablocal variable 2017-06-27 14:40:31 +02:00
Christian Brabandt
174b7e1962 hunks: Make hunk extension slightly faster
do not call airline#extensions#branch#head() but instead use the cached
variable b:airline_head.

Note: it looks like GitGutterGetHunkSummary() could need some cacheing
2017-06-27 14:16:28 +02:00
Christian Brabandt
6ab0098ced Ale: Cache Warning and Errors
should provide some better performance
2017-06-27 13:52:48 +02:00
Christian Brabandt
feee9bcf3c highlight: skip processing the same hi group twice
Shouldn't happen, but just in case skip creating highlighting group,
if the same group with the same attributes has already been defined.
2017-06-26 23:17:43 +02:00
Christian Brabandt
583ae3d5f9 highlighter: skip create hi groups for inactive mode if not needed
This will skip creation of highlighting groups, if there are no inactive
windows.
2017-06-26 22:30:48 +02:00
Christian Brabandt
560092a9ec highligher: fix the comparison before redefining hi group
The comparison in airline#highlighter#exec() was there to prevent to
call out to too many :hi calls by making sure that the newly to be
defined highlighting group will be actually different from the current
existing one.

However, that did not work, as the returned old highlight
group did never match the newly to be created one, since it
intentionally left the cterm attributes out for the gui and the gui
attributes for the terminal.

Therefore, fix the comparasion and make it compare the actual values
that we have.

This should make vim-airline a bit faster (hopefully!)
2017-06-26 22:27:01 +02:00
Lingnan Dai
7f19896dc6 Fix problems with AirlineSelect{Prev,Next}Tab
Use the entire list of buffers instead of the currently visible ones
2017-02-28 15:56:37 +00:00
112 changed files with 7271 additions and 2093 deletions

View File

@@ -19,3 +19,5 @@ if you are using Neovim:
#### expected behavior
????
#### screen shot (if possible)

52
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
name: CI
on:
push:
branches:
- master
- vim9script
pull_request:
branches:
- master
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
vim_version:
- 'v8.2.1000'
- 'v8.2.0000'
- 'v8.1.0000'
- 'v8.0.0000'
- 'v7.4'
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
- name: Setup Bundle
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Setup Vim
uses: thinca/action-setup-vim@v1
with:
vim_version: ${{ matrix.vim_version }}
- name: Install Dependencies
run: |
curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/simple.vim" -o autoload/airline/themes/simple.vim
curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/molokai.vim" -o autoload/airline/themes/molokai.vim
mkdir colors && curl -f -L 'https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim' -o colors/molokai.vim
- name: Run Test
run: rake ci

22
.github/workflows/reviewdog.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: reviewdog
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
vint:
name: runner / vint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: vint
uses: reviewdog/action-vint@v1
with:
github_token: ${{ secrets.github_token }}
level: error
reporter: github-pr-check

4
.gitignore vendored
View File

@@ -1,4 +1,8 @@
.DS_Store
doc/tags
*.lock
.vim-flavor
*.swp
.bundle
vendor

View File

@@ -1,8 +0,0 @@
language: ruby
before_install:
- curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/simple.vim" -o autoload/airline/themes/simple.vim
- curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/molokai.vim" -o autoload/airline/themes/molokai.vim
- mkdir colors && curl -f -L 'https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim' -o colors/molokai.vim
rvm:
- 1.9.3
script: rake ci

View File

@@ -2,7 +2,132 @@
This is the Changelog for the vim-airline project.
## [Unreleased]
## [0.12] - Unreleased
- New features
- Extensions:
- [poetv](https://github.com/petobens/poet-v) support
- [vim-lsp](https://github.com/prabirshrestha/vim-lsp) support
- [zoomwintab](https://github.com/troydm/zoomwintab.vim) support
- [Vaffle](https://github.com/cocopon/vaffle.vim) support
- [vim-dirvish](https://github.com/justinmk/vim-dirvish) support
- [fzf.vim](https://github.com/junegunn/fzf.vim) support
- [OmniSharp](https://github.com/OmniSharp/omnisharp-vim) support
- [searchcount](https://vim-jp.org/vimdoc-en/eval.html#searchcount()) support
- [fern.vim](https://github.com/lambdalisue/fern.vim) support
- [Vim-CMake](https://github.com/cdelledonne/vim-cmake) support
- [battery.vim](https://github.com/lambdalisue/battery.vim) support
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) support
- [gen_tags.vim](https://github.com/jsfaint/gen_tags.vim) support
- Improvements
- git branch can also be displayed using [gina.vim](https://github.com/lambdalisue/gina.vim)
- coc extensions can also show additional status messages
- [coc-git](https://github.com/neoclide/coc-git) extension integrated into hunks extension
- Other
- Introduce Vim script static analysis using [reviewdog](https://github.com/reviewdog/action-vint)
- Added multiple Vim versions to unit tests using Travis CI
- Added option to show short paths in the status line
## [0.11] - 2019-11-10
- New features
- Extensions:
- [Coc](https://github.com/neoclide/coc.nvim) support
- [Defx](https://github.com/Shougo/defx.nvim) support
- [gina](https://github.com/lambdalisue/gina.vim) support
- [vim-bookmark](https://github.com/MattesGroeger/vim-bookmarks) support
- [vista.vim](https://github.com/liuchengxu/vista.vim) support
- [tabws](https://github.com/s1341/vim-tabws) support for the tabline
- Improvements
- The statusline can be configured to be shown on top (in the tabline)
Set the `g:airline_statusline_ontop` to enable this experimental feature.
- If `buffer_idx_mode=2`, up to 89 mappings will be exposed to access more
buffers directly (issue [#1823](https://github.com/vim-airline/vim-airline/issues/1823))
- Allow to use `random` as special theme name, which will switch to a random
airline theme (at least if a random number can be generated :()
- The branch extensions now also displays whether the repository is in a clean state
(will append a ! or ⚡if the repository is considered dirty).
- The whitespace extensions will also check for conflict markers
- `:AirlineRefresh` command now takes an additional `!` attribute, that **skips**
recreating the highlighting groups (which might have a serious performance
impact if done very often, as might be the case when the configuration variable
`airline_skip_empty_sections` is active).
- airline can now also detect multiple cursor mode (issue [#1933](https://github.com/vim-airline/vim-airline/issues/1933))
- expose hunks output using the function `airline#extensions#hunks#get_raw_hunks()` to the outside [#1877](https://github.com/vim-airline/vim-airline/pull/1877)
- expose wordcount affected filetype list to the public using the `airline#extensions#wordcount#filetypes` variable [#1887](https://github.com/vim-airline/vim-airline/pull/1887)
- for the `:AirlineExtension` command, indicate whether the extension has been loaded from an external source [#1890](https://github.com/vim-airline/vim-airline/issues/1890)
- correctly load custom wordcount formatters [#1896](https://github.com/vim-airline/vim-airline/issues/1896)
- add a new short_path formatter for the tabline [#1898](https://github.com/vim-airline/vim-airline/pull/1898)
- several improvements to the branch, denite and tabline extension, as well as the async code for Vim and Neovim
- the term extension supports [neoterm](https://github.com/kassio/neoterm) vim plugin
## [0.10] - 2018-12-15
- New features
- Extensions:
- [LanguageClient](https://github.com/autozimu/LanguageClient-neovim)
- [vim-gutentags](https://github.com/ludovicchabant/vim-gutentags)
- [vim-localsearch](https://github.com/mox-mox/vim-localsearch)
- [xtabline](https://github.com/mg979/vim-xtabline)
- [vim-grepper](https://github.com/mhinz/vim-grepper)
- Add custom AirlineModeChanged autocommand, allowing to call user defined commands
whenever airline displays a different mode
- New :AirlineExtensions command, to show which extensions have been loaded
- Detect several new modes (e.g. completion, virtual replace, etc)
- Improvements
- Various performance improvements, should Vim keep responsive, even when
many highlighting groups need to be re-created
- Rework tabline extension
- Refactor [vim-ctrlspace](https://github.com/szw/vim-ctrlspace) extension
- Refactor the wordcount extension
- Reworked the po extension
- Allow to disable line numbers for the [Ale Extension](https://github.com/w0rp/ale)
- [fugitive](https://github.com/tpope/vim-fugitive) plugin has been refactored
causing adjustments for vim-airline, also uses Fugitives new API calls
- some improvements to Vims terminal mode
- Allow to use alternative seperators for inactive windows ([#1236](https://github.com/vim-airline/vim-airline/issues/1236))
- Statusline can be set to inactive, whenever Vim loses focus (using FocusLost autocommand)
## [0.9] - 2018-01-15
- Changes
- Look of default Airline Symbols has been improved [#1397](https://github.com/vim-airline/vim-airline/issues/1397)
- Airline does now set `laststatus=2` if needed
- Syntastic extension now displays warnings and errors separately
- Updates on Resize and SessionLoad events
- Add `maxlinenr` symbol to `airline_section_z`
- Add quickfix title to inactive windows
- Improvements
- Many performance improvements (using caching and async feature when possible)
- Cache changes to highlighting groups if `g:airline_highlighting_cache = 1` is set
- Allow to skip empty sections by setting `g:airline_skip_empty_sections` variable
- Make use of improved Vim Script API, if available (e.g. getwininfo())
- Support for Vims terminal feature (very experimental since it hasn't been stabilized yet)
- More configuration for the tabline extension (with clickable buffers for Neovim)
- Works better on smaller window sizes
- Make airline aware of git worktrees
- Improvements to the fugitive extension [#1603](https://github.com/vim-airline/vim-airline/issues/1603)
- Allows for configurable fileformat output if `g:airline#parts#ffenc#skip_expected_string` is set
- Improvements to the documentation
- New features
- Full async support for Vim 8 and Neovim
- Extensions:
- [vim-bufmru](https://github.com/mildred/vim-bufmru)
- [xkb-switch](https://github.com/ierton/xkb-switch)
- [input-source-switcher](https://github.com/vovkasm/input-source-switcher)
- [vimagit](https://github.com/jreybert/vimagit)
- [denite](https://github.com/Shougo/denite.nvim)
- [dein](https://github.com/Shougo/dein.vim)
- [vimtex](https://github.com/lervag/vimtex)
- [minpac](https://github.com/k-takata/minpac/)
- [vim-cursormode](https://github.com/vheon/vim-cursormode)
- [Neomake](https://github.com/neomake/neomake)
- [Ale](https://github.com/w0rp/ale)
- [vim-obsession](https://github.com/tpope/vim-obsession)
- spell (can also display Spell language)
- keymap
- Formatters:
- Formatters for JavaScript [#1617](https://github.com/vim-airline/vim-airline/issues/1617)
- Tabline: Allow for custom formatter for `tab_nr_type` [#1418](https://github.com/vim-airline/vim-airline/issues/1418)
- Customizable wordcount formatter [#1584](https://github.com/vim-airline/vim-airline/issues/1584)
- Add User autocommand for Theme changing [#1226](https://github.com/vim-airline/vim-airline/issues/1226)
- Shows mercurial mq status if hg mq extension is enabled
## [0.8] - 2016-03-09
- Changes
@@ -21,7 +146,7 @@ This is the Changelog for the vim-airline project.
- [taboo](https://github.com/gcmt/taboo.vim)
- [vim-ctrlspace](https://github.com/szw/vim-ctrlspace)
- [quickfixsigns](https://github.com/tomtom/quickfixsigns_vim)
- [YouCompleteMe](https://github.com/Valloric/YouCompleteMe)
- [YouCompleteMe](https://github.com/ycm-core/YouCompleteMe)
- [po.vim](http://www.vim.org/scripts/script.php?script_id=695)
- [unicode.vim](https://github.com/chrisbra/unicode.vim)
- wordcount
@@ -109,7 +234,10 @@ This is the Changelog for the vim-airline project.
- integration with other plugins: netrw, unite, nerdtree, undotree, gundo, tagbar, minibufexplr, ctrlp
- support for themes: 8 included
[Unreleased]: https://github.com/vim-airline/vim-airline/compare/v0.8...HEAD
[0.12]: https://github.com/vim-airline/vim-airline/compare/v0.11...HEAD
[0.11]: https://github.com/vim-airline/vim-airline/compare/v0.10...v0.11
[0.10]: https://github.com/vim-airline/vim-airline/compare/v0.9...v0.10
[0.9]: https://github.com/vim-airline/vim-airline/compare/v0.8...v0.9
[0.8]: https://github.com/vim-airline/vim-airline/compare/v0.7...v0.8
[0.7]: https://github.com/vim-airline/vim-airline/compare/v0.6...v0.7
[0.6]: https://github.com/vim-airline/vim-airline/compare/v0.5...v0.6

View File

@@ -4,17 +4,15 @@ Contributions and pull requests are welcome. Please take note of the following
* Adhere to the existing style as much as possible; notably, 2 space indents and long-form keywords.
* Keep the history clean! Squash your branches before you submit a pull request. `pull --rebase` is your friend.
* Any changes to the core should be tested against Vim 7.2.
* Any changes to the core should be tested against Vim 7.4.
# Bugs
Tracking down bugs can take a very long time due to different configurations, versions, and operating systems. To ensure a timely response, please help me out by doing the following:
* Reproduce it with this [minivimrc][7] repository to rule out any configuration conflicts. Even better, create a `gist` of your vimrc that is compatible with [pathogen][11].
* And to make it easier to reproduce, please supply the following:
* the `:version` of vim
* the commit of vim-airline you're using
* the OS that you're using, including terminal emulator, GUI vs non-GUI
* the `:version` of vim
* the commit of vim-airline you're using
* the OS that you're using, including terminal emulator, GUI vs non-GUI
# Themes
@@ -26,7 +24,5 @@ Tracking down bugs can take a very long time due to different configurations, ve
If you would like to take a more active role in improving vim-airline, please consider [becoming a maintainer][43].
[7]: https://github.com/bling/minivimrc
[11]: https://github.com/tpope/vim-pathogen
[14]: https://github.com/vim-airline/vim-airline/wiki/Screenshots
[43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer

View File

@@ -1,2 +1,2 @@
source 'https://rubygems.org'
gem 'vim-flavor', '~> 1.1'
gem 'vim-flavor', '~> 2.2.2'

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (C) 2013-2016 Bailey Ling
Copyright (C) 2013-2020 Bailey Ling, Christian Brabandt, et al.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),

141
README.md
View File

@@ -1,9 +1,63 @@
# vim-airline [![Build Status](https://travis-ci.org/vim-airline/vim-airline.png)](https://travis-ci.org/vim-airline/vim-airline)
# vim-airline [![Build Status](https://travis-ci.org/vim-airline/vim-airline.svg?branch=master)](https://travis-ci.org/vim-airline/vim-airline) [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/cb%40256bit.org) [![reviewdog](https://github.com/vim-airline/vim-airline/workflows/reviewdog/badge.svg?branch=master&event=push)](https://github.com/vim-airline/vim-airline/actions?query=workflow%3Areviewdog+event%3Apush+branch%3Amaster)
Lean &amp; mean status/tabline for vim that's light as air.
Lean & mean status/tabline for vim that's light as air.
![img](https://github.com/vim-airline/vim-airline/wiki/screenshots/demo.gif)
When the plugin is correctly loaded, there will be a nice statusline at the
bottom of each vim window.
That line consists of several sections, each one displaying some piece of
information. By default (without configuration) this line will look like this:
```
+-----------------------------------------------------------------------------+
|~ |
|~ |
|~ VIM - Vi IMproved |
|~ |
|~ version 8.2 |
|~ by Bram Moolenaar et al. |
|~ Vim is open source and freely distributable |
|~ |
|~ type :h :q<Enter> to exit |
|~ type :help<Enter> or <F1> for on-line help |
|~ type :help version8<Enter> for version info |
|~ |
|~ |
+-----------------------------------------------------------------------------+
| A | B | C X | Y | Z | [...] |
+-----------------------------------------------------------------------------+
```
The statusline is the colored line at the bottom, which contains the sections
(possibly in different colors):
section|meaning (example)
-------|------------------
A | displays the mode + additional flags like crypt/spell/paste (INSERT)
B | Environment status (VCS information - branch, hunk summary (master), [battery][61] level)
C | filename + read-only flag (~/.vim/vimrc RO)
X | filetype (vim)
Y | file encoding[fileformat] (utf-8[unix])
Z | current position in the file
[...] | additional sections (warning/errors/statistics) from external plugins (e.g. YCM, syntastic, ...)
The information in Section Z looks like this:
`10% ☰ 10/100 ln : 20`
This means:
```
10% - 10 percent down the top of the file
☰ 10 - current line 10
/100 ln - of 100 lines
: 20 - current column 20
```
For a better look, those sections can be colored differently, depending on various conditions
(e.g. the mode or whether the current file is 'modified')
# Features
* Tiny core written with extensibility in mind ([open/closed principle][8]).
@@ -12,11 +66,12 @@ Lean &amp; mean status/tabline for vim that's light as air.
[undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29],
[vim-signify][30], [quickfixsigns][39], [syntastic][5], [eclim][34],
[lawrencium][21], [virtualenv][31], [tmuxline][35], [taboo.vim][37],
[ctrlspace][38], [vim-bufmru][47], [vimagit][50], [denite][51] and more.
[ctrlspace][38], [vim-bufmru][47], [vimagit][50], [denite][51],
[vim.battery][61] and more.
* Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
* Optimized for speed; it loads in under a millisecond.
* Optimized for speed - loads in under a millisecond.
* Extensive suite of themes for popular color schemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others.
Note these are now external to this plugin. See [below][46] for detail.
Note these are now external to this plugin. More details can be found in the [themes repository][46].
* Supports 7.2 as the minimum Vim version.
* The master branch tries to be as stable as possible, and new features are merged in only after they have gone through a [full regression test][33].
* Unit testing suite.
@@ -39,7 +94,7 @@ Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
```
See https://github.com/vim-airline/vim-airline-themes for more.
See [vim-airline-themes][46] for more.
## Automatic truncation
@@ -62,6 +117,26 @@ Separators can be configured independently for the tabline, so here is how you c
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
In addition, you can also choose which path formatter airline uses. This affects how file paths are
displayed in each individual tab as well as the current buffer indicator in the upper right.
To do so, set the `formatter` field with:
let g:airline#extensions#tabline#formatter = 'default'
Here is a complete list of formatters with screenshots:
#### `default`
![image](https://user-images.githubusercontent.com/2652762/34422844-1d005efa-ebe6-11e7-8053-c784c0da7ba7.png)
#### `jsformatter`
![image](https://user-images.githubusercontent.com/2652762/34422843-1cf6a4d2-ebe6-11e7-810a-07e6eb08de24.png)
#### `unique_tail`
![image](https://user-images.githubusercontent.com/2652762/34422841-1ce5b4ec-ebe6-11e7-86e9-3d45c876068b.png)
#### `unique_tail_improved`
![image](https://user-images.githubusercontent.com/2652762/34422842-1cee23f2-ebe6-11e7-962d-97e068873077.png)
## Seamless integration
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).
@@ -84,7 +159,7 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
#### [syntastic][5]
![image](https://f.cloud.github.com/assets/306502/962864/9824c484-04f7-11e3-9928-da94f8c7da5a.png)
#### hunks ([vim-gitgutter][29] & [vim-signify][30])
#### hunks ([vim-gitgutter][29] & [vim-signify][30] & [coc-git][59])
![image](https://f.cloud.github.com/assets/306502/995185/73fc7054-09b9-11e3-9d45-618406c6ed98.png)
#### [vimagit][50]
@@ -108,6 +183,18 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
#### [vimtex][53]
![image](https://cloud.githubusercontent.com/assets/1798172/25799740/e77d5c2e-33ee-11e7-8660-d34ce4c5f13f.png)
#### [localsearch][54]
![image](https://raw.githubusercontent.com/mox-mox/vim-localsearch/master/vim-airline-localsearch-indicator.png)
#### [LanguageClient][57]
![image](https://user-images.githubusercontent.com/9622/45275524-52f45c00-b48b-11e8-8b83-a66240b10747.gif)
#### [Vim-CMake][60]
![image](https://user-images.githubusercontent.com/24732205/87788512-c876a380-c83d-11ea-9ee3-5f639f986a8f.png)
#### [vim.battery][61]
![image](https://user-images.githubusercontent.com/1969470/94561399-368b0e00-0264-11eb-94a0-f6b67c73d422.png)
## Extras
vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also:
@@ -115,6 +202,13 @@ vim-airline also supplies some supplementary stand-alone extensions. In additio
#### whitespace
![image](https://f.cloud.github.com/assets/306502/962401/2a75385e-04ef-11e3-935c-e3b9f0e954cc.png)
### statusline on top
The statusline can alternatively be drawn on top, making room for other plugins to use the statusline:
The example shows a custom statusline setting, that imitates Vims default statusline, while allowing
to call custom functions. Use `:let g:airline_statusline_ontop=1` to enable it.
![image](https://i.imgur.com/tW1lMRU.png)
## Configurable and extensible
#### Fine-tuned configuration
@@ -159,16 +253,14 @@ This plugin follows the standard runtime path structure, and as such it can be i
| [Plug][40] | `Plug 'vim-airline/vim-airline'` |
| [VAM][22] | `call vam#ActivateAddons([ 'vim-airline' ])` |
| [Dein][52] | `call dein#add('vim-airline/vim-airline')` |
| [minpac][54] | `call minpac#add('vim-airline/vim-airline')` |
| [minpac][55] | `call minpac#add('vim-airline/vim-airline')` |
| pack feature (native Vim 8 package feature)| `git clone https://github.com/vim-airline/vim-airline ~/.vim/pack/dist/start/vim-airline`<br/>Remember to run `:helptags ~/.vim/pack/dist/start/vim-airline/doc` to generate help tags |
| manual | copy all of the files into your `~/.vim` directory |
# Configuration
# Documentation
`:help airline`
The default setting of 'laststatus' is for the statusline to not appear until a split is created. If you want it to appear all the time, add the following to your vimrc:
`set laststatus=2`
# Integrating with powerline fonts
For the nice looking powerline symbols to appear, you will need to install a patched font. Instructions can be found in the official powerline [documentation][20]. Prepatched fonts can be found in the [powerline-fonts][3] repository.
@@ -181,7 +273,7 @@ Solutions to common problems can be found in the [Wiki][27].
# Performance
Whoa! Everything got slow all of a sudden...
Whoa! Everything got slow all of a sudden...
vim-airline strives to make it easy to use out of the box, which means that by default it will look for all compatible plugins that you have installed and enable the relevant extension.
@@ -189,7 +281,11 @@ Many optimizations have been made such that the majority of users will not see a
The [minivimrc][7] project has some helper mappings to troubleshoot performance related issues.
If you don't want all the bells and whistles enabled by default, you can define a value for `g:airline_extensions`. When this variable is defined, only the extensions listed will be loaded; an empty array would effectively disable all extensions.
If you don't want all the bells and whistles enabled by default, you can define a value for `g:airline_extensions`. When this variable is defined, only the extensions listed will be loaded; an empty array would effectively disable all extensions (e.g. `:let g:airline_extensions = []`).
Also, you can enable caching of the various syntax highlighting groups. This will try to prevent some of the more expensive `:hi` calls in Vim, which seem to be expensive in the Vim core at the expense of possibly not being one hundred percent correct all the time (especially if you often change highlighting groups yourself using `:hi` commands). To set this up do `:let g:airline_highlighting_cache = 1`. A `:AirlineRefresh` will however clear the cache.
In addition you might want to check out the [dark_minimal theme][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.
# Screenshots
@@ -203,7 +299,7 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
# License
MIT License. Copyright (c) 2013-2017 Bailey Ling & Contributors.
[MIT License][58]. Copyright (c) 2013-2020 Bailey Ling & Contributors.
[1]: https://github.com/Lokaltog/vim-powerline
[2]: https://github.com/Lokaltog/powerline
@@ -222,7 +318,7 @@ MIT License. Copyright (c) 2013-2017 Bailey Ling & Contributors.
[15]: https://github.com/techlivezheng/vim-plugin-minibufexpl
[16]: https://github.com/sjl/gundo.vim
[17]: https://github.com/mbbill/undotree
[18]: https://github.com/scrooloose/nerdtree
[18]: https://github.com/preservim/nerdtree
[19]: https://github.com/majutsushi/tagbar
[20]: https://powerline.readthedocs.org/en/master/installation.html#patched-fonts
[21]: https://bitbucket.org/ludovicchabant/vim-lawrencium
@@ -242,7 +338,7 @@ MIT License. Copyright (c) 2013-2017 Bailey Ling & Contributors.
[35]: https://github.com/edkolev/tmuxline.vim
[36]: https://github.com/edkolev/promptline.vim
[37]: https://github.com/gcmt/taboo.vim
[38]: https://github.com/szw/vim-ctrlspace
[38]: https://github.com/vim-ctrlspace/vim-ctrlspace
[39]: https://github.com/tomtom/quickfixsigns_vim
[40]: https://github.com/junegunn/vim-plug
[41]: https://github.com/bling
@@ -250,7 +346,7 @@ MIT License. Copyright (c) 2013-2017 Bailey Ling & Contributors.
[43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer
[44]: https://github.com/mhartington
[45]: https://github.com/vim-airline/vim-airline/commit/d7fd8ca649e441b3865551a325b10504cdf0711b
[46]: https://github.com/vim-airline/vim-airline#themes
[46]: https://github.com/vim-airline/vim-airline-themes#vim-airline-themes--
[47]: https://github.com/mildred/vim-bufmru
[48]: https://github.com/ierton/xkb-switch
[49]: https://github.com/vovkasm/input-source-switcher
@@ -258,4 +354,11 @@ MIT License. Copyright (c) 2013-2017 Bailey Ling & Contributors.
[51]: https://github.com/Shougo/denite.nvim
[52]: https://github.com/Shougo/dein.vim
[53]: https://github.com/lervag/vimtex
[54]: https://github.com/k-takata/minpac/
[54]: https://github.com/mox-mox/vim-localsearch
[55]: https://github.com/k-takata/minpac/
[56]: https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/dark_minimal.vim
[57]: https://github.com/autozimu/LanguageClient-neovim
[58]: https://github.com/vim-airline/vim-airline/blob/master/LICENSE
[59]: https://github.com/neoclide/coc-git
[60]: https://github.com/cdelledonne/vim-cmake
[61]: http://github.com/lambdalisue/battery.vim/

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -7,6 +7,11 @@ let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', [])
let s:sections = ['a','b','c','gutter','x','y','z', 'error', 'warning']
let s:inactive_funcrefs = []
let s:contexts = {}
let s:core_funcrefs = [
\ function('airline#extensions#apply'),
\ function('airline#extensions#default#apply') ]
function! airline#add_statusline_func(name)
call airline#add_statusline_funcref(function(a:name))
@@ -14,9 +19,7 @@ endfunction
function! airline#add_statusline_funcref(function)
if index(g:airline_statusline_funcrefs, a:function) >= 0
echohl WarningMsg
echo 'The airline statusline funcref '.string(a:function).' has already been added.'
echohl NONE
call airline#util#warning(printf('The airline statusline funcref "%s" has already been added.', string(a:function)))
return
endif
call add(g:airline_statusline_funcrefs, a:function)
@@ -34,6 +37,7 @@ function! airline#add_inactive_statusline_func(name)
endfunction
function! airline#load_theme()
let g:airline_theme = get(g:, 'airline_theme', 'dark')
if exists('*airline#themes#{g:airline_theme}#refresh')
call airline#themes#{g:airline_theme}#refresh()
endif
@@ -51,42 +55,63 @@ function! airline#load_theme()
call airline#update_statusline()
endfunction
function! airline#switch_theme(name)
" Load an airline theme
function! airline#switch_theme(name, ...)
let silent = get(a:000, '0', 0)
" get all available themes
let themes = airline#util#themes('')
let err = 0
try
let palette = g:airline#themes#{a:name}#palette "also lazy loads the theme
let g:airline_theme = a:name
catch
echohl WarningMsg | echo 'The specified theme cannot be found.' | echohl NONE
if index(themes, a:name) == -1
" Theme not available
if !silent
call airline#util#warning(printf('The specified theme "%s" cannot be found.', a:name))
endif
throw "not-found"
let err = 1
else
exe "ru autoload/airline/themes/". a:name. ".vim"
let g:airline_theme = a:name
endif
catch /^Vim/
" catch only Vim errors, not "not-found"
call airline#util#warning(printf('There is an error in theme "%s".', a:name))
if &vbs
call airline#util#warning(v:exception)
endif
let err = 1
endtry
if err
if exists('g:airline_theme')
return
else
let g:airline_theme = 'dark'
endif
endtry
endif
let w:airline_lastmode = ''
unlet! w:airline_lastmode
call airline#load_theme()
silent doautocmd User AirlineAfterTheme
call airline#util#doautocmd('AirlineAfterTheme')
" this is required to prevent clobbering the startup info message, i don't know why...
call airline#check_mode(winnr())
endfunction
" Try to load the right theme for the current colorscheme
function! airline#switch_matching_theme()
if exists('g:colors_name')
let existing = g:airline_theme
let theme = substitute(g:colors_name, '-', '_', 'g')
let theme = tr(tolower(g:colors_name), '-', '_')
try
let palette = g:airline#themes#{theme}#palette
call airline#switch_theme(theme)
call airline#switch_theme(theme, 1)
return 1
catch
for map in items(g:airline_theme_map)
if match(g:colors_name, map[0]) > -1
try
let palette = g:airline#themes#{map[1]}#palette
call airline#switch_theme(map[1])
call airline#switch_theme(map[1], 1)
catch
call airline#switch_theme(existing)
endtry
@@ -98,71 +123,116 @@ function! airline#switch_matching_theme()
return 0
endfunction
" Update the statusline
function! airline#update_statusline()
if airline#util#getwinvar(winnr(), 'airline_disabled', 0)
if airline#util#stl_disabled(winnr())
return
endif
for nr in filter(range(1, winnr('$')), 'v:val != winnr()')
if airline#util#getwinvar(nr, 'airline_disabled', 0)
continue
endif
call setwinvar(nr, 'airline_active', 0)
let context = { 'winnr': nr, 'active': 0, 'bufnr': winbufnr(nr) }
call s:invoke_funcrefs(context, s:inactive_funcrefs)
endfor
let range = filter(range(1, winnr('$')), 'v:val != winnr()')
" create inactive statusline
call airline#update_statusline_inactive(range)
unlet! w:airline_render_left w:airline_render_right
exe 'unlet! ' 'w:airline_section_'. join(s:sections, ' w:airline_section_')
" Now create the active statusline
let w:airline_active = 1
let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) }
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
endfunction
let s:contexts = {}
let s:core_funcrefs = [
\ function('airline#extensions#apply'),
\ function('airline#extensions#default#apply') ]
" Function to be called to make all statuslines inactive
" Triggered on FocusLost autocommand
function! airline#update_statusline_focuslost()
if get(g:, 'airline_focuslost_inactive', 0)
let bufnr=bufnr('%')
call airline#highlighter#highlight_modified_inactive(bufnr)
call airline#highlighter#highlight(['inactive'], bufnr)
call airline#update_statusline_inactive(range(1, winnr('$')))
endif
endfunction
" Function to draw inactive statuslines for inactive windows
function! airline#update_statusline_inactive(range)
if airline#util#stl_disabled(winnr())
return
endif
for nr in a:range
if airline#util#stl_disabled(nr)
continue
endif
call setwinvar(nr, 'airline_active', 0)
let context = { 'winnr': nr, 'active': 0, 'bufnr': winbufnr(nr) }
if get(g:, 'airline_inactive_alt_sep', 0)
call extend(context, {
\ 'left_sep': g:airline_left_alt_sep,
\ 'right_sep': g:airline_right_alt_sep }, 'keep')
endif
call s:invoke_funcrefs(context, s:inactive_funcrefs)
endfor
endfunction
" Gather output from all funcrefs which will later be returned by the
" airline#statusline() function
function! s:invoke_funcrefs(context, funcrefs)
let builder = airline#builder#new(a:context)
let err = airline#util#exec_funcrefs(a:funcrefs + s:core_funcrefs, builder, a:context)
if err == 1
let a:context.line = builder.build()
let s:contexts[a:context.winnr] = a:context
call setwinvar(a:context.winnr, '&statusline', '%!airline#statusline('.a:context.winnr.')')
let option = get(g:, 'airline_statusline_ontop', 0) ? '&tabline' : '&statusline'
call setwinvar(a:context.winnr, option, '%!airline#statusline('.a:context.winnr.')')
endif
endfunction
" Main statusline function per window
" will be set to the statusline option
function! airline#statusline(winnr)
if has_key(s:contexts, a:winnr)
return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line
endif
" in rare circumstances this happens...see #276
return ''
endfunction
" Check if mode has changed
function! airline#check_mode(winnr)
if !exists("s:airline_run")
let s:airline_run = 0
if !has_key(s:contexts, a:winnr)
return ''
endif
let s:airline_run += 1
let context = s:contexts[a:winnr]
if get(w:, 'airline_active', 1)
let l:m = mode()
let l:m = mode(1)
if l:m ==# "i"
let l:mode = ['insert']
elseif l:m ==# "R"
elseif l:m[0] ==# "i"
let l:mode = ['insert']
elseif l:m ==# "Rv"
let l:mode =['replace']
elseif l:m[0] ==# "R"
let l:mode = ['replace']
elseif l:m =~# '\v(v|V||s|S|)'
elseif l:m[0] =~# '\v(v|V||s|S|)'
let l:mode = ['visual']
elseif l:m ==# "t"
let l:mode = ['terminal']
elseif l:m[0] ==# "c"
let l:mode = ['commandline']
elseif l:m ==# "no" " does not work, most likely, Vim does not refresh the statusline in OP mode
let l:mode = ['normal']
elseif l:m[0:1] ==# 'ni'
let l:mode = ['insert']
let l:m = 'ni'
else
let l:mode = ['normal']
endif
if exists("*VMInfos") && !empty(VMInfos())
" Vim plugin Multiple Cursors https://github.com/mg979/vim-visual-multi
let l:m = 'multi'
endif
if index(['Rv', 'no', 'ni', 'ix', 'ic', 'multi'], l:m) == -1
let l:m = l:m[0]
endif
let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m)
else
let l:mode = ['inactive']
@@ -190,18 +260,26 @@ function! airline#check_mode(winnr)
endif
let mode_string = join(l:mode)
if s:airline_run < 3
" skip this round.
" When this function is run too early after startup,
" it forces a redraw by vim which will remove the intro screen.
let w:airline_lastmode = mode_string
return ''
endif
if get(w:, 'airline_lastmode', '') != mode_string
call airline#highlighter#highlight_modified_inactive(context.bufnr)
call airline#highlighter#highlight(l:mode, context.bufnr)
call airline#highlighter#highlight(l:mode, string(context.bufnr))
call airline#util#doautocmd('AirlineModeChanged')
let w:airline_lastmode = mode_string
endif
return ''
endfunction
function! airline#update_tabline()
if get(g:, 'airline_statusline_ontop', 0)
call airline#extensions#tabline#redraw()
endif
endfunction
function! airline#mode_changed()
" airline#visual_active
" Boolean: for when to get visual wordcount
" needed for the wordcount extension
let g:airline#visual_active = (mode() =~? '[vs]')
call airline#update_tabline()
endfunction

382
autoload/airline/async.vim Normal file
View File

@@ -0,0 +1,382 @@
" MIT License. Copyright (c) 2013-2020 Christian Brabandt et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:untracked_jobs = {}
let s:mq_jobs = {}
let s:po_jobs = {}
let s:clean_jobs = {}
" Generic functions handling on exit event of the various async functions
function! s:untracked_output(dict, buf)
if a:buf =~? ('^'. a:dict.cfg['untracked_mark'])
let a:dict.cfg.untracked[a:dict.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
else
let a:dict.cfg.untracked[a:dict.file] = ''
endif
endfunction
" also called from branch extension (for non-async vims)
function! airline#async#mq_output(buf, file)
let buf=a:buf
if !empty(a:buf)
if a:buf =~# 'no patches applied' ||
\ a:buf =~# "unknown command 'qtop'" ||
\ a:buf =~# "abort"
let buf = ''
elseif exists("b:mq") && b:mq isnot# buf
" make sure, statusline is updated
unlet! b:airline_head
endif
let b:mq = buf
endif
if has_key(s:mq_jobs, a:file)
call remove(s:mq_jobs, a:file)
endif
endfunction
function! s:po_output(buf, file)
if !empty(a:buf)
let b:airline_po_stats = printf("%s", a:buf)
else
let b:airline_po_stats = ''
endif
if has_key(s:po_jobs, a:file)
call remove(s:po_jobs, a:file)
endif
endfunction
function! s:valid_dir(dir)
if empty(a:dir) || !isdirectory(a:dir)
return getcwd()
endif
return a:dir
endfunction
function! airline#async#vcs_untracked(config, file, vcs)
if g:airline#init#vim_async
" Vim 8 with async support
noa call airline#async#vim_vcs_untracked(a:config, a:file)
else
" nvim async or vim without job-feature
noa call airline#async#nvim_vcs_untracked(a:config, a:file, a:vcs)
endif
endfunction
function! s:set_clean_variables(file, vcs, val)
let var=getbufvar(fnameescape(a:file), 'buffer_vcs_config', {})
if has_key(var, a:vcs) && has_key(var[a:vcs], 'dirty') &&
\ type(getbufvar(fnameescape(a:file), 'buffer_vcs_config')) == type({})
let var[a:vcs].dirty=a:val
try
call setbufvar(fnameescape(a:file), 'buffer_vcs_config', var)
unlet! b:airline_head
catch
endtry
endif
endfunction
function! s:set_clean_jobs_variable(vcs, file, id)
if !has_key(s:clean_jobs, a:vcs)
let s:clean_jobs[a:vcs] = {}
endif
let s:clean_jobs[a:vcs][a:file]=a:id
endfunction
function! s:on_exit_clean(...) dict abort
let buf=self.buf
call s:set_clean_variables(self.file, self.vcs, !empty(buf))
if has_key(get(s:clean_jobs, self.vcs, {}), self.file)
call remove(s:clean_jobs[self.vcs], self.file)
endif
endfunction
function! airline#async#vcs_clean(cmd, file, vcs)
if g:airline#init#vim_async
" Vim 8 with async support
noa call airline#async#vim_vcs_clean(a:cmd, a:file, a:vcs)
elseif has("nvim")
" nvim async
noa call airline#async#nvim_vcs_clean(a:cmd, a:file, a:vcs)
else
" Vim pre 8 using system()
call airline#async#vim7_vcs_clean(a:cmd, a:file, a:vcs)
endif
endfunction
if v:version >= 800 && has("job")
" Vim 8.0 with Job feature
" TODO: Check if we need the cwd option for the job_start() functions
" (only works starting with Vim 8.0.0902)
function! s:on_stdout(channel, msg) dict abort
let self.buf .= a:msg
endfunction
function! s:on_exit_mq(channel) dict abort
call airline#async#mq_output(self.buf, self.file)
endfunction
function! s:on_exit_untracked(channel) dict abort
call s:untracked_output(self, self.buf)
if has_key(s:untracked_jobs, self.file)
call remove(s:untracked_jobs, self.file)
endif
endfunction
function! s:on_exit_po(channel) dict abort
call s:po_output(self.buf, self.file)
call airline#extensions#po#shorten()
endfunction
function! airline#async#get_mq_async(cmd, file)
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
let cmd = a:cmd
else
let cmd = [&shell, &shellcmdflag, a:cmd]
endif
let options = {'cmd': a:cmd, 'buf': '', 'file': a:file}
if has_key(s:mq_jobs, a:file)
if job_status(get(s:mq_jobs, a:file)) == 'run'
return
elseif has_key(s:mq_jobs, a:file)
call remove(s:mq_jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit_mq', options)})
let s:mq_jobs[a:file] = id
endfunction
function! airline#async#get_msgfmt_stat(cmd, file)
if !executable('msgfmt')
" no msgfmt
return
endif
if g:airline#init#is_windows
let cmd = 'cmd /C ' . a:cmd. shellescape(a:file)
else
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
endif
let options = {'buf': '', 'file': a:file}
if has_key(s:po_jobs, a:file)
if job_status(get(s:po_jobs, a:file)) == 'run'
return
elseif has_key(s:po_jobs, a:file)
call remove(s:po_jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit_po', options)})
let s:po_jobs[a:file] = id
endfunction
function! airline#async#vim_vcs_clean(cmd, file, vcs)
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
let cmd = a:cmd
else
let cmd = [&shell, &shellcmdflag, a:cmd]
endif
let options = {'buf': '', 'vcs': a:vcs, 'file': a:file}
let jobs = get(s:clean_jobs, a:vcs, {})
if has_key(jobs, a:file)
if job_status(get(jobs, a:file)) == 'run'
return
elseif has_key(jobs, a:file)
" still running
return
" jobs dict should be cleaned on exit, so not needed here
" call remove(jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'null',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit_clean', options)})
call s:set_clean_jobs_variable(a:vcs, a:file, id)
endfunction
function! airline#async#vim_vcs_untracked(config, file)
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
let cmd = a:config['cmd'] . shellescape(a:file)
else
let cmd = [&shell, &shellcmdflag, a:config['cmd'] . shellescape(a:file)]
endif
let options = {'cfg': a:config, 'buf': '', 'file': a:file}
if has_key(s:untracked_jobs, a:file)
if job_status(get(s:untracked_jobs, a:file)) == 'run'
return
elseif has_key(s:untracked_jobs, a:file)
call remove(s:untracked_jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit_untracked', options)})
let s:untracked_jobs[a:file] = id
endfunction
elseif has("nvim")
" NVim specific functions
function! s:nvim_output_handler(job_id, data, event) dict
if a:event == 'stdout' || a:event == 'stderr'
let self.buf .= join(a:data)
endif
endfunction
function! s:nvim_untracked_job_handler(job_id, data, event) dict
if a:event == 'exit'
call s:untracked_output(self, self.buf)
if has_key(s:untracked_jobs, self.file)
call remove(s:untracked_jobs, self.file)
endif
endif
endfunction
function! s:nvim_mq_job_handler(job_id, data, event) dict
if a:event == 'exit'
call airline#async#mq_output(self.buf, self.file)
endif
endfunction
function! s:nvim_po_job_handler(job_id, data, event) dict
if a:event == 'exit'
call s:po_output(self.buf, self.file)
call airline#extensions#po#shorten()
endif
endfunction
function! airline#async#nvim_get_mq_async(cmd, file)
let config = {
\ 'buf': '',
\ 'file': a:file,
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')),
\ 'on_stdout': function('s:nvim_output_handler'),
\ 'on_stderr': function('s:nvim_output_handler'),
\ 'on_exit': function('s:nvim_mq_job_handler')
\ }
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
let cmd = a:cmd
else
let cmd = [&shell, &shellcmdflag, a:cmd]
endif
if has_key(s:mq_jobs, a:file)
call remove(s:mq_jobs, a:file)
endif
let id = jobstart(cmd, config)
let s:mq_jobs[a:file] = id
endfunction
function! airline#async#nvim_get_msgfmt_stat(cmd, file)
let config = {
\ 'buf': '',
\ 'file': a:file,
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')),
\ 'on_stdout': function('s:nvim_output_handler'),
\ 'on_stderr': function('s:nvim_output_handler'),
\ 'on_exit': function('s:nvim_po_job_handler')
\ }
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
" no msgfmt on windows?
return
else
let cmd = [&shell, &shellcmdflag, a:cmd. shellescape(a:file)]
endif
if has_key(s:po_jobs, a:file)
call remove(s:po_jobs, a:file)
endif
let id = jobstart(cmd, config)
let s:po_jobs[a:file] = id
endfunction
function! airline#async#nvim_vcs_clean(cmd, file, vcs)
let config = {
\ 'buf': '',
\ 'vcs': a:vcs,
\ 'file': a:file,
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')),
\ 'on_stdout': function('s:nvim_output_handler'),
\ 'on_stderr': function('s:nvim_output_handler'),
\ 'on_exit': function('s:on_exit_clean')}
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
let cmd = a:cmd
else
let cmd = [&shell, &shellcmdflag, a:cmd]
endif
if !has_key(s:clean_jobs, a:vcs)
let s:clean_jobs[a:vcs] = {}
endif
if has_key(s:clean_jobs[a:vcs], a:file)
" still running
return
" jobs dict should be cleaned on exit, so not needed here
" call remove(s:clean_jobs[a:vcs], a:file)
endif
let id = jobstart(cmd, config)
call s:set_clean_jobs_variable(a:vcs, a:file, id)
endfunction
endif
" Should work in either Vim pre 8 or Nvim
function! airline#async#nvim_vcs_untracked(cfg, file, vcs)
let cmd = a:cfg.cmd . shellescape(a:file)
let id = -1
let config = {
\ 'buf': '',
\ 'vcs': a:vcs,
\ 'cfg': a:cfg,
\ 'file': a:file,
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h'))
\ }
if has("nvim")
call extend(config, {
\ 'on_stdout': function('s:nvim_output_handler'),
\ 'on_exit': function('s:nvim_untracked_job_handler')})
if has_key(s:untracked_jobs, config.file)
" still running
return
endif
try
let id = jobstart(cmd, config)
catch
" catch-all, jobstart() failed, fall back to system()
let id=-1
endtry
let s:untracked_jobs[a:file] = id
endif
" vim without job feature or nvim jobstart failed
if id < 1
let output=system(cmd)
call s:untracked_output(config, output)
call airline#extensions#branch#update_untracked_config(a:file, a:vcs)
endif
endfunction
function! airline#async#vim7_vcs_clean(cmd, file, vcs)
" Vim pre 8, fallback using system()
" don't want to to see error messages
if g:airline#init#is_windows && &shell =~ 'cmd'
let cmd = a:cmd .' 2>nul'
elseif g:airline#init#is_windows && &shell =~ 'powerline'
let cmd = a:cmd .' 2> $null'
else
let cmd = a:cmd .' 2>/dev/null'
endif
let output=system(cmd)
call s:set_clean_variables(a:file, a:vcs, !empty(output))
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -22,7 +22,19 @@ function! s:prototype.add_raw(text) dict
call add(self._sections, ['', a:text])
endfunction
function! s:get_prev_group(sections, i)
function! s:prototype.insert_section(group, contents, position) dict
call insert(self._sections, [a:group, a:contents], a:position)
endfunction
function! s:prototype.insert_raw(text, position) dict
call insert(self._sections, ['', a:text], a:position)
endfunction
function! s:prototype.get_position() dict
return len(self._sections)
endfunction
function! airline#builder#get_prev_group(sections, i)
let x = a:i - 1
while x >= 0
let group = a:sections[x][0]
@@ -34,6 +46,19 @@ function! s:get_prev_group(sections, i)
return ''
endfunction
function! airline#builder#get_next_group(sections, i)
let x = a:i + 1
let l = len(a:sections)
while x < l
let group = a:sections[x][0]
if group != '' && group != '|'
return group
endif
let x = x + 1
endwhile
return ''
endfunction
function! s:prototype.build() dict
let side = 1
let line = ''
@@ -48,8 +73,10 @@ function! s:prototype.build() dict
let group = section[0]
let contents = section[1]
let pgroup = prev_group
let prev_group = s:get_prev_group(self._sections, i)
if group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
let prev_group = airline#builder#get_prev_group(self._sections, i)
if group ==# 'airline_c' && &buftype ==# 'terminal' && self._context.active
let group = 'airline_term'
elseif group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
let group = 'airline_c'. self._context.bufnr
elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
let prev_group = 'airline_c'. self._context.bufnr
@@ -100,30 +127,33 @@ function! s:prototype.build() dict
return line
endfunction
function! s:should_change_group(group1, group2)
function! airline#builder#should_change_group(group1, group2)
if a:group1 == a:group2
return 0
endif
let color1 = airline#highlighter#get_highlight(a:group1)
let color2 = airline#highlighter#get_highlight(a:group2)
if g:airline_gui_mode ==# 'gui'
return color1[1] != color2[1] || color1[0] != color2[0]
else
return color1[3] != color2[3] || color1[2] != color2[2]
endif
return color1[1] != color2[1] || color1[0] != color2[0]
\ || color1[2] != color2[2] || color1[3] != color2[3]
endfunction
function! s:get_transitioned_seperator(self, prev_group, group, side)
let line = ''
call airline#highlighter#add_separator(a:prev_group, a:group, a:side)
let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep
let line .= '%#'.a:group.'#'
if get(a:self._context, 'tabline', 0) && get(g:, 'airline#extensions#tabline#alt_sep', 0) && a:group ==# 'airline_tabsel' && a:side
call airline#highlighter#add_separator(a:prev_group, a:group, 0)
let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
let line .= a:self._context.right_sep.'%#'.a:group.'#'
else
call airline#highlighter#add_separator(a:prev_group, a:group, a:side)
let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep
let line .= '%#'.a:group.'#'
endif
return line
endfunction
function! s:get_seperator(self, prev_group, group, side)
if s:should_change_group(a:prev_group, a:group)
if airline#builder#should_change_group(a:prev_group, a:group)
return s:get_transitioned_seperator(a:self, a:prev_group, a:group, a:side)
else
return a:side ? a:self._context.left_alt_sep : a:self._context.right_alt_sep
@@ -132,6 +162,7 @@ endfunction
function! s:get_accented_line(self, group, contents)
if a:self._context.active
" active window
let contents = []
let content_parts = split(a:contents, '__accent')
for cpart in content_parts
@@ -141,6 +172,7 @@ function! s:get_accented_line(self, group, contents)
let line = join(contents, a:group)
let line = substitute(line, '__restore__', a:group, 'g')
else
" inactive window
let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g')
let line = substitute(line, '%#__restore__#', '', 'g')
endif
@@ -207,4 +239,3 @@ function! airline#builder#new(context)
\ }, 'keep')
return builder
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -49,4 +49,3 @@ function! airline#debug#profile3()
profile pause
noautocmd qall!
endfunction

View File

@@ -1,8 +1,9 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:loaded_ext = []
let s:ext = {}
let s:ext._theme_funcrefs = []
@@ -22,14 +23,25 @@ endfunction
let s:script_path = tolower(resolve(expand('<sfile>:p:h')))
let s:filetype_overrides = {
\ 'nerdtree': [ 'NERD', '' ],
\ 'coc-explorer': [ 'CoC Explorer', '' ],
\ 'defx': ['defx', '%{b:defx.paths[0]}'],
\ 'fugitive': ['fugitive', '%{airline#util#wrap(airline#extensions#branch#get_head(),80)}'],
\ 'gundo': [ 'Gundo', '' ],
\ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ],
\ 'help': [ 'Help', '%f' ],
\ 'minibufexpl': [ 'MiniBufExplorer', '' ],
\ 'startify': [ 'startify', '' ],
\ 'vim-plug': [ 'Plugins', '' ],
\ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ],
\ 'vimshell': ['vimshell','%{vimshell#get_status_string()}'],
\ 'vaffle' : [ 'Vaffle', '%{b:vaffle.dir}' ],
\ }
if get(g:, 'airline#extensions#nerdtree_statusline', 1)
let s:filetype_overrides['nerdtree'] = [ get(g:, 'NERDTreeStatusline', 'NERD'), '' ]
else
let s:filetype_overrides['nerdtree'] = ['NERDTree', '']
endif
let s:filetype_regex_overrides = {}
function! s:check_defined_section(name)
@@ -56,32 +68,39 @@ function! airline#extensions#apply_left_override(section1, section2)
let w:airline_render_right = 0
endfunction
let s:active_winnr = -1
function! airline#extensions#apply(...)
let s:active_winnr = winnr()
let filetype_overrides = get(s:, 'filetype_overrides', {})
call extend(filetype_overrides, get(g:, 'airline_filetype_overrides', {}), 'force')
if s:is_excluded_window()
return -1
endif
if &buftype == 'help'
call airline#extensions#apply_left_override('Help', '%f')
if &buftype == 'terminal'
let w:airline_section_x = ''
let w:airline_section_y = ''
let w:airline_render_right = 1
endif
if &previewwindow
if &previewwindow && empty(get(w:, 'airline_section_a', ''))
let w:airline_section_a = 'Preview'
let w:airline_section_b = ''
let w:airline_section_c = bufname(winbufnr(winnr()))
endif
if has_key(s:filetype_overrides, &ft)
let args = s:filetype_overrides[&ft]
if has_key(filetype_overrides, &ft) &&
\ ((&filetype == 'help' && &buftype == 'help') || &filetype !~ 'help')
" for help files only override it, if the buftype is also of type 'help',
" else it would trigger when editing Vim help files
let args = filetype_overrides[&ft]
call airline#extensions#apply_left_override(args[0], args[1])
endif
if &buftype == 'help'
let w:airline_section_x = ''
let w:airline_section_y = ''
let w:airline_render_right = 1
endif
for item in items(s:filetype_regex_overrides)
if match(&ft, item[0]) >= 0
call airline#extensions#apply_left_override(item[1][0], item[1][1])
@@ -113,16 +132,8 @@ function! airline#extensions#load_theme()
call airline#util#exec_funcrefs(s:ext._theme_funcrefs, g:airline#themes#{g:airline_theme}#palette)
endfunction
function! s:sync_active_winnr()
if exists('#airline') && winnr() != s:active_winnr
call airline#update_statusline()
endif
endfunction
function! airline#extensions#load()
let loaded_ext = []
" non-trivial number of external plugins use eventignore=all, so we need to account for that
autocmd CursorMoved * call <sid>sync_active_winnr()
let s:loaded_ext = []
if exists('g:airline_extensions')
for ext in g:airline_extensions
@@ -130,32 +141,62 @@ function! airline#extensions#load()
call airline#extensions#{ext}#init(s:ext)
catch /^Vim\%((\a\+)\)\=:E117/ " E117, function does not exist
call airline#util#warning("Extension '".ext."' not installed, ignoring!")
continue
endtry
call add(s:loaded_ext, ext)
endfor
return
endif
call airline#extensions#quickfix#init(s:ext)
call add(loaded_ext, 'quickfix')
call add(s:loaded_ext, 'quickfix')
if get(g:, 'loaded_unite', 0)
if get(g:, 'loaded_unite', 0) && get(g:, 'airline#extensions#unite#enabled', 1)
call airline#extensions#unite#init(s:ext)
call add(loaded_ext, 'unite')
call add(s:loaded_ext, 'unite')
endif
if get(g:, 'loaded_denite', 0)
if get(g:, 'loaded_denite', 0) && get(g:, 'airline#extensions#denite#enabled', 1)
call airline#extensions#denite#init(s:ext)
call add(loaded_ext, 'denite')
call add(s:loaded_ext, 'denite')
endif
if get(g:, 'loaded_gina', 0) && get(g:, 'airline#extensions#gina#enabled', 1)
call airline#extensions#gina#init(s:ext)
call add(s:loaded_ext, 'gina')
endif
if get(g:, 'fern_loaded', 0) && get(g:, 'airline#extensions#fern#enabled', 1)
call airline#extensions#fern#init(s:ext)
call add(s:loaded_ext, 'fern')
endif
if exists(':NetrwSettings')
call airline#extensions#netrw#init(s:ext)
call add(loaded_ext, 'netrw')
call add(s:loaded_ext, 'netrw')
endif
if get(g:, 'airline#extensions#ycm#enabled', 0)
" fzf buffers are also terminal buffers, so this must be above term.
if exists(':FZF') && get(g:, 'airline#extensions#fzf#enabled', 1)
call airline#extensions#fzf#init(s:ext)
call add(s:loaded_ext, 'fzf')
endif
" Vim-CMake buffers are also terminal buffers, so this must be above term.
if get(g:, 'loaded_cmake', 0) && get(g:, 'airline#extensions#vimcmake#enabled', 1)
call airline#extensions#vimcmake#init(s:ext)
call add(s:loaded_ext, 'vimcmake')
endif
if (has("terminal") || has('nvim')) &&
\ get(g:, 'airline#extensions#term#enabled', 1)
call airline#extensions#term#init(s:ext)
call add(s:loaded_ext, 'term')
endif
if get(g:, 'airline#extensions#ycm#enabled', 0) && exists('g:loaded_youcompleteme')
call airline#extensions#ycm#init(s:ext)
call add(loaded_ext, 'ycm')
call add(s:loaded_ext, 'ycm')
endif
if get(g:, 'loaded_vimfiler', 0)
@@ -164,156 +205,260 @@ function! airline#extensions#load()
if get(g:, 'loaded_ctrlp', 0)
call airline#extensions#ctrlp#init(s:ext)
call add(loaded_ext, 'ctrlp')
call add(s:loaded_ext, 'ctrlp')
endif
if get(g:, 'loaded_localsearch', 0)
call airline#extensions#localsearch#init(s:ext)
call add(s:loaded_ext, 'localsearch')
endif
if get(g:, 'CtrlSpaceLoaded', 0)
call airline#extensions#ctrlspace#init(s:ext)
call add(loaded_ext, 'ctrlspace')
call add(s:loaded_ext, 'ctrlspace')
endif
if get(g:, 'command_t_loaded', 0)
call airline#extensions#commandt#init(s:ext)
call add(loaded_ext, 'commandt')
call add(s:loaded_ext, 'commandt')
endif
if exists(':UndotreeToggle')
call airline#extensions#undotree#init(s:ext)
call add(loaded_ext, 'undotree')
call add(s:loaded_ext, 'undotree')
endif
if get(g:, 'airline#extensions#hunks#enabled', 1)
\ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes') || exists('g:loaded_quickfixsigns'))
\ && (exists('g:loaded_signify')
\ || exists('g:loaded_gitgutter')
\ || exists('g:loaded_changes')
\ || exists('g:loaded_quickfixsigns')
\ || exists(':CocCommand'))
call airline#extensions#hunks#init(s:ext)
call add(loaded_ext, 'hunks')
call add(s:loaded_ext, 'hunks')
endif
if get(g:, 'airline#extensions#vimagit#enabled', 1)
\ && (exists('g:loaded_magit'))
call airline#extensions#vimagit#init(s:ext)
call add(loaded_ext, 'vimagit')
call add(s:loaded_ext, 'vimagit')
endif
if get(g:, 'airline#extensions#tagbar#enabled', 1)
\ && exists(':TagbarToggle')
call airline#extensions#tagbar#init(s:ext)
call add(loaded_ext, 'tagbar')
call add(s:loaded_ext, 'tagbar')
endif
if get(g:, 'airline#extensions#vista#enabled', 1)
\ && exists(':Vista')
call airline#extensions#vista#init(s:ext)
call add(s:loaded_ext, 'vista')
endif
if get(g:, 'airline#extensions#bookmark#enabled', 1)
\ && exists(':BookmarkToggle')
call airline#extensions#bookmark#init(s:ext)
call add(s:loaded_ext, 'bookmark')
endif
if get(g:, 'airline#extensions#csv#enabled', 1)
\ && (get(g:, 'loaded_csv', 0) || exists(':Table'))
call airline#extensions#csv#init(s:ext)
call add(loaded_ext, 'csv')
call add(s:loaded_ext, 'csv')
endif
if get(g:, 'airline#extensions#zoomwintab#enabled', 0)
call airline#extensions#zoomwintab#init(s:ext)
call add(s:loaded_ext, 'zoomwintab')
endif
if exists(':VimShell')
let s:filetype_overrides['vimshell'] = ['vimshell','%{vimshell#get_status_string()}']
let s:filetype_regex_overrides['^int-'] = ['vimshell','%{substitute(&ft, "int-", "", "")}']
endif
if get(g:, 'airline#extensions#branch#enabled', 1)
\ && (exists('*fugitive#head') || exists('*lawrencium#statusline') ||
\ (get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine')))
if get(g:, 'airline#extensions#branch#enabled', 1) && (
\ airline#util#has_fugitive() ||
\ airline#util#has_gina() ||
\ airline#util#has_lawrencium() ||
\ airline#util#has_vcscommand() ||
\ airline#util#has_custom_scm())
call airline#extensions#branch#init(s:ext)
call add(loaded_ext, 'branch')
call add(s:loaded_ext, 'branch')
endif
if get(g:, 'airline#extensions#bufferline#enabled', 1)
\ && exists('*bufferline#get_status_string')
call airline#extensions#bufferline#init(s:ext)
call add(loaded_ext, 'bufferline')
call add(s:loaded_ext, 'bufferline')
endif
if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV)))
if get(g:, 'airline#extensions#fugitiveline#enabled', 1)
\ && airline#util#has_fugitive()
\ && index(s:loaded_ext, 'bufferline') == -1
call airline#extensions#fugitiveline#init(s:ext)
call add(s:loaded_ext, 'fugitiveline')
endif
" NOTE: This means that if both virtualenv and poetv are enabled and
" available, poetv silently takes precedence and the virtualenv
" extension won't be initialized. Since both extensions currently just
" add a virtualenv identifier section to the airline, this seems
" acceptable.
if (get(g:, 'airline#extensions#poetv#enabled', 0) && (exists(':PoetvActivate')))
call airline#extensions#poetv#init(s:ext)
call add(s:loaded_ext, 'poetv')
elseif (get(g:, 'airline#extensions#virtualenv#enabled', 0) && (exists(':VirtualEnvList')))
call airline#extensions#virtualenv#init(s:ext)
call add(loaded_ext, 'virtualenv')
call add(s:loaded_ext, 'virtualenv')
elseif (get(g:, 'airline#extensions#poetv#enabled', 0) && (isdirectory($VIRTUAL_ENV)))
call airline#extensions#poetv#init(s:ext)
call add(s:loaded_ext, 'poetv')
endif
if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate'))
call airline#extensions#eclim#init(s:ext)
call add(loaded_ext, 'eclim')
call add(s:loaded_ext, 'eclim')
endif
if get(g:, 'airline#extensions#syntastic#enabled', 1)
\ && exists(':SyntasticCheck')
call airline#extensions#syntastic#init(s:ext)
call add(loaded_ext, 'syntastic')
call add(s:loaded_ext, 'syntastic')
endif
if (get(g:, 'airline#extensions#ale#enabled', 1) && exists(':ALELint'))
call airline#extensions#ale#init(s:ext)
call add(loaded_ext, 'ale')
call add(s:loaded_ext, 'ale')
endif
if (get(g:, 'airline#extensions#lsp#enabled', 1) && exists(':LspDeclaration'))
call airline#extensions#lsp#init(s:ext)
call add(s:loaded_ext, 'lsp')
endif
if (get(g:, 'airline#extensions#nvimlsp#enabled', 1)
\ && exists(':LspInstallInfo'))
call airline#extensions#nvimlsp#init(s:ext)
call add(s:loaded_ext, 'nvimlsp')
endif
if (get(g:, 'airline#extensions#coc#enabled', 1) && exists(':CocCommand'))
call airline#extensions#coc#init(s:ext)
call add(s:loaded_ext, 'coc')
endif
if (get(g:, 'airline#extensions#languageclient#enabled', 1) && exists(':LanguageClientStart'))
call airline#extensions#languageclient#init(s:ext)
call add(s:loaded_ext, 'languageclient')
endif
if get(g:, 'airline#extensions#whitespace#enabled', 1)
call airline#extensions#whitespace#init(s:ext)
call add(loaded_ext, 'whitespace')
call add(s:loaded_ext, 'whitespace')
endif
if (get(g:, 'airline#extensions#neomake#enabled', 1) && exists(':Neomake'))
call airline#extensions#neomake#init(s:ext)
call add(loaded_ext, 'neomake')
call add(s:loaded_ext, 'neomake')
endif
if get(g:, 'airline#extensions#po#enabled', 1) && executable('msgfmt')
call airline#extensions#po#init(s:ext)
call add(loaded_ext, 'po')
call add(s:loaded_ext, 'po')
endif
if get(g:, 'airline#extensions#wordcount#enabled', 1)
call airline#extensions#wordcount#init(s:ext)
call add(loaded_ext, 'wordcount')
call add(s:loaded_ext, 'wordcount')
endif
if get(g:, 'airline#extensions#tabline#enabled', 0)
call airline#extensions#tabline#init(s:ext)
call add(loaded_ext, 'tabline')
call add(s:loaded_ext, 'tabline')
endif
if get(g:, 'airline#extensions#tmuxline#enabled', 1) && exists(':Tmuxline')
call airline#extensions#tmuxline#init(s:ext)
call add(loaded_ext, 'tmuxline')
call add(s:loaded_ext, 'tmuxline')
endif
if get(g:, 'airline#extensions#promptline#enabled', 1) && exists(':PromptlineSnapshot') && len(get(g:, 'airline#extensions#promptline#snapshot_file', ''))
call airline#extensions#promptline#init(s:ext)
call add(loaded_ext, 'promptline')
call add(s:loaded_ext, 'promptline')
endif
if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2
if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && get(g:, 'loaded_nrrw_rgn', 0)
call airline#extensions#nrrwrgn#init(s:ext)
call add(loaded_ext, 'nrrwrgn')
call add(s:loaded_ext, 'nrrwrgn')
endif
if get(g:, 'airline#extensions#unicode#enabled', 1) && exists(':UnicodeTable') == 2
call airline#extensions#unicode#init(s:ext)
call add(loaded_ext, 'nrrwrgn')
call add(s:loaded_ext, 'unicode')
endif
if (get(g:, 'airline#extensions#capslock#enabled', 1) && exists('*CapsLockStatusline'))
call airline#extensions#capslock#init(s:ext)
call add(loaded_ext, 'capslock')
call add(s:loaded_ext, 'capslock')
endif
if (get(g:, 'airline#extensions#gutentags#enabled', 1) && get(g:, 'loaded_gutentags', 0))
call airline#extensions#gutentags#init(s:ext)
call add(s:loaded_ext, 'gutentags')
endif
if get(g:, 'airline#extensions#gen_tags#enabled', 1) && (get(g:, 'loaded_gentags#gtags', 0) || get(g:, 'loaded_gentags#ctags', 0))
call airline#extensions#gen_tags#init(s:ext)
call add(s:loaded_ext, 'gen_tags')
endif
if (get(g:, 'airline#extensions#grepper#enabled', 1) && get(g:, 'loaded_grepper', 0))
call airline#extensions#grepper#init(s:ext)
call add(s:loaded_ext, 'grepper')
endif
if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib'))
call airline#extensions#xkblayout#init(s:ext)
call add(loaded_ext, 'xkblayout')
call add(s:loaded_ext, 'xkblayout')
endif
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap'))
call airline#extensions#keymap#init(s:ext)
call add(s:loaded_ext, 'keymap')
endif
if (get(g:, 'airline#extensions#windowswap#enabled', 1) && get(g:, 'loaded_windowswap', 0))
call airline#extensions#windowswap#init(s:ext)
call add(loaded_ext, 'windowswap')
call add(s:loaded_ext, 'windowswap')
endif
if (get(g:, 'airline#extensions#obsession#enabled', 1) && exists('*ObsessionStatus'))
call airline#extensions#obsession#init(s:ext)
call add(loaded_ext, 'obsession')
call add(s:loaded_ext, 'obsession')
endif
runtime autoload/vimtex.vim
if (get(g:, 'airline#extensions#vimtex#enabled', 1)) && exists('*vimtex#init')
call airline#extensions#vimtex#init(s:ext)
call add(loaded_ext, 'vimtex')
if get(g:, 'airline#extensions#vimtex#enabled', 1)
runtime autoload/vimtex.vim
if exists('*vimtex#init')
call airline#extensions#vimtex#init(s:ext)
call add(s:loaded_ext, 'vimtex')
endif
endif
if (get(g:, 'airline#extensions#cursormode#enabled', 0))
call airline#extensions#cursormode#init(s:ext)
call add(s:loaded_ext, 'cursormode')
endif
if get(g:, 'airline#extensions#searchcount#enabled', 1) && exists('*searchcount')
call airline#extensions#searchcount#init(s:ext)
call add(s:loaded_ext, 'searchcount')
endif
if get(g:, 'loaded_battery', 0) && get(g:, 'airline#extensions#battery#enabled', 0)
call airline#extensions#battery#init(s:ext)
call add(s:loaded_ext, 'battery')
endif
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
@@ -326,15 +471,31 @@ function! airline#extensions#load()
\ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0
let name = fnamemodify(file, ':t:r')
if !get(g:, 'airline#extensions#'.name.'#enabled', 1) ||
\ index(loaded_ext, name) > -1
\ index(s:loaded_ext, name) > -1
continue
endif
try
call airline#extensions#{name}#init(s:ext)
" mark as external
call add(s:loaded_ext, name.'*')
catch
endtry
endif
endfor
endif
if exists(':Dirvish') && get(g:, 'airline#extensions#dirvish#enabled', 1)
call airline#extensions#dirvish#init(s:ext)
call add(s:loaded_ext, 'dirvish')
endif
if (get(g:, 'airline#extensions#omnisharp#enabled', 1) && get(g:, 'OmniSharp_loaded', 0))
call airline#extensions#omnisharp#init(s:ext)
call add(s:loaded_ext, 'omnisharp')
endif
endfunction
function! airline#extensions#get_loaded_extensions()
return s:loaded_ext
endfunction

View File

@@ -1,31 +1,111 @@
" MIT License. Copyright (c) 2013-2017 Bjorn Neergaard, w0rp
" MIT License. Copyright (c) 2013-2020 Bjorn Neergaard, w0rp et al.
" Plugin: https://github.com/dense-analysis/ale
" vim: et ts=2 sts=2 sw=2
let s:error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:')
scriptencoding utf-8
if !get(g:, 'loaded_ale_dont_use_this_in_other_plugins_please', 0)
finish
endif
function! s:airline_ale_count(cnt, symbol)
return a:cnt ? a:symbol. a:cnt : ''
endfunction
function! s:legacy_airline_ale_get_line_number(cnt, type) abort
" Before ALE introduced the FirstProblem API function, this is how
" airline would get the line numbers:
" 1. Get the whole loclist; 2. Filter it for the desired problem type.
" 3. Return the line number of the first element in the filtered list.
if a:cnt == 0
return ''
endif
let buffer = bufnr('')
let problem_type = (a:type ==# 'error') ? 'E' : 'W'
let problems = copy(ale#engine#GetLoclist(buffer))
call filter(problems, 'v:val.bufnr is buffer && v:val.type is# problem_type')
if empty(problems)
return ''
endif
let open_lnum_symbol = get(g:, 'airline#extensions#ale#open_lnum_symbol', '(L')
let close_lnum_symbol = get(g:, 'airline#extensions#ale#close_lnum_symbol', ')')
return open_lnum_symbol . problems[0].lnum . close_lnum_symbol
endfunction
function! s:new_airline_ale_get_line_number(cnt, type) abort
" The FirstProblem call in ALE is a far more efficient way
" of obtaining line number data. If the installed ALE supports
" it, we should use this method of getting line data.
if a:cnt == 0
return ''
endif
let l:buffer = bufnr('')
" Try to get the first error from ALE.
let l:result = ale#statusline#FirstProblem(l:buffer, a:type)
if empty(l:result)
" If there are no errors then try and check for style errors.
let l:result = ale#statusline#FirstProblem(l:buffer, 'style_' . a:type)
endif
if empty(l:result)
return ''
endif
let l:open_lnum_symbol =
\ get(g:, 'airline#extensions#ale#open_lnum_symbol', '(L')
let l:close_lnum_symbol =
\ get(g:, 'airline#extensions#ale#close_lnum_symbol', ')')
return open_lnum_symbol . l:result.lnum . close_lnum_symbol
endfunction
function! s:airline_ale_get_line_number(cnt, type) abort
" Use the new ALE statusline API function if it is available.
if exists("*ale#statusline#FirstProblem")
return s:new_airline_ale_get_line_number(a:cnt, a:type)
endif
return s:legacy_airline_ale_get_line_number(a:cnt, a:type)
endfunction
function! airline#extensions#ale#get(type)
if !exists(':ALELint')
return ''
endif
let l:is_err = a:type ==# 'error'
let l:counts = ale#statusline#Count(bufnr(''))
let l:symbol = l:is_err ? s:error_symbol : s:warning_symbol
let error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:')
let warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:')
let checking_symbol = get(g:, 'airline#extensions#ale#checking_symbol', '...')
let show_line_numbers = get(g:, 'airline#extensions#ale#show_line_numbers', 1)
if type(l:counts) == type({}) && has_key(l:counts, 'error')
" Use the current Dictionary format.
let l:errors = l:counts.error + l:counts.style_error
let l:num = l:is_err ? l:errors : l:counts.total - l:errors
else
" Use the old List format.
let l:num = l:is_err ? l:counts[0] : l:counts[1]
let is_err = a:type ==# 'error'
if ale#engine#IsCheckingBuffer(bufnr('')) == 1
return is_err ? '' : checking_symbol
endif
if l:num == 0
return ''
let symbol = is_err ? error_symbol : warning_symbol
let counts = ale#statusline#Count(bufnr(''))
if type(counts) == type({}) && has_key(counts, 'error')
" Use the current Dictionary format.
let errors = counts.error + counts.style_error
let num = is_err ? errors : counts.total - errors
else
return l:symbol . l:num
" Use the old List format.
let num = is_err ? counts[0] : counts[1]
endif
if show_line_numbers == 1
return s:airline_ale_count(num, symbol) . <sid>airline_ale_get_line_number(num, a:type)
else
return s:airline_ale_count(num, symbol)
endif
endfunction
@@ -40,4 +120,15 @@ endfunction
function! airline#extensions#ale#init(ext)
call airline#parts#define_function('ale_error_count', 'airline#extensions#ale#get_error')
call airline#parts#define_function('ale_warning_count', 'airline#extensions#ale#get_warning')
augroup airline_ale
autocmd!
autocmd CursorHold,BufWritePost * call <sid>ale_refresh()
autocmd User ALEJobStarted,ALELintPost call <sid>ale_refresh()
augroup END
endfunction
function! s:ale_refresh()
if get(g:, 'airline_skip_empty_sections', 0)
exe ':AirlineRefresh!'
endif
endfunction

View File

@@ -0,0 +1,23 @@
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
" Plugin: https://github.com/lambdalisue/battery.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !exists('g:loaded_battery')
finish
endif
function! airline#extensions#battery#status(...) abort
if !exists('g:battery#update_statusline')
let g:battery#update_statusline = 1
call battery#update()
endif
let bat = battery#component()
return bat
endfunction
function! airline#extensions#battery#init(ext) abort
call airline#parts#define_function('battery', 'airline#extensions#battery#status')
endfunction

View File

@@ -0,0 +1,30 @@
" MIT License. Copyright (c) 2020 Bjoern Petri <bjoern.petri@sundevil.de>
" Plugin: https://github.com/MattesGroeger/vim-bookmarks
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !exists(':BookmarkToggle')
finish
endif
function! airline#extensions#bookmark#currentbookmark() abort
if get(w:, 'airline_active', 0)
let file = expand('%:p')
if file ==# ''
return
endif
let current_line = line('.')
let has_bm = bm#has_bookmark_at_line(file, current_line)
let bm = has_bm ? bm#get_bookmark_by_line(file, current_line) : 0
let annotation = has_bm ? bm['annotation'] : ''
return annotation
endif
return ''
endfunction
function! airline#extensions#bookmark#init(ext) abort
call airline#parts#define_function('bookmark', 'airline#extensions#bookmark#currentbookmark')
endfunction

View File

@@ -1,18 +1,9 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling et al.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: fugitive, gina, lawrencium and vcscommand
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:has_fugitive = exists('*fugitive#head')
let s:has_lawrencium = exists('*lawrencium#statusline')
let s:has_vcscommand = get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine')
if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand
finish
endif
let s:has_async = airline#util#async
" s:vcs_config contains static configuration of VCSes and their status relative
" to the active file.
" 'branch' - The name of currently active branch. This field is empty iff it
@@ -27,18 +18,22 @@ let s:vcs_config = {
\ 'git': {
\ 'exe': 'git',
\ 'cmd': 'git status --porcelain -- ',
\ 'dirty': 'git status -uno --porcelain --ignore-submodules',
\ 'untracked_mark': '??',
\ 'update_branch': 's:update_git_branch',
\ 'exclude': '\.git',
\ 'update_branch': 's:update_git_branch',
\ 'display_branch': 's:display_git_branch',
\ 'branch': '',
\ 'untracked': {},
\ },
\ 'mercurial': {
\ 'exe': 'hg',
\ 'cmd': 'hg status -u -- ',
\ 'dirty': 'hg status -mard',
\ 'untracked_mark': '?',
\ 'exclude': '\.hg',
\ 'update_branch': 's:update_hg_branch',
\ 'display_branch': 's:display_hg_branch',
\ 'branch': '',
\ 'untracked': {},
\ },
@@ -59,6 +54,7 @@ function! s:init_buffer()
let b:buffer_vcs_config[vcs] = {
\ 'branch': '',
\ 'untracked': '',
\ 'dirty': 0,
\ }
endfor
unlet! b:airline_head
@@ -83,55 +79,86 @@ else
endfunction
endif
let s:git_dirs = {}
function! s:update_git_branch(path)
if !s:has_fugitive
" Fugitive special revisions. call '0' "staging" ?
let s:names = {'0': 'index', '1': 'orig', '2':'fetch', '3':'merge'}
let s:sha1size = get(g:, 'airline#extensions#branch#sha1_len', 7)
function! s:update_git_branch()
call airline#util#ignore_next_focusgain()
if !airline#util#has_fugitive() && !airline#util#has_gina()
let s:vcs_config['git'].branch = ''
return
endif
let name = fugitive#head(7)
if empty(name)
if has_key(s:git_dirs, a:path)
let s:vcs_config['git'].branch = s:git_dirs[a:path]
return
if airline#util#has_fugitive()
let s:vcs_config['git'].branch = exists("*FugitiveHead") ?
\ FugitiveHead(s:sha1size) : fugitive#head(s:sha1size)
if s:vcs_config['git'].branch is# 'master' &&
\ airline#util#winwidth() < 81
" Shorten default a bit
let s:vcs_config['git'].branch='mas'
endif
let dir = fugitive#extract_git_dir(a:path)
if empty(dir)
let name = ''
else
try
let line = join(readfile(dir . '/HEAD'))
if strpart(line, 0, 16) == 'ref: refs/heads/'
let name = strpart(line, 16)
else
" raw commit hash
let name = strpart(line, 0, 7)
endif
catch
let name = ''
endtry
else
try
let g:gina#component#repo#commit_length = s:sha1size
let s:vcs_config['git'].branch = gina#component#repo#branch()
catch
endtry
if s:vcs_config['git'].branch is# 'master' &&
\ airline#util#winwidth() < 81
" Shorten default a bit
let s:vcs_config['git'].branch='mas'
endif
endif
let s:git_dirs[a:path] = name
let s:vcs_config['git'].branch = name
endfunction
function! s:update_hg_branch(path)
if s:has_lawrencium
let stl=lawrencium#statusline()
if !empty(stl) && s:has_async
call s:get_mq_async('LC_ALL=C hg qtop', expand('%:p'))
function! s:display_git_branch()
" disable FocusGained autocommand, might cause loops because system() causes
" a refresh, which causes a system() command again #2029
call airline#util#ignore_next_focusgain()
let name = b:buffer_vcs_config['git'].branch
try
let commit = matchstr(FugitiveParse()[0], '^\x\+')
if has_key(s:names, commit)
let name = get(s:names, commit)."(".name.")"
elseif !empty(commit)
let ref = fugitive#repo().git_chomp('describe', '--all', '--exact-match', commit)
if ref !~ "^fatal: no tag exactly matches"
let name = s:format_name(substitute(ref, '\v\C^%(heads/|remotes/|tags/)=','',''))."(".name.")"
else
let name = matchstr(commit, '.\{'.s:sha1size.'}')."(".name.")"
endif
endif
if exists("s:mq") && !empty(s:mq)
catch
endtry
return name
endfunction
function! s:update_hg_branch()
if airline#util#has_lawrencium()
let cmd='LC_ALL=C hg qtop'
let stl=lawrencium#statusline()
let file=expand('%:p')
if !empty(stl) && get(b:, 'airline_do_mq_check', 1)
if g:airline#init#vim_async
noa call airline#async#get_mq_async(cmd, file)
elseif has("nvim")
noa call airline#async#nvim_get_mq_async(cmd, file)
else
" remove \n at the end of the command
let output=system(cmd)[0:-2]
noa call airline#async#mq_output(output, file)
endif
endif
" do not do mq check anymore
let b:airline_do_mq_check = 0
if exists("b:mq") && !empty(b:mq)
if stl is# 'default'
" Shorten default a bit
let stl='def'
endif
let stl.=' ['.s:mq.']'
let stl.=' ['.b:mq.']'
endif
let s:vcs_config['mercurial'].branch = stl
else
@@ -139,10 +166,13 @@ function! s:update_hg_branch(path)
endif
endfunction
function! s:display_hg_branch()
return b:buffer_vcs_config['mercurial'].branch
endfunction
function! s:update_branch()
let l:path = exists("*fnamemodify") ? fnamemodify(resolve(@%), ":p:h") : expand("%:p:h")
for vcs in keys(s:vcs_config)
call {s:vcs_config[vcs].update_branch}(l:path)
call {s:vcs_config[vcs].update_branch}()
if b:buffer_vcs_config[vcs].branch != s:vcs_config[vcs].branch
let b:buffer_vcs_config[vcs].branch = s:vcs_config[vcs].branch
unlet! b:airline_head
@@ -150,7 +180,7 @@ function! s:update_branch()
endfor
endfunction
function! s:update_untracked_in_buffer_config(file, vcs)
function! airline#extensions#branch#update_untracked_config(file, vcs)
if !has_key(s:vcs_config[a:vcs].untracked, a:file)
return
elseif s:vcs_config[a:vcs].untracked[a:file] != b:buffer_vcs_config[a:vcs].untracked
@@ -160,129 +190,52 @@ function! s:update_untracked_in_buffer_config(file, vcs)
endfunction
function! s:update_untracked()
let l:file = expand("%:p")
if empty(l:file) || isdirectory(l:file)
let file = expand("%:p")
if empty(file) || isdirectory(file) || !empty(&buftype)
return
endif
let l:needs_update = 1
let needs_update = 1
let vcs_checks = get(g:, "airline#extensions#branch#vcs_checks", ["untracked", "dirty"])
for vcs in keys(s:vcs_config)
if l:file =~ s:vcs_config[vcs].exclude
if file =~ s:vcs_config[vcs].exclude
" Skip check for files that live in the exclude directory
let l:needs_update = 0
let needs_update = 0
endif
if has_key(s:vcs_config[vcs].untracked, l:file)
let l:needs_update = 0
call s:update_untracked_in_buffer_config(l:file, vcs)
if has_key(s:vcs_config[vcs].untracked, file)
let needs_update = 0
call airline#extensions#branch#update_untracked_config(file, vcs)
endif
endfor
if !l:needs_update
if !needs_update
return
endif
for vcs in keys(s:vcs_config)
let l:config = s:vcs_config[vcs]
if s:has_async
" Note that asynchronous update updates s:vcs_config only, and only
" s:update_untracked updates b:buffer_vcs_config. If s:vcs_config is
" invalidated again before s:update_untracked is called, then we lose the
" result of the previous call, i.e. the head string is not updated. It
" doesn't happen often in practice, so we let it be.
call s:get_vcs_untracked_async(l:config, l:file)
else
let output = airline#util#system(l:config.cmd . shellescape(l:file))
if output =~? ('^' . l:config.untracked_mark)
let l:config.untracked[l:file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
else
let l:config.untracked[l:file] = ''
endif
call s:update_untracked_in_buffer_config(l:file, vcs)
" only check, for git, if fugitive is installed
" and for 'hg' if lawrencium is installed, else skip
if vcs is# 'git' && (!airline#util#has_fugitive() && !airline#util#has_gina())
continue
elseif vcs is# 'mercurial' && !airline#util#has_lawrencium()
continue
endif
let config = s:vcs_config[vcs]
" Note that asynchronous update updates s:vcs_config only, and only
" s:update_untracked updates b:buffer_vcs_config. If s:vcs_config is
" invalidated again before s:update_untracked is called, then we lose the
" result of the previous call, i.e. the head string is not updated. It
" doesn't happen often in practice, so we let it be.
if index(vcs_checks, 'untracked') > -1
call airline#async#vcs_untracked(config, file, vcs)
endif
" Check clean state of repo
if index(vcs_checks, 'dirty') > -1
call airline#async#vcs_clean(config.dirty, file, vcs)
endif
endfor
endfunction
if s:has_async
let s:jobs = {}
function! s:on_stdout(channel, msg) dict abort
let self.buf .= a:msg
endfunction
function! s:on_exit(channel) dict abort
if self.buf =~? ('^' . self.config['untracked_mark'])
let self.config.untracked[self.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
else
let self.config.untracked[self.file] = ''
endif
" b:buffer_vcs_config will be updated on next call of update_untracked if
" needed
if has_key(s:jobs, self.file)
call remove(s:jobs, self.file)
endif
endfunction
function! s:get_vcs_untracked_async(config, file)
if g:airline#util#is_windows && &shell =~ 'cmd'
let cmd = a:config['cmd'] . shellescape(a:file)
else
let cmd = ['sh', '-c', a:config['cmd'] . shellescape(a:file)]
endif
let options = {'config': a:config, 'buf': '', 'file': a:file}
if has_key(s:jobs, a:file)
if job_status(get(s:jobs, a:file)) == 'run'
return
elseif has_key(s:jobs, a:file)
call remove(s:jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit', options)})
let s:jobs[a:file] = id
endfu
function! s:on_exit_mq(channel) dict abort
if !empty(self.buf)
if self.buf is# 'no patches applied' ||
\ self.buf =~# "unknown command 'qtop'"
let self.buf = ''
elseif exists("s:mq") && s:mq isnot# self.buf
" make sure, statusline is updated
unlet! b:airline_head
endif
let s:mq = self.buf
endif
if has_key(s:jobs, self.file)
call remove(s:jobs, self.file)
endif
endfunction
function! s:get_mq_async(cmd, file)
if g:airline#util#is_windows && &shell =~ 'cmd'
let cmd = a:cmd
else
let cmd = ['sh', '-c', a:cmd]
endif
let options = {'cmd': a:cmd, 'buf': '', 'file': a:file}
if has_key(s:jobs, a:file)
if job_status(get(s:jobs, a:file)) == 'run'
return
elseif has_key(s:jobs, a:file)
call remove(s:jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit_mq', options)})
let s:jobs[a:file] = id
endfu
endif
function! airline#extensions#branch#head()
if !exists('b:buffer_vcs_config')
call s:init_buffer()
@@ -296,88 +249,76 @@ function! airline#extensions#branch#head()
endif
let b:airline_head = ''
let l:vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"])
let vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"])
let l:heads = {}
for vcs in l:vcs_priority
let heads = []
for vcs in vcs_priority
if !empty(b:buffer_vcs_config[vcs].branch)
let l:heads[vcs] = b:buffer_vcs_config[vcs].branch
let heads += [vcs]
endif
endfor
for vcs in keys(l:heads)
for vcs in heads
if !empty(b:airline_head)
let b:airline_head .= ' | '
endif
let b:airline_head .= (len(l:heads) > 1 ? s:vcs_config[l:vcs].exe .':' : '') . s:format_name(l:heads[l:vcs])
let b:airline_head .= b:buffer_vcs_config[vcs].untracked
if len(heads) > 1
let b:airline_head .= s:vcs_config[vcs].exe .':'
endif
let b:airline_head .= s:format_name({s:vcs_config[vcs].display_branch}())
let additional = b:buffer_vcs_config[vcs].untracked
if empty(additional) &&
\ has_key(b:buffer_vcs_config[vcs], 'dirty') &&
\ b:buffer_vcs_config[vcs].dirty
let additional = g:airline_symbols['dirty']
endif
let b:airline_head .= additional
endfor
if empty(l:heads)
if s:has_vcscommand
call VCSCommandEnableBufferSetup()
if empty(heads)
if airline#util#has_vcscommand()
noa call VCSCommandEnableBufferSetup()
if exists('b:VCSCommandBufferInfo')
let b:airline_head = s:format_name(get(b:VCSCommandBufferInfo, 0, ''))
endif
endif
endif
if exists("g:airline#extensions#branch#displayed_head_limit")
let w:displayed_head_limit = g:airline#extensions#branch#displayed_head_limit
if len(b:airline_head) > w:displayed_head_limit - 1
let b:airline_head = b:airline_head[0:(w:displayed_head_limit - 1)].(&encoding ==? 'utf-8' ? '…' : '.')
if empty(heads)
if airline#util#has_custom_scm()
try
let Fn = function(g:airline#extensions#branch#custom_head)
let b:airline_head = Fn()
endtry
endif
endif
if has_key(l:heads, 'git') && !s:check_in_path()
let b:airline_head = ''
if exists("g:airline#extensions#branch#displayed_head_limit")
let w:displayed_head_limit = g:airline#extensions#branch#displayed_head_limit
if strwidth(b:airline_head) > w:displayed_head_limit - 1
let b:airline_head =
\ airline#util#strcharpart(b:airline_head, 0, w:displayed_head_limit - 1)
\ . (&encoding ==? 'utf-8' ? '…' : '.')
endif
endif
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth)
return b:airline_head
endfunction
function! airline#extensions#branch#get_head()
let head = airline#extensions#branch#head()
let empty_message = get(g:, 'airline#extensions#branch#empty_message', '')
let winwidth = get(airline#parts#get('branch'), 'minwidth', 120)
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
let head = airline#util#shorten(head, winwidth, minwidth)
let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch)
return empty(head)
\ ? empty_message
\ ? get(g:, 'airline#extensions#branch#empty_message', '')
\ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head)
endfunction
function! s:check_in_path()
if !exists('b:airline_file_in_root')
let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', ''))
let bufferpath = resolve(fnamemodify(expand('%'), ':p'))
if !filereadable(root) "not a file
" if .git is a directory, it's the old submodule format
if match(root, '\.git$') >= 0
let root = expand(fnamemodify(root, ':h'))
else
" else it's the newer format, and we need to guesstimate
" 1) check for worktrees
if match(root, 'worktrees') > -1
" worktree can be anywhere, so simply assume true here
return 1
endif
" 2) check for submodules
let pattern = '\.git[\\/]\(modules\)[\\/]'
if match(root, pattern) >= 0
let root = substitute(root, pattern, '', '')
endif
endif
endif
let b:airline_file_in_root = stridx(bufferpath, root) > -1
endif
return b:airline_file_in_root
endfunction
function! s:reset_untracked_cache(shellcmdpost)
" shellcmdpost - whether function was called as a result of ShellCmdPost hook
if !s:has_async && !has('nvim')
if !g:airline#init#vim_async && !has('nvim')
if a:shellcmdpost
" Clear cache only if there was no error or the script uses an
" asynchronous interface. Otherwise, cache clearing would overwrite
@@ -388,12 +329,12 @@ function! s:reset_untracked_cache(shellcmdpost)
endif
endif
let l:file = expand("%:p")
let file = expand("%:p")
for vcs in keys(s:vcs_config)
" Dump the value of the cache for the current file. Partially mitigates the
" issue of cache invalidation happening before a call to
" s:update_untracked()
call s:update_untracked_in_buffer_config(l:file, l:vcs)
call airline#extensions#branch#update_untracked_config(file, vcs)
let s:vcs_config[vcs].untracked = {}
endfor
endfunction
@@ -401,9 +342,8 @@ endfunction
function! airline#extensions#branch#init(ext)
call airline#parts#define_function('branch', 'airline#extensions#branch#get_head')
autocmd BufReadPost * unlet! b:airline_file_in_root
autocmd CursorHold,ShellCmdPost,CmdwinLeave * unlet! b:airline_head
autocmd User AirlineBeforeRefresh unlet! b:airline_head
autocmd ShellCmdPost,CmdwinLeave * unlet! b:airline_head b:airline_do_mq_check
autocmd User AirlineBeforeRefresh unlet! b:airline_head b:airline_do_mq_check
autocmd BufWritePost * call s:reset_untracked_cache(0)
autocmd ShellCmdPost * call s:reset_untracked_cache(1)
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/bling/vim-bufferline
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -7,10 +8,8 @@ if !exists('*bufferline#get_status_string')
finish
endif
let s:overwrite = get(g:, 'airline#extensions#bufferline#overwrite_variables', 1)
function! airline#extensions#bufferline#init(ext)
if s:overwrite
if get(g:, 'airline#extensions#bufferline#overwrite_variables', 1)
highlight bufferline_selected gui=bold cterm=bold term=bold
highlight link bufferline_selected_inactive airline_c_inactive
let g:bufferline_inactive_highlight = 'airline_c'

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2014 Mathias Andersson.
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
" Plugin: https://github.com/tpope/vim-capslock
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -8,10 +9,9 @@ if !exists('*CapsLockStatusline')
endif
function! airline#extensions#capslock#status()
return tolower(CapsLockStatusline()) == '[caps]' ? 'CAPS' : ''
return tolower(CapsLockStatusline()) ==# '[caps]' ? get(g:, 'airline#extensions#capslock#symbol', 'CAPS') : ''
endfunction
function! airline#extensions#capslock#init(ext)
call airline#parts#define_function('capslock', 'airline#extensions#capslock#status')
endfunction

View File

@@ -0,0 +1,54 @@
" MIT License. Copyright (c) 2019-2020 Peng Guanwen et al.
" vim: et ts=2 sts=2 sw=2
" Plugin: https://github.com/neoclide/coc
scriptencoding utf-8
let s:error_symbol = get(g:, 'airline#extensions#coc#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#coc#warning_symbol', 'W:')
function! airline#extensions#coc#get_warning() abort
return airline#extensions#coc#get('warning')
endfunction
function! airline#extensions#coc#get_error() abort
return airline#extensions#coc#get('error')
endfunction
function! airline#extensions#coc#get(type) abort
if !exists(':CocCommand')
return ''
endif
let _backup = get(g:, 'coc_stl_format', '')
let is_err = (a:type is# 'error')
if is_err
let g:coc_stl_format = get(g:, 'airline#extensions#coc#stl_format_err', '%E{[%e(#%fe)]}')
else
let g:coc_stl_format = get(g:, 'airline#extensions#coc#stl_format_warn', '%W{[%w(#%fw)]}')
endif
let info = get(b:, 'coc_diagnostic_info', {})
if empty(info) | return '' | endif
let cnt = get(info, a:type, 0)
if !empty(_backup)
let g:coc_stl_format = _backup
endif
if empty(cnt)
return ''
else
return (is_err ? s:error_symbol : s:warning_symbol).cnt
endif
endfunction
function! airline#extensions#coc#get_status() abort
" Shorten text for windows < 91 characters
return airline#util#shorten(get(g:, 'coc_status', ''), 91, 9)
endfunction
function! airline#extensions#coc#init(ext) abort
call airline#parts#define_function('coc_error_count', 'airline#extensions#coc#get_error')
call airline#parts#define_function('coc_warning_count', 'airline#extensions#coc#get_warning')
call airline#parts#define_function('coc_status', 'airline#extensions#coc#get_status')
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/wincent/command-t
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling, Christian Brabandt et al.
" Plugin: https://github.com/chrisbra/csv.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -30,4 +31,3 @@ endfunction
function! airline#extensions#csv#init(ext)
call a:ext.add_statusline_func('airline#extensions#csv#apply')
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/ctrlpvim/ctrlp.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -79,4 +80,3 @@ function! airline#extensions#ctrlp#init(ext)
call a:ext.add_statusline_func('airline#extensions#ctrlp#apply')
call a:ext.add_theme_func('airline#extensions#ctrlp#load_theme')
endfunction

View File

@@ -1,19 +1,21 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/szw/vim-ctrlspace
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:spc = g:airline_symbols.space
let s:padding = s:spc . s:spc . s:spc
function! airline#extensions#ctrlspace#statusline(...) abort
let spc = g:airline_symbols.space
let l:padding = spc . spc . spc
let cs = ctrlspace#context#Configuration().Symbols.CS
function! airline#extensions#ctrlspace#statusline(...)
let b = airline#builder#new({ 'active': 1 })
call b.add_section('airline_b', '⌗' . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding))
call b.add_section('airline_b', cs . l:padding . ctrlspace#api#StatuslineModeSegment(l:padding))
call b.split()
call b.add_section('airline_x', s:spc . ctrlspace#api#StatuslineTabSegment() . s:spc)
call b.add_section('airline_x', spc . ctrlspace#api#StatuslineTabSegment() . spc)
return b.build()
endfunction
function! airline#extensions#ctrlspace#init(ext)
function! airline#extensions#ctrlspace#init(ext) abort
let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()"
endfunction

View File

@@ -0,0 +1,122 @@
" MIT Licsense.
" Plugin: https://github.com/vheon/vim-cursormode
" Copyright (C) 2014 Andrea Cedraro <a.cedraro@gmail.com>,
" Copyright (C) 2017 Eduardo Suarez-Santana <e.suarezsantana@gmail.com>
scriptencoding utf-8
if exists('g:loaded_cursormode')
finish
endif
let g:loaded_cursormode = 1
let s:is_win = has('win32') || has('win64')
let s:is_iTerm = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'iTerm.app'
let s:is_AppleTerminal = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'Apple_Terminal'
let s:is_good = !has('gui_running') && !s:is_win && !s:is_AppleTerminal
let s:last_mode = ''
if !exists('g:cursormode_exit_mode')
let g:cursormode_exit_mode='n'
endif
function! airline#extensions#cursormode#tmux_escape(escape)
return '\033Ptmux;'.substitute(a:escape, '\\033', '\\033\\033', 'g').'\033\\'
endfunction
let s:iTerm_escape_template = '\033]Pl%s\033\\'
let s:xterm_escape_template = '\033]12;%s\007'
function! s:get_mode()
return call(get(g:, 'cursormode_mode_func', 'mode'), [])
endfunction
function! airline#extensions#cursormode#set(...)
let mode = s:get_mode()
if mode !=# s:last_mode
let s:last_mode = mode
call s:set_cursor_color_for(mode)
endif
return ''
endfunction
function! s:set_cursor_color_for(mode)
let mode = a:mode
for mode in [a:mode, a:mode.&background]
if has_key(s:color_map, mode)
try
let save_eventignore = &eventignore
set eventignore=all
let save_shelltemp = &shelltemp
set noshelltemp
silent call system(s:build_command(s:color_map[mode]))
return
finally
let &shelltemp = save_shelltemp
let &eventignore = save_eventignore
endtry
endif
endfor
endfunction
function! s:build_command(color)
if s:is_iTerm
let color = substitute(a:color, '^#', '', '')
let escape_template = s:iTerm_escape_template
else
let color = a:color
let escape_template = s:xterm_escape_template
endif
let escape = printf(escape_template, color)
if exists('$TMUX')
let escape = airline#extensions#cursormode#tmux_escape(escape)
endif
return "printf '".escape."' > /dev/tty"
endfunction
function! s:get_color_map()
if exists('g:cursormode_color_map')
return g:cursormode_color_map
endif
try
let map = g:cursormode#{g:colors_name}#color_map
return map
catch
return {
\ "nlight": "#000000",
\ "ndark": "#BBBBBB",
\ "i": "#0000BB",
\ "v": "#FF5555",
\ "V": "#BBBB00",
\ "\<C-V>": "#BB00BB",
\ }
endtry
endfunction
augroup airline#extensions#cursormode
autocmd!
autocmd VimLeave * nested call s:set_cursor_color_for(g:cursormode_exit_mode)
" autocmd VimEnter * call airline#extensions#cursormode#activate()
autocmd Colorscheme * call airline#extensions#cursormode#activate()
augroup END
function! airline#extensions#cursormode#activate()
let s:color_map = s:get_color_map()
call airline#extensions#cursormode#set()
endfunction
function! airline#extensions#cursormode#apply(...)
let w:airline_section_a = get(w:, 'airline_section_a', g:airline_section_a)
let w:airline_section_a .= '%{airline#extensions#cursormode#set()}'
endfunction
function! airline#extensions#cursormode#init(ext)
let s:color_map = s:get_color_map()
call a:ext.add_statusline_func('airline#extensions#cursormode#apply')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -19,7 +19,7 @@ let s:layout = get(g:, 'airline#extensions#default#layout', [
function! s:get_section(winnr, key, ...)
if has_key(s:section_truncate_width, a:key)
if winwidth(a:winnr) < s:section_truncate_width[a:key]
if airline#util#winwidth(a:winnr) < s:section_truncate_width[a:key]
return ''
endif
endif
@@ -98,4 +98,3 @@ function! airline#extensions#default#apply(builder, context)
return 1
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2017 Thomas Dy
" MIT License. Copyright (c) 2017-2020 Thomas Dy et al.
" Plugin: https://github.com/Shougo/denite.nvim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -7,41 +8,48 @@ if !get(g:, 'loaded_denite', 0)
finish
endif
let s:denite_ver = (exists('*denite#get_status_mode') ? 2 : 3)
" Denite does not use vim's built-in modal editing but has a custom prompt
" that implements its own insert/normal mode so we have to handle changing the
" highlight
function! airline#extensions#denite#check_denite_mode(bufnr)
let l:mode = split(denite#get_status_mode(), ' ')
let l:mode = tolower(l:mode[1])
if !exists('b:denite_mode_cache') || l:mode != b:denite_mode_cache
call airline#highlighter#highlight([l:mode], a:bufnr)
let b:denite_mode_cache = l:mode
function! airline#extensions#denite#check_denite_mode(bufnr) abort
if &filetype !=# 'denite' && &filetype !=# 'denite-filter'
return ''
endif
if s:denite_ver == 3
let mode = split(denite#get_status("mode"), ' ')
else
let mode = split(denite#get_status_mode(), ' ')
endif
let mode = tolower(get(mode, 1, ''))
if !exists('b:denite_mode_cache') || mode != b:denite_mode_cache
call airline#highlighter#highlight([mode], a:bufnr)
let b:denite_mode_cache = mode
endif
return ''
endfunction
function! airline#extensions#denite#apply(...)
if &ft == 'denite'
function! airline#extensions#denite#apply(...) abort
if &filetype ==# 'denite' || &filetype ==# 'denite-filter'
let w:airline_skip_empty_sections = 0
call a:1.add_section('airline_a', ' Denite %{airline#extensions#denite#check_denite_mode('.a:2['bufnr'].')}')
call a:1.add_section('airline_c', ' %{denite#get_status_sources()}')
call a:1.split()
call a:1.add_section('airline_y', ' %{denite#get_status_path()} ')
call a:1.add_section('airline_z', ' %{denite#get_status_linenr()} ')
if s:denite_ver == 3
call a:1.add_section('airline_c', ' %{denite#get_status("sources")}')
call a:1.split()
call a:1.add_section('airline_y', ' %{denite#get_status("path")} ')
call a:1.add_section('airline_z', ' %{denite#get_status("linenr")} ')
else
call a:1.add_section('airline_c', ' %{denite#get_status_sources()}')
call a:1.split()
call a:1.add_section('airline_y', ' %{denite#get_status_path()} ')
call a:1.add_section('airline_z', ' %{denite#get_status_linenr()} ')
endif
return 1
endif
endfunction
function! airline#extensions#denite#init(ext)
function! airline#extensions#denite#init(ext) abort
call denite#custom#option('_', 'statusline', 0)
call a:ext.add_statusline_func('airline#extensions#denite#apply')
" airline#extensions#denite#apply normally gets called only after the
" denite window gets closed, so we have to call airline#update_statusline
" ourselves to make sure it's applied when the window is opened.
augroup airline_denite
autocmd!
autocmd FileType denite call airline#update_statusline()
augroup END
endfunction

View File

@@ -0,0 +1,36 @@
" MIT Licsense
" Plugin: https://github.com/justinmk/vim-dirvish
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'loaded_dirvish', 0)
finish
endif
let s:spc = g:airline_symbols.space
function! airline#extensions#dirvish#init(ext) abort
call a:ext.add_statusline_func('airline#extensions#dirvish#apply')
endfunction
function! airline#extensions#dirvish#apply(...) abort
if &filetype ==# 'dirvish' && exists('b:dirvish')
let w:airline_section_a = 'Dirvish'
let w:airline_section_b = exists('*airline#extensions#branch#get_head')
\ ? '%{airline#extensions#branch#get_head()}'
\ : ''
let w:airline_section_c = '%{b:dirvish._dir}'
let w:airline_section_x = ''
let w:airline_section_y = ''
let current_column_regex = ':%\dv'
let w:airline_section_z = join(filter(
\ split(get(w:, 'airline_section_z', g:airline_section_z)),
\ 'v:val !~ current_column_regex'
\ ))
endif
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" PLugin: https://eclim.org
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -59,4 +60,3 @@ function! airline#extensions#eclim#init(ext)
call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings')
call a:ext.add_statusline_func('airline#extensions#eclim#creat_line')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -53,4 +53,3 @@ function! airline#extensions#example#get_cats()
endfor
return cats
endfunction

View File

@@ -0,0 +1,36 @@
" MIT License. Copyright (c) 2013-2020
" Plugin: https://github.com/lambdalisue/fern.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'fern_loaded', 0)
finish
endif
function! airline#extensions#fern#apply(...) abort
if (&ft =~# 'fern')
let spc = g:airline_symbols.space
let fri = fern#fri#parse(expand('%f'))
call a:1.add_section('airline_a', spc.'fern'.spc)
if exists('*airline#extensions#branch#get_head')
call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc)
else
call a:1.add_section('airline_b', '')
endif
if !(fri.authority =~# '^drawer')
let abspath = substitute(fri.path, 'file://', '', '')
call a:1.add_section('airline_c', spc.fnamemodify(abspath, ':~'))
call a:1.split()
if len(get(g:, 'fern#comparators', {}))
call a:1.add_section('airline_y', spc.'%{fern#comparator}'.spc)
endif
endif
return 1
endif
endfunction
function! airline#extensions#fern#init(ext) abort
let g:fern_force_overwrite_statusline = 0
call a:ext.add_statusline_func('airline#extensions#fern#apply')
endfunction

View File

@@ -0,0 +1,52 @@
" MIT License. Copyright (c) 2017-2020 Cimbali et al
" Plugin: https://github.com/tpope/vim-fugitive
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !airline#util#has_fugitive()
finish
endif
function! s:ModifierFlags()
return (exists("+autochdir") && &autochdir) ? ':p' : ':.'
endfunction
function! airline#extensions#fugitiveline#bufname()
if !exists('b:fugitive_name')
let b:fugitive_name = ''
try
if bufname('%') =~? '^fugitive:' && exists('*FugitiveReal')
let b:fugitive_name = FugitiveReal(bufname('%'))
elseif exists('b:git_dir') && exists('*fugitive#repo')
if get(b:, 'fugitive_type', '') is# 'blob'
let b:fugitive_name = fugitive#repo().translate(FugitivePath(@%, ''))
endif
elseif exists('b:git_dir') && !exists('*fugitive#repo')
let buffer = fugitive#buffer()
if buffer.type('blob')
let b:fugitive_name = buffer.repo().translate(buffer.path('/'))
endif
endif
catch
endtry
endif
let fmod = s:ModifierFlags()
if empty(b:fugitive_name)
return fnamemodify(bufname('%'), fmod)
else
return fnamemodify(b:fugitive_name, fmod). " [git]"
endif
endfunction
function! airline#extensions#fugitiveline#init(ext)
if exists("+autochdir") && &autochdir
" if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well
call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m')
else
call airline#parts#define_raw('file', '%<%{airline#extensions#fugitiveline#bufname()}%m')
endif
autocmd ShellCmdPost,CmdwinLeave * unlet! b:fugitive_name
autocmd User AirlineBeforeRefresh unlet! b:fugitive_name
endfunction

View File

@@ -0,0 +1,44 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/junegunn/fzf, https://github.com/junegunn/fzf.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#fzf#init(ext) abort
" Remove the custom statusline that fzf.vim sets by removing its `FileType
" fzf` autocmd. Ideally we'd use `let g:fzf_statusline = 0`, but this
" variable is checked *before* airline#extensions#init() is called.
augroup _fzf_statusline
autocmd!
augroup END
call a:ext.add_statusline_func('airline#extensions#fzf#apply')
call a:ext.add_inactive_statusline_func('airline#extensions#fzf#inactive_apply')
endfunction
function! airline#extensions#fzf#statusline(...) abort
let spc = g:airline_symbols.space
let builder = airline#builder#new({ 'active': 1 })
call builder.add_section('airline_a', spc.'FZF'.spc)
call builder.add_section('airline_c', '')
return builder.build()
endfunction
function! airline#extensions#fzf#apply(...) abort
if &filetype ==# 'fzf'
let spc = g:airline_symbols.space
call a:1.add_section('airline_a', spc.'FZF'.spc)
call a:1.add_section('airline_c', '')
return 1
endif
endfunction
function! airline#extensions#fzf#inactive_apply(...) abort
if getbufvar(a:2.bufnr, '&filetype') ==# 'fzf'
let spc = g:airline_symbols.space
call a:1.add_section('airline_a', spc.'FZF'.spc)
call a:1.add_section('airline_c', '')
return 1
endif
endfunction

View File

@@ -0,0 +1,19 @@
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
" Written by Kamil Cukrowski 2020
" Plugin: https://github.com/jsfaint/gen_tags.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !(get(g:, 'loaded_gentags#gtags', 0) || get(g:, 'loaded_gentags#ctags', 0))
finish
endif
function! airline#extensions#gen_tags#status(...) abort
return gen_tags#job#is_running() != 0 ? 'Gen. gen_tags' : ''
endfunction
function! airline#extensions#gen_tags#init(ext) abort
call airline#parts#define_function('gen_tags', 'airline#extensions#gen_tags#status')
endfunction

View File

@@ -0,0 +1,24 @@
" MIT License. Copyright (c) 2013-2020
" Plugin: https://github.com/lambdalisue/gina.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'loaded_gina', 0)
finish
endif
function! airline#extensions#gina#apply(...) abort
if (&ft =~# 'gina' && &ft !~# 'blame') || &ft ==# 'diff'
call a:1.add_section('airline_a', ' gina ')
call a:1.add_section('airline_b', ' %{gina#component#repo#branch()} ')
call a:1.split()
call a:1.add_section('airline_y', ' staged %{gina#component#status#staged()} ')
call a:1.add_section('airline_z', ' unstaged %{gina#component#status#unstaged()} ')
return 1
endif
endfunction
function! airline#extensions#gina#init(ext) abort
let g:gina_force_overwrite_statusline = 0
call a:ext.add_statusline_func('airline#extensions#gina#apply')
endfunction

View File

@@ -0,0 +1,18 @@
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
" Plugin: https://github.com/mhinz/vim-grepper
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'loaded_grepper', 0)
finish
endif
function! airline#extensions#grepper#status()
let msg = grepper#statusline()
return empty(msg) ? '' : 'grepper'
endfunction
function! airline#extensions#grepper#init(ext)
call airline#parts#define_function('grepper', 'airline#extensions#grepper#status')
endfunction

View File

@@ -0,0 +1,18 @@
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
" Plugin: https://github.com/ludovicchabant/vim-gutentags
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'loaded_gutentags', 0)
finish
endif
function! airline#extensions#gutentags#status()
let msg = gutentags#statusline()
return empty(msg) ? '' : 'Gen. ' . msg
endfunction
function! airline#extensions#gutentags#init(ext)
call airline#parts#define_function('gutentags', 'airline#extensions#gutentags#status')
endfunction

View File

@@ -1,16 +1,32 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: vim-gitgutter, vim-signify, changesPlugin, quickfixsigns, coc-git
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) && !get(g:, 'loaded_quickfixsigns', 0)
if !get(g:, 'loaded_signify', 0)
\ && !get(g:, 'loaded_gitgutter', 0)
\ && !get(g:, 'loaded_changes', 0)
\ && !get(g:, 'loaded_quickfixsigns', 0)
\ && !exists("*CocAction")
finish
endif
let s:non_zero_only = get(g:, 'airline#extensions#hunks#non_zero_only', 0)
let s:hunk_symbols = get(g:, 'airline#extensions#hunks#hunk_symbols', ['+', '~', '-'])
function! s:get_hunks_signify()
function! s:coc_git_enabled() abort
if !exists("*CocAction") ||
\ !get(g:, 'airline#extensions#hunks#coc_git', 0)
" coc-git extension is disabled by default
" unless specifically being enabled by the user
" (as requested from coc maintainer)
return 0
endif
return 1
endfunction
function! s:get_hunks_signify() abort
let hunks = sy#repo#get_stats()
if hunks[0] >= 0
return hunks
@@ -18,35 +34,46 @@ function! s:get_hunks_signify()
return []
endfunction
function! s:is_branch_empty()
return exists('*airline#extensions#branch#head') && empty(airline#extensions#branch#head())
function! s:get_hunks_coc() abort
let hunks = get(b:, 'coc_git_status', '')
if empty(hunks)
return []
endif
let result = [0, 0, 0]
for val in split(hunks)
if val[0] is# '+'
let result[0] = val[1:] + 0
elseif val[0] is# '~'
let result[1] = val[1:] + 0
elseif val[0] is# '-'
let result[2] = val[1:] + 0
endif
endfor
return result
endfunction
function! s:get_hunks_gitgutter()
function! s:is_branch_empty() abort
return exists('*airline#extensions#branch#head') &&
\ empty(get(b:, 'airline_head', ''))
endfunction
function! s:get_hunks_gitgutter() abort
if !get(g:, 'gitgutter_enabled', 0) || s:is_branch_empty()
return ''
endif
return GitGutterGetHunkSummary()
endfunction
function! s:get_hunks_changes()
if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty()
return []
endif
function! s:get_hunks_changes() abort
let hunks = changes#GetStats()
for i in hunks
if i > 0
return hunks
endif
endfor
return []
return hunks == [0, 0, 0] ? [] : hunks
endfunction
function! s:get_hunks_empty()
function! s:get_hunks_empty() abort
return ''
endfunction
function! s:get_hunks()
function! airline#extensions#hunks#get_raw_hunks() abort
if !exists('b:source_func') || get(b:, 'source_func', '') is# 's:get_hunks_empty'
if get(g:, 'loaded_signify') && sy#buffer_is_active()
let b:source_func = 's:get_hunks_signify'
@@ -56,6 +83,8 @@ function! s:get_hunks()
let b:source_func = 's:get_hunks_changes'
elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary')
let b:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary'
elseif s:coc_git_enabled()
let b:source_func = 's:get_hunks_coc'
else
let b:source_func = 's:get_hunks_empty'
endif
@@ -63,34 +92,43 @@ function! s:get_hunks()
return {b:source_func}()
endfunction
function! airline#extensions#hunks#get_hunks()
function! airline#extensions#hunks#get_hunks() abort
if !get(w:, 'airline_active', 0)
return ''
endif
" Cache vavlues, so that it isn't called too often
" Cache values, so that it isn't called too often
if exists("b:airline_hunks") &&
\ get(b:, 'airline_changenr', 0) == changenr() &&
\ winwidth(0) == get(s:, 'airline_winwidth', 0) &&
\ get(b:, 'airline_changenr', 0) == b:changedtick &&
\ airline#util#winwidth() == get(s:, 'airline_winwidth', 0) &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_signify' &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_gitgutter' &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_empty'
\ get(b:, 'source_func', '') isnot# 's:get_hunks_empty' &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_changes' &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_coc'
return b:airline_hunks
endif
let hunks = s:get_hunks()
let hunks = airline#extensions#hunks#get_raw_hunks()
let string = ''
let winwidth = get(airline#parts#get('hunks'), 'minwidth', 100)
if !empty(hunks)
" hunks should contain [added, changed, deleted]
for i in [0, 1, 2]
if (s:non_zero_only == 0 && winwidth(0) > 100) || hunks[i] > 0
if (s:non_zero_only == 0 && airline#util#winwidth() > winwidth) || hunks[i] > 0
let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i])
endif
endfor
endif
if index(airline#extensions#get_loaded_extensions(), 'branch') == -1 && string[-1:] == ' '
" branch extension not loaded, skip trailing whitespace
let string = string[0:-2]
endif
let b:airline_hunks = string
let b:airline_changenr = changenr()
let s:airline_winwidth = winwidth(0)
let b:airline_changenr = b:changedtick
let s:airline_winwidth = airline#util#winwidth()
return string
endfunction
function! airline#extensions#hunks#init(ext)
function! airline#extensions#hunks#init(ext) abort
call airline#parts#define_function('hunks', 'airline#extensions#hunks#get_hunks')
endfunction

View File

@@ -0,0 +1,31 @@
" MIT License. Copyright (c) 2013-2020 Doron Behar, C.Brabandt et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !has('keymap')
finish
endif
function! airline#extensions#keymap#status()
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap'))
let short_codes = get(g:, 'airline#extensions#keymap#short_codes', {})
let label = get(g:, 'airline#extensions#keymap#label', g:airline_symbols.keymap)
let default = get(g:, 'airline#extensions#keymap#default', '')
if (label !=# '')
let label .= ' '
endif
let keymap = &keymap
if has_key(short_codes, keymap)
let keymap = short_codes[keymap]
endif
return printf('%s', (!empty(keymap) && &iminsert ? (label . keymap) :
\ (!empty(default) ? label . default : default)))
else
return ''
endif
endfunction
function! airline#extensions#keymap#init(ext)
call airline#parts#define_function('keymap', 'airline#extensions#keymap#status')
endfunction

View File

@@ -0,0 +1,109 @@
" MIT License. Copyright (c) 2013-2020 Bjorn Neergaard, hallettj et al.
" Plugin: https://github.com/autozimu/LanguageClient-neovim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:error_symbol = get(g:, 'airline#extensions#languageclient#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#languageclient#warning_symbol', 'W:')
let s:show_line_numbers = get(g:, 'airline#extensions#languageclient#show_line_numbers', 1)
" Severity codes from the LSP spec
let s:severity_error = 1
let s:severity_warning = 2
let s:severity_info = 3
let s:severity_hint = 4
" After each LanguageClient state change `s:diagnostics` will be populated with
" a map from file names to lists of errors, warnings, informational messages,
" and hints.
let s:diagnostics = {}
function! s:languageclient_refresh()
if get(g:, 'airline_skip_empty_sections', 0)
exe ':AirlineRefresh!'
endif
endfunction
function! s:record_diagnostics(state)
" The returned message might not have the 'result' key
if has_key(a:state, 'result')
let result = json_decode(a:state.result)
let s:diagnostics = result.diagnostics
endif
call s:languageclient_refresh()
endfunction
function! s:get_diagnostics()
call LanguageClient#getState(function("s:record_diagnostics"))
endfunction
function! s:diagnostics_for_buffer()
return get(s:diagnostics, expand('%:p'), [])
endfunction
function! s:airline_languageclient_count(cnt, symbol)
return a:cnt ? a:symbol. a:cnt : ''
endfunction
function! s:airline_languageclient_get_line_number(type) abort
let linenumber_of_first_problem = 0
for d in s:diagnostics_for_buffer()
if has_key(d, 'severity') && d.severity == a:type
let linenumber_of_first_problem = d.range.start.line
break
endif
endfor
if linenumber_of_first_problem == 0
return ''
endif
let open_lnum_symbol = get(g:, 'airline#extensions#languageclient#open_lnum_symbol', '(L')
let close_lnum_symbol = get(g:, 'airline#extensions#languageclient#close_lnum_symbol', ')')
return open_lnum_symbol . linenumber_of_first_problem . close_lnum_symbol
endfunction
function! airline#extensions#languageclient#get(type)
if get(b:, 'LanguageClient_isServerRunning', 0) ==# 0
return ''
endif
let is_err = a:type == s:severity_error
let symbol = is_err ? s:error_symbol : s:warning_symbol
let cnt = 0
for d in s:diagnostics_for_buffer()
if has_key(d, 'severity') && d.severity == a:type
let cnt += 1
endif
endfor
if cnt == 0
return ''
endif
if s:show_line_numbers == 1
return s:airline_languageclient_count(cnt, symbol) . <sid>airline_languageclient_get_line_number(a:type)
else
return s:airline_languageclient_count(cnt, symbol)
endif
endfunction
function! airline#extensions#languageclient#get_warning()
return airline#extensions#languageclient#get(s:severity_warning)
endfunction
function! airline#extensions#languageclient#get_error()
return airline#extensions#languageclient#get(s:severity_error)
endfunction
function! airline#extensions#languageclient#init(ext)
call airline#parts#define_function('languageclient_error_count', 'airline#extensions#languageclient#get_error')
call airline#parts#define_function('languageclient_warning_count', 'airline#extensions#languageclient#get_warning')
augroup airline_languageclient
autocmd!
autocmd User LanguageClientDiagnosticsChanged call <sid>get_diagnostics()
augroup END
endfunction

View File

@@ -0,0 +1,41 @@
" MIT License. Copyright (c) 2018-2020 mox et al.
" Plugin: https://github.com/mox-mox/vim-localsearch
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:enabled = get(g:, 'airline#extensions#localsearch#enabled', 1)
if !get(g:, 'loaded_localsearch', 0) || !s:enabled || get(g:, 'airline#extensions#localsearch#loaded', 0)
finish
endif
let g:airline#extensions#localsearch#loaded = 001
let s:spc = g:airline_symbols.space
let g:airline#extensions#localsearch#inverted = get(g:, 'airline#extensions#localsearch#inverted', 0)
function! airline#extensions#localsearch#load_theme(palette) abort
call airline#highlighter#exec('localsearch_dark', [ '#ffffff' , '#000000' , 15 , 1 , ''])
endfunction
function! airline#extensions#localsearch#init(ext) abort
call a:ext.add_theme_func('airline#extensions#localsearch#load_theme')
call a:ext.add_statusline_func('airline#extensions#localsearch#apply')
endfunction
function! airline#extensions#localsearch#apply(...) abort
" first variable is the statusline builder
let builder = a:1
""""" WARNING: the API for the builder is not finalized and may change
if exists('#localsearch#WinEnter') && !g:airline#extensions#localsearch#inverted " If localsearch mode is enabled and 'invert' option is false
call builder.add_section('localsearch_dark', s:spc.airline#section#create('LS').s:spc)
endif
if !exists('#localsearch#WinEnter') && g:airline#extensions#localsearch#inverted " If localsearch mode is disabled and 'invert' option is true
call builder.add_section('localsearch_dark', s:spc.airline#section#create('GS').s:spc)
endif
return 0
endfunction

View File

@@ -0,0 +1,67 @@
" MIT License. Copyright (c) 2013-2020 François-Xavier Carton et al.
" Plugin: https://github.com/prabirshrestha/vim-lsp
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'lsp_loaded', 0)
finish
endif
function! s:airline_lsp_count(cnt, symbol) abort
return a:cnt ? a:symbol. a:cnt : ''
endfunction
function! s:airline_lsp_get_line_number(cnt, type) abort
let result = ''
if a:type ==# 'error'
let result = lsp#get_buffer_first_error_line()
endif
if empty(result)
return ''
endif
let open_lnum_symbol =
\ get(g:, 'airline#extensions#lsp#open_lnum_symbol', '(L')
let close_lnum_symbol =
\ get(g:, 'airline#extensions#lsp#close_lnum_symbol', ')')
return open_lnum_symbol . result . close_lnum_symbol
endfunction
function! airline#extensions#lsp#get(type) abort
if !exists(':LspDeclaration')
return ''
endif
let error_symbol = get(g:, 'airline#extensions#lsp#error_symbol', 'E:')
let warning_symbol = get(g:, 'airline#extensions#lsp#warning_symbol', 'W:')
let show_line_numbers = get(g:, 'airline#extensions#lsp#show_line_numbers', 1)
let is_err = a:type ==# 'error'
let symbol = is_err ? error_symbol : warning_symbol
let num = lsp#get_buffer_diagnostics_counts()[a:type]
if show_line_numbers == 1
return s:airline_lsp_count(num, symbol) . <sid>airline_lsp_get_line_number(num, a:type)
else
return s:airline_lsp_count(num, symbol)
endif
endfunction
function! airline#extensions#lsp#get_warning() abort
return airline#extensions#lsp#get('warning')
endfunction
function! airline#extensions#lsp#get_error() abort
return airline#extensions#lsp#get('error')
endfunction
function! airline#extensions#lsp#init(ext) abort
call airline#parts#define_function('lsp_error_count', 'airline#extensions#lsp#get_error')
call airline#parts#define_function('lsp_warning_count', 'airline#extensions#lsp#get_warning')
endfunction

View File

@@ -1,3 +1,5 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/neomake/neomake
" vim: et ts=2 sts=2 sw=2
if !exists(':Neomake')
@@ -7,14 +9,24 @@ endif
let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#neomake#warning_symbol', 'W:')
function! s:get_counts()
let l:counts = neomake#statusline#LoclistCounts()
if empty(l:counts)
return neomake#statusline#QflistCounts()
else
return l:counts
endif
endfunction
function! airline#extensions#neomake#get_warnings()
let counts = neomake#statusline#LoclistCounts()
let counts = s:get_counts()
let warnings = get(counts, 'W', 0)
return warnings ? s:warning_symbol.warnings : ''
endfunction
function! airline#extensions#neomake#get_errors()
let counts = neomake#statusline#LoclistCounts()
let counts = s:get_counts()
let errors = get(counts, 'E', 0)
return errors ? s:error_symbol.errors : ''
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: http://www.drchip.org/astronaut/vim/#NETRW
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -30,5 +31,5 @@ endfunction
function! airline#extensions#netrw#sortstring()
let order = (get(g:, 'netrw_sort_direction', 'n') =~ 'n') ? '+' : '-'
return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']'
return get(g:, 'netrw_sort_by', '') . (g:airline_symbols.space) . '[' . order . ']'
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling, Christian Brabandt et al.
" Plugin: https://github.com/chrisbra/NrrwRgn
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -19,7 +20,7 @@ function! airline#extensions#nrrwrgn#apply(...)
let dict=nrrwrgn#NrrwRgnStatus()
let vmode = { 'v': 'Char ', 'V': 'Line ', '': 'Block '}
let mode = dict.visual ? vmode[dict.visual] : vmode['V']
let winwidth = winwidth(0)
let winwidth = airline#util#winwidth()
if winwidth < 80
let mode = mode[0]
endif

View File

@@ -0,0 +1,48 @@
" Apache 2.0 license. Copyright (c) 2019-2020 Copyright Neovim contributors.
" Plugin: https://github.com/neovim/nvim-lsp
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !(get(g:, 'airline#extensions#nvimlsp#enabled', 1)
\ && exists(':LspInstallInfo'))
finish
endif
function! s:airline_nvimlsp_count(cnt, symbol) abort
return a:cnt ? a:symbol. a:cnt : ''
endfunction
function! airline#extensions#nvimlsp#get(type) abort
if !exists(':LspInstallInfo')
return ''
endif
let error_symbol = get(g:, 'airline#extensions#nvimlsp#error_symbol', 'E:')
let warning_symbol = get(g:, 'airline#extensions#nvimlsp#warning_symbol', 'W:')
let is_err = a:type ==# 'Error'
let symbol = is_err ? error_symbol : warning_symbol
if luaeval("pcall(require, 'vim.lsp.diagnostic')")
let num = v:lua.vim.lsp.diagnostic.get_count(0, a:type)
else
let num = v:lua.vim.lsp.util.buf_diagnostics_count(a:type)
endif
return s:airline_nvimlsp_count(num, symbol)
endfunction
function! airline#extensions#nvimlsp#get_warning() abort
return airline#extensions#nvimlsp#get('Warning')
endfunction
function! airline#extensions#nvimlsp#get_error() abort
return airline#extensions#nvimlsp#get('Error')
endfunction
function! airline#extensions#nvimlsp#init(ext) abort
call airline#parts#define_function('nvimlsp_error_count', 'airline#extensions#nvimlsp#get_error')
call airline#parts#define_function('nvimlsp_warning_count', 'airline#extensions#nvimlsp#get_warning')
endfunction

View File

@@ -1,3 +1,5 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/tpope/vim-obsession
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -19,4 +21,3 @@ endfunction
function! airline#extensions#obsession#get_status()
return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '')
endfunction

View File

@@ -0,0 +1,45 @@
" MIT License
" Plugin: https://github.com/OmniSharp/omnisharp-vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'OmniSharp_loaded', 0)
finish
endif
function! airline#extensions#omnisharp#server_status(...) abort
if !exists(':OmniSharpGotoDefinition') || !get(g:, 'OmniSharp_server_stdio', 0)
return ''
endif
let host = OmniSharp#GetHost(bufnr('%'))
if type(host.job) != v:t_dict || get(host.job, 'stopped')
return ''
endif
let sln = fnamemodify(host.sln_or_dir, ':t')
if get(host.job, 'loaded', 0)
return sln
endif
try
let projectsloaded = OmniSharp#project#CountLoaded()
let projectstotal = OmniSharp#project#CountTotal()
catch
" The CountLoaded and CountTotal functions are very new - catch the error
" when they don't exist
let projectsloaded = 0
let projectstotal = 0
endtry
return printf('%s(%d/%d)', sln, projectsloaded, projectstotal)
endfunction
function! airline#extensions#omnisharp#init(ext) abort
call airline#parts#define_function('omnisharp', 'airline#extensions#omnisharp#server_status')
augroup airline_omnisharp
autocmd!
autocmd User OmniSharpStarted,OmniSharpReady,OmniSharpStopped AirlineRefresh!
augroup END
endfunction

View File

@@ -1,66 +1,62 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling, Christian Brabandt et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:has_async = airline#util#async
function! s:shorten()
function! airline#extensions#po#shorten()
" Format and shorte the output of msgfmt
let b:airline_po_stats = substitute(get(b:, 'airline_po_stats', ''), ' \(message\|translation\)s*\.*', '', 'g')
let b:airline_po_stats = substitute(b:airline_po_stats, ', ', '/', 'g')
if exists("g:airline#extensions#po#displayed_limit")
let w:displayed_po_limit = g:airline#extensions#po#displayed_limit
if len(b:airline_po_stats) > w:displayed_po_limit - 1
let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 2)].(&encoding==?'utf-8' ? '…' : '.'). ']'
let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 2)].(&encoding==?'utf-8' ? '…' : '.')
endif
endif
endfunction
if s:has_async
let s:jobs = {}
function! s:on_stdout(channel, msg) dict abort
let self.buf = a:msg
endfunction
function! s:on_exit(channel) dict abort
if !empty(self.buf)
let b:airline_po_stats = printf("[%s]", self.buf)
else
let b:airline_po_stats = ''
endif
if has_key(s:jobs, self.file)
call remove(s:jobs, self.file)
endif
call s:shorten()
endfunction
function! s:get_msgfmt_stat_async(cmd, file)
if g:airline#util#is_windows || !executable('msgfmt')
" no msgfmt on windows?
return
else
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
endif
let options = {'buf': '', 'file': a:file}
if has_key(s:jobs, a:file)
if job_status(get(s:jobs, a:file)) == 'run'
return
elseif has_key(s:jobs, a:file)
call remove(s:jobs, a:file)
if strlen(get(b:, 'airline_po_stats', '')) >= 30 && airline#util#winwidth() < 150
let fuzzy = ''
let untranslated = ''
let messages = ''
" Shorten [120 translated, 50 fuzzy, 4 untranslated] to [120T/50F/4U]
if b:airline_po_stats =~ 'fuzzy'
let fuzzy = substitute(b:airline_po_stats, '.\{-}\(\d\+\) fuzzy.*', '\1F', '')
if fuzzy == '0F'
let fuzzy = ''
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit', options)})
let s:jobs[a:file] = id
endfu
endif
if b:airline_po_stats =~ 'untranslated'
let untranslated = substitute(b:airline_po_stats, '.\{-}\(\d\+\) untranslated.*', '\1U', '')
if untranslated == '0U'
let untranslated = ''
endif
endif
let messages = substitute(b:airline_po_stats, '\(\d\+\) translated.*', '\1T', '')
if messages ==# '0T'
let messages = ''
endif
let b:airline_po_stats = printf('%s%s%s', fuzzy, (empty(fuzzy) || empty(untranslated) ? '' : '/'), untranslated)
if strlen(b:airline_po_stats) < 10
let b:airline_po_stats = messages. (!empty(b:airline_po_stats) && !empty(messages) ? '/':''). b:airline_po_stats
endif
endif
let b:airline_po_stats = '['.b:airline_po_stats. '] '
endfunction
function! airline#extensions#po#on_winenter()
" only reset cache, if the window size changed
if get(b:, 'airline_winwidth', 0) != airline#util#winwidth()
let b:airline_winwidth = airline#util#winwidth()
" needs re-formatting
unlet! b:airline_po_stats
endif
endfunction
function! airline#extensions#po#apply(...)
if &ft ==# 'po'
call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}')
" Also reset the cache variable, if a window has been split, e.g. the winwidth changed
autocmd airline BufWritePost * unlet! b:airline_po_stats
autocmd airline WinEnter * call airline#extensions#po#on_winenter()
endif
endfunction
@@ -69,21 +65,26 @@ function! airline#extensions#po#stats()
return b:airline_po_stats
endif
let cmd = 'msgfmt --statistics -o /dev/null -- '
if s:has_async
call s:get_msgfmt_stat_async(cmd, expand('%:p'))
if g:airline#init#is_windows
let cmd = 'msgfmt --statistics -o NUL '
else
let cmd = 'msgfmt --statistics -o /dev/null -- '
endif
if g:airline#init#vim_async
call airline#async#get_msgfmt_stat(cmd, expand('%:p'))
elseif has("nvim")
call airline#async#nvim_get_msgfmt_stat(cmd, expand('%:p'))
else
let airline_po_stats = system(cmd. shellescape(expand('%:p')))
if v:shell_error
return ''
endif
try
let b:airline_po_stats = '['. split(airline_po_stats, '\n')[0]. ']'
let b:airline_po_stats = substitute(b:airline_po_stats, ' \(message\|translation\)s*\.*', '', 'g')
let b:airline_po_stats = split(airline_po_stats, '\n')[0]
catch
let b:airline_po_stats = ''
endtry
call s:shorten()
call airline#extensions#po#shorten()
endif
return get(b:, 'airline_po_stats', '')
endfunction

View File

@@ -0,0 +1,32 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/petobens/poet_v
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:spc = g:airline_symbols.space
function! airline#extensions#poetv#init(ext)
call a:ext.add_statusline_func('airline#extensions#poetv#apply')
endfunction
function! airline#extensions#poetv#apply(...)
if &filetype =~# 'python'
if get(g:, 'poetv_loaded', 0)
let statusline = poetv#statusline()
else
let statusline = fnamemodify($VIRTUAL_ENV, ':t')
endif
if !empty(statusline)
call airline#extensions#append_to_section('x',
\ s:spc.g:airline_right_alt_sep.s:spc.statusline)
endif
endif
endfunction
function! airline#extensions#poetv#update()
if &filetype =~# 'python'
call airline#extensions#poetv#apply()
call airline#update_statusline()
endif
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/edkolev/promptline.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,14 +1,19 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let g:airline#extensions#quickfix#quickfix_text = 'Quickfix'
let g:airline#extensions#quickfix#location_text = 'Location'
if !exists('g:airline#extensions#quickfix#quickfix_text')
let g:airline#extensions#quickfix#quickfix_text = 'Quickfix'
endif
if !exists('g:airline#extensions#quickfix#location_text')
let g:airline#extensions#quickfix#location_text = 'Location'
endif
function! airline#extensions#quickfix#apply(...)
if &buftype == 'quickfix'
let w:airline_section_a = s:get_text()
let w:airline_section_a = airline#extensions#quickfix#get_type()
let w:airline_section_b = '%{get(w:, "quickfix_title", "")}'
let w:airline_section_c = ''
let w:airline_section_x = ''
@@ -26,7 +31,7 @@ function! airline#extensions#quickfix#inactive_qf_window(...)
endif
endfunction
function! s:get_text()
function! airline#extensions#quickfix#get_type()
if exists("*win_getid") && exists("*getwininfo")
let dict = getwininfo(win_getid())
if len(dict) > 0 && get(dict[0], 'quickfix', 0) && !get(dict[0], 'loclist', 0)

View File

@@ -0,0 +1,43 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" This extension is inspired by vim-anzu <https://github.com/osyo-manga/vim-anzu>.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !exists('*searchcount')
finish
endif
function! airline#extensions#searchcount#init(ext) abort
call a:ext.add_statusline_func('airline#extensions#searchcount#apply')
endfunction
function! airline#extensions#searchcount#apply(...) abort
call airline#extensions#append_to_section('y',
\ '%{v:hlsearch ? airline#extensions#searchcount#status() : ""}')
endfunction
function! airline#extensions#searchcount#status() abort
try
let result = searchcount(#{recompute: 1, maxcount: -1})
if empty(result) || result.total ==# 0
return ''
endif
if result.incomplete ==# 1 " timed out
return printf(' /%s [?/??]', @/)
elseif result.incomplete ==# 2 " max count exceeded
if result.total > result.maxcount &&
\ result.current > result.maxcount
return printf('%s[>%d/>%d]', @/,
\ result.current, result.total)
elseif result.total > result.maxcount
return printf('%s[%d/>%d]', @/,
\ result.current, result.total)
endif
endif
return printf('%s[%d/%d]', @/,
\ result.current, result.total)
catch
return ''
endtry
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/vim-syntastic/syntastic
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -22,15 +23,15 @@ function! airline#extensions#syntastic#get(type)
let _backup = get(g:, 'syntastic_stl_format', '')
let is_err = (a:type is# 'error')
if is_err
let g:syntastic_stl_format = '%E{%e}'
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%fe(#%e)]}')
else
let g:syntastic_stl_format = '%W{%w}'
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_warn', '%W{[%fw(#%w)]}')
endif
let cnt = SyntasticStatuslineFlag()
if !empty(_backup)
let g:syntastic_stl_format = _backup
endif
if cnt == 0
if empty(cnt)
return ''
else
return (is_err ? s:error_symbol : s:warning_symbol).cnt

View File

@@ -1,193 +1,487 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 et fdm=marker
scriptencoding utf-8
let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
let s:ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree')
let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0)
if s:taboo
let g:taboo_tabline = 0
endif
let s:ctrlspace = get(g:, 'CtrlSpaceLoaded', 0)
let s:tabws = get(g:, 'tabws_loaded', 0)
let s:current_tabcnt = -1
function! airline#extensions#tabline#init(ext)
if has('gui_running')
if has('gui_running') && match(&guioptions, 'e') > -1
set guioptions-=e
endif
autocmd User AirlineToggledOn call s:toggle_on()
autocmd User AirlineToggledOff call s:toggle_off()
call s:toggle_on()
call a:ext.add_theme_func('airline#extensions#tabline#load_theme')
endfunction
function! s:toggle_off()
call airline#extensions#tabline#autoshow#off()
call airline#extensions#tabline#tabs#off()
call airline#extensions#tabline#buffers#off()
call airline#extensions#tabline#ctrlspace#off()
endfunction
function! s:toggle_on()
call airline#extensions#tabline#autoshow#on()
call airline#extensions#tabline#tabs#on()
call airline#extensions#tabline#buffers#on()
call airline#extensions#tabline#ctrlspace#on()
set tabline=%!airline#extensions#tabline#get()
endfunction
function! s:update_tabline()
if get(g:, 'airline#extensions#tabline#disable_refresh', 0)
return
endif
let match = expand('<afile>')
if pumvisible()
return
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
return
" return, if buffer matches ignore pattern or is directory (netrw)
elseif empty(match)
\ || match(match, s:ignore_bufadd_pat) > -1
\ || isdirectory(expand("<afile>"))
return
endif
doautocmd User BufMRUChange
endfunction
function! airline#extensions#tabline#load_theme(palette)
if pumvisible()
return
endif
let colors = get(a:palette, 'tabline', {})
" Theme for tabs on the left
let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b)
let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c)
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
else
"Fall back to normal airline_c if modified airline_c isn't present
let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
endif
call airline#highlighter#exec('airline_tab', l:tab)
call airline#highlighter#exec('airline_tabsel', l:tabsel)
call airline#highlighter#exec('airline_tabtype', l:tabtype)
call airline#highlighter#exec('airline_tabfill', l:tabfill)
call airline#highlighter#exec('airline_tabmod', l:tabmod)
call airline#highlighter#exec('airline_tabmod_unsel', l:tabmodu)
call airline#highlighter#exec('airline_tabhid', l:tabhid)
" Theme for tabs on the right
let l:tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
let l:tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
let l:tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
let l:tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c)
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c)
else
"Fall back to normal airline_c if modified airline_c isn't present
let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
endif
call airline#highlighter#exec('airline_tab_right', l:tab_right)
call airline#highlighter#exec('airline_tabsel_right', l:tabsel_right)
call airline#highlighter#exec('airline_tabmod_right', l:tabmod_right)
call airline#highlighter#exec('airline_tabhid_right', l:tabhid_right)
call airline#highlighter#exec('airline_tabmod_unsel_right', l:tabmodu_right)
endfunction
let s:current_tabcnt = -1
function! airline#extensions#tabline#get()
let curtabcnt = tabpagenr('$')
if curtabcnt != s:current_tabcnt
let s:current_tabcnt = curtabcnt
call airline#extensions#tabline#tabs#invalidate()
call airline#extensions#tabline#buffers#invalidate()
call airline#extensions#tabline#ctrlspace#invalidate()
endif
if !exists('#airline#BufAdd#*')
autocmd airline BufAdd * call <sid>update_tabline()
endif
if s:ctrlspace
return airline#extensions#tabline#ctrlspace#get()
elseif s:show_buffers && curtabcnt == 1 || !s:show_tabs
return airline#extensions#tabline#buffers#get()
else
return airline#extensions#tabline#tabs#get()
function! airline#extensions#tabline#add_label(dict, type, right)
if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
call a:dict.add_section_spaced('airline_tablabel'.
\ (a:right ? '_right' : ''),
\ get(g:, 'airline#extensions#tabline#'.a:type.'_label', a:type))
endif
endfunction
function! airline#extensions#tabline#title(n)
let title = ''
if s:taboo
let title = TabooTabTitle(a:n)
function! airline#extensions#tabline#add_tab_label(dict)
let show_tab_count = get(g:, 'airline#extensions#tabline#show_tab_count', 1)
if show_tab_count == 2
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
elseif show_tab_count == 1 && tabpagenr('$') > 1
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
endif
if empty(title) && exists('*gettabvar')
let title = gettabvar(a:n, 'title')
endif
if empty(title)
let buflist = tabpagebuflist(a:n)
let winnr = tabpagewinnr(a:n)
let all_buffers = airline#extensions#tabline#buflist#list()
return airline#extensions#tabline#get_buffer_name(
\ buflist[winnr - 1],
\ filter(buflist, 'index(all_buffers, v:val) != -1'))
endif
return title
endfunction
function! airline#extensions#tabline#get_buffer_name(nr, ...)
let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list()
return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, buffers)
endfunction
if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
function! airline#extensions#tabline#new_builder()
let builder_context = {
\ 'active' : 1,
\ 'tabline' : 1,
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep),
\ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep),
\ }
if get(g:, 'airline_powerline_fonts', 0)
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep)
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep)
else
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ')
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|')
endif
return airline#builder#new(builder_context)
endfunction
function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
let cur = bufnr('%')
if cur == a:bufnr
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
let group = 'airline_tabmod'
else
let group = 'airline_tabsel'
" Legacy VimScript implementation " {{{1
function! s:toggle_off() " {{{2
call airline#extensions#tabline#autoshow#off()
call airline#extensions#tabline#tabs#off()
call airline#extensions#tabline#buffers#off()
if s:ctrlspace
call airline#extensions#tabline#ctrlspace#off()
endif
else
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
let group = 'airline_tabmod_unsel'
elseif index(a:tab_bufs, a:bufnr) > -1
let group = 'airline_tab'
else
let group = 'airline_tabhid'
if s:tabws
call airline#extensions#tabline#tabws#off()
endif
endif
return group
endfunction
endfunction
function! s:toggle_on() " {{{2
if get(g:, 'airline_statusline_ontop', 0)
call airline#extensions#tabline#enable()
let &tabline='%!airline#statusline('.winnr().')'
return
endif
call airline#extensions#tabline#autoshow#on()
call airline#extensions#tabline#tabs#on()
call airline#extensions#tabline#buffers#on()
if s:ctrlspace
call airline#extensions#tabline#ctrlspace#on()
endif
if s:tabws
call airline#extensions#tabline#tabws#on()
endif
set tabline=%!airline#extensions#tabline#get()
endfunction
function! s:update_tabline(forceit) " {{{2
if get(g:, 'airline#extensions#tabline#disable_refresh', 0)
return
endif
" loading a session file
" On SessionLoadPost, g:SessionLoad variable is still set :/
if !a:forceit && get(g:, 'SessionLoad', 0)
return
endif
let match = expand('<afile>')
if pumvisible()
return
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
return
" return, if buffer matches ignore pattern or is directory (netrw)
elseif empty(match) || airline#util#ignore_buf(match) || isdirectory(match)
return
endif
call airline#util#doautocmd('BufMRUChange')
call airline#extensions#tabline#redraw()
endfunction
function! airline#extensions#tabline#redraw() " {{{2
" sometimes, the tabline is not correctly updated see #1580
" so force redraw here
if exists(":redrawtabline") == 2
redrawtabline
else
" Have to set a property equal to itself to get airline to re-eval.
" Setting `let &tabline=&tabline` destroys the cursor position so we
" need something less invasive.
let &ro = &ro
endif
endfunction
function! airline#extensions#tabline#enable() " {{{2
if &lines > 3
set showtabline=2
endif
endfunction
function! airline#extensions#tabline#load_theme(palette) " {{{2
if pumvisible()
return
endif
let colors = get(a:palette, 'tabline', {})
let tablabel = get(colors, 'airline_tablabel', a:palette.normal.airline_b)
" Theme for tabs on the left
let tab = get(colors, 'airline_tab', a:palette.inactive.airline_c)
let tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
let tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
let tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
let tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
let tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c)
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
else
"Fall back to normal airline_c if modified airline_c isn't present
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
endif
call airline#highlighter#exec('airline_tablabel', tablabel)
call airline#highlighter#exec('airline_tab', tab)
call airline#highlighter#exec('airline_tabsel', tabsel)
call airline#highlighter#exec('airline_tabtype', tabtype)
call airline#highlighter#exec('airline_tabfill', tabfill)
call airline#highlighter#exec('airline_tabmod', tabmod)
call airline#highlighter#exec('airline_tabmod_unsel', tabmodu)
call airline#highlighter#exec('airline_tabhid', tabhid)
" Theme for tabs on the right
" label on the right
let tablabel_r = get(colors, 'airline_tablabel', a:palette.normal.airline_b)
let tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
let tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
let tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
let tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c)
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c)
else
"Fall back to normal airline_c if modified airline_c isn't present
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
endif
call airline#highlighter#exec('airline_tablabel_right', tablabel_r)
call airline#highlighter#exec('airline_tab_right', tab_right)
call airline#highlighter#exec('airline_tabsel_right', tabsel_right)
call airline#highlighter#exec('airline_tabmod_right', tabmod_right)
call airline#highlighter#exec('airline_tabhid_right', tabhid_right)
call airline#highlighter#exec('airline_tabmod_unsel_right', tabmodu_right)
endfunction
function! airline#extensions#tabline#get() " {{{2
let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
let curtabcnt = tabpagenr('$')
if curtabcnt != s:current_tabcnt
let s:current_tabcnt = curtabcnt
call airline#extensions#tabline#tabs#invalidate()
call airline#extensions#tabline#buffers#invalidate()
call airline#extensions#tabline#ctrlspace#invalidate()
call airline#extensions#tabline#tabws#invalidate()
endif
if !exists('#airline#BufAdd#*')
autocmd airline BufAdd * call <sid>update_tabline(0)
endif
if !exists('#airline#SessionLoadPost')
autocmd airline SessionLoadPost * call <sid>update_tabline(1)
endif
if s:ctrlspace
return airline#extensions#tabline#ctrlspace#get()
elseif s:tabws
return airline#extensions#tabline#tabws#get()
elseif show_buffers && curtabcnt == 1 || !show_tabs
return airline#extensions#tabline#buffers#get()
else
return airline#extensions#tabline#tabs#get()
endif
endfunction
function! airline#extensions#tabline#title(n) " {{{2
let title = ''
if s:taboo
let title = TabooTabTitle(a:n)
endif
if empty(title) && exists('*gettabvar')
let title = gettabvar(a:n, 'title')
endif
let formatter = get(g:, 'airline#extensions#tabline#tabtitle_formatter')
if empty(title) && formatter !=# '' && exists("*".formatter)
let title = call(formatter, [a:n])
endif
if empty(title)
let buflist = tabpagebuflist(a:n)
let winnr = tabpagewinnr(a:n)
let all_buffers = airline#extensions#tabline#buflist#list()
let curbuf = filter(buflist, 'index(all_buffers, v:val) != -1')
if len(curbuf) == 0
call add(curbuf, tabpagebuflist()[0])
endif
return airline#extensions#tabline#get_buffer_name(curbuf[0], curbuf)
endif
return title
endfunction
function! airline#extensions#tabline#get_buffer_name(nr, ...) " {{{2
let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list()
let formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, buffers)
endfunction
function! airline#extensions#tabline#new_builder() " {{{2
let builder_context = {
\ 'active' : 1,
\ 'tabline' : 1,
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep),
\ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep),
\ }
if get(g:, 'airline_powerline_fonts', 0)
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep)
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep)
else
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ')
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|')
endif
return airline#extensions#tabline#builder#new(builder_context)
endfunction
function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr) " {{{2
let cur = bufnr('%')
if cur == a:bufnr
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
let group = 'airline_tabmod'
else
let group = 'airline_tabsel'
endif
else
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
let group = 'airline_tabmod_unsel'
elseif index(a:tab_bufs, a:bufnr) > -1
let group = 'airline_tab'
else
let group = 'airline_tabhid'
endif
endif
return group
endfunction
function! airline#extensions#tabline#add_tab_label(dict) " {{{2
let show_tab_count = get(g:, 'airline#extensions#tabline#show_tab_count', 1)
if show_tab_count == 2
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
elseif show_tab_count == 1 && tabpagenr('$') > 1
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
endif
endfunction
else
" Vim9 Script implementation
"def airline#extensions#tabline#init(ext: dict<any>): void # {{{2
" Seems not to work yet :(
" if has('gui_running') && match(&guioptions, 'e') > -1
" :set guioptions-=e
" endif
" autocmd User AirlineToggledOn call s:toggle_on()
" autocmd User AirlineToggledOff call s:toggle_off()
" s:toggle_on()
" try
" ext.add_theme_func('airline#extensions#tabline#load_theme')
" catch
" endtry
"enddef
def s:toggle_off(): void # {{{2
airline#extensions#tabline#autoshow#off()
airline#extensions#tabline#tabs#off()
airline#extensions#tabline#buffers#off()
if s:ctrlspace
airline#extensions#tabline#ctrlspace#off()
endif
if s:tabws
airline#extensions#tabline#tabws#off()
endif
enddef
def s:toggle_on(): void # {{{2
if get(g:, 'airline_statusline_ontop', 0)
airline#extensions#tabline#enable()
&tabline = '%!airline#statusline(' .. winnr() .. ')'
return
endif
airline#extensions#tabline#autoshow#on()
airline#extensions#tabline#tabs#on()
airline#extensions#tabline#buffers#on()
if s:ctrlspace
airline#extensions#tabline#ctrlspace#on()
endif
if s:tabws
airline#extensions#tabline#tabws#on()
endif
&tabline = '%!airline#extensions#tabline#get()'
enddef
def s:update_tabline(forceit: number): void # {{{2
if get(g:, 'airline#extensions#tabline#disable_refresh', 0)
return
endif
if !forceit && get(g:, 'SessionLoad', 0)
return
endif
var match = expand('<afile>')
if pumvisible()
return
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
return
# return, if buffer matches ignore pattern or is directory (netrw)
elseif empty(match) || airline#util#ignore_buf(match) || isdirectory(match)
return
endif
airline#util#doautocmd('BufMRUChange')
airline#extensions#tabline#redraw()
enddef
def airline#extensions#tabline#redraw(): void # {{{2
# TODO: Is this still needed?
:redrawtabline
enddef
def airline#extensions#tabline#enable(): void # {{{2
if &lines > 3
&showtabline = 2
endif
enddef
def airline#extensions#tabline#load_theme(palette: dict<any>): void # {{{2
if pumvisible()
return
endif
var colors = get(palette, 'tabline', {})
var tablabel = get(colors, 'airline_tablabel', palette.normal.airline_b)
# Theme for tabs on the left
var tab = get(colors, 'airline_tab', palette.inactive.airline_c)
var tabsel = get(colors, 'airline_tabsel', palette.normal.airline_a)
var tabtype = get(colors, 'airline_tabtype', palette.visual.airline_a)
var tabfill = get(colors, 'airline_tabfill', palette.normal.airline_c)
var tabmod = get(colors, 'airline_tabmod', palette.insert.airline_a)
var tabhid = get(colors, 'airline_tabhid', palette.normal.airline_c)
var tabmodu = tabhid
var tabmodu_right = tabhid
if has_key(palette, 'normal_modified') && has_key(palette.normal_modified, 'airline_c')
tabmodu = get(colors, 'airline_tabmod_unsel', palette.normal_modified.airline_c)
tabmodu_right = get(colors, 'airline_tabmod_unsel_right', palette.normal_modified.airline_c)
else
# Fall back to normal airline_c if modified airline_c isn't present
tabmodu = get(colors, 'airline_tabmod_unsel', palette.normal.airline_c)
tabmodu_right = get(colors, 'airline_tabmod_unsel_right', palette.normal.airline_c)
endif
airline#highlighter#exec('airline_tablabel', tablabel)
airline#highlighter#exec('airline_tab', tab)
airline#highlighter#exec('airline_tabsel', tabsel)
airline#highlighter#exec('airline_tabtype', tabtype)
airline#highlighter#exec('airline_tabfill', tabfill)
airline#highlighter#exec('airline_tabmod', tabmod)
airline#highlighter#exec('airline_tabmod_unsel', tabmodu)
airline#highlighter#exec('airline_tabmod_unsel_right', tabmodu_right)
airline#highlighter#exec('airline_tabhid', tabhid)
# Theme for tabs on the right
var tablabel_r = get(colors, 'airline_tablabel', palette.normal.airline_b)
var tabsel_right = get(colors, 'airline_tabsel_right', palette.normal.airline_a)
var tab_right = get(colors, 'airline_tab_right', palette.inactive.airline_c)
var tabmod_right = get(colors, 'airline_tabmod_right', palette.insert.airline_a)
var tabhid_right = get(colors, 'airline_tabhid_right', palette.normal.airline_c)
airline#highlighter#exec('airline_tablabel_right', tablabel_r)
airline#highlighter#exec('airline_tab_right', tab_right)
airline#highlighter#exec('airline_tabsel_right', tabsel_right)
airline#highlighter#exec('airline_tabmod_right', tabmod_right)
airline#highlighter#exec('airline_tabhid_right', tabhid_right)
enddef
def airline#extensions#tabline#get(): string # {{{2
var show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
var show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
var curtabcnt = tabpagenr('$')
if curtabcnt != s:current_tabcnt
s:current_tabcnt = curtabcnt
airline#extensions#tabline#tabs#invalidate()
airline#extensions#tabline#buffers#invalidate()
airline#extensions#tabline#ctrlspace#invalidate()
airline#extensions#tabline#tabws#invalidate()
endif
if !exists('#airline#BufAdd#*')
autocmd airline BufAdd * call <sid>update_tabline(0)
endif
if !exists('#airline#SessionLoadPost')
autocmd airline SessionLoadPost * call <sid>update_tabline(1)
endif
if s:ctrlspace
return airline#extensions#tabline#ctrlspace#get()
elseif s:tabws
return airline#extensions#tabline#tabws#get()
elseif show_buffers && curtabcnt == 1 || !show_tabs
return airline#extensions#tabline#buffers#get()
else
return airline#extensions#tabline#tabs#get()
endif
enddef
def airline#extensions#tabline#title(n: number): string # {{{2
var title = ''
if get(g:, 'airline#extensions#taboo#enabled', 1) &&
get(g:, 'loaded_taboo', 0) && exists("*TabooTabTitle")
title = call("TabooTabTitle", [n])
endif
if empty(title)
title = gettabvar(n, 'title')
endif
var formatter = get(g:, 'airline#extensions#tabline#tabtitle_formatter', '')
if empty(title) && !empty(formatter) && exists("*" .. formatter)
title = call(formatter, [n])
endif
if empty(title)
var buflist = tabpagebuflist(n)
var winnr = tabpagewinnr(n)
var all_buffers = airline#extensions#tabline#buflist#list()
var curbuf = filter(buflist, {_, v -> index(all_buffers, v) != -1})
if len(curbuf) == 0
add(curbuf, tabpagebuflist()[0])
endif
return airline#extensions#tabline#get_buffer_name(curbuf[0], curbuf)
endif
return title
enddef
def airline#extensions#tabline#get_buffer_name(nr: number, buffers = airline#extensions#tabline#buflist#list()): string # {{{2
var Formatter = 'airline#extensions#tabline#formatters#' .. get(g:, 'airline#extensions#tabline#formatter', 'default') .. '#format'
return call(Formatter, [ nr, buffers] )
enddef
def airline#extensions#tabline#new_builder(): dict<any> # {{{2
var builder_context = {
'active': 1,
'tabline': 1,
'right_sep': get(g:, 'airline#extensions#tabline#right_sep', g:airline_right_sep),
'right_alt_sep': get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep),
'left_sep': get(g:, 'airline#extensions#tabline#left_sep', g:airline_left_sep),
'left_alt_sep': get(g:, 'airline#extensions#tabline#left_alt_sep', g:airline_left_alt_sep),
}
return airline#extensions#tabline#builder#new(builder_context)
enddef
def airline#extensions#tabline#group_of_bufnr(tab_bufs: list<number>, bufnr: number): string # {{{2
var cur = bufnr('%')
var group = ''
if cur == bufnr
if g:airline_detect_modified && getbufvar(bufnr, '&modified')
group = 'airline_tabmod'
else
group = 'airline_tabsel'
endif
else
if g:airline_detect_modified && getbufvar(bufnr, '&modified')
group = 'airline_tabmod_unsel'
elseif index(tab_bufs, bufnr) > -1
group = 'airline_tab'
else
group = 'airline_tabhid'
endif
endif
return group
enddef
"def airline#extensions#tabline#add_label(dict: dict<any>, type: string, right: number): void # {{{2
" # Seems not to work yet :(
" if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
" dict.add_section_spaced('airline_tablabel' .. (right ? '_right' : ''),
" get(g:, 'airline#extensions#tabline#' .. type .. '_label', type))
" endif
"enddef
" def airline#extensions#tabline#add_tab_label(dict: dict<any>): void # {{{2
" var show_tab_count = get(g:, 'airline#extensions#tabline#show_tab_count', 1)
" if show_tab_count == 2
" dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
" elseif show_tab_count == 1 && tabpagenr('$') > 1
" dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
" endif
" enddef
endif

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -24,9 +24,7 @@ function! airline#extensions#tabline#autoshow#on()
augroup airline_tabline_autoshow
autocmd!
if s:buf_min_count <= 0 && s:tab_min_count <= 1
if &lines > 3
set showtabline=2
endif
call airline#extensions#tabline#enable()
else
if s:show_buffers == 1
autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()))

View File

@@ -1,11 +1,8 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
let s:spc = g:airline_symbols.space
let s:current_bufnr = -1
@@ -36,11 +33,14 @@ function! airline#extensions#tabline#buffers#off()
endfunction
function! airline#extensions#tabline#buffers#on()
let terminal_event = has("nvim") ? 'TermOpen' : 'TerminalOpen'
augroup airline_tabline_buffers
autocmd!
autocmd BufDelete * call airline#extensions#tabline#buffers#invalidate()
autocmd User BufMRUChange call airline#extensions#tabline#buflist#invalidate()
autocmd User BufMRUChange call airline#extensions#tabline#buffers#invalidate()
autocmd BufDelete * call airline#extensions#tabline#buflist#clean()
if exists("##".terminal_event)
exe 'autocmd '. terminal_event. ' * call airline#extensions#tabline#buflist#clean()'
endif
autocmd User BufMRUChange call airline#extensions#tabline#buflist#clean()
augroup END
endfunction
@@ -49,122 +49,133 @@ function! airline#extensions#tabline#buffers#invalidate()
endfunction
function! airline#extensions#tabline#buffers#get()
call <sid>map_keys()
try
call <sid>map_keys()
catch
" no-op
endtry
let cur = bufnr('%')
if cur == s:current_bufnr
if cur == s:current_bufnr && &columns == s:column_width
if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified
return s:current_tabline
endif
endif
let l:index = 1
let b = airline#extensions#tabline#new_builder()
let tab_bufs = tabpagebuflist(tabpagenr())
for nr in s:get_visible_buffers()
if nr < 0
call b.add_raw('%#airline_tabhid#...')
continue
let show_buf_label_first = 0
if get(g:, 'airline#extensions#tabline#buf_label_first', 0)
let show_buf_label_first = 1
endif
if show_buf_label_first
call airline#extensions#tabline#add_label(b, 'buffers', 0)
endif
let b.tab_bufs = tabpagebuflist(tabpagenr())
let b.overflow_group = 'airline_tabhid'
let b.buffers = airline#extensions#tabline#buflist#list()
if get(g:, 'airline#extensions#tabline#current_first', 0)
if index(b.buffers, cur) > -1
call remove(b.buffers, index(b.buffers, cur))
endif
let b.buffers = [cur] + b.buffers
endif
let group = airline#extensions#tabline#group_of_bufnr(tab_bufs, nr)
if nr == cur
function! b.get_group(i) dict
let bufnum = get(self.buffers, a:i, -1)
if bufnum == -1
return ''
endif
let group = airline#extensions#tabline#group_of_bufnr(self.tab_bufs, bufnum)
if bufnum == bufnr('%')
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
endif
return group
endfunction
" Neovim feature: Have clickable buffers
if has("tablineat")
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@')
endif
if s:buffer_idx_mode
if len(s:number_map) > 0
call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
else
call b.add_section(group, '['.l:index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
endif
let l:index = l:index + 1
if has("tablineat")
function! b.get_pretitle(i) dict
let bufnum = get(self.buffers, a:i, -1)
return '%'.bufnum.'@airline#extensions#tabline#buffers#clickbuf@'
endfunction
function! b.get_posttitle(i) dict
return '%X'
endfunction
endif
function! b.get_title(i) dict
let bufnum = get(self.buffers, a:i, -1)
let group = self.get_group(a:i)
let pgroup = self.get_group(a:i - 1)
" always add a space when powerline_fonts are used
" or for the very first item
if get(g:, 'airline_powerline_fonts', 0) || a:i == 0
let space = s:spc
else
call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
let space= (pgroup == group ? s:spc : '')
endif
if has("tablineat")
call b.add_raw('%X')
if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
if len(s:number_map) > 0
return space. s:get_number(a:i) . '%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)' . s:spc
else
return '['.(a:i+1).s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)'.']'
endif
else
return space.'%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)'.s:spc
endif
endfor
endfunction
let current_buffer = max([index(b.buffers, cur), 0])
let last_buffer = len(b.buffers) - 1
call b.insert_titles(current_buffer, 0, last_buffer)
call b.add_section('airline_tabfill', '')
call b.split()
call b.add_section('airline_tabfill', '')
if s:show_tab_type
call b.add_section_spaced('airline_tabtype', s:buffers_label)
endif
if tabpagenr('$') > 1
call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
if !show_buf_label_first
call airline#extensions#tabline#add_label(b, 'buffers', 1)
endif
call airline#extensions#tabline#add_tab_label(b)
let s:current_bufnr = cur
let s:column_width = &columns
let s:current_tabline = b.build()
let s:current_visible_buffers = copy(b.buffers)
" Do not remove from s:current_visible_buffers, this breaks s:select_tab()
"if b._right_title <= last_buffer
" call remove(s:current_visible_buffers, b._right_title, last_buffer)
"endif
"if b._left_title > 0
" call remove(s:current_visible_buffers, 0, b._left_title)
"endif
return s:current_tabline
endfunction
function! s:get_visible_buffers()
let buffers = airline#extensions#tabline#buflist#list()
let cur = bufnr('%')
let total_width = 0
let max_width = 0
for nr in buffers
let width = len(airline#extensions#tabline#get_buffer_name(nr)) + 4
let total_width += width
let max_width = max([max_width, width])
endfor
" only show current and surrounding buffers if there are too many buffers
let position = index(buffers, cur)
let vimwidth = &columns
if total_width > vimwidth && position > -1
let buf_count = len(buffers)
" determine how many buffers to show based on the longest buffer width,
" use one on the right side and put the rest on the left
let buf_max = vimwidth / max_width
let buf_right = 1
let buf_left = max([0, buf_max - buf_right])
let start = max([0, position - buf_left])
let end = min([buf_count, position + buf_right])
" fill up available space on the right
if position < buf_left
let end += (buf_left - position)
endif
" fill up available space on the left
if end > buf_count - 1 - buf_right
let start -= max([0, buf_right - (buf_count - 1 - position)])
endif
let buffers = eval('buffers[' . start . ':' . end . ']')
if start > 0
call insert(buffers, -1, 0)
endif
if end < buf_count - 1
call add(buffers, -1)
endif
function! s:get_number(index)
if len(s:number_map) == 0
return a:index
endif
let bidx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
if bidx_mode > 1
let l:count = bidx_mode == 2 ? a:index+11 : a:index+1
return join(map(split(printf('%02d', l:count), '\zs'),
\ 'get(s:number_map, v:val, "")'), '')
else
return get(s:number_map, a:index+1, '')
endif
let s:current_visible_buffers = buffers
return buffers
endfunction
function! s:select_tab(buf_index)
" no-op when called in the NERDTree buffer
if exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName
" no-op when called in 'keymap_ignored_filetypes'
if count(get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes',
\ ['vimfiler', 'nerdtree']), &ft)
return
endif
let idx = a:buf_index
if s:current_visible_buffers[0] == -1
let idx = idx + 1
@@ -172,31 +183,35 @@ function! s:select_tab(buf_index)
let buf = get(s:current_visible_buffers, idx, 0)
if buf != 0
exec 'b!' . buf
endif
exec 'b!' . buf
endif
endfunction
function! s:jump_to_tab(offset)
let l = s:current_visible_buffers
let l = airline#extensions#tabline#buflist#list()
let i = index(l, bufnr('%'))
if i > -1
exec 'b!' . l[float2nr(fmod(i + a:offset, len(l)))]
exec 'b!' . l[(i + a:offset) % len(l)]
endif
endfunction
function! s:map_keys()
if s:buffer_idx_mode
noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
noremap <silent> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR>
noremap <silent> <Plug>AirlineSelectTab4 :call <SID>select_tab(3)<CR>
noremap <silent> <Plug>AirlineSelectTab5 :call <SID>select_tab(4)<CR>
noremap <silent> <Plug>AirlineSelectTab6 :call <SID>select_tab(5)<CR>
noremap <silent> <Plug>AirlineSelectTab7 :call <SID>select_tab(6)<CR>
noremap <silent> <Plug>AirlineSelectTab8 :call <SID>select_tab(7)<CR>
noremap <silent> <Plug>AirlineSelectTab9 :call <SID>select_tab(8)<CR>
let bidx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1)
if bidx_mode > 0
if bidx_mode == 1
for i in range(1, 9)
exe printf('noremap <silent> <Plug>AirlineSelectTab%d :call <SID>select_tab(%d)<CR>', i, i-1)
endfor
else
let start_idx = bidx_mode == 2 ? 11 : 1
for i in range(start_idx, 99)
exe printf('noremap <silent> <Plug>AirlineSelectTab%02d :call <SID>select_tab(%d)<CR>', i, i-start_idx)
endfor
endif
noremap <silent> <Plug>AirlineSelectPrevTab :<C-u>call <SID>jump_to_tab(-v:count1)<CR>
noremap <silent> <Plug>AirlineSelectNextTab :<C-u>call <SID>jump_to_tab(v:count1)<CR>
" Enable this for debugging
" com! AirlineBufferList :echo map(copy(s:current_visible_buffers), {i,k -> k.": ".bufname(k)})
endif
endfunction
@@ -212,7 +227,7 @@ function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, mo
elseif a:button is# 'm'
" middle button - delete buffer
if get(g:, 'airline#extensions#tabline#middle_click_preserves_windows', 0) == 0
if get(g:, 'airline#extensions#tabline#middle_click_preserves_windows', 0) == 0 || winnr('$') == 1
" just simply delete the clicked buffer. This will cause windows
" associated with the clicked buffer to be closed.
silent execute 'bdelete' a:minwid

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -7,12 +7,38 @@ function! airline#extensions#tabline#buflist#invalidate()
unlet! s:current_buffer_list
endfunction
function! airline#extensions#tabline#buflist#clean()
call airline#extensions#tabline#buflist#invalidate()
call airline#extensions#tabline#buffers#invalidate()
endfunction
" paths in excludes list
function! s:ExcludePaths(nr, exclude_paths)
let bname = bufname(a:nr)
if empty(bname)
return 0
endif
let bpath = fnamemodify(bname, ":p")
for f in a:exclude_paths
if bpath =~# f | return 1 | endif
endfor
endfunction
" other types to exclude
function! s:ExcludeOther(nr, exclude_preview)
if (getbufvar(a:nr, 'current_syntax') == 'qf') ||
\ (a:exclude_preview && getbufvar(a:nr, '&bufhidden') == 'wipe'
\ && getbufvar(a:nr, '&buftype') == 'nofile')
return 1 | endif
endfunction
function! airline#extensions#tabline#buflist#list()
if exists('s:current_buffer_list')
return s:current_buffer_list
endif
let excludes = get(g:, 'airline#extensions#tabline#excludes', [])
let exclude_buffers = get(g:, 'airline#extensions#tabline#exclude_buffers', [])
let exclude_paths = get(g:, 'airline#extensions#tabline#excludes', [])
let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1)
let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$"))
@@ -24,16 +50,28 @@ function! airline#extensions#tabline#buflist#list()
for nr in list
if buflisted(nr)
" Do not add to the bufferlist, if either
" 1) buffername matches exclude pattern
" 2) buffer is a quickfix buffer
" 3) exclude preview windows (if 'bufhidden' == wipe
" and 'buftype' == nofile
if (!empty(excludes) && match(bufname(nr), join(excludes, '\|')) > -1) ||
\ (getbufvar(nr, 'current_syntax') == 'qf') ||
\ (exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe'
\ && getbufvar(nr, '&buftype') == 'nofile')
" 1) bufnr is exclude_buffers list
" 2) buffername matches one of exclude_paths patterns
" 3) buffer is a quickfix buffer
" 4) when excluding preview windows:
" 'bufhidden' == wipe
" 'buftype' == nofile
" 5) ignore buffers matching airline#extensions#tabline#ignore_bufadd_pat
" check buffer numbers first
if index(exclude_buffers, nr) >= 0
continue
" check paths second
elseif !empty(exclude_paths) && s:ExcludePaths(nr, exclude_paths)
continue
" ignore buffers matching airline#extensions#tabline#ignore_bufadd_pat
elseif airline#util#ignore_buf(bufname(nr))
continue
" check other types last
elseif s:ExcludeOther(nr, exclude_preview)
continue
endif
call add(buffers, nr)
endif
endfor
@@ -41,4 +79,3 @@ function! airline#extensions#tabline#buflist#list()
let s:current_buffer_list = buffers
return buffers
endfunction

View File

@@ -0,0 +1,232 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:prototype = {}
" Set the point in the tabline where the builder should insert the titles.
"
" Subsequent calls will overwrite the previous ones, so only the last call
" determines to location to insert titles.
"
" NOTE: The titles are not inserted until |build| is called, so that the
" remaining contents of the tabline can be taken into account.
"
" Callers should define at least |get_title| and |get_group| on the host
" object before calling |build|.
function! s:prototype.insert_titles(current, first, last) dict
let self._first_title = a:first " lowest index
let self._last_title = a:last " highest index
let self._left_title = a:current " next index to add on the left
let self._right_title = a:current + 1 " next index to add on the right
let self._left_position = self.get_position() " left end of titles
let self._right_position = self._left_position " right end of the titles
endfunction
" Insert a title for entry number |index|, of group |group| at position |pos|,
" if there is space for it. Returns 1 if it is inserted, 0 otherwise
"
" |force| inserts the title even if there isn't enough space left for it.
" |sep_size| adjusts the size change that the title is considered to take up,
" to account for changes to the separators
"
" The title is defined by |get_title| on the hosting object, called with
" |index| as its only argument.
" |get_pretitle| and |get_posttitle| may be defined on the host object to
" insert some formatting before or after the title. These should be 0-width.
"
" This method updates |_right_position| and |_remaining_space| on the host
" object, if the title is inserted.
function! s:prototype.try_insert_title(index, group, pos, sep_size, force) dict
let title = self.get_title(a:index)
let title_size = s:tabline_evaluated_length(title) + a:sep_size
if a:force || self._remaining_space >= title_size
let pos = a:pos
if has_key(self, "get_pretitle")
call self.insert_raw(self.get_pretitle(a:index), pos)
let self._right_position += 1
let pos += 1
endif
call self.insert_section(a:group, title, pos)
let self._right_position += 1
let pos += 1
if has_key(self, "get_posttitle")
call self.insert_raw(self.get_posttitle(a:index), pos)
let self._right_position += 1
let pos += 1
endif
let self._remaining_space -= title_size
return 1
endif
return 0
endfunction
function! s:get_separator_change(new_group, old_group, end_group, sep_size, alt_sep_size)
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)
endfunction
" Compute the change in size of the tabline caused by separators
"
" This should be kept up-to-date with |s:get_transitioned_seperator| and
" |s:get_separator| in autoload/airline/builder.vim
function! s:get_separator_change_with_end(new_group, old_group, new_end_group, old_end_group, sep_size, alt_sep_size)
let sep_change = 0
if !empty(a:new_end_group) " Separator between title and the end
let sep_change += airline#builder#should_change_group(a:new_group, a:new_end_group) ? a:sep_size : a:alt_sep_size
endif
if !empty(a:old_group) " Separator between the title and the one adjacent
let sep_change += airline#builder#should_change_group(a:new_group, a:old_group) ? a:sep_size : a:alt_sep_size
if !empty(a:old_end_group) " Remove mis-predicted separator
let sep_change -= airline#builder#should_change_group(a:old_group, a:old_end_group) ? a:sep_size : a:alt_sep_size
endif
endif
return sep_change
endfunction
" This replaces the build function of the |airline#builder#new| object, to
" insert titles as specified by the last call to |insert_titles| before
" passing to the original build function.
"
" Callers should define at least |get_title| and |get_group| on the host
" object if |insert_titles| has been called on it.
function! s:prototype.build() dict
if has_key(self, '_left_position') && self._first_title <= self._last_title
let self._remaining_space = &columns - s:tabline_evaluated_length(self._build())
let center_active = get(g:, 'airline#extensions#tabline#center_active', 0)
let sep_size = s:tabline_evaluated_length(self._context.left_sep)
let alt_sep_size = s:tabline_evaluated_length(self._context.left_alt_sep)
let outer_left_group = airline#builder#get_prev_group(self._sections, self._left_position)
let outer_right_group = airline#builder#get_next_group(self._sections, self._right_position)
let overflow_marker = get(g:, 'airline#extensions#tabline#overflow_marker', g:airline_symbols.ellipsis)
let overflow_marker_size = s:tabline_evaluated_length(overflow_marker)
" Allow space for the markers before we begin filling in titles.
if self._left_title > self._first_title
let self._remaining_space -= overflow_marker_size +
\ s:get_separator_change(self.overflow_group, "", outer_left_group, sep_size, alt_sep_size)
endif
if self._left_title < self._last_title
let self._remaining_space -= overflow_marker_size +
\ s:get_separator_change(self.overflow_group, "", outer_right_group, sep_size, alt_sep_size)
endif
" Add the current title
let group = self.get_group(self._left_title)
if self._left_title == self._first_title
let sep_change = s:get_separator_change(group, "", outer_left_group, sep_size, alt_sep_size)
else
let sep_change = s:get_separator_change(group, "", self.overflow_group, sep_size, alt_sep_size)
endif
if self._left_title == self._last_title
let sep_change += s:get_separator_change(group, "", outer_right_group, sep_size, alt_sep_size)
else
let sep_change += s:get_separator_change(group, "", self.overflow_group, sep_size, alt_sep_size)
endif
let left_group = group
let right_group = group
let self._left_title -=
\ self.try_insert_title(self._left_title, group, self._left_position, sep_change, 1)
if get(g:, 'airline#extensions#tabline#current_first', 0)
" always have current title first
let self._left_position += 1
endif
if !center_active && self._right_title <= self._last_title
" Add the title to the right
let group = self.get_group(self._right_title)
if self._right_title == self._last_title
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
else
let sep_change = s:get_separator_change(group, right_group, self.overflow_group, sep_size, alt_sep_size)
endif
let right_group = group
let self._right_title +=
\ self.try_insert_title(self._right_title, group, self._right_position, sep_change, 1)
endif
while self._remaining_space > 0
let done = 0
if self._left_title >= self._first_title
" Insert next title to the left
let group = self.get_group(self._left_title)
if self._left_title == self._first_title
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
else
let sep_change = s:get_separator_change(group, left_group, self.overflow_group, sep_size, alt_sep_size)
endif
let left_group = group
let done = self.try_insert_title(self._left_title, group, self._left_position, sep_change, 0)
let self._left_title -= done
endif
" If center_active is set, this |if| operates as an independent |if|,
" otherwise as an |elif|.
if self._right_title <= self._last_title && (center_active || !done)
" Insert next title to the right
let group = self.get_group(self._right_title)
if self._right_title == self._last_title
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
else
let sep_change = s:get_separator_change(group, right_group, self.overflow_group, sep_size, alt_sep_size)
endif
let right_group = group
let done = self.try_insert_title(self._right_title, group, self._right_position, sep_change, 0)
let self._right_title += done
endif
if !done
break
endif
endwhile
if self._left_title >= self._first_title
if get(g:, 'airline#extensions#tabline#current_first', 0)
let self._left_position -= 1
endif
call self.insert_section(self.overflow_group, overflow_marker, self._left_position)
let self._right_position += 1
endif
if self._right_title <= self._last_title
call self.insert_section(self.overflow_group, overflow_marker, self._right_position)
endif
endif
return self._build()
endfunction
let s:prototype.overflow_group = 'airline_tab'
" Extract the text content a tabline will render. (Incomplete).
"
" See :help 'statusline' for the list of fields.
function! s:evaluate_tabline(tabline)
let tabline = a:tabline
let tabline = substitute(tabline, '%{\([^}]\+\)}', '\=eval(submatch(1))', 'g')
let tabline = substitute(tabline, '%#[^#]\+#', '', 'g')
let tabline = substitute(tabline, '%(\([^)]\+\)%)', '\1', 'g')
let tabline = substitute(tabline, '%\d\+[TX]', '', 'g')
let tabline = substitute(tabline, '%=', '', 'g')
let tabline = substitute(tabline, '%\d*\*', '', 'g')
if has('tablineat')
let tabline = substitute(tabline, '%@[^@]\+@', '', 'g')
endif
return tabline
endfunction
function! s:tabline_evaluated_length(tabline)
return airline#util#strchars(s:evaluate_tabline(a:tabline))
endfunction
function! airline#extensions#tabline#builder#new(context)
let builder = airline#builder#new(a:context)
let builder._build = builder.build
call extend(builder, s:prototype, 'force')
return builder
endfunction

View File

@@ -1,17 +1,14 @@
" MIT License. Copyright (c) 2016 Kevin Sapper
" MIT License. Copyright (c) 2016-2020 Kevin Sapper et al.
" Plugin: https://github.com/szw/vim-ctrlspace
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:current_bufnr = -1
let s:current_modified = 0
let s:current_tabnr = -1
let s:current_tabline = ''
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
let s:switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0)
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
let s:highlight_groups = ['hid', 0, '', 'sel', 'mod_unsel', 0, 'mod_unsel', 'mod']
function! airline#extensions#tabline#ctrlspace#off()
augroup airline_tabline_ctrlspace
@@ -31,118 +28,137 @@ function! airline#extensions#tabline#ctrlspace#invalidate()
let s:current_tabnr = -1
endfunction
function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pos)
if a:pos == 0
let pos_extension = ''
else
let pos_extension = '_right'
endif
let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab)
for buffer in s:buffer_list
if a:cur_buf == buffer.index
if buffer.modified
let group = 'airline_tabmod'.pos_extension
else
let group = 'airline_tabsel'.pos_extension
endif
else
if buffer.modified
let group = 'airline_tabmod_unsel'.pos_extension
elseif buffer.visible
let group = 'airline_tab'.pos_extension
else
let group = 'airline_tabhid'.pos_extension
endif
function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pull_right)
let pos_extension = (a:pull_right ? '_right' : '')
let buffer_list = []
for bufferindex in sort(keys(ctrlspace#api#Buffers(a:cur_tab)), 'N')
for buffer in ctrlspace#api#BufferList(a:cur_tab)
if buffer['index'] == bufferindex
call add(buffer_list, buffer)
endif
let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)'
if has("tablineat")
let buf_name = '%'.buffer.index.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X'
endif
call a:builder.add_section_spaced(group, buf_name)
endfor
endfor
endfunction
function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos)
if a:pos == 0
let pos_extension = ''
else
let pos_extension = '_right'
" add by tenfy(tenfyzhong@qq.com)
" if the current buffer no in the buffer list
" return false and no redraw tabline.
" Fixes #1515. if there a BufEnter autocmd execute redraw. The tabline may no update.
let bufnr_list = map(copy(buffer_list), 'v:val["index"]')
if index(bufnr_list, a:cur_buf) == -1 && a:cur_tab == s:current_tabnr
return 0
endif
for tab in s:tab_list
if tab.current
if tab.modified
let group = 'airline_tabmod'.pos_extension
else
let group = 'airline_tabsel'.pos_extension
endif
else
if tab.modified
let group = 'airline_tabmod_unsel'.pos_extension
else
let group = 'airline_tabhid'.pos_extension
endif
let s:current_modified = getbufvar(a:cur_buf, '&modified')
for buffer in buffer_list
let group = 'airline_tab'
\ .s:highlight_groups[(4 * buffer.modified) + (2 * buffer.visible) + (a:cur_buf == buffer.index)]
\ .pos_extension
let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)'
if has("tablineat")
let buf_name = '%'.buffer.index.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X'
endif
call a:builder.add_section_spaced(group, '%'.tab.index.'T'.tab.title.ctrlspace#api#TabBuffersNumber(tab.index).'%T')
call a:builder.add_section_spaced(group, buf_name)
endfor
" add by tenfy(tenfyzhong@qq.com)
" if the selected buffer was updated
" return true
return 1
endfunction
function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pull_right)
let pos_extension = (a:pull_right ? '_right' : '')
let tab_list = ctrlspace#api#TabList()
for tab in tab_list
let group = 'airline_tab'
\ .s:highlight_groups[(4 * tab.modified) + (3 * tab.current)]
\ .pos_extension
if get(g:, 'airline#extensions#tabline#ctrlspace_show_tab_nr', 0) == 0
call a:builder.add_section_spaced(group, '%'.tab.index.'T'.tab.title.ctrlspace#api#TabBuffersNumber(tab.index).'%T')
else
call a:builder.add_section_spaced(group, '%'.(tab.index).'T'.(tab.index).(g:airline_symbols.space).(tab.title).ctrlspace#api#TabBuffersNumber(tab.index).'%T')
endif
endfor
endfunction
function! airline#extensions#tabline#ctrlspace#get()
let cur_buf = bufnr('%')
let buffer_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
let tab_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
let switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0)
call airline#extensions#tabline#tabs#map_keys()
let s:tab_list = ctrlspace#api#TabList()
for tab in s:tab_list
if tab.current
let cur_tab = tab.index
endif
endfor
try
call airline#extensions#tabline#tabs#map_keys()
endtry
let cur_tab = tabpagenr()
if cur_buf == s:current_bufnr && cur_tab == s:current_tabnr
return s:current_tabline
if !g:airline_detect_modified || getbufvar(cur_buf, '&modified') == s:current_modified
return s:current_tabline
endif
endif
let builder = airline#extensions#tabline#new_builder()
let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
let AppendBuffers = function('airline#extensions#tabline#ctrlspace#add_buffer_section', [builder, cur_tab, cur_buf])
let AppendTabs = function('airline#extensions#tabline#ctrlspace#add_tab_section', [builder])
let AppendLabel = function(builder.add_section_spaced, ['airline_tabtype'], builder)
" <= 1: |{Tabs} <tab|
" == 2: |{Buffers} <buffers|
" == 3: |buffers> {Buffers} {Tabs} <tabs|
let showing_mode = (2 * show_buffers) + (show_tabs)
let ignore_update = 0
" Add left tabline content
if s:show_buffers == 0
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
elseif s:show_tabs == 0
call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0)
if showing_mode <= 1 " Tabs only mode
call AppendTabs(0)
elseif showing_mode == 2 " Buffers only mode
let ignore_update = !AppendBuffers(0)
else
if s:switch_buffers_and_tabs == 0
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0)
if !switch_buffers_and_tabs
call AppendLabel(buffer_label)
let ignore_update = !AppendBuffers(0)
else
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
call AppendLabel(tab_label)
call AppendTabs(0)
endif
endif
if ignore_update | return s:current_tabline | endif
call builder.add_section('airline_tabfill', '')
call builder.split()
call builder.add_section('airline_tabfill', '')
" Add right tabline content
if s:show_buffers == 0
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
elseif s:show_tabs == 0
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
if showing_mode <= 1 " Tabs only mode
call AppendLabel(tab_label)
elseif showing_mode == 2 " Buffers only mode
call AppendLabel(buffer_label)
else
if s:switch_buffers_and_tabs == 0
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1)
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
if !switch_buffers_and_tabs
call AppendTabs(1)
call AppendLabel(tab_label)
else
call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1)
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
let ignore_update = AppendBuffers(1)
call AppendLabel(buffer_label)
endif
endif
if ignore_update | return s:current_tabline | endif
let s:current_bufnr = cur_buf
let s:current_tabnr = cur_tab
let s:current_tabline = builder.build()

View File

@@ -1,41 +1,82 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 et fdm=marker
scriptencoding utf-8
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
let s:fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
let s:buf_modified_symbol = g:airline_symbols.modified
if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
" Legacy VimScript implementation {{{1
function! airline#extensions#tabline#formatters#default#format(bufnr, buffers) " {{{2
let fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
let _ = ''
function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
let _ = ''
let name = bufname(a:bufnr)
if empty(name)
let _ .= '[No Name]'
else
if s:fnamecollapse
let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
let name = bufname(a:bufnr)
if empty(name)
let _ .= '[No Name]'
elseif name =~ 'term://'
" Neovim Terminal
let _ = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
else
let _ .= fnamemodify(name, fmod)
if get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
" Does not handle non-ascii characters like Cyrillic: 'D/Учёба/t.c'
"let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
let _ .= pathshorten(fnamemodify(name, fmod))
else
let _ .= fnamemodify(name, fmod)
endif
if a:bufnr != bufnr('%') && fnametruncate && strlen(_) > fnametruncate
let _ = airline#util#strcharpart(_, 0, fnametruncate)
endif
endif
if a:bufnr != bufnr('%') && s:fnametruncate && strlen(_) > s:fnametruncate
let _ = strpart(_, 0, s:fnametruncate)
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
endfunction
function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name) " {{{2
let buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
let buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
let _ = buf_nr_show ? printf(buf_nr_format, a:bufnr) : ''
let _ .= substitute(a:buffer_name, '\\', '/', 'g')
if getbufvar(a:bufnr, '&modified') == 1
let _ .= g:airline_symbols.modified
endif
endif
return _
endfunction
else
" New Vim9 script implementation {{{1
def airline#extensions#tabline#formatters#default#format(bufnr: number, buffers: list<number>): string # {{{2
var fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
var result = ''
var fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
endfunction
function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name)
let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : ''
let _ .= substitute(a:buffer_name, '\\', '/', 'g')
if getbufvar(a:bufnr, '&modified') == 1
let _ .= s:buf_modified_symbol
endif
return _
endfunction
var name = bufname(bufnr)
if empty(name)
result = '[No Name]'
elseif name =~ 'term://'
# Neovim Terminal
result = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
else
if get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
result = pathshorten(fnamemodify(name, fmod))
else
result = fnamemodify(name, fmod)
endif
if bufnr != bufnr('%') && fnametruncate && strlen(result) > fnametruncate
result = airline#util#strcharpart(result, 0, fnametruncate)
endif
endif
return airline#extensions#tabline#formatters#default#wrap_name(bufnr, result)
enddef
def airline#extensions#tabline#formatters#default#wrap_name(bufnr: number, buffer_name: string): string # {{{2
var buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
var buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
var result = buf_nr_show ? printf(buf_nr_format, bufnr) : ''
result = result .. substitute(buffer_name, '\\', '/', 'g')
if getbufvar(bufnr, '&modified') == 1
result = result .. g:airline_symbols.modified
endif
return result
enddef
endif

View File

@@ -0,0 +1,15 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#tabline#formatters#jsformatter#format(bufnr, buffers)
let buf = bufname(a:bufnr)
let filename = fnamemodify(buf, ':t')
if filename == 'index.js' || filename == 'index.jsx' || filename == 'index.ts' || filename == 'index.tsx'
return fnamemodify(buf, ':p:h:t') . '/i'
else
return airline#extensions#tabline#formatters#unique_tail_improved#format(a:bufnr, a:buffers)
endif
endfunction

View File

@@ -0,0 +1,22 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
function! airline#extensions#tabline#formatters#short_path#format(bufnr, buffers)
let _ = ''
let name = bufname(a:bufnr)
if empty(name)
let _ .= '[No Name]'
elseif name =~ 'term://'
" Neovim Terminal
let _ = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
else
let _ .= fnamemodify(name, ':p:h:t') . '/' . fnamemodify(name, ':t')
endif
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
endfunction

View File

@@ -0,0 +1,15 @@
" MIT License. Copyright (c) 2017-2020 Christian Brabandt et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#tabline#formatters#tabnr#format(tab_nr_type, nr)
let spc=g:airline_symbols.space
if a:tab_nr_type == 0 " nr of splits
return spc. '%{len(tabpagebuflist('.a:nr.'))}'
elseif a:tab_nr_type == 1 " tab number
return spc. a:nr
else "== 2 splits and tab number
return spc. a:nr. '.%{len(tabpagebuflist('.a:nr.'))}'
endif
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -10,9 +10,14 @@ function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffer
for nr in a:buffers
let name = bufname(nr)
if empty(name)
let map[nr] = '[No Name]'
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, '[No Name]')
else
let tail = fnamemodify(name, ':s?/\+$??:t')
if name =~ 'term://'
" Neovim Terminal
let tail = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
else
let tail = fnamemodify(name, ':s?/\+$??:t')
endif
if has_key(tails, tail)
let duplicates[nr] = nr
endif
@@ -21,8 +26,15 @@ function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffer
endif
endfor
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.')
for nr in values(duplicates)
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.'))
let name = bufname(nr)
let fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
if fnamecollapse
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g'))
else
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(name, fmod))
endif
endfor
if has_key(map, a:bufnr)

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,17 +1,9 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1)
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X')
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
let s:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1)
let s:spc = g:airline_symbols.space
let s:current_bufnr = -1
let s:current_tabnr = -1
let s:current_modified = 0
@@ -36,8 +28,12 @@ endfunction
function! airline#extensions#tabline#tabs#get()
let curbuf = bufnr('%')
let curtab = tabpagenr()
call airline#extensions#tabline#tabs#map_keys()
if curbuf == s:current_bufnr && curtab == s:current_tabnr
try
call airline#extensions#tabline#tabs#map_keys()
catch
" no-op
endtry
if curbuf == s:current_bufnr && curtab == s:current_tabnr && &columns == s:column_width
if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified
return s:current_tabline
endif
@@ -45,68 +41,94 @@ function! airline#extensions#tabline#tabs#get()
let b = airline#extensions#tabline#new_builder()
for i in range(1, tabpagenr('$'))
if i == curtab
call airline#extensions#tabline#add_label(b, 'tabs', 0)
function! b.get_group(i) dict
let curtab = tabpagenr()
let group = 'airline_tab'
if a:i == curtab
let group = 'airline_tabsel'
if g:airline_detect_modified
for bi in tabpagebuflist(i)
for bi in tabpagebuflist(curtab)
if getbufvar(bi, '&modified')
let group = 'airline_tabmod'
endif
endfor
endif
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
else
let group = 'airline_tab'
endif
return group
endfunction
function! b.get_title(i) dict
let val = '%('
if s:show_tab_nr
if s:tab_nr_type == 0
let val .= (g:airline_symbols.space).'%{len(tabpagebuflist('.i.'))}'
elseif s:tab_nr_type == 1
let val .= (g:airline_symbols.space).i
else "== 2
let val .= (g:airline_symbols.space).i.'.%{len(tabpagebuflist('.i.'))}'
endif
if get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
let val .= airline#extensions#tabline#tabs#tabnr_formatter(tab_nr_type, a:i)
endif
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)')
endfor
return val.'%'.a:i.'T %{airline#extensions#tabline#title('.a:i.')} %)'
endfunction
call b.insert_titles(curtab, 1, tabpagenr('$'))
call b.add_section('airline_tabfill', '')
call b.split()
call b.add_section('airline_tabfill', '')
if s:show_close_button
call b.add_section('airline_tab_right', ' %999X'.s:close_symbol.' ')
if get(g:, 'airline#extensions#tabline#show_close_button', 1)
call b.add_section('airline_tab_right', ' %999X'.
\ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ')
endif
if s:show_splits == 1
if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1
let buffers = tabpagebuflist(curtab)
for nr in buffers
let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right"
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
endfor
elseif s:show_tab_type == 1
call b.add_section_spaced('airline_tabtype', s:tabs_label)
if get(g:, 'airline#extensions#tabline#show_buffers', 1)
call airline#extensions#tabline#add_label(b, 'buffers', 1)
endif
endif
call airline#extensions#tabline#add_tab_label(b)
let s:current_bufnr = curbuf
let s:current_tabnr = curtab
let s:column_width = &columns
let s:current_tabline = b.build()
return s:current_tabline
endfunction
function! airline#extensions#tabline#tabs#map_keys()
noremap <silent> <Plug>AirlineSelectTab1 :1tabn<CR>
noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR>
noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR>
noremap <silent> <Plug>AirlineSelectTab4 :4tabn<CR>
noremap <silent> <Plug>AirlineSelectTab5 :5tabn<CR>
noremap <silent> <Plug>AirlineSelectTab6 :6tabn<CR>
noremap <silent> <Plug>AirlineSelectTab7 :7tabn<CR>
noremap <silent> <Plug>AirlineSelectTab8 :8tabn<CR>
noremap <silent> <Plug>AirlineSelectTab9 :9tabn<CR>
if maparg('<Plug>AirlineSelectTab1', 'n') is# ':1tabn<CR>'
return
endif
let bidx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1)
if bidx_mode == 1
for i in range(1, 9)
exe printf('noremap <silent> <Plug>AirlineSelectTab%d :%dtabn<CR>', i, i)
endfor
else
for i in range(11, 99)
exe printf('noremap <silent> <Plug>AirlineSelectTab%d :%dtabn<CR>', i, i-10)
endfor
endif
noremap <silent> <Plug>AirlineSelectPrevTab gT
" tabn {count} goes to count tab does not go {count} tab pages forward!
noremap <silent> <Plug>AirlineSelectNextTab :<C-U>exe repeat(':tabn\|', v:count1)<cr>
endfunction
function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i) abort
let formatter = get(g:, 'airline#extensions#tabline#tabnr_formatter', 'tabnr')
try
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, a:i)
catch /^Vim\%((\a\+)\)\=:E117/ " catch E117, unknown function
" Function not found
return call(formatter, [a:nr, a:i])
catch
" something went wrong, return an empty string
return ""
endtry
endfunction

View File

@@ -0,0 +1,154 @@
" MIT License. Copyright (c) 2016-2020 Kevin Sapper et al.
" PLugin: https://github.com/s1341/vim-tabws
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:current_bufnr = -1
let s:current_modified = 0
let s:current_tabnr = -1
let s:current_tabline = ''
let s:highlight_groups = ['hid', 0, '', 'sel', 'mod_unsel', 0, 'mod_unsel', 'mod']
function! airline#extensions#tabline#tabws#off()
augroup airline_tabline_tabws
autocmd!
augroup END
endfunction
function! airline#extensions#tabline#tabws#on()
augroup airline_tabline_tabws
autocmd!
autocmd BufDelete * call airline#extensions#tabline#tabws#invalidate()
augroup END
endfunction
function! airline#extensions#tabline#tabws#invalidate()
let s:current_bufnr = -1
let s:current_tabnr = -1
endfunction
function! airline#extensions#tabline#tabws#add_buffer_section(builder, cur_tab, cur_buf, pull_right)
let pos_extension = (a:pull_right ? '_right' : '')
let bufnr_list = tabws#getbuffersfortab(a:cur_tab)
if index(bufnr_list, a:cur_buf) == -1 && a:cur_tab == s:current_tabnr
return 0
endif
let s:current_modified = getbufvar(a:cur_buf, '&modified')
let visible_list = tabpagebuflist(a:cur_tab)
for buffer in bufnr_list
let group = 'airline_tab'
\ .s:highlight_groups[(4 * getbufvar(buffer, '&modified')) + (2 * (index(visible_list, buffer) != -1)) + (a:cur_buf == buffer)]
\ .pos_extension
let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.')}%)'
if has("tablineat")
let buf_name = '%'.buffer.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X'
endif
call a:builder.add_section_spaced(group, buf_name)
endfor
" add by tenfy(tenfyzhong@qq.com)
" if the selected buffer was updated
" return true
return 1
endfunction
function! airline#extensions#tabline#tabws#add_tab_section(builder, pull_right)
let pos_extension = (a:pull_right ? '_right' : '')
for tab in range(1, tabpagenr('$'))
let current = tab == tabpagenr()
let group = 'airline_tab'
\ .s:highlight_groups[(3 * current)]
\ .pos_extension
if get(g:, 'airline#extensions#tabline#tabws_show_tab_nr', 0) == 0
call a:builder.add_section_spaced(group, '%'.tab.'T'.tabws#gettabname(tab).'%T')
else
call a:builder.add_section_spaced(group, '%'.tab.'T'.tab.(g:airline_symbols.space).tabws#gettabname(tab).'%T')
endif
endfor
endfunction
function! airline#extensions#tabline#tabws#get()
let cur_buf = bufnr('%')
let buffer_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
let tab_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
let switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0)
try
call airline#extensions#tabline#tabs#map_keys()
endtry
let cur_tab = tabpagenr()
if cur_buf == s:current_bufnr && cur_tab == s:current_tabnr
if !g:airline_detect_modified || getbufvar(cur_buf, '&modified') == s:current_modified
return s:current_tabline
endif
endif
let builder = airline#extensions#tabline#new_builder()
let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
let AppendBuffers = function('airline#extensions#tabline#tabws#add_buffer_section', [builder, cur_tab, cur_buf])
let AppendTabs = function('airline#extensions#tabline#tabws#add_tab_section', [builder])
let AppendLabel = function(builder.add_section_spaced, ['airline_tabtype'], builder)
" <= 1: |{Tabs} <tab|
" == 2: |{Buffers} <buffers|
" == 3: |buffers> {Buffers} {Tabs} <tabs|
let showing_mode = (2 * show_buffers) + (show_tabs)
let ignore_update = 0
" Add left tabline content
if showing_mode <= 1 " Tabs only mode
call AppendTabs(0)
elseif showing_mode == 2 " Buffers only mode
let ignore_update = !AppendBuffers(0)
else
if !switch_buffers_and_tabs
call AppendLabel(buffer_label)
let ignore_update = !AppendBuffers(0)
else
call AppendLabel(tab_label)
call AppendTabs(0)
endif
endif
if ignore_update | return s:current_tabline | endif
call builder.add_section('airline_tabfill', '')
call builder.split()
call builder.add_section('airline_tabfill', '')
" Add right tabline content
if showing_mode <= 1 " Tabs only mode
call AppendLabel(tab_label)
elseif showing_mode == 2 " Buffers only mode
call AppendLabel(buffer_label)
else
if !switch_buffers_and_tabs
call AppendTabs(1)
call AppendLabel(tab_label)
else
let ignore_update = AppendBuffers(1)
call AppendLabel(buffer_label)
endif
endif
if ignore_update | return s:current_tabline | endif
let s:current_bufnr = cur_buf
let s:current_tabnr = cur_tab
let s:current_tabline = builder.build()
return s:current_tabline
endfunction

View File

@@ -0,0 +1,396 @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" xTabline - Reduced version for vim-airline
" Plugin: https://github.com/mg979/vim-xtabline
" MIT License Copyright (C) 2018-2020 Gianmaria Bajo <mg1979.git@gmail.com>
" tabpagecd:
" expanded version by mg979
" MIT License Copyright (C) 2012-2013 Kana Natsuno <http://whileimautomaton.net/>
" MIT License Copyright (C) 2018-2020 Gianmaria Bajo <mg1979.git@gmail.com>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! airline#extensions#tabline#xtabline#init()
let s:state = 0
" initialize mappings
call airline#extensions#tabline#xtabline#maps()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Variables
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:loaded_xtabline = 1
let s:most_recent = -1
let s:xtabline_filtering = 1
let t:xtl_excluded = get(g:, 'airline#extensions#tabline#exclude_buffers', [])
let t:xtl_accepted = []
let g:xtabline_include_previews = get(g:, 'xtabline_include_previews', 1)
let g:xtabline_alt_action = get(g:, 'xtabline_alt_action', "buffer #")
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Autocommands
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
augroup plugin-xtabline
autocmd!
autocmd TabNew * call s:Do('new')
autocmd TabEnter * call s:Do('enter')
autocmd TabLeave * call s:Do('leave')
autocmd TabClosed * call s:Do('close')
autocmd BufEnter * let g:xtabline_changing_buffer = 0
autocmd BufAdd,BufDelete,BufWrite * call airline#extensions#tabline#xtabline#filter_buffers()
augroup END
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Commands
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
com! XTabReopen call airline#extensions#tabline#xtabline#reopen_last_tab()
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Mappings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! airline#extensions#tabline#xtabline#maps()
if !exists('g:xtabline_disable_keybindings')
fun! s:mapkeys(keys, plug)
if empty(mapcheck(a:keys)) && !hasmapto(a:plug)
silent! execute 'nmap <unique> '.a:keys.' '.a:plug
endif
endfun
call s:mapkeys('<F5>','<Plug>XTablineToggleTabs')
call s:mapkeys('<leader><F5>','<Plug>XTablineToggleFiltering')
call s:mapkeys('<BS>','<Plug>XTablineSelectBuffer')
call s:mapkeys(']l','<Plug>XTablineNextBuffer')
call s:mapkeys('[l','<Plug>XTablinePrevBuffer')
call s:mapkeys('<leader>tr','<Plug>XTablineReopen')
endif
nnoremap <unique> <script> <Plug>XTablineToggleTabs <SID>ToggleTabs
nnoremap <silent> <SID>ToggleTabs :call airline#extensions#tabline#xtabline#toggle_tabs()<cr>
nnoremap <unique> <script> <Plug>XTablineToggleFiltering <SID>ToggleFiltering
nnoremap <silent> <SID>ToggleFiltering :call airline#extensions#tabline#xtabline#toggle_buffers()<cr>
nnoremap <unique> <script> <Plug>XTablineSelectBuffer <SID>SelectBuffer
nnoremap <silent> <expr> <SID>SelectBuffer g:xtabline_changing_buffer ? "\<C-c>" : ":<C-u>call airline#extensions#tabline#xtabline#select_buffer(v:count)\<cr>"
nnoremap <unique> <script> <Plug>XTablineNextBuffer <SID>NextBuffer
nnoremap <silent> <expr> <SID>NextBuffer airline#extensions#tabline#xtabline#next_buffer(v:count1)
nnoremap <unique> <script> <Plug>XTablinePrevBuffer <SID>PrevBuffer
nnoremap <silent> <expr> <SID>PrevBuffer airline#extensions#tabline#xtabline#prev_buffer(v:count1)
nnoremap <unique> <script> <Plug>XTablineReopen <SID>ReopenLastTab
nnoremap <silent> <SID>ReopenLastTab :XTabReopen<cr>
if get(g:, 'xtabline_cd_commands', 0)
map <unique> <leader>cdc <Plug>XTablineCdCurrent
map <unique> <leader>cdd <Plug>XTablineCdDown1
map <unique> <leader>cd2 <Plug>XTablineCdDown2
map <unique> <leader>cd3 <Plug>XTablineCdDown3
map <unique> <leader>cdh <Plug>XTablineCdHome
nnoremap <unique> <script> <Plug>XTablineCdCurrent :cd %:p:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr>
nnoremap <unique> <script> <Plug>XTablineCdDown1 :cd %:p:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr>
nnoremap <unique> <script> <Plug>XTablineCdDown2 :cd %:p:h:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr>
nnoremap <unique> <script> <Plug>XTablineCdDown3 :cd %:p:h:h:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr>
nnoremap <unique> <script> <Plug>XTablineCdHome :cd ~<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr>
endif
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Commands functions
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! airline#extensions#tabline#xtabline#toggle_tabs()
"""Toggle between tabs/buffers tabline."""
if tabpagenr("$") == 1 | call airline#util#warning("There is only one tab.") | return | endif
if g:airline#extensions#tabline#show_tabs
let g:airline#extensions#tabline#show_tabs = 0
call airline#util#warning("Showing buffers")
else
let g:airline#extensions#tabline#show_tabs = 1
call airline#util#warning("Showing tabs")
endif
doautocmd BufAdd
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! airline#extensions#tabline#xtabline#toggle_buffers()
"""Toggle buffer filtering in the tabline."""
if s:xtabline_filtering
let s:xtabline_filtering = 0
let g:airline#extensions#tabline#exclude_buffers = []
call airline#util#warning("Buffer filtering turned off")
doautocmd BufAdd
else
let s:xtabline_filtering = 1
call airline#extensions#tabline#xtabline#filter_buffers()
call airline#util#warning("Buffer filtering turned on")
doautocmd BufAdd
endif
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! airline#extensions#tabline#xtabline#reopen_last_tab()
"""Reopen the last closed tab."""
if !exists('s:most_recently_closed_tab')
call airline#util#warning("No recent tabs.")
return
endif
let tab = s:most_recently_closed_tab
tabnew
let empty = bufnr("%")
let t:cwd = tab['cwd']
cd `=t:cwd`
let t:name = tab['name']
for buf in tab['buffers'] | execute "badd ".buf | endfor
execute "edit ".tab['buffers'][0]
execute "bdelete ".empty
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! airline#extensions#tabline#xtabline#filter_buffers()
"""Filter buffers so that only the ones within the tab's cwd will show up.
" 'accepted' is a list of buffer numbers, for quick access.
" 'excluded' is a list of buffer numbers, it will be used by Airline to hide buffers.
if !s:xtabline_filtering | return | endif
let g:airline#extensions#tabline#exclude_buffers = []
let t:xtl_excluded = g:airline#extensions#tabline#exclude_buffers
let t:xtl_accepted = [] | let accepted = t:xtl_accepted
let previews = g:xtabline_include_previews
" bufnr(0) is the alternate buffer
for buf in range(1, bufnr("$"))
if !buflisted(buf) | continue | endif
" get the path
let path = expand("#".buf.":p")
" confront with the cwd
if !previews && path =~ "^".getcwd()
call add(accepted, buf)
elseif previews && path =~ getcwd()
call add(accepted, buf)
else
call add(t:xtl_excluded, buf)
endif
endfor
call s:RefreshTabline()
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! airline#extensions#tabline#xtabline#next_buffer(nr)
"""Switch to next visible buffer."""
if ( s:NotEnoughBuffers() || !s:xtabline_filtering ) | return | endif
let accepted = t:xtl_accepted
let ix = index(accepted, bufnr("%"))
let target = ix + a:nr
let total = len(accepted)
if ix == -1
" not in index, go back to most recent or back to first
if s:most_recent == -1 || s:most_recent >= total
let s:most_recent = 0
endif
elseif target >= total
" over last buffer
while target >= total | let target -= total | endwhile
let s:most_recent = target
else
let s:most_recent = target
endif
return ":buffer " . accepted[s:most_recent] . "\<cr>"
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! airline#extensions#tabline#xtabline#prev_buffer(nr)
"""Switch to previous visible buffer."""
if ( s:NotEnoughBuffers() || !s:xtabline_filtering ) | return | endif
let accepted = t:xtl_accepted
let ix = index(accepted, bufnr("%"))
let target = ix - a:nr
let total = len(accepted)
if ix == -1
" not in index, go back to most recent or back to first
if s:most_recent == -1 || s:most_recent >= total
let s:most_recent = 0
endif
elseif target < 0
" before first buffer
while target < 0 | let target += total | endwhile
let s:most_recent = target
else
let s:most_recent = target
endif
return ":buffer " . accepted[s:most_recent] . "\<cr>"
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! airline#extensions#tabline#xtabline#select_buffer(nr)
"""Switch to visible buffer in the tabline with [count]."""
if ( a:nr == 0 || !s:xtabline_filtering ) | execute g:xtabline_alt_action | return | endif
let accepted = t:xtl_accepted
if (a:nr > len(accepted)) || s:NotEnoughBuffers() || accepted[a:nr - 1] == bufnr("%")
return
else
let g:xtabline_changing_buffer = 1
execute "buffer ".accepted[a:nr - 1]
endif
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:TabBuffers()
"""Return a list of buffers names for this tab."""
return map(copy(t:xtl_accepted), 'bufname(v:val)')
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Helper functions
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:NotEnoughBuffers()
"""Just return if there aren't enough buffers."""
if len(t:xtl_accepted) < 2
if index(t:xtl_accepted, bufnr("%")) == -1
return
elseif !len(t:xtl_accepted)
call airline#util#warning("No available buffers for this tab.")
else
call airline#util#warning("No other available buffers for this tab.")
endif
return 1
endif
endfunction
function! s:RefreshTabline()
call airline#extensions#tabline#buflist#invalidate()
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TabPageCd
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" tabpagecd - Turn :cd into :tabpagecd, to use one tab page per project
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:InitCwds()
if !exists('g:xtab_cwds') | let g:xtab_cwds = [] | endif
while len(g:xtab_cwds) < tabpagenr("$")
call add(g:xtab_cwds, getcwd())
endwhile
let s:state = 1
let t:cwd = getcwd()
let s:last_tab = 0
call airline#extensions#tabline#xtabline#filter_buffers()
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! airline#extensions#tabline#xtabline#update_obsession()
let string = 'let g:xtab_cwds = '.string(g:xtab_cwds).' | call airline#extensions#tabline#xtabline#update_obsession()'
if !exists('g:obsession_append')
let g:obsession_append = [string]
else
call filter(g:obsession_append, 'v:val !~# "^let g:xtab_cwds"')
call add(g:obsession_append, string)
endif
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:Do(action)
let arg = a:action
if !s:state | call s:InitCwds() | return | endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if arg == 'new'
call insert(g:xtab_cwds, getcwd(), tabpagenr()-1)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
elseif arg == 'enter'
let t:cwd =g:xtab_cwds[tabpagenr()-1]
cd `=t:cwd`
call airline#extensions#tabline#xtabline#filter_buffers()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
elseif arg == 'leave'
let t:cwd = getcwd()
let g:xtab_cwds[tabpagenr()-1] = t:cwd
let s:last_tab = tabpagenr() - 1
if !exists('t:name') | let t:name = t:cwd | endif
let s:most_recent_tab = {'cwd': t:cwd, 'name': t:name, 'buffers': s:TabBuffers()}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
elseif arg == 'close'
let s:most_recently_closed_tab = copy(s:most_recent_tab)
call remove(g:xtab_cwds, s:last_tab)
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call airline#extensions#tabline#xtabline#update_obsession()
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/majutsushi/tagbar
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -9,6 +10,7 @@ endif
let s:flags = get(g:, 'airline#extensions#tagbar#flags', '')
let s:spc = g:airline_symbols.space
let s:init=0
" Arguments: current, sort, fname
function! airline#extensions#tagbar#get_status(...)
@@ -29,7 +31,18 @@ let s:airline_tagbar_last_lookup_time = 0
let s:airline_tagbar_last_lookup_val = ''
function! airline#extensions#tagbar#currenttag()
if get(w:, 'airline_active', 0)
if s:airline_tagbar_last_lookup_time != localtime()
if !s:init
try
" try to load the plugin, if filetypes are disabled,
" this will cause an error, so try only once
let a=tagbar#currenttag('%', '', '')
catch
endtry
unlet! a
let s:init=1
endif
" function tagbar#currenttag does not exist, if filetype is not enabled
if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag")
let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags)
let s:airline_tagbar_last_lookup_time = localtime()
endif
@@ -44,4 +57,3 @@ function! airline#extensions#tagbar#init(ext)
call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag')
endfunction

View File

@@ -0,0 +1,80 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
call airline#parts#define_function('tmode', 'airline#extensions#term#termmode')
call airline#parts#define('terminal', {'text': get(g:airline_mode_map, 't', 't'), 'accent': 'bold'})
let s:spc = g:airline_symbols.space
let s:section_a = airline#section#create_left(['terminal', 'tmode'])
let s:section_z = airline#section#create(['linenr', 'maxlinenr'])
function! airline#extensions#term#apply(...) abort
if &buftype ==? 'terminal' || bufname(a:2.bufnr)[0] ==? '!'
call a:1.add_section_spaced('airline_a', s:section_a)
call a:1.add_section_spaced('airline_b', s:neoterm_id(a:2.bufnr))
call a:1.add_section('airline_term', s:spc.s:termname(a:2.bufnr))
call a:1.split()
call a:1.add_section('airline_y', '')
call a:1.add_section_spaced('airline_z', s:section_z)
return 1
endif
endfunction
function! airline#extensions#term#inactive_apply(...) abort
if getbufvar(a:2.bufnr, '&buftype') ==? 'terminal'
call a:1.add_section_spaced('airline_a', s:section_a)
call a:1.add_section_spaced('airline_b', s:neoterm_id(a:2.bufnr))
call a:1.add_section('airline_term', s:spc.s:termname(a:2.bufnr))
call a:1.split()
call a:1.add_section('airline_y', '')
call a:1.add_section_spaced('airline_z', s:section_z)
return 1
endif
endfunction
function! airline#extensions#term#termmode() abort
let mode = airline#parts#mode()[0]
if mode ==? 'T' || mode ==? '-'
" We don't need to output T, the statusline already says "TERMINAL".
" Also we don't want to output "-" on an inactive statusline.
let mode = ''
endif
return mode
endfunction
function! s:termname(bufnr) abort
let bufname = bufname(a:bufnr)
if has('nvim')
" Get rid of the leading "term", working dir and process ID.
" Afterwards, remove the possibly added neoterm ID.
return substitute(matchstr(bufname, 'term.*:\zs.*'),
\ ';#neoterm-\d\+', '', '')
else
if bufname =~? 'neoterm-\d\+'
" Do not return a redundant buffer name, when this is a neoterm terminal.
return ''
endif
" Get rid of the leading "!".
if bufname[0] ==? '!'
return bufname[1:]
else
return bufname
endif
endif
endfunction
function! s:neoterm_id(bufnr) abort
let id = getbufvar(a:bufnr, 'neoterm_id')
if id !=? ''
let id = 'neoterm-'.id
endif
return id
endfunction
function! airline#extensions#term#init(ext) abort
call a:ext.add_statusline_func('airline#extensions#term#apply')
call a:ext.add_inactive_statusline_func('airline#extensions#term#inactive_apply')
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/edkolev/tmuxline.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -25,4 +26,3 @@ function! airline#extensions#tmuxline#set_tmux_colors(palette)
call tmuxline#api#snapshot(s:tmuxline_snapshot_file)
endif
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/mbbill/undotree
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -11,14 +12,14 @@ function! airline#extensions#undotree#apply(...)
if exists('t:undotree')
if &ft == 'undotree'
if exists('*t:undotree.GetStatusLine')
call airline#extensions#apply_left_override('undo', '%{t:undotree.GetStatusLine()}')
call airline#extensions#apply_left_override('undo', '%{exists("t:undotree") ? t:undotree.GetStatusLine() : ""}')
else
call airline#extensions#apply_left_override('undotree', '%f')
endif
endif
if &ft == 'diff' && exists('*t:diffpanel.GetStatusLine')
call airline#extensions#apply_left_override('diff', '%{t:diffpanel.GetStatusLine()}')
call airline#extensions#apply_left_override('diff', '%{exists("t:diffpanel") ? t:diffpanel.GetStatusLine() : ""}')
endif
endif
endfunction
@@ -26,4 +27,3 @@ endfunction
function! airline#extensions#undotree#init(ext)
call a:ext.add_statusline_func('airline#extensions#undotree#apply')
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling, Christian Brabandt et al.
" Plugin: https://github.com/chrisbra/unicode.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -14,7 +15,7 @@ function! airline#extensions#unicode#apply(...)
\ 'accent': 'bold' })
let w:airline_section_a = airline#section#create(['unicode'])
let w:airline_section_b = ''
let w:airline_section_c = ''
let w:airline_section_c = ' '
let w:airline_section_y = ''
endif
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/Shougo/unite.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -22,4 +23,3 @@ function! airline#extensions#unite#init(ext)
let g:unite_force_overwrite_statusline = 0
call a:ext.add_statusline_func('airline#extensions#unite#apply')
endfunction

View File

@@ -1,29 +1,29 @@
" MIT License. Copyright (c) 2016 Jerome Reybert
" MIT License. Copyright (c) 2016-2020 Jerome Reybert et al.
" Plugin: https://github.com/jreybert/vimagit
" vim: et ts=2 sts=2 sw=2
" This plugin replace the whole section_a when in vimagit buffer
" This plugin replaces the whole section_a when in vimagit buffer
scriptencoding utf-8
if !get(g:, 'loaded_magit', 0)
finish
endif
function! airline#extensions#vimagit#init(ext)
let s:commit_mode = {'ST': 'STAGING', 'CC': 'COMMIT', 'CA': 'AMEND'}
function! airline#extensions#vimagit#init(ext) abort
call a:ext.add_statusline_func('airline#extensions#vimagit#apply')
endfunction
function! airline#extensions#vimagit#get_mode()
if ( b:magit_current_commit_mode == '' )
return "STAGING"
elseif ( b:magit_current_commit_mode == 'CC' )
return "COMMIT"
elseif ( b:magit_current_commit_mode == 'CA' )
return "AMEND"
else
return "???"
function! airline#extensions#vimagit#get_mode() abort
if ( exists("*magit#get_current_mode") )
return magit#get_current_mode()
else
return get(s:commit_mode, b:magit_current_commit_mode, '???')
endif
endfunction
function! airline#extensions#vimagit#apply(...)
function! airline#extensions#vimagit#apply(...) abort
if ( &filetype == 'magit' )
let w:airline_section_a = '%{airline#extensions#vimagit#get_mode()}'
endif

View File

@@ -0,0 +1,30 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/cdelledonne/vim-cmake
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#vimcmake#init(ext) abort
call a:ext.add_statusline_func('airline#extensions#vimcmake#apply')
call a:ext.add_inactive_statusline_func('airline#extensions#vimcmake#inactive_apply')
endfunction
function! airline#extensions#vimcmake#apply(...) abort
if &filetype ==# 'vimcmake'
let spc = g:airline_symbols.space
call a:1.add_section('airline_a', spc.'CMake'.spc)
call a:1.add_section('airline_b', spc.'%{cmake#statusline#GetBuildInfo(1)}'.spc)
call a:1.add_section('airline_c', spc.'%{cmake#statusline#GetCmdInfo()}'.spc)
return 1
endif
endfunction
function! airline#extensions#vimcmake#inactive_apply(...) abort
if getbufvar(a:2.bufnr, '&filetype') ==# 'vimcmake'
let spc = g:airline_symbols.space
call a:1.add_section('airline_a', spc.'[CMake]')
call a:1.add_section('airline_b', spc.'%{cmake#statusline#GetBuildInfo(0)}')
call a:1.add_section('airline_c', spc.'%{cmake#statusline#GetCmdInfo()}')
return 1
endif
endfunction

View File

@@ -1,3 +1,7 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/lervag/vimtex
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:spc = g:airline_symbols.space
@@ -78,4 +82,3 @@ function! airline#extensions#vimtex#get_scope()
endif
return l:status
endfunction

View File

@@ -1,4 +1,5 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/jmcantrell/vim-virtualenv
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -0,0 +1,18 @@
" MIT License. Copyright (c) 2020 s1341 (github@shmarya.net)
" Plugin: https://github.com/liuchengxu/vista.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'loaded_vista', 0)
finish
endif
function! airline#extensions#vista#currenttag() abort
if get(w:, 'airline_active', 0)
return airline#util#shorten(get(b:, 'vista_nearest_method_or_function', ''), 91, 9)
endif
endfunction
function! airline#extensions#vista#init(ext) abort
call airline#parts#define_function('vista', 'airline#extensions#vista#currenttag')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
@@ -7,20 +7,15 @@ scriptencoding utf-8
let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1)
let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace)
let s:default_checks = ['indent', 'trailing', 'mixed-indent-file']
let s:default_checks = ['indent', 'trailing', 'mixed-indent-file', 'conflicts']
let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing')
let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent')
let s:long_format = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long')
let s:mixed_indent_file_format = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', '[%s]mix-indent-file')
let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
let s:c_like_langs = get(g:, 'airline#extensions#c_like_langs', [ 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ])
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'],
\ 'csv': ['indent', 'mixed-indent-file']}
function! s:check_mixed_indent()
if s:indent_algo == 1
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
if indent_algo == 1
" [<tab>]<space><tab>
" spaces before or between tabs are not allowed
let t_s_t = '(^\t* +\t\s*\S)'
@@ -28,15 +23,17 @@ function! s:check_mixed_indent()
" count of spaces at the end of tabs should be less than tabstop value
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
return search('\v' . t_s_t . '|' . t_l_s, 'nw')
elseif s:indent_algo == 2
return search('\v(^\t* +\t\s*\S)', 'nw')
elseif indent_algo == 2
return search('\v(^\t* +\t\s*\S)', 'nw', 0, 500)
else
return search('\v(^\t+ +)|(^ +\t+)', 'nw')
return search('\v(^\t+ +)|(^ +\t+)', 'nw', 0, 500)
endif
endfunction
function! s:check_mixed_indent_file()
if index(s:c_like_langs, &ft) > -1
let c_like_langs = get(g:, 'airline#extensions#c_like_langs',
\ [ 'arduino', 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ])
if index(c_like_langs, &ft) > -1
" for C-like languages: allow /** */ comment style with one space before the '*'
let head_spc = '\v(^ +\*@!)'
else
@@ -51,23 +48,39 @@ function! s:check_mixed_indent_file()
endif
endfunction
function! s:conflict_marker()
" Checks for git conflict markers
let annotation = '\%([0-9A-Za-z_.:]\+\)\?'
if &ft is# 'rst'
" rst filetypes use '=======' as header
let pattern = '^\%(\%(<\{7} '.annotation. '\)\|\%(>\{7\} '.annotation.'\)\)$'
else
let pattern = '^\%(\%(<\{7} '.annotation. '\)\|\%(=\{7\}\)\|\%(>\{7\} '.annotation.'\)\)$'
endif
return search(pattern, 'nw')
endfunction
function! airline#extensions#whitespace#check()
if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines
let max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
if &readonly || !&modifiable || !s:enabled || line('$') > max_lines
\ || get(b:, 'airline_whitespace_disabled', 0)
return ''
endif
let skip_check_ft = extend(s:skip_check_ft,
\ get(g:, 'airline#extensions#whitespace#skip_indent_check_ft', {}), 'force')
if !exists('b:airline_whitespace_check')
let b:airline_whitespace_check = ''
let checks = get(b:, 'airline_whitespace_checks', get(g:, 'airline#extensions#whitespace#checks', s:default_checks))
let trailing = 0
if index(checks, 'trailing') > -1
let check = 'trailing'
if index(checks, check) > -1 && index(get(skip_check_ft, &ft, []), check) < 0
try
let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$')
let trailing = search(regexp, 'nw')
catch
echomsg 'airline#whitespace: error occured evaluating '. regexp
call airline#util#warning(printf('Whitespace: error occurred evaluating "%s"', regexp))
echomsg v:exception
return ''
endtry
@@ -75,13 +88,13 @@ function! airline#extensions#whitespace#check()
let mixed = 0
let check = 'indent'
if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0
if index(checks, check) > -1 && index(get(skip_check_ft, &ft, []), check) < 0
let mixed = s:check_mixed_indent()
endif
let mixed_file = ''
let check = 'mixed-indent-file'
if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0
if index(checks, check) > -1 && index(get(skip_check_ft, &ft, []), check) < 0
let mixed_file = s:check_mixed_indent_file()
endif
@@ -90,7 +103,12 @@ function! airline#extensions#whitespace#check()
let long = search('\%>'.&tw.'v.\+', 'nw')
endif
if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file)
let conflicts = 0
if index(checks, 'conflicts') > -1
let conflicts = s:conflict_marker()
endif
if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file) || conflicts != 0
let b:airline_whitespace_check = s:symbol
if strlen(s:symbol) > 0
let space = (g:airline_symbols.space)
@@ -100,16 +118,24 @@ function! airline#extensions#whitespace#check()
if s:show_message
if trailing != 0
let b:airline_whitespace_check .= space.printf(s:trailing_format, trailing)
let trailing_fmt = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing')
let b:airline_whitespace_check .= space.printf(trailing_fmt, trailing)
endif
if mixed != 0
let b:airline_whitespace_check .= space.printf(s:mixed_indent_format, mixed)
let mixed_indent_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent')
let b:airline_whitespace_check .= space.printf(mixed_indent_fmt, mixed)
endif
if long != 0
let b:airline_whitespace_check .= space.printf(s:long_format, long)
let long_fmt = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long')
let b:airline_whitespace_check .= space.printf(long_fmt, long)
endif
if !empty(mixed_file)
let b:airline_whitespace_check .= space.printf(s:mixed_indent_file_format, mixed_file)
let mixed_indent_file_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', '[%s]mix-indent-file')
let b:airline_whitespace_check .= space.printf(mixed_indent_file_fmt, mixed_file)
endif
if conflicts != 0
let conflicts_fmt = get(g:, 'airline#extensions#whitespace#conflicts_format', '[%s]conflicts')
let b:airline_whitespace_check .= space.printf(conflicts_fmt, conflicts)
endif
endif
endif
@@ -136,7 +162,7 @@ function! airline#extensions#whitespace#toggle()
call airline#update_statusline()
endif
endif
echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled')
call airline#util#warning(printf('Whitespace checking: %s',(s:enabled ? 'Enabled' : 'Disabled')))
endfunction
function! airline#extensions#whitespace#disable()
@@ -161,7 +187,7 @@ function! s:ws_refresh()
endif
unlet! b:airline_whitespace_check
if get(g:, 'airline_skip_empty_sections', 0)
exe ':AirlineRefresh'
exe ':AirlineRefresh!'
endif
let b:airline_ws_changedtick = b:changedtick
endfunction

View File

@@ -1,3 +1,5 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" Plugin: https://github.com/wesQ3/vim-windowswap
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -26,4 +28,3 @@ function! airline#extensions#windowswap#get_status()
endif
return ''
endfunction

View File

@@ -1,43 +1,118 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 fdm=marker
scriptencoding utf-8
let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default')
let g:airline#extensions#wordcount#filetypes = get(g:, 'airline#extensions#wordcount#filetypes',
\ '\vhelp|markdown|rst|org|text|asciidoc|tex|mail')
function! s:wordcount_update()
if empty(bufname(''))
return
endif
if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1
let l:mode = mode()
if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S'
let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format()
let b:airline_change_tick = b:changedtick
else
if get(b:, 'airline_wordcount_cache', '') is# '' ||
\ b:airline_wordcount_cache isnot# get(b:, 'airline_wordcount', '') ||
\ get(b:, 'airline_change_tick', 0) != b:changedtick ||
\ get(b:, 'airline_winwidth', 0) != winwidth(0)
" cache data
let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format()
let b:airline_wordcount_cache = b:airline_wordcount
let b:airline_change_tick = b:changedtick
let b:airline_winwidth = winwidth(0)
endif
" get wordcount {{{1
if exists('*wordcount')
function! s:get_wordcount(visual_mode_active)
if get(g:, 'actual_curbuf', '') != bufnr('')
return
endif
let query = a:visual_mode_active ? 'visual_words' : 'words'
return get(wordcount(), query, 0)
endfunction
else " Pull wordcount from the g_ctrl-g stats
function! s:get_wordcount(visual_mode_active)
let pattern = a:visual_mode_active
\ ? '^.\D*\d\+\D\+\d\+\D\+\zs\d\+'
\ : '^.\D*\%(\d\+\D\+\)\{5}\zs\d\+'
let save_status = v:statusmsg
if !a:visual_mode_active && col('.') == col('$')
let save_pos = getpos('.')
execute "silent normal! g\<c-g>"
call setpos('.', save_pos)
else
execute "silent normal! g\<c-g>"
endif
let stats = v:statusmsg
let v:statusmsg = save_status
return str2nr(matchstr(stats, pattern))
endfunction
endif
" format {{{1
let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default')
" wrapper function for compatibility; redefined below for old-style formatters
function! s:format_wordcount(wordcount)
return airline#extensions#wordcount#formatters#{s:formatter}#to_string(a:wordcount)
endfunction
" check user-defined formatter exists with appropriate functions, otherwise
" fall back to default
if s:formatter !=# 'default'
execute 'runtime! autoload/airline/extensions/wordcount/formatters/'.s:formatter.'.vim'
if !exists('*airline#extensions#wordcount#formatters#{s:formatter}#to_string')
if !exists('*airline#extensions#wordcount#formatters#{s:formatter}#format')
let s:formatter = 'default'
else
" redefine for backwords compatibility
function! s:format_wordcount(_)
if mode() ==? 'v'
return b:airline_wordcount
else
return airline#extensions#wordcount#formatters#{s:formatter}#format()
endif
endfunction
endif
endif
endif
" update {{{1
let s:wordcount_cache = 0 " cache wordcount for performance when force_update=0
function! s:update_wordcount(force_update)
let wordcount = s:get_wordcount(0)
if wordcount != s:wordcount_cache || a:force_update
let s:wordcount_cache = wordcount
let b:airline_wordcount = s:format_wordcount(wordcount)
endif
endfunction
function airline#extensions#wordcount#get()
if get(g:, 'airline#visual_active', 0)
return s:format_wordcount(s:get_wordcount(1))
else
if get(b:, 'airline_changedtick', 0) != b:changedtick
call s:update_wordcount(0)
let b:airline_changedtick = b:changedtick
endif
return get(b:, 'airline_wordcount', '')
endif
endfunction
" airline functions {{{1
" default filetypes:
function! airline#extensions#wordcount#apply(...)
if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1
call airline#extensions#prepend_to_section('z', '%{get(b:, "airline_wordcount", "")}')
let filetypes = get(g:, 'airline#extensions#wordcount#filetypes',
\ ['asciidoc', 'help', 'mail', 'markdown', 'nroff', 'org', 'rst', 'plaintex', 'tex', 'text'])
" export current filetypes settings to global namespace
let g:airline#extensions#wordcount#filetypes = filetypes
" Check if filetype needs testing
if did_filetype()
" correctly test for compound filetypes (e.g. markdown.pandoc)
let ft = substitute(&filetype, '\.', '\\|', 'g')
" Select test based on type of "filetypes": new=list, old=string
if type(filetypes) == get(v:, 't_list', type([]))
\ ? match(filetypes, '\<'. ft. '\>') > -1 || index(filetypes, 'all') > -1
\ : match(&filetype, filetypes) > -1
let b:airline_changedtick = -1
call s:update_wordcount(1) " force update: ensures initial worcount exists
elseif exists('b:airline_wordcount') " cleanup when filetype is removed
unlet b:airline_wordcount
endif
endif
if exists('b:airline_wordcount')
call airline#extensions#prepend_to_section(
\ 'z', '%{airline#extensions#wordcount#get()}')
endif
endfunction
function! airline#extensions#wordcount#init(ext)
call a:ext.add_statusline_func('airline#extensions#wordcount#apply')
autocmd BufReadPost,CursorMoved,CursorMovedI * call s:wordcount_update()
endfunction

View File

@@ -1,64 +1,47 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#wordcount#formatters#default#format()
let words = string(s:wordcount())
if empty(words)
return
endif
let result = g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space
if winwidth(0) >= 80
let separator = s:get_decimal_group()
if words > 999 && !empty(separator)
function! airline#extensions#wordcount#formatters#default#update_fmt(...)
let s:fmt = get(g:, 'airline#extensions#wordcount#formatter#default#fmt', '%s words')
let s:fmt_short = get(g:, 'airline#extensions#wordcount#formatter#default#fmt_short', s:fmt == '%s words' ? '%sW' : s:fmt)
endfunction
" Reload format when statusline is rebuilt
call airline#extensions#wordcount#formatters#default#update_fmt()
if index(g:airline_statusline_funcrefs, function('airline#extensions#wordcount#formatters#default#update_fmt')) == -1
" only add it, if not already done
call airline#add_statusline_funcref(function('airline#extensions#wordcount#formatters#default#update_fmt'))
endif
if match(get(v:, 'lang', ''), '\v\cC|en') > -1
let s:decimal_group = ','
elseif match(get(v:, 'lang', ''), '\v\cde|dk|fr|pt') > -1
let s:decimal_group = '.'
else
let s:decimal_group = ''
endif
function! airline#extensions#wordcount#formatters#default#to_string(wordcount)
if airline#util#winwidth() > 85
if a:wordcount > 999
" Format number according to locale, e.g. German: 1.245 or English: 1,245
let words = substitute(words, '\d\@<=\(\(\d\{3\}\)\+\)$', separator.'&', 'g')
endif
let result = printf("%s%s", words, " words"). result
else
let result = printf("%s%s", words, "W"). result
endif
return result
endfunction
function! s:wordcount()
if exists("*wordcount")
let l:mode = mode()
if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S'
let l:visual_words = wordcount()['visual_words']
if l:visual_words != ''
return l:visual_words
else
return 0
endif
let wordcount = substitute(a:wordcount, '\d\@<=\(\(\d\{3\}\)\+\)$', s:decimal_group.'&', 'g')
else
return wordcount()['words']
let wordcount = a:wordcount
endif
elseif mode() =~? 's'
return
let str = printf(s:fmt, wordcount)
else
let old_status = v:statusmsg
let position = getpos(".")
exe "silent normal! g\<c-g>"
let stat = v:statusmsg
call setpos('.', position)
let v:statusmsg = old_status
let parts = split(stat)
if len(parts) > 11
return str2nr(parts[11])
else
return
endif
let str = printf(s:fmt_short, a:wordcount)
endif
endfunction
function! s:get_decimal_group()
if match(v:lang, '\v\cC|en') > -1
return ','
elseif match(v:lang, '\v\cde|dk|fr|pt') > -1
return '.'
let str .= g:airline_symbols.space
if !empty(g:airline_right_alt_sep)
let str .= g:airline_right_alt_sep . g:airline_symbols.space
endif
return ''
return str
endfunction

View File

@@ -0,0 +1,47 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#wordcount#formatters#readingtime#update_fmt(...) abort
let s:fmt = get(g:, 'airline#extensions#wordcount#formatter#readingtime#fmt', 'About %s minutes')
let s:fmt_short = get(g:, 'airline#extensions#wordcount#formatter#readingtime#fmt_short', s:fmt ==# 'About %s minutes' ? '%sW' : s:fmt)
endfunction
" Reload format when statusline is rebuilt
call airline#extensions#wordcount#formatters#readingtime#update_fmt()
if index(g:airline_statusline_funcrefs, function('airline#extensions#wordcount#formatters#readingtime#update_fmt')) == -1
" only add it, if not already done
call airline#add_statusline_funcref(function('airline#extensions#wordcount#formatters#readingtime#update_fmt'))
endif
if match(get(v:, 'lang', ''), '\v\cC|en') > -1
let s:decimal_group = ','
elseif match(get(v:, 'lang', ''), '\v\cde|dk|fr|pt') > -1
let s:decimal_group = '.'
else
let s:decimal_group = ''
endif
function! airline#extensions#wordcount#formatters#readingtime#to_string(wordcount) abort
if airline#util#winwidth() > 85
if a:wordcount > 999
" Format number according to locale, e.g. German: 1.245 or English: 1,245
let wordcount = substitute(a:wordcount, '\d\@<=\(\(\d\{3\}\)\+\)$', s:decimal_group.'&', 'g')
else
let wordcount = a:wordcount
endif
let str = printf(s:fmt, ceil(wordcount / 200.0))
else
let str = printf(s:fmt_short, ceil(a:wordcount / 200.0))
endif
let str .= g:airline_symbols.space
if !empty(g:airline_right_alt_sep)
let str .= g:airline_right_alt_sep . g:airline_symbols.space
endif
return str
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2017 YoungHoon Rhiu.
" MIT License. Copyright (c) 2017-2020 YoungHoon Rhiu et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -9,8 +9,8 @@ endif
function! airline#extensions#xkblayout#status()
let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
let keyboard_layout = split(keyboard_layout, '\.')[-1]
let short_codes = {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'}
let keyboard_layout = get(split(keyboard_layout, '\.'), -1, '')
let short_codes = get(g:, 'airline#extensions#xkblayout#short_codes', {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'})
if has_key(short_codes, keyboard_layout)
let keyboard_layout = short_codes[keyboard_layout]
@@ -22,4 +22,3 @@ endfunction
function! airline#extensions#xkblayout#init(ext)
call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status')
endfunction

View File

@@ -1,8 +1,13 @@
" MIT License. Copyright (c) 2015 Evgeny Firsov.
" MIT License. Copyright (c) 2015-2020 Evgeny Firsov et al.
" Plugin: https://github.com/ycm-core/YouCompleteMe
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !get(g:, 'loaded_youcompleteme', 0)
finish
endif
let s:spc = g:airline_symbols.space
let s:error_symbol = get(g:, 'airline#extensions#ycm#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#ycm#warning_symbol', 'W:')
@@ -12,8 +17,8 @@ function! airline#extensions#ycm#init(ext)
call airline#parts#define_function('ycm_warning_count', 'airline#extensions#ycm#get_warning_count')
endfunction
function! airline#extensions#ycm#get_error_count()
if exists(':YcmDiag') && exists("*youcompleteme#GetErrorCount")
function! airline#extensions#ycm#get_error_count() abort
if exists("*youcompleteme#GetErrorCount")
let cnt = youcompleteme#GetErrorCount()
if cnt != 0
@@ -25,7 +30,7 @@ function! airline#extensions#ycm#get_error_count()
endfunction
function! airline#extensions#ycm#get_warning_count()
if exists(':YcmDiag') && exists("*youcompleteme#GetWarningCount")
if exists("*youcompleteme#GetWarningCount")
let cnt = youcompleteme#GetWarningCount()
if cnt != 0
@@ -35,4 +40,3 @@ function! airline#extensions#ycm#get_warning_count()
return ''
endfunction

View File

@@ -0,0 +1,27 @@
" MIT License. Copyright (c) 2020 Dmitry Geurkov (d.geurkov@gmail.com)
" Plugin: https://github.com/troydm/zoomwintab.vim
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
" Avoid installing twice
if exists('g:loaded_vim_airline_zoomwintab')
finish
endif
let g:loaded_vim_airline_zoomwintab = 1
let s:zoomwintab_status_zoomed_in =
\ get(g:, 'airline#extensions#zoomwintab#status_zoomed_in', g:airline_left_alt_sep.' Zoomed')
let s:zoomwintab_status_zoomed_out =
\ get(g:, 'airline#extensions#zoomwintab#status_zoomed_out', '')
function! airline#extensions#zoomwintab#apply(...) abort
call airline#extensions#prepend_to_section('gutter',
\ exists('t:zoomwintab') ? s:zoomwintab_status_zoomed_in : s:zoomwintab_status_zoomed_out)
endfunction
function! airline#extensions#zoomwintab#init(ext) abort
call a:ext.add_statusline_func('airline#extensions#zoomwintab#apply')
endfunction

View File

@@ -0,0 +1,8 @@
scriptencoding utf-8
function! airline#formatter#short_path#format(val) abort
if get(g:, 'airline_stl_path_style', 'default') ==# 'short'
return '%{pathshorten(expand("'.a:val.'"))}'
endif
return a:val
endfunction

View File

@@ -1,237 +1,629 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
" MIT License. Copyright (c) 2013-2020 Bailey Ling Christian Brabandt et al.
" vim: et ts=2 sts=2 sw=2 fdm=marker et
scriptencoding utf-8
let s:is_win32term = (has('win32') || has('win64')) &&
\ !has('gui_running') &&
\ (empty($CONEMUBUILD) || &term !=? 'xterm') &&
\ empty($WTSESSION) &&
\ !(exists("+termguicolors") && &termguicolors)
let s:separators = {}
let s:accents = {}
let s:hl_groups = {}
function! s:gui2cui(rgb, fallback)
if a:rgb == ''
return a:fallback
elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1
return a:rgb
endif
let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)')
return airline#msdos#round_msdos_colors(rgb)
endfunction
function! s:get_syn(group, what)
if !exists("g:airline_gui_mode")
let g:airline_gui_mode = airline#init#gui_mode()
endif
let color = ''
if hlexists(a:group)
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode)
endif
if empty(color) || color == -1
" should always exists
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode)
" however, just in case
if empty(color) || color == -1
let color = 'NONE'
if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
" Legacy VimScript implementation {{{1
function! s:gui2cui(rgb, fallback) abort " {{{2
if a:rgb == ''
return a:fallback
elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1
return a:rgb
endif
endif
return color
endfunction
let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)')
return airline#msdos#round_msdos_colors(rgb)
endfunction
function! s:group_not_done(list, name) abort " {{{2
if index(a:list, a:name) == -1
call add(a:list, a:name)
return 1
else
if &vbs
echomsg printf("airline: group: %s already done, skipping", a:name)
endif
return 0
endif
endfu
function! s:get_syn(group, what, mode) abort "{{{2
let color = ''
if hlexists(a:group)
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, a:mode)
endif
if empty(color) || color == -1
" should always exist
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, a:mode)
" however, just in case
if empty(color) || color == -1
let color = 'NONE'
endif
endif
return color
endfunction
function! s:get_array(guifg, guibg, ctermfg, ctermbg, opts) abort " {{{2
return [ a:guifg, a:guibg, a:ctermfg, a:ctermbg, empty(a:opts) ? '' : join(a:opts, ',') ]
endfunction
function! airline#highlighter#reset_hlcache() abort " {{{2
let s:hl_groups = {}
endfunction
function! airline#highlighter#get_highlight(group, ...) abort " {{{2
" only check for the cterm reverse attribute
" TODO: do we need to check all modes (gui, term, as well)?
let reverse = synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group)
let res = s:hl_groups[a:group]
return reverse ? [ res[1], res[0], res[3], res[2], res[4] ] : res
else
let ctermfg = s:get_syn(a:group, 'fg', 'cterm')
let ctermbg = s:get_syn(a:group, 'bg', 'cterm')
let guifg = s:get_syn(a:group, 'fg', 'gui')
let guibg = s:get_syn(a:group, 'bg', 'gui')
let bold = synIDattr(synIDtrans(hlID(a:group)), 'bold')
if reverse
let res = s:get_array(guibg, guifg, ctermbg, ctermfg, bold ? ['bold'] : a:000)
else
let res = s:get_array(guifg, guibg, ctermfg, ctermbg, bold ? ['bold'] : a:000)
endif
endif
let s:hl_groups[a:group] = res
return res
endfunction
function! airline#highlighter#get_highlight2(fg, bg, ...) abort " {{{2
let guifg = s:get_syn(a:fg[0], a:fg[1], 'gui')
let guibg = s:get_syn(a:bg[0], a:bg[1], 'gui')
let ctermfg = s:get_syn(a:fg[0], a:fg[1], 'cterm')
let ctermbg = s:get_syn(a:bg[0], a:bg[1], 'cterm')
return s:get_array(guifg, guibg, ctermfg, ctermbg, a:000)
endfunction
function! s:hl_group_exists(group) abort " {{{2
if !hlexists(a:group)
return 0
elseif empty(synIDattr(synIDtrans(hlID(a:group)), 'fg'))
return 0
endif
return 1
endfunction
function! airline#highlighter#exec(group, colors) abort " {{{2
if pumvisible()
return
endif
let colors = a:colors
if s:is_win32term
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
endif
let old_hi = airline#highlighter#get_highlight(a:group)
if len(colors) == 4
call add(colors, '')
endif
let new_hi = [colors[0], colors[1], printf('%s', colors[2]), printf('%s', colors[3]), colors[4]]
let colors = s:CheckDefined(colors)
if old_hi != new_hi || !s:hl_group_exists(a:group)
let cmd = printf('hi %s%s', a:group, s:GetHiCmd(colors))
try
exe cmd
catch
echoerr "Error when running command: ". cmd
endtry
if has_key(s:hl_groups, a:group)
let s:hl_groups[a:group] = colors
endif
endif
endfunction
function! s:CheckDefined(colors) abort " {{{2
" Checks, whether the definition of the colors is valid and is not empty or NONE
" e.g. if the colors would expand to this:
" hi airline_c ctermfg=NONE ctermbg=NONE
" that means to clear that highlighting group, therefore, fallback to Normal
" highlighting group for the cterm values
function! s:get_array(fg, bg, opts)
return g:airline_gui_mode ==# 'gui'
\ ? [ a:fg, a:bg, '', '', join(a:opts, ',') ]
\ : [ '', '', a:fg, a:bg, join(a:opts, ',') ]
endfunction
function! airline#highlighter#get_highlight(group, ...)
let fg = s:get_syn(a:group, 'fg')
let bg = s:get_syn(a:group, 'bg')
let reverse = g:airline_gui_mode ==# 'gui'
\ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui')
\ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
\|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term')
return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000)
endfunction
function! airline#highlighter#get_highlight2(fg, bg, ...)
let fg = s:get_syn(a:fg[0], a:fg[1])
let bg = s:get_syn(a:bg[0], a:bg[1])
return s:get_array(fg, bg, a:000)
endfunction
function! s:hl_group_exists(group)
if !hlexists(a:group)
return 0
elseif empty(synIDattr(hlID(a:group), 'fg'))
return 0
endif
return 1
endfunction
function! airline#highlighter#exec(group, colors)
if pumvisible()
return
endif
let colors = a:colors
if s:is_win32term
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
endif
let old_hi = airline#highlighter#get_highlight(a:group)
if len(colors) == 4
call add(colors, '')
endif
let colors = s:CheckDefined(colors)
if old_hi != colors || !s:hl_group_exists(a:group)
let cmd = printf('hi %s %s %s %s %s %s %s %s',
\ a:group, s:Get(colors, 0, 'guifg=', ''), s:Get(colors, 1, 'guibg=', ''),
\ s:Get(colors, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''),
\ s:Get(colors, 4, 'gui=', ''), s:Get(colors, 4, 'cterm=', ''),
\ s:Get(colors, 4, 'term=', ''))
exe cmd
endif
endfunction
function! s:CheckDefined(colors)
" Checks, whether the definition of the colors is valid and is not empty or NONE
" e.g. if the colors would expand to this:
" hi airline_c ctermfg=NONE ctermbg=NONE
" that means to clear that highlighting group, therefore, fallback to Normal
" highlighting group for the cterm values
" This only works, if the Normal highlighting group is actually defined, so
" return early, if it has been cleared
if !exists("g:airline#highlighter#normal_fg_hi")
let g:airline#highlighter#normal_fg_hi = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm')
endif
if empty(g:airline#highlighter#normal_fg_hi) || g:airline#highlighter#normal_fg_hi < 0
return a:colors
endif
for val in a:colors
if !empty(val) && val !=# 'NONE'
" This only works, if the Normal highlighting group is actually defined, so
" return early, if it has been cleared
if !exists("g:airline#highlighter#normal_fg_hi")
let g:airline#highlighter#normal_fg_hi = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm')
endif
if empty(g:airline#highlighter#normal_fg_hi) || g:airline#highlighter#normal_fg_hi < 0
return a:colors
endif
endfor
" this adds the bold attribute to the term argument of the :hi command,
" but at least this makes sure, the group will be defined
let fg = g:airline#highlighter#normal_fg_hi
let bg = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm')
if bg < 0
" in case there is no background color defined for Normal
let bg = a:colors[3]
endif
return a:colors[0:1] + [fg, bg] + [a:colors[4]]
endfunction
function! s:Get(dict, key, prefix, default)
if get(a:dict, a:key, a:default) isnot# a:default
return a:prefix. get(a:dict, a:key)
else
return ''
endif
endfunction
for val in a:colors
if !empty(val) && val !=# 'NONE'
return a:colors
endif
endfor
" this adds the bold attribute to the term argument of the :hi command,
" but at least this makes sure, the group will be defined
let fg = g:airline#highlighter#normal_fg_hi
let bg = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm')
if bg < 0
" in case there is no background color defined for Normal
let bg = a:colors[3]
endif
return a:colors[0:1] + [fg, bg] + [a:colors[4]]
endfunction
function! s:GetHiCmd(list) abort " {{{2
" a:list needs to have 5 items!
let res = ''
let i = -1
while i < 4
let i += 1
let item = get(a:list, i, '')
if item is ''
continue
endif
if i == 0
let res .= ' guifg='.item
elseif i == 1
let res .= ' guibg='.item
elseif i == 2
let res .= ' ctermfg='.item
elseif i == 3
let res .= ' ctermbg='.item
elseif i == 4
let res .= printf(' gui=%s cterm=%s term=%s', item, item, item)
endif
endwhile
return res
endfunction
function! s:exec_separator(dict, from, to, inverse, suffix) abort " {{{2
if pumvisible()
return
endif
let group = a:from.'_to_'.a:to.a:suffix
let from = airline#themes#get_highlight(a:from.a:suffix)
let to = airline#themes#get_highlight(a:to.a:suffix)
if a:inverse
let colors = [ from[1], to[1], from[3], to[3] ]
else
let colors = [ to[1], from[1], to[3], from[3] ]
endif
let a:dict[group] = colors
call airline#highlighter#exec(group, colors)
endfunction
function! airline#highlighter#load_theme() abort " {{{2
if pumvisible()
return
endif
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()')
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
endfor
call airline#highlighter#highlight(['inactive'])
if getbufvar( bufnr('%'), '&modified' )
call airline#highlighter#highlight(['normal', 'modified'])
else
call airline#highlighter#highlight(['normal'])
endif
endfunction
function! airline#highlighter#add_separator(from, to, inverse) abort " {{{2
let s:separators[a:from.a:to] = [a:from, a:to, a:inverse]
call <sid>exec_separator({}, a:from, a:to, a:inverse, '')
endfunction
function! airline#highlighter#add_accent(accent) abort " {{{2
let s:accents[a:accent] = 1
endfunction
function! airline#highlighter#highlight_modified_inactive(bufnr) abort " {{{2
if getbufvar(a:bufnr, '&modified')
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : []
else
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : []
endif
function! s:exec_separator(dict, from, to, inverse, suffix)
if pumvisible()
return
endif
let l:from = airline#themes#get_highlight(a:from.a:suffix)
let l:to = airline#themes#get_highlight(a:to.a:suffix)
let group = a:from.'_to_'.a:to.a:suffix
if a:inverse
let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ]
else
let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ]
endif
let a:dict[group] = colors
call airline#highlighter#exec(group, colors)
endfunction
if !empty(colors)
call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors)
endif
endfunction
function! airline#highlighter#highlight(modes, ...) abort " {{{2
let bufnr = a:0 ? a:1 : ''
let p = g:airline#themes#{g:airline_theme}#palette
function! airline#highlighter#load_theme()
if pumvisible()
return
endif
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()')
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
endfor
call airline#highlighter#highlight(['inactive'])
if getbufvar( bufnr('%'), '&modified' )
call airline#highlighter#highlight(['normal', 'modified'])
else
call airline#highlighter#highlight(['normal'])
endif
endfunction
function! airline#highlighter#add_separator(from, to, inverse)
let s:separators[a:from.a:to] = [a:from, a:to, a:inverse]
call <sid>exec_separator({}, a:from, a:to, a:inverse, '')
endfunction
function! airline#highlighter#add_accent(accent)
let s:accents[a:accent] = 1
endfunction
function! airline#highlighter#highlight_modified_inactive(bufnr)
if getbufvar(a:bufnr, '&modified')
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : []
else
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c')
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : []
endif
if !empty(colors)
call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors)
endif
endfunction
function! airline#highlighter#highlight(modes, ...)
let bufnr = a:0 ? a:1 : ''
let p = g:airline#themes#{g:airline_theme}#palette
" draw the base mode, followed by any overrides
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
for mode in mapped
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
for kvp in items(dict)
let mode_colors = kvp[1]
let name = kvp[0]
if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive'
let name = 'airline_c'.bufnr
endif
call airline#highlighter#exec(name.suffix, mode_colors)
for accent in keys(s:accents)
if !has_key(p.accents, accent)
" draw the base mode, followed by any overrides
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
let airline_grouplist = []
let buffers_in_tabpage = sort(tabpagebuflist())
if exists("*uniq")
let buffers_in_tabpage = uniq(buffers_in_tabpage)
endif
" mapped might be something like ['normal', 'normal_modified']
" if a group is in both modes available, only define the second
" that is how this was done previously overwrite the previous definition
for mode in reverse(mapped)
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
for kvp in items(dict)
let mode_colors = kvp[1]
let name = kvp[0]
if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive'
let name = 'airline_c'.bufnr
endif
" do not re-create highlighting for buffers that are no longer visible
" in the current tabpage
if name =~# 'airline_c\d\+'
let bnr = matchstr(name, 'airline_c\zs\d\+') + 0
if bnr > 0 && index(buffers_in_tabpage, bnr) == -1
continue
endif
elseif (name =~# '_to_') || (name[0:10] is# 'airline_tab' && !empty(suffix))
" group will be redefined below at exec_separator
" or is not needed for tabline with '_inactive' suffix
" since active flag is 1 for builder)
continue
endif
let colors = copy(mode_colors)
if p.accents[accent][0] != ''
let colors[0] = p.accents[accent][0]
if s:group_not_done(airline_grouplist, name.suffix)
call airline#highlighter#exec(name.suffix, mode_colors)
endif
if p.accents[accent][2] != ''
let colors[2] = p.accents[accent][2]
if !has_key(p, 'accents')
" work around a broken installation
" shouldn't actually happen, p should always contain accents
continue
endif
if len(colors) >= 5
let colors[4] = get(p.accents[accent], 4, '')
else
call add(colors, get(p.accents[accent], 4, ''))
endif
call airline#highlighter#exec(name.suffix.'_'.accent, colors)
for accent in keys(s:accents)
if !has_key(p.accents, accent)
continue
endif
let colors = copy(mode_colors)
if p.accents[accent][0] != ''
let colors[0] = p.accents[accent][0]
endif
if p.accents[accent][2] != ''
let colors[2] = p.accents[accent][2]
endif
if len(colors) >= 5
let colors[4] = get(p.accents[accent], 4, '')
else
call add(colors, get(p.accents[accent], 4, ''))
endif
if s:group_not_done(airline_grouplist, name.suffix.'_'.accent)
call airline#highlighter#exec(name.suffix.'_'.accent, colors)
endif
endfor
endfor
endfor
" TODO: optimize this
for sep in items(s:separators)
call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
endfor
if empty(s:separators)
" nothing to be done
continue
endif
" TODO: optimize this
for sep in items(s:separators)
" we cannot check, that the group already exists, else the separators
" might not be correctly defined. But perhaps we can skip above groups
" that match the '_to_' name, because they would be redefined here...
call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
endfor
endif
endfor
endfunction
finish
else
" This is using Vim9 script " {{{1
def s:gui2cui(rgb: string, fallback: string): string # {{{2
if empty(rgb)
return fallback
elseif match(rgb, '^\%(NONE\|[fb]g\)$') > -1
return rgb
endif
endfor
endfunction
var _rgb = []
_rgb = map(split(rgb[1:], '..\zs'), {_, v -> ("0x" .. v)->str2nr(16)})
return airline#msdos#round_msdos_colors(_rgb)
enddef
def s:group_not_done(list: list<string>, name: string): bool # {{{2
if index(list, name) == -1
add(list, name)
return true
else
if &vbs
:echomsg printf("airline: group: %s already done, skipping", name)
endif
return false
endif
enddef
def s:get_syn(group: string, what: string, mode: string): string # {{{2
var color = ''
if hlexists(group)
color = hlID(group)->synIDtrans()->synIDattr(what, mode)
endif
if empty(color) || str2nr(color) == -1
# Normal highlighting group should always exist
color = hlID('Normal')->synIDtrans()->synIDattr(what, mode)
# however, just in case
if empty(color) || str2nr(color) == -1
color = 'NONE'
endif
endif
return color
enddef
def s:get_array(guifg: string, guibg: string, ctermfg: string, ctermbg: string, opts: list<string>): list<string> # {{{2
return [ guifg, guibg, ctermfg, ctermbg, empty(opts) ? '' : join(opts, ',') ]
enddef
def airline#highlighter#reset_hlcache(): void # {{{2
s:hl_groups = {}
enddef
def airline#highlighter#get_highlight(group: string, rest: list<string> = ['']): list<string> # {{{2
# only check for the cterm reverse attribute
# TODO: do we need to check all modes (gui, term, as well)?
var reverse = false
var res = []
var ctermfg: string
var ctermbg: string
var guifg: string
var guibg: string
var bold: bool
if hlID(group)->synIDtrans()->synIDattr('reverse', 'cterm')->str2nr()
reverse = true
endif
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, group)
res = s:hl_groups[group]
return reverse ? [ res[1], res[0], res[3], res[2], res[4] ] : res
else
ctermfg = s:get_syn(group, 'fg', 'cterm')
ctermbg = s:get_syn(group, 'bg', 'cterm')
guifg = s:get_syn(group, 'fg', 'gui')
guibg = s:get_syn(group, 'bg', 'gui')
if hlID(group)->synIDtrans()->synIDattr('bold')->str2nr()
bold = true
endif
if reverse
res = s:get_array(guibg, guifg, ctermbg, ctermfg, bold ? ['bold'] : rest)
else
res = s:get_array(guifg, guibg, ctermfg, ctermbg, bold ? ['bold'] : rest)
endif
endif
s:hl_groups[group] = res
return res
enddef
def airline#highlighter#get_highlight2(fg: list<string>, bg: list<string>, rest1: string = '', rest2: string = '', rest3: string = ''): list<string> # {{{2
var guifg = s:get_syn(fg[0], fg[1], 'gui')
var guibg = s:get_syn(bg[0], bg[1], 'gui')
var ctermfg = s:get_syn(fg[0], fg[1], 'cterm')
var ctermbg = s:get_syn(bg[0], bg[1], 'cterm')
var rest = [ rest1, rest2, rest3 ]
return s:get_array(guifg, guibg, ctermfg, ctermbg, filter(rest, {_, v -> !empty(v)}))
enddef
def s:hl_group_exists(group: string): bool # {{{2
if !hlexists(group)
return false
elseif hlID(group)->synIDtrans()->synIDattr('fg')->empty()
return false
endif
return true
enddef
def s:CheckDefined(colors: list<any>): list<any> # {{{2
# Checks, whether the definition of the colors is valid and is not empty or NONE
# e.g. if the colors would expand to this:
# hi airline_c ctermfg=NONE ctermbg=NONE
# that means to clear that highlighting group, therefore, fallback to Normal
# highlighting group for the cterm values
# This only works, if the Normal highlighting group is actually defined,
# so return early, if it has been cleared
if !exists("g:airline#highlighter#normal_fg_hi")
g:airline#highlighter#normal_fg_hi = hlID('Normal')->synIDtrans()->synIDattr('fg', 'cterm')
endif
if empty(g:airline#highlighter#normal_fg_hi) || str2nr(g:airline#highlighter#normal_fg_hi) < 0
return colors
endif
for val in colors
if !empty(val) && val !=# 'NONE'
return colors
endif
endfor
# this adds the bold attribute to the term argument of the :hi command,
# but at least this makes sure, the group will be defined
var fg = g:airline#highlighter#normal_fg_hi
var bg = hlID('Normal')->synIDtrans()->synIDattr('bg', 'cterm')
if str2nr(bg) < 0
# in case there is no background color defined for Normal
bg = colors[3]
endif
return colors[0:1] + [fg, bg] + [colors[4]]
enddef
def s:GetHiCmd(list: list<string>): string # {{{2
# list needs to have 5 items!
var res: string
var i = -1
var item: string
while i < 4
i += 1
item = get(list, i, '')
if item is ''
continue
endif
if i == 0
res = res .. ' guifg=' .. item
elseif i == 1
res = res .. ' guibg=' .. item
elseif i == 2
res = res .. ' ctermfg=' .. item
elseif i == 3
res = res .. ' ctermbg=' .. item
elseif i == 4
res = res .. printf(' gui=%s cterm=%s term=%s', item, item, item)
endif
endwhile
return res
enddef
def airline#highlighter#exec(group: string, clrs: list<any>): void # {{{2
# TODO: is clrs: list<any> correct? Should probably be list<number> instead
# convert all themes to use strings in cterm color definition
if pumvisible()
return
endif
var colors: list<string>
colors = map(copy(clrs), { _, v -> type(v) != type('') ? string(v) : v})
if len(colors) == 4
add(colors, '')
endif
if s:is_win32term
colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
endif
var old_hi: list<string> = airline#highlighter#get_highlight(group)
var new_hi: list<string> = colors
colors = s:CheckDefined(colors)
if old_hi != new_hi || !s:hl_group_exists(group)
var cmd = ''
cmd = printf('hi %s%s', group, s:GetHiCmd(colors))
:exe cmd
if has_key(s:hl_groups, group)
s:hl_groups[group] = colors
endif
endif
enddef
def s:exec_separator(dict: dict<any>, from_arg: string, to_arg: string, inverse: bool, suffix: string): void # {{{2
if pumvisible()
return
endif
var group = from_arg .. '_to_' .. to_arg .. suffix
var from = map(airline#themes#get_highlight(from_arg .. suffix),
{_, v -> type(v) != type('') ? string(v) : v})
var colors = []
var to = map(airline#themes#get_highlight(to_arg .. suffix),
{_, v -> type(v) != type('') ? string(v) : v})
if inverse
colors = [ from[1], to[1], from[3], to[3] ]
else
colors = [ to[1], from[1], to[3], from[3] ]
endif
dict[group] = colors
airline#highlighter#exec(group, colors)
enddef
def airline#highlighter#load_theme(): void # {{{2
if pumvisible()
return
endif
for winnr in filter(range(1, winnr('$')), {_, v -> v != winnr()})
airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
endfor
airline#highlighter#highlight(['inactive'])
if getbufvar( bufnr('%'), '&modified' )
airline#highlighter#highlight(['normal', 'modified'])
else
airline#highlighter#highlight(['normal'])
endif
enddef
def airline#highlighter#add_separator(from: string, to: string, inverse: bool): void # {{{2
s:separators[from .. to] = [from, to, inverse]
s:exec_separator({}, from, to, inverse, '')
enddef
def airline#highlighter#add_accent(accent: string): void # {{{2
s:accents[accent] = 1
enddef
def airline#highlighter#highlight_modified_inactive(bufnr: number): void # {{{2
var colors: list<any>
var dict1 = eval('g:airline#themes#' .. g:airline_theme .. '#palette')->get('inactive_modified', {})
var dict2 = eval('g:airline#themes#' .. g:airline_theme .. '#palette')->get('inactive', {})
if empty(dict2)
return
endif
if getbufvar(bufnr, '&modified')
colors = get(dict1, 'airline_c', [])
else
colors = get(dict2, 'airline_c', [])
endif
if !empty(colors)
airline#highlighter#exec('airline_c' .. bufnr .. '_inactive', colors)
endif
enddef
def airline#highlighter#highlight(modes: list<string>, bufnr: string = ''): void # {{{2
var p: dict<any> = eval('g:airline#themes#' .. g:airline_theme .. '#palette')
# draw the base mode, followed by any overrides
var mapped = map(modes, {_, v -> v == modes[0] ? v : modes[0] .. "_" .. v})
var suffix = ''
if modes[0] == 'inactive'
suffix = '_inactive'
endif
var airline_grouplist = []
var dict: dict<any>
var bnr: number = 0
var buffers_in_tabpage: list<number> = uniq(sort(tabpagebuflist()))
# mapped might be something like ['normal', 'normal_modified']
# if a group is in both modes available, only define the second
# that is how this was done previously overwrite the previous definition
for mode in reverse(mapped)
if exists('g:airline#themes#' .. g:airline_theme .. '#palette.' .. mode)
dict = eval('g:airline#themes#' .. g:airline_theme .. '#palette.' .. mode)
for kvp in items(dict)
var mode_colors = kvp[1]
var name = kvp[0]
if name == 'airline_c' && !empty(bufnr) && suffix == '_inactive'
name = 'airline_c' .. bufnr
endif
# do not re-create highlighting for buffers that are no longer visible
# in the current tabpage
if name =~# 'airline_c\d\+'
bnr = str2nr(matchstr(name, 'airline_c\zs\d\+'))
if bnr > 0 && index(buffers_in_tabpage, bnr) == -1
continue
endif
elseif (name =~ '_to_') || (name[0:10] == 'airline_tab' && !empty(suffix))
# group will be redefined below at exec_separator
# or is not needed for tabline with '_inactive' suffix
# since active flag is 1 for builder)
continue
endif
if s:group_not_done(airline_grouplist, name .. suffix)
airline#highlighter#exec(name .. suffix, mode_colors)
endif
if !has_key(p, 'accents')
# shouldn't actually happen, p should always contain accents
continue
endif
for accent in keys(s:accents)
if !has_key(p.accents, accent)
continue
endif
var colors = copy(mode_colors)
if p.accents[accent][0] != ''
colors[0] = p.accents[accent][0]
endif
if type(get(p.accents[accent], 2, '')) == type('')
colors[2] = get(p.accents[accent], 2, '')
else
colors[2] = string(p.accents[accent][2])
endif
if len(colors) >= 5
colors[4] = get(p.accents[accent], 4, '')
else
add(colors, get(p.accents[accent], 4, ''))
endif
if s:group_not_done(airline_grouplist, name .. suffix .. '_' .. accent)
airline#highlighter#exec(name .. suffix .. '_' .. accent, colors)
endif
endfor
endfor
if empty(s:separators)
continue
endif
for sep in items(s:separators)
# we cannot check, that the group already exists, else the separators
# might not be correctly defined. But perhaps we can skip above groups
# that match the '_to_' name, because they would be redefined here...
s:exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
endfor
endif
endfor
enddef
endif " }}}1

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -18,38 +18,45 @@ function! airline#init#bootstrap()
let g:airline#init#bootstrapping = 1
let g:airline#util#async = v:version >= 800 && has('job')
let g:airline#util#is_windows = has('win32') || has('win64')
let g:airline#init#vim_async = (v:version >= 800 && has('job'))
let g:airline#init#is_windows = has('win32') || has('win64')
call s:check_defined('g:airline_detect_modified', 1)
call s:check_defined('g:airline_detect_paste', 1)
call s:check_defined('g:airline_detect_crypt', 1)
call s:check_defined('g:airline_detect_spell', 1)
call s:check_defined('g:airline_detect_spelllang', 1)
call s:check_defined('g:airline_detect_iminsert', 0)
call s:check_defined('g:airline_inactive_collapse', 1)
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])
call s:check_defined('g:airline_exclude_filetypes', [])
call s:check_defined('g:airline_exclude_preview', 0)
call s:check_defined('g:airline_gui_mode', airline#init#gui_mode())
call s:check_defined('g:airline_mode_map', {})
call extend(g:airline_mode_map, {
\ '__' : '------',
\ 'n' : 'NORMAL',
\ 'i' : 'INSERT',
\ 'R' : 'REPLACE',
\ 'v' : 'VISUAL',
\ 'V' : 'V-LINE',
\ 'c' : 'COMMAND',
\ '' : 'V-BLOCK',
\ 'i' : 'INSERT',
\ 'ic' : 'INSERT COMPL',
\ 'ix' : 'INSERT COMPL',
\ 'multi' : 'MULTI',
\ 'n' : 'NORMAL',
\ 'ni' : '(INSERT)',
\ 'no' : 'OP PENDING',
\ 'R' : 'REPLACE',
\ 'Rv' : 'V REPLACE',
\ 's' : 'SELECT',
\ 'S' : 'S-LINE',
\ '' : 'S-BLOCK',
\ 't' : 'TERMINAL',
\ 'v' : 'VISUAL',
\ 'V' : 'V-LINE',
\ '' : 'V-BLOCK',
\ }, 'keep')
call s:check_defined('g:airline_theme_map', {})
call extend(g:airline_theme_map, {
\ 'default': 'dark',
\ '\CTomorrow': 'tomorrow',
\ 'base16': 'base16',
\ 'mo[l|n]okai': 'molokai',
@@ -68,7 +75,9 @@ function! airline#init#bootstrap()
\ 'paste': 'PASTE',
\ 'spell': 'SPELL',
\ 'modified': '+',
\ 'space': ' '
\ 'space': ' ',
\ 'keymap': 'Keymap:',
\ 'ellipsis': '...'
\ }, 'keep')
if get(g:, 'airline_powerline_fonts', 0)
@@ -77,7 +86,7 @@ function! airline#init#bootstrap()
call s:check_defined('g:airline_left_alt_sep', "\ue0b1") " 
call s:check_defined('g:airline_right_sep', "\ue0b2") " 
call s:check_defined('g:airline_right_alt_sep', "\ue0b3") " 
" ro=, ws=☲, lnr=☰, mlnr=, br=, nx=Ɇ, crypt=🔒
" ro=, ws=☲, lnr=☰, mlnr=, br=, nx=Ɇ, crypt=🔒, dirty=⚡
call extend(g:airline_symbols, {
\ 'readonly': "\ue0a2",
\ 'whitespace': "\u2632",
@@ -85,6 +94,7 @@ function! airline#init#bootstrap()
\ 'maxlinenr': " \ue0a1",
\ 'branch': "\ue0a0",
\ 'notexists': "\u0246",
\ 'dirty': "\u26a1",
\ 'crypt': nr2char(0x1F512),
\ }, 'keep')
elseif &encoding==?'utf-8' && !get(g:, "airline_symbols_ascii", 0)
@@ -102,6 +112,7 @@ function! airline#init#bootstrap()
\ 'branch': "\u16A0",
\ 'notexists': "\u0246",
\ 'crypt': nr2char(0x1F512),
\ 'dirty': '!',
\ }, 'keep')
else
" Symbols for ASCII terminals
@@ -117,6 +128,7 @@ function! airline#init#bootstrap()
\ 'branch': '',
\ 'notexists': '?',
\ 'crypt': 'cr',
\ 'dirty': '!',
\ }, 'keep')
endif
@@ -133,66 +145,84 @@ function! airline#init#bootstrap()
\ 'function': 'airline#parts#readonly',
\ 'accent': 'red',
\ })
call airline#parts#define_raw('file', '%f%m')
call airline#parts#define_raw('file', airline#formatter#short_path#format('%f%m'))
call airline#parts#define_raw('path', '%F%m')
call airline#parts#define('linenr', {
\ 'raw': '%{g:airline_symbols.linenr}%4l',
\ 'raw': '%{g:airline_symbols.linenr}%l',
\ 'accent': 'bold'})
call airline#parts#define('maxlinenr', {
\ 'raw': '/%L%{g:airline_symbols.maxlinenr}',
\ 'accent': 'bold'})
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
call airline#parts#define_empty(['hunks', 'branch', 'obsession', 'tagbar',
\ 'syntastic-warn', 'syntastic-err', 'eclim', 'whitespace','windowswap',
call airline#parts#define('hunks', {
\ 'raw': '',
\ 'minwidth': 100})
call airline#parts#define('branch', {
\ 'raw': '',
\ 'minwidth': 80})
call airline#parts#define('coc_status', {
\ 'raw': '',
\ 'accent': 'bold'
\ })
call airline#parts#define_empty(['obsession', 'tagbar', 'syntastic-warn',
\ 'syntastic-err', 'eclim', 'whitespace','windowswap',
\ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count',
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count'])
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count',
\ 'lsp_error_count', 'lsp_warning_count',
\ 'nvimlsp_error_count', 'nvimlsp_warning_count',
\ 'languageclient_error_count', 'languageclient_warning_count',
\ 'coc_warning_count', 'coc_error_count', 'vista', 'battery'])
call airline#parts#define_text('bookmark', '')
call airline#parts#define_text('capslock', '')
call airline#parts#define_text('gutentags', '')
call airline#parts#define_text('gen_tags', '')
call airline#parts#define_text('grepper', '')
call airline#parts#define_text('xkblayout', '')
call airline#parts#define_text('keymap', '')
call airline#parts#define_text('omnisharp', '')
unlet g:airline#init#bootstrapping
endfunction
function! airline#init#gui_mode()
return ((has('nvim') && exists('$NVIM_TUI_ENABLE_TRUE_COLOR') && !exists("+termguicolors"))
\ || has('gui_running') || (has("termtruecolor") && &guicolors == 1) || (has("termguicolors") && &termguicolors == 1)) ?
\ 'gui' : 'cterm'
endfunction
function! airline#init#sections()
let spc = g:airline_symbols.space
if !exists('g:airline_section_a')
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'spell', 'capslock', 'xkblayout', 'iminsert'])
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'keymap', 'spell', 'capslock', 'xkblayout', 'iminsert'])
endif
if !exists('g:airline_section_b')
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
if airline#util#winwidth() > 99
let g:airline_section_b = airline#section#create(['hunks', 'branch', 'battery'])
else
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
endif
endif
if !exists('g:airline_section_c')
if exists("+autochdir") && &autochdir == 1
let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly'])
let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly', 'coc_status'])
else
let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly'])
let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly', 'coc_status'])
endif
endif
if !exists('g:airline_section_gutter')
let g:airline_section_gutter = airline#section#create(['%='])
endif
if !exists('g:airline_section_x')
let g:airline_section_x = airline#section#create_right(['tagbar', 'filetype'])
let g:airline_section_x = airline#section#create_right(['bookmark', 'tagbar', 'vista', 'gutentags', 'gen_tags', 'omnisharp', 'grepper', 'filetype'])
endif
if !exists('g:airline_section_y')
let g:airline_section_y = airline#section#create_right(['ffenc'])
endif
if !exists('g:airline_section_z')
if winwidth(0) > 80
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
if airline#util#winwidth() > 79
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%p%%'.spc, 'linenr', 'maxlinenr', ':%v'])
else
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3v'])
let g:airline_section_z = airline#section#create(['%p%%'.spc, 'linenr', ':%v'])
endif
endif
if !exists('g:airline_section_error')
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count'])
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count', 'lsp_error_count', 'nvimlsp_error_count', 'languageclient_error_count', 'coc_error_count'])
endif
if !exists('g:airline_section_warning')
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'whitespace'])
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'lsp_warning_count', 'nvimlsp_warning_count', 'languageclient_warning_count', 'whitespace', 'coc_warning_count'])
endif
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling Christian Brabandt et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -22,7 +22,7 @@ scriptencoding utf-8
" 14 Yellow
" 15 White
let s:basic16 = [
const s:basic16 = [
\ [ 0x00, 0x00, 0x00 ],
\ [ 0x00, 0x00, 0x80 ],
\ [ 0x00, 0x80, 0x00 ],
@@ -41,6 +41,26 @@ let s:basic16 = [
\ [ 0xFF, 0xFF, 0xFF ]
\ ]
if exists(":def")
def airline#msdos#round_msdos_colors(rgblist: list<number>): string
# Check for values from MSDOS 16 color terminal
var best = []
var min = 100000
var t = 0
for value in s:basic16
t = abs(value[0] - rgblist[0]) +
abs(value[1] - rgblist[1]) +
abs(value[2] - rgblist[2])
if min > t
min = t
best = value
endif
endfor
return string(index(s:basic16, best))
enddef
finish
endif
function! airline#msdos#round_msdos_colors(rgblist)
" Check for values from MSDOS 16 color terminal
let best = []

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -65,7 +65,18 @@ function! airline#parts#paste()
endfunction
function! airline#parts#spell()
return g:airline_detect_spell && &spell ? g:airline_symbols.spell : ''
let spelllang = g:airline_detect_spelllang ? printf(" [%s]", toupper(substitute(&spelllang, ',', '/', 'g'))) : ''
if g:airline_detect_spell && &spell
let winwidth = airline#util#winwidth()
if winwidth >= 90
return g:airline_symbols.spell . spelllang
elseif winwidth >= 70
return g:airline_symbols.spell
else
return split(g:airline_symbols.spell, '\zs')[0]
endif
endif
return ''
endfunction
function! airline#parts#iminsert()
@@ -76,7 +87,12 @@ function! airline#parts#iminsert()
endfunction
function! airline#parts#readonly()
if &readonly && &modifiable && !filereadable(bufname('%'))
" only consider regular buffers (e.g. ones that represent actual files,
" but not special ones like e.g. NERDTree)
if !empty(&buftype) || airline#util#ignore_buf(bufname('%'))
return ''
endif
if &readonly && !filereadable(bufname('%'))
return '[noperm]'
else
return &readonly ? g:airline_symbols.readonly : ''
@@ -84,7 +100,9 @@ function! airline#parts#readonly()
endfunction
function! airline#parts#filetype()
return winwidth(0) < 90 && strlen(&filetype) > 3 ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? '…' : '>') : &filetype
return (airline#util#winwidth() < 90 && strlen(&filetype) > 3)
\ ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? '…' : '>')
\ : &filetype
endfunction
function! airline#parts#ffenc()

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -82,4 +82,3 @@ endfunction
function! airline#section#create_right(parts)
return s:create(a:parts, -1)
endfunction

View File

@@ -1,73 +1,151 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 et
scriptencoding utf-8
" generates a dictionary which defines the colors for each highlight group
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...)
let palette = {
\ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] ,
\ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] ,
\ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] ,
\ }
if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
" generates a dictionary which defines the colors for each highlight group
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...)
let palette = {
\ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] ,
\ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] ,
\ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] ,
\ }
if a:0 > 0
call extend(palette, {
\ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] ,
\ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] ,
\ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] ,
\ })
else
call extend(palette, {
\ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] ,
\ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] ,
\ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] ,
\ })
endif
return palette
endfunction
function! airline#themes#get_highlight(group, ...)
return call('airline#highlighter#get_highlight', [a:group] + a:000)
endfunction
function! airline#themes#get_highlight2(fg, bg, ...)
return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000)
endfunction
function! airline#themes#patch(palette)
for mode in keys(a:palette)
if !has_key(a:palette[mode], 'airline_warning')
let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ]
if a:0 > 0
call extend(palette, {
\ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] ,
\ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] ,
\ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] ,
\ })
else
call extend(palette, {
\ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] ,
\ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] ,
\ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] ,
\ })
endif
if !has_key(a:palette[mode], 'airline_error')
let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
return palette
endfunction
function! airline#themes#get_highlight(group, ...)
return call('airline#highlighter#get_highlight', [a:group] + a:000)
endfunction
function! airline#themes#get_highlight2(fg, bg, ...)
return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000)
endfunction
function! airline#themes#patch(palette)
for mode in keys(a:palette)
if mode == 'accents'
continue
endif
if !has_key(a:palette[mode], 'airline_warning')
let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ]
endif
if !has_key(a:palette[mode], 'airline_error')
let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
endif
if !has_key(a:palette[mode], 'airline_term')
let a:palette[mode]['airline_term'] = [ '#9cffd3', '#202020', 85, 232]
endif
endfor
let a:palette.accents = get(a:palette, 'accents', {})
let a:palette.accents.none = [ '', '', '', '', '' ]
let a:palette.accents.bold = [ '', '', '', '', 'bold' ]
let a:palette.accents.italic = [ '', '', '', '', 'italic' ]
if !has_key(a:palette.accents, 'red')
let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ]
endif
endfor
if !has_key(a:palette.accents, 'green')
let a:palette.accents.green = [ '#008700' , '' , 22 , '' ]
endif
if !has_key(a:palette.accents, 'blue')
let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ]
endif
if !has_key(a:palette.accents, 'yellow')
let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ]
endif
if !has_key(a:palette.accents, 'orange')
let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ]
endif
if !has_key(a:palette.accents, 'purple')
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ]
endif
endfunction
else
" New Vim9script implementation
def airline#themes#generate_color_map(sect1: list<string>, sect2: list<any>, sect3: list<any>): dict<any>
# Only allows for 3 arguments currently, because Vim9 Script does not
# allow for a:000
let a:palette.accents = get(a:palette, 'accents', {})
let a:palette.accents.none = [ '', '', '', '', '' ]
let a:palette.accents.bold = [ '', '', '', '', 'bold' ]
let a:palette.accents.italic = [ '', '', '', '', 'italic' ]
# all sections should be string
map(sect2, {_, v -> type(v) != type('') ? string(v) : v})
var palette = {
'airline_a': [ sect1[0], sect1[1], sect1[2], sect1[3], get(sect1, 4, '') ],
'airline_b': [ sect2[0], sect2[1], sect2[2], sect2[3], get(sect2, 4, '') ],
'airline_c': [ sect3[0], sect3[1], sect3[2], sect3[3], get(sect3, 4, '') ],
}
if !has_key(a:palette.accents, 'red')
let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ]
endif
if !has_key(a:palette.accents, 'green')
let a:palette.accents.green = [ '#008700' , '' , 22 , '' ]
endif
if !has_key(a:palette.accents, 'blue')
let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ]
endif
if !has_key(a:palette.accents, 'yellow')
let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ]
endif
if !has_key(a:palette.accents, 'orange')
let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ]
endif
if !has_key(a:palette.accents, 'purple')
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ]
endif
endfunction
extend(palette, {
'airline_x': [ sect3[0], sect3[1], sect3[2], sect3[3], '' ],
'airline_y': [ sect2[0], sect2[1], sect2[2], sect2[3], '' ],
'airline_z': [ sect1[0], sect1[1], sect1[2], sect1[3], '' ],
})
return palette
enddef
def airline#themes#get_highlight(group: string): list<string>
return call('airline#highlighter#get_highlight', [group])
enddef
def airline#themes#get_highlight2(fg: list<string>, bg: list<string>): list<string>
return call('airline#highlighter#get_highlight2', [fg, bg])
enddef
def airline#themes#patch(palette: dict<any>): void
for mode in keys(palette)
if mode == 'accents'
continue
endif
if !has_key(palette[mode], 'airline_warning')
extend(palette[mode], #{airline_warning: [ '#000000', '#df5f00', '232', '166', '' ]})
endif
if !has_key(palette[mode], 'airline_error')
extend(palette[mode], #{airline_error: [ '#000000', '#990000', '232', '160', '' ]})
endif
if !has_key(palette[mode], 'airline_term')
extend(palette[mode], #{airline_term: [ '#9cffd3', '#202020', '85', '232', '']})
endif
endfor
palette.accents = get(palette, 'accents', {})
extend(palette.accents, #{none: [ '', '', '', '', '' ]})
extend(palette.accents, #{bold: [ '', '', '', '', 'bold' ]})
extend(palette.accents, #{italic: [ '', '', '', '', 'italic' ]})
if !has_key(palette.accents, 'red')
extend(palette.accents, #{red: [ '#ff0000', '', '160', '' ]})
endif
if !has_key(palette.accents, 'green')
extend(palette.accents, #{green: [ '#008700', '', '22', '' ]})
endif
if !has_key(palette.accents, 'blue')
extend(palette.accents, #{blue: [ '#005fff', '', '27', '' ]})
endif
if !has_key(palette.accents, 'yellow')
extend(palette.accents, #{yellow: [ '#dfff00', '', '190', '' ]})
endif
if !has_key(palette.accents, 'orange')
extend(palette.accents, #{orange: [ '#df5f00', '', '166', '' ]})
endif
if !has_key(palette.accents, 'purple')
extend(palette.accents, #{purple: [ '#af00df', '', '128', '' ]})
endif
enddef
endif

View File

@@ -1,82 +1,143 @@
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 tw=80
scriptencoding utf-8
" Each theme is contained in its own file and declares variables scoped to the
" file. These variables represent the possible "modes" that airline can
" detect. The mode is the return value of mode(), which gets converted to a
" readable string. The following is a list currently supported modes: normal,
" insert, replace, visual, and inactive.
" Airline themes are generated based on the following concepts:
" * The section of the status line, valid Airline statusline sections are:
" * airline_a (left most section)
" * airline_b (section just to the right of airline_a)
" * airline_c (section just to the right of airline_b)
" * airline_x (first section of the right most sections)
" * airline_y (section just to the right of airline_x)
" * airline_z (right most section)
" * The mode of the buffer, as reported by the :mode() function. Airline
" converts the values reported by mode() to the following:
" * normal
" * insert
" * replace
" * visual
" * inactive
" * terminal
" The last one is actually no real mode as returned by mode(), but used by
" airline to style inactive statuslines (e.g. windows, where the cursor
" currently does not reside in).
" * In addition to each section and mode specified above, airline themes
" can also specify overrides. Overrides can be provided for the following
" scenarios:
" * 'modified'
" * 'paste'
"
" Each mode can also have overrides. These are small changes to the mode that
" don't require a completely different look. "modified" and "paste" are two
" such supported overrides. These are simply suffixed to the major mode,
" separated by an underscore. For example, "normal_modified" would be normal
" mode where the current buffer is modified.
" Airline themes are specified as a global viml dictionary using the above
" sections, modes and overrides as keys to the dictionary. The name of the
" dictionary is significant and should be specified as:
" * g:airline#themes#<theme_name>#palette
" where <theme_name> is substituted for the name of the theme.vim file where the
" theme definition resides. Airline themes should reside somewhere on the
" 'runtimepath' where it will be loaded at vim startup, for example:
" * autoload/airline/themes/theme_name.vim
"
" The theming algorithm is a 2-pass system where the mode will draw over all
" parts of the statusline, and then the override is applied after. This means
" it is possible to specify a subset of the theme in overrides, as it will
" simply overwrite the previous colors. If you want simultaneous overrides,
" then they will need to change different parts of the statusline so they do
" not conflict with each other.
"
" First, let's define an empty dictionary and assign it to the "palette"
" variable. The # is a separator that maps with the directory structure. If
" you get this wrong, Vim will complain loudly.
" For this, the dark.vim, theme, this is defined as
let g:airline#themes#dark#palette = {}
" First let's define some arrays. The s: is just a VimL thing for scoping the
" variables to the current script. Without this, these variables would be
" declared globally. Now let's declare some colors for normal mode and add it
" to the dictionary. The array is in the format:
" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid
" values for the "opt" value.
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
" Keys in the dictionary are composed of the mode, and if specified the
" override. For example:
" * g:airline#themes#dark#palette.normal
" * the colors for a statusline while in normal mode
" * g:airline#themes#dark#palette.normal_modified
" * the colors for a statusline while in normal mode when the buffer has
" been modified
" * g:airline#themes#dark#palette.visual
" * the colors for a statusline while in visual mode
"
" Values for each dictionary key is an array of color values that should be
" familiar for colorscheme designers:
" * [guifg, guibg, ctermfg, ctermbg, opts]
" See "help attr-list" for valid values for the "opt" value.
"
" Each theme must provide an array of such values for each airline section of
" the statusline (airline_a through airline_z). A convenience function,
" airline#themes#generate_color_map() exists to mirror airline_a/b/c to
" airline_x/y/z, respectively.
" The dark.vim theme:
let s:airline_a_normal = [ '#00005f' , '#dfff00' , '17' , '190' ]
let s:airline_b_normal = [ '#ffffff' , '#444444' , '255' , '238' ]
let s:airline_c_normal = [ '#9cffd3' , '#202020' , '85' , '234' ]
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:airline_a_normal, s:airline_b_normal, s:airline_c_normal)
" It should be noted the above is equivalent to:
" let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(
" \ [ '#00005f' , '#dfff00' , 17 , 190 ], " section airline_a
" \ [ '#ffffff' , '#444444' , 255 , 238 ], " section airline_b
" \ [ '#9cffd3' , '#202020' , 85 , 234 ] " section airline_c
" \)
"
" In turn, that is equivalent to:
" let g:airline#themes#dark#palette.normal = {
" \ 'airline_a': [ '#00005f' , '#dfff00' , 17 , 190 ], "section airline_a
" \ 'airline_b': [ '#ffffff' , '#444444' , 255 , 238 ], "section airline_b
" \ 'airline_c': [ '#9cffd3' , '#202020' , 85 , 234 ], "section airline_c
" \ 'airline_x': [ '#9cffd3' , '#202020' , 85 , 234 ], "section airline_x
" \ 'airline_y': [ '#ffffff' , '#444444' , 255 , 238 ], "section airline_y
" \ 'airline_z': [ '#00005f' , '#dfff00' , 17 , 190 ] "section airline_z
" \}
"
" airline#themes#generate_color_map() also uses the values provided as
" parameters to create intermediary groups such as:
" airline_a_to_airline_b
" airline_b_to_airline_c
" etc...
" Here we define overrides for when the buffer is modified. This will be
" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are
" declared.
let g:airline#themes#dark#palette.normal_modified = {
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ 'airline_c': [ '#ffffff' , '#5f005f' , '255' , '53' , '' ] ,
\ }
let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ]
let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ]
let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ]
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let s:airline_a_insert = [ '#00005f' , '#00dfff' , '17' , '45' ]
let s:airline_b_insert = [ '#ffffff' , '#005fff' , '255' , '27' ]
let s:airline_c_insert = [ '#ffffff' , '#000080' , '15' , '17' ]
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:airline_a_insert, s:airline_b_insert, s:airline_c_insert)
let g:airline#themes#dark#palette.insert_modified = {
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ 'airline_c': [ '#ffffff' , '#5f005f' , '255' , '53' , '' ] ,
\ }
let g:airline#themes#dark#palette.insert_paste = {
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
\ 'airline_a': [ s:airline_a_insert[0] , '#d78700' , s:airline_a_insert[2] , '172' , '' ] ,
\ }
let g:airline#themes#dark#palette.terminal = airline#themes#generate_color_map(s:airline_a_insert, s:airline_b_insert, s:airline_c_insert)
let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert)
let g:airline#themes#dark#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ]
let g:airline#themes#dark#palette.replace.airline_a = [ s:airline_b_insert[0] , '#af0000' , s:airline_b_insert[2] , '124' , '' ]
let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified
let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ]
let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ]
let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ]
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let s:airline_a_visual = [ '#000000' , '#ffaf00' , '232' , '214' ]
let s:airline_b_visual = [ '#000000' , '#ff5f00' , '232' , '202' ]
let s:airline_c_visual = [ '#ffffff' , '#5f0000' , '15' , '52' ]
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:airline_a_visual, s:airline_b_visual, s:airline_c_visual)
let g:airline#themes#dark#palette.visual_modified = {
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ 'airline_c': [ '#ffffff' , '#5f005f' , '255' , '53' , '' ] ,
\ }
let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
let s:airline_a_inactive = [ '#4e4e4e' , '#1c1c1c' , '239' , '234' , '' ]
let s:airline_b_inactive = [ '#4e4e4e' , '#262626' , '239' , '235' , '' ]
let s:airline_c_inactive = [ '#4e4e4e' , '#303030' , '239' , '236' , '' ]
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:airline_a_inactive, s:airline_b_inactive, s:airline_c_inactive)
let g:airline#themes#dark#palette.inactive_modified = {
\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
\ 'airline_c': [ '#875faf' , '' , '97' , '' , '' ] ,
\ }
" For commandline mode, we use the colors from normal mode, except the mode
" indicator should be colored differently, e.g. light green
let s:airline_a_commandline = [ '#0000ff' , '#0cff00' , '17' , '40' ]
let s:airline_b_commandline = [ '#ffffff' , '#444444' , '255' , '238' ]
let s:airline_c_commandline = [ '#9cffd3' , '#202020' , '85' , '234' ]
let g:airline#themes#dark#palette.commandline = airline#themes#generate_color_map(s:airline_a_commandline, s:airline_b_commandline, s:airline_c_commandline)
" Accents are used to give parts within a section a slightly different look or
" color. Here we are defining a "red" accent, which is used by the 'readonly'
@@ -86,18 +147,17 @@ let g:airline#themes#dark#palette.inactive_modified = {
" will be red instead of the section's foreground color. You can also have
" multiple parts with accents within a section.
let g:airline#themes#dark#palette.accents = {
\ 'red': [ '#ff0000' , '' , 160 , '' ]
\ 'red': [ '#ff0000' , '' , '160' , '' ]
\ }
" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp
" variable so that related functionality is loaded iff the user is using
" variable so that related functionality is loaded if the user is using
" ctrlp. Note that this is optional, and if you do not define ctrlp colors
" they will be chosen automatically from the existing palette.
if get(g:, 'loaded_ctrlp', 0)
let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
\ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ],
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])
\ [ '#d7d7ff' , '#5f00af' , '189' , '55' , '' ],
\ [ '#ffffff' , '#875fd7' , '231' , '98' , '' ],
\ [ '#5f00af' , '#ffffff' , '55' , '231' , 'bold' ])
endif

View File

@@ -1,13 +1,32 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2020 Bailey Ling Christian Brabandt et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
call airline#init#bootstrap()
" couple of static variables. Those should not change within a session, thus
" can be initialized here as "static"
let s:spc = g:airline_symbols.space
let s:nomodeline = (v:version > 703 || (v:version == 703 && has("patch438"))) ? '<nomodeline>' : ''
let s:has_strchars = exists('*strchars')
let s:has_strcharpart = exists('*strcharpart')
let s:focusgained_ignore_time = 0
" TODO: Try to cache winwidth(0) function
" e.g. store winwidth per window and access that, only update it, if the size
" actually changed.
function! airline#util#winwidth(...)
let nr = get(a:000, 0, 0)
if get(g:, 'airline_statusline_ontop', 0)
return &columns
else
return winwidth(nr)
endif
endfunction
function! airline#util#shorten(text, winwidth, minwidth, ...)
if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth
if airline#util#winwidth() < a:winwidth && len(split(a:text, '\zs')) > a:minwidth
if get(a:000, 0, 0)
" shorten from tail
return '…'.matchstr(a:text, '.\{'.a:minwidth.'}$')
@@ -21,14 +40,14 @@ function! airline#util#shorten(text, winwidth, minwidth, ...)
endfunction
function! airline#util#wrap(text, minwidth)
if a:minwidth > 0 && winwidth(0) < a:minwidth
if a:minwidth > 0 && airline#util#winwidth() < a:minwidth
return ''
endif
return a:text
endfunction
function! airline#util#append(text, minwidth)
if a:minwidth > 0 && winwidth(0) < a:minwidth
if a:minwidth > 0 && airline#util#winwidth() < a:minwidth
return ''
endif
let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc
@@ -42,12 +61,23 @@ function! airline#util#warning(msg)
endfunction
function! airline#util#prepend(text, minwidth)
if a:minwidth > 0 && winwidth(0) < a:minwidth
if a:minwidth > 0 && airline#util#winwidth() < a:minwidth
return ''
endif
return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc
endfunction
if v:version >= 704
function! airline#util#getbufvar(bufnr, key, def)
return getbufvar(a:bufnr, a:key, a:def)
endfunction
else
function! airline#util#getbufvar(bufnr, key, def)
let bufvals = getbufvar(a:bufnr, '')
return get(bufvals, a:key, a:def)
endfunction
endif
if v:version >= 704
function! airline#util#getwinvar(winnr, key, def)
return getwinvar(a:winnr, a:key, a:def)
@@ -84,30 +114,99 @@ else
endfunction
endif
" Define a wrapper over system() that uses nvim's async job control if
" available. This way we avoid overwriting v:shell_error, which might
" potentially disrupt other plugins.
if has('nvim')
function! s:system_job_handler(job_id, data, event) dict
if a:event == 'stdout'
let self.buf .= join(a:data)
endif
endfunction
" Compatibility wrapper for strchars, in case this vim version does not
" have it natively
function! airline#util#strchars(str)
if s:has_strchars
return strchars(a:str)
else
return strlen(substitute(a:str, '.', 'a', 'g'))
endif
endfunction
function! airline#util#strcharpart(...)
if s:has_strcharpart
return call('strcharpart', a:000)
else
" does not handle multibyte chars :(
return a:1[(a:2):(a:3)]
endif
endfunction
function! airline#util#ignore_buf(name)
let pat = '\c\v'. get(g:, 'airline#ignore_bufadd_pat', '').
\ get(g:, 'airline#extensions#tabline#ignore_bufadd_pat',
\ '!|defx|gundo|nerd_tree|startify|tagbar|term://|undotree|vimfiler')
return match(a:name, pat) > -1
endfunction
function! airline#util#has_fugitive()
if !exists("s:has_fugitive")
let s:has_fugitive = exists('*fugitive#head') || exists('*FugitiveHead')
endif
return s:has_fugitive
endfunction
function! airline#util#has_gina()
if !exists("s:has_gina")
let s:has_gina = (exists(':Gina') && v:version >= 800)
endif
return s:has_gina
endfunction
function! airline#util#has_lawrencium()
if !exists("s:has_lawrencium")
let s:has_lawrencium = exists('*lawrencium#statusline')
endif
return s:has_lawrencium
endfunction
function! airline#util#has_vcscommand()
if !exists("s:has_vcscommand")
let s:has_vcscommand = exists('*VCSCommandGetStatusLine')
endif
return get(g:, 'airline#extensions#branch#use_vcscommand', 0) && s:has_vcscommand
endfunction
function! airline#util#has_custom_scm()
return !empty(get(g:, 'airline#extensions#branch#custom_head', ''))
endfunction
function! airline#util#doautocmd(event)
exe printf("silent doautocmd %s User %s", s:nomodeline, a:event)
endfunction
function! airline#util#themes(match)
let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:match.'*.vim'), "\n")
return sort(map(files, 'fnamemodify(v:val, ":t:r")') + ('random' =~ a:match ? ['random'] : []))
endfunction
function! airline#util#stl_disabled(winnr)
" setting the statusline is disabled,
" either globally, per window, or per buffer
" w:airline_disabled is deprecated!
return get(g:, 'airline_disable_statusline', 0) ||
\ airline#util#getwinvar(a:winnr, 'airline_disable_statusline', 0) ||
\ airline#util#getwinvar(a:winnr, 'airline_disabled', 0) ||
\ airline#util#getbufvar(winbufnr(a:winnr), 'airline_disable_statusline', 0)
endfunction
function! airline#util#ignore_next_focusgain()
if has('win32')
" Setup an ignore for platforms that trigger FocusLost on calls to
" system(). macvim (gui and terminal) and Linux terminal vim do not.
let s:focusgained_ignore_time = localtime()
endif
endfunction
function! airline#util#try_focusgained()
" Ignore lasts for at most one second and is cleared on the first
" focusgained. We use ignore to prevent system() calls from triggering
" FocusGained (which occurs 100% on win32 and seem to sometimes occur under
" tmux).
let dt = localtime() - s:focusgained_ignore_time
let s:focusgained_ignore_time = 0
return dt >= 1
endfunction
function! airline#util#system(cmd)
let l:config = {
\ 'buf': '',
\ 'on_stdout': function('s:system_job_handler'),
\ }
let l:id = jobstart(a:cmd, l:config)
if l:id < 1
return system(a:cmd)
endif
call jobwait([l:id])
return l:config.buf
endfunction
else
function! airline#util#system(cmd)
return system(a:cmd)
endfunction
endif

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More