mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-12-07 12:44:26 +08:00
Compare commits
420 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad716f1df4 | ||
|
|
664426be21 | ||
|
|
5b9cbc1a57 | ||
|
|
a66f7ae13e | ||
|
|
073d760689 | ||
|
|
f2241b61b2 | ||
|
|
15c540dc94 | ||
|
|
d17fcbf72f | ||
|
|
98b95e6399 | ||
|
|
a0e9b383c6 | ||
|
|
62ec219601 | ||
|
|
6eda2735aa | ||
|
|
0cba7d3ed6 | ||
|
|
3736132370 | ||
|
|
390908dead | ||
|
|
6d665580a3 | ||
|
|
297ca3d004 | ||
|
|
4f0d2ebbb5 | ||
|
|
62f2dc02f0 | ||
|
|
92c0a90b64 | ||
|
|
262fdc20d5 | ||
|
|
0b537b3065 | ||
|
|
89d1d43165 | ||
|
|
f4f9a8a241 | ||
|
|
63d8764f9d | ||
|
|
6409c7b317 | ||
|
|
22f54d8528 | ||
|
|
018688a90f | ||
|
|
d848de4918 | ||
|
|
57fb980df7 | ||
|
|
5df9e23f14 | ||
|
|
0370a3b89b | ||
|
|
51e74f1d1f | ||
|
|
ccef93e887 | ||
|
|
15322e41c7 | ||
|
|
486b68cb08 | ||
|
|
af96e9745f | ||
|
|
3f82d3a975 | ||
|
|
0f375addd2 | ||
|
|
a40184536b | ||
|
|
67a97c1ea0 | ||
|
|
c213f2ac44 | ||
|
|
770d57a01d | ||
|
|
3f7222e488 | ||
|
|
28dcb68bf3 | ||
|
|
28cd6253e9 | ||
|
|
2db9b27e39 | ||
|
|
71c80aaf54 | ||
|
|
63a75aca2a | ||
|
|
73b4e4233c | ||
|
|
28453d7038 | ||
|
|
826561daf3 | ||
|
|
48d9d5e901 | ||
|
|
7d5302b51f | ||
|
|
3921bc13a3 | ||
|
|
c7b8a56b22 | ||
|
|
a0c9198fa2 | ||
|
|
4a1ac56286 | ||
|
|
b19dc8fc65 | ||
|
|
b3ecf49f86 | ||
|
|
193e350440 | ||
|
|
3abbfabf55 | ||
|
|
f07889c266 | ||
|
|
7b20361baf | ||
|
|
03f63eb666 | ||
|
|
9a1acf144f | ||
|
|
79f91649b6 | ||
|
|
1b41629214 | ||
|
|
ea7f5d5313 | ||
|
|
cd2884abf1 | ||
|
|
715274c3f9 | ||
|
|
f1529ce051 | ||
|
|
a26a460698 | ||
|
|
cc8f47e248 | ||
|
|
2db882e9b8 | ||
|
|
8169aa25af | ||
|
|
7469672a46 | ||
|
|
170b6d4c26 | ||
|
|
d1e82c71a3 | ||
|
|
28ed36a9ec | ||
|
|
1fedd3a2b7 | ||
|
|
538326ceac | ||
|
|
d4f645777e | ||
|
|
a753422549 | ||
|
|
fdd75df927 | ||
|
|
6b213e1071 | ||
|
|
9c1486522a | ||
|
|
11cd15d218 | ||
|
|
1297773a26 | ||
|
|
a8b0c5f760 | ||
|
|
ffd8c406ab | ||
|
|
9f193de600 | ||
|
|
28bebd35ea | ||
|
|
3ac318bfd3 | ||
|
|
9112675ad8 | ||
|
|
a8c96d7c07 | ||
|
|
941341d085 | ||
|
|
ead2cd63bb | ||
|
|
704e58e1b7 | ||
|
|
6acb234a12 | ||
|
|
d1d9548b8e | ||
|
|
773f0e3637 | ||
|
|
0f1aec97da | ||
|
|
ebb8f0c2b1 | ||
|
|
cbf264ff5f | ||
|
|
979e04a6ec | ||
|
|
86e73cade7 | ||
|
|
4265798d4b | ||
|
|
148eb6bb28 | ||
|
|
a6fb6d9da0 | ||
|
|
1fb184305b | ||
|
|
c8a36e14e9 | ||
|
|
45205aa4a3 | ||
|
|
b84e548522 | ||
|
|
6ab14bf474 | ||
|
|
1c3ae6077a | ||
|
|
eb0ddf61dc | ||
|
|
395fccfda7 | ||
|
|
b69aa396c1 | ||
|
|
61ca196d73 | ||
|
|
5f769dbed9 | ||
|
|
45ff435378 | ||
|
|
448aa43ec4 | ||
|
|
cc7b3c1636 | ||
|
|
1471330825 | ||
|
|
05572482b8 | ||
|
|
cd1d8c2a96 | ||
|
|
624d2f1438 | ||
|
|
767c1efd10 | ||
|
|
999c40fcf3 | ||
|
|
105e9daaf7 | ||
|
|
4078688305 | ||
|
|
96d42317b1 | ||
|
|
23a8a7e04d | ||
|
|
25e384f236 | ||
|
|
8867301f78 | ||
|
|
840bf02baf | ||
|
|
fd5bde1a3a | ||
|
|
58bbc512f9 | ||
|
|
1d03b9dc62 | ||
|
|
916d023c35 | ||
|
|
0a1f4cc910 | ||
|
|
5415c5e6ec | ||
|
|
a30df884f4 | ||
|
|
54584a2bb2 | ||
|
|
dc7d991007 | ||
|
|
d372b5bc46 | ||
|
|
98bc6abde3 | ||
|
|
9355e683cd | ||
|
|
54dba2a92b | ||
|
|
a829ec4861 | ||
|
|
d3859dc5dd | ||
|
|
57c061dcb0 | ||
|
|
6601474bf5 | ||
|
|
e0bde5dea4 | ||
|
|
53aa65a5ce | ||
|
|
fa5910eb14 | ||
|
|
d68c9bbeb2 | ||
|
|
70b86537bd | ||
|
|
2d3bbbff43 | ||
|
|
6fd5b6ae56 | ||
|
|
4604f6d465 | ||
|
|
72888d87ea | ||
|
|
56197d5104 | ||
|
|
c0f96df97f | ||
|
|
39ac0a93e5 | ||
|
|
e3cfd3643b | ||
|
|
3d9071e6b6 | ||
|
|
bd468dacfe | ||
|
|
c047abfe96 | ||
|
|
bc63a60b0f | ||
|
|
f9ccb57e76 | ||
|
|
31f5a9307d | ||
|
|
fa11b8855b | ||
|
|
904ac4eb0b | ||
|
|
ada0ba8ae3 | ||
|
|
426c8bb8ef | ||
|
|
df0c1731db | ||
|
|
f6a95d3a6f | ||
|
|
ffac12cbbe | ||
|
|
b2e1dbad6f | ||
|
|
b3a574b4a3 | ||
|
|
7f6dfbefd1 | ||
|
|
5b1c92979c | ||
|
|
9dc546c699 | ||
|
|
14691bb00e | ||
|
|
b20e181bc8 | ||
|
|
49671d0a11 | ||
|
|
cd0b15b195 | ||
|
|
c3ee263d5b | ||
|
|
2eaf57ece8 | ||
|
|
c850f485ad | ||
|
|
464633baad | ||
|
|
d441b3f7b6 | ||
|
|
f05f649be8 | ||
|
|
cfd373a5a2 | ||
|
|
6ceaffc49a | ||
|
|
78e67897a4 | ||
|
|
e66d65ebf4 | ||
|
|
4d8a06a5a9 | ||
|
|
6c6c6c104f | ||
|
|
f3d6a3542a | ||
|
|
e8fd2057a8 | ||
|
|
8c36d2b595 | ||
|
|
a993ae5d42 | ||
|
|
f08078d683 | ||
|
|
99971aa24d | ||
|
|
d57344a3c3 | ||
|
|
496de8b745 | ||
|
|
71dc6f0257 | ||
|
|
09b5eb952c | ||
|
|
a334a89e59 | ||
|
|
ce6cf6f07e | ||
|
|
b7367c605a | ||
|
|
18200bfad3 | ||
|
|
33a633766d | ||
|
|
776f7aa948 | ||
|
|
62f3d1d412 | ||
|
|
6516b1b4dc | ||
|
|
fc021cf4e8 | ||
|
|
6508558c3d | ||
|
|
08e9aa5386 | ||
|
|
0609a1f945 | ||
|
|
2e99805dbf | ||
|
|
726b730f0a | ||
|
|
7e004804d1 | ||
|
|
d81cdacb1e | ||
|
|
c44bbc66f5 | ||
|
|
61e2c7f86a | ||
|
|
4d825bdb64 | ||
|
|
07ac69570b | ||
|
|
68f5f1e50d | ||
|
|
3f34ff56b8 | ||
|
|
f045452743 | ||
|
|
13993d120e | ||
|
|
7190164451 | ||
|
|
a0298263b7 | ||
|
|
2390022e33 | ||
|
|
57bbe050c7 | ||
|
|
dd508340ea | ||
|
|
2f17e368b5 | ||
|
|
0f6cfcdfc2 | ||
|
|
264c1fefd2 | ||
|
|
ae024293e4 | ||
|
|
ecf10d0e58 | ||
|
|
11e6492849 | ||
|
|
dcf76b0992 | ||
|
|
82a6097b01 | ||
|
|
7957bd1d32 | ||
|
|
110594c91a | ||
|
|
012229fe08 | ||
|
|
a60eabb82f | ||
|
|
fce8585239 | ||
|
|
326b37cf13 | ||
|
|
1b8ecb6336 | ||
|
|
0756b9a4aa | ||
|
|
251ed064e8 | ||
|
|
c33c1de079 | ||
|
|
9903fee60e | ||
|
|
487d262901 | ||
|
|
a1c112cafd | ||
|
|
bcd37fc115 | ||
|
|
aec0a1a15a | ||
|
|
da8035d8a8 | ||
|
|
cda5647a29 | ||
|
|
f5676d1fa1 | ||
|
|
a92b12e1c6 | ||
|
|
d342c3cb1e | ||
|
|
c3434164b2 | ||
|
|
8715d13cc5 | ||
|
|
44da0a4761 | ||
|
|
c7fb175d35 | ||
|
|
59f3669a42 | ||
|
|
60eb44c94e | ||
|
|
723987eca9 | ||
|
|
964f53a418 | ||
|
|
a8ccef61ba | ||
|
|
4cc255a384 | ||
|
|
eac10a104f | ||
|
|
5aef1b90e5 | ||
|
|
821372b9cf | ||
|
|
db45cdd994 | ||
|
|
781c40bb3d | ||
|
|
9bee0e923e | ||
|
|
66e49d9a15 | ||
|
|
b790fd2120 | ||
|
|
c3a814dbae | ||
|
|
a141918faa | ||
|
|
11bc0ba843 | ||
|
|
45c9621157 | ||
|
|
feca81fb86 | ||
|
|
4f95970228 | ||
|
|
7d871137be | ||
|
|
6a05b92716 | ||
|
|
55716a1cc2 | ||
|
|
acb93da0d8 | ||
|
|
add75907d5 | ||
|
|
eab6d35852 | ||
|
|
1bb1ce594a | ||
|
|
044a90ed55 | ||
|
|
981b83003f | ||
|
|
a1680cc36d | ||
|
|
30a3c4f549 | ||
|
|
c7d4710f76 | ||
|
|
6e1e6686e7 | ||
|
|
a6e07b6a55 | ||
|
|
4db6d11962 | ||
|
|
ac799f6021 | ||
|
|
92bf1b0b39 | ||
|
|
08570b6dcb | ||
|
|
64e925d675 | ||
|
|
315cf0deec | ||
|
|
0f91e21710 | ||
|
|
02ffdfe0e5 | ||
|
|
a280ea4a18 | ||
|
|
a7b84f5b67 | ||
|
|
b84e13f1d7 | ||
|
|
c7e05efb76 | ||
|
|
5a065e8b82 | ||
|
|
15bc732df4 | ||
|
|
33310c5b24 | ||
|
|
c4a4a20b8d | ||
|
|
3ad4a18d85 | ||
|
|
a76f523be5 | ||
|
|
f7c818a0ff | ||
|
|
d9acbc53b0 | ||
|
|
0df2c9b12e | ||
|
|
00f718691a | ||
|
|
d66b507b02 | ||
|
|
8209ca7da1 | ||
|
|
902921931e | ||
|
|
ae394294c3 | ||
|
|
bf3cc5ad9d | ||
|
|
47bdae9067 | ||
|
|
2876715b56 | ||
|
|
023fe122c5 | ||
|
|
fbf96559c9 | ||
|
|
2ba64a88fd | ||
|
|
f0b969549a | ||
|
|
47c36d2819 | ||
|
|
aee733aa87 | ||
|
|
c75106f12d | ||
|
|
4b1913ad13 | ||
|
|
df2f380c9e | ||
|
|
b9f55455fb | ||
|
|
d2ac3d5755 | ||
|
|
e72a7e2c8d | ||
|
|
2528de7d81 | ||
|
|
7396dc7a10 | ||
|
|
51bb8dd7e0 | ||
|
|
5b7b9cf656 | ||
|
|
0b47adf087 | ||
|
|
3914d5b475 | ||
|
|
ecff00a559 | ||
|
|
18f93ac96b | ||
|
|
75f53ef6e5 | ||
|
|
a2e0ed982f | ||
|
|
84bf60c405 | ||
|
|
896c14bded | ||
|
|
700c9b9740 | ||
|
|
724beb0c73 | ||
|
|
fb85c0a91a | ||
|
|
d13305fc5d | ||
|
|
7844d8bf72 | ||
|
|
4a342afb90 | ||
|
|
275ec4fe63 | ||
|
|
d9e68039b8 | ||
|
|
3cd8daa162 | ||
|
|
e6b6f36d90 | ||
|
|
a7bff3b30b | ||
|
|
5ecc25d6d6 | ||
|
|
6db0af6f8d | ||
|
|
9b41fe5de9 | ||
|
|
1328610188 | ||
|
|
ada8cd7641 | ||
|
|
349d01ba39 | ||
|
|
3f87d28abb | ||
|
|
71814fb19f | ||
|
|
b99da65412 | ||
|
|
6286b6d8d8 | ||
|
|
5907d3909e | ||
|
|
57f2619c67 | ||
|
|
1837b2ee39 | ||
|
|
d3ec54d42e | ||
|
|
2b0fe51f99 | ||
|
|
a8f92cc68a | ||
|
|
4237bfb052 | ||
|
|
88dedb586a | ||
|
|
5d2d764368 | ||
|
|
6819443d6a | ||
|
|
980e78b4bf | ||
|
|
7480245ebf | ||
|
|
f93894f6ac | ||
|
|
e1a4cd764f | ||
|
|
d29c7b27fa | ||
|
|
3305410982 | ||
|
|
e0791cc1a0 | ||
|
|
7a286639c5 | ||
|
|
2711c73a47 | ||
|
|
cf47d63f71 | ||
|
|
abd310bb31 | ||
|
|
f60cf736db | ||
|
|
26aa528c42 | ||
|
|
958f78335e | ||
|
|
167602d5b9 | ||
|
|
78c4438469 | ||
|
|
9912ce13a4 | ||
|
|
63111e9810 | ||
|
|
2e2a66c5a0 | ||
|
|
3ebbc57725 | ||
|
|
55a9721c22 | ||
|
|
7f1cfb0c3f | ||
|
|
85696f28a9 | ||
|
|
e4968d7a40 | ||
|
|
8c634887bf | ||
|
|
c2ffb8b3ec | ||
|
|
eb58badee2 | ||
|
|
8c1a7a5343 | ||
|
|
dec9b8e65c | ||
|
|
e5a51f9fca |
@@ -3,6 +3,6 @@ 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
|
||||
#rvm:
|
||||
# - 1.9.3
|
||||
script: rake ci
|
||||
|
||||
64
CHANGELOG.md
64
CHANGELOG.md
@@ -2,7 +2,65 @@
|
||||
|
||||
This is the Changelog for the vim-airline project.
|
||||
|
||||
## [Unreleased]
|
||||
## [0.12] - Unreleased
|
||||
|
||||
## [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
|
||||
@@ -153,7 +211,9 @@ 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.9...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...v.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
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2013-2016 Bailey Ling
|
||||
Copyright (C) 2013-2019 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"),
|
||||
|
||||
32
README.md
32
README.md
@@ -1,4 +1,4 @@
|
||||
# vim-airline [](https://travis-ci.org/vim-airline/vim-airline)
|
||||
# vim-airline [](https://travis-ci.org/vim-airline/vim-airline)[](https://saythanks.io/to/chrisbra)
|
||||
|
||||
Lean & mean status/tabline for vim that's light as air.
|
||||
|
||||
@@ -182,6 +182,12 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
|
||||
#### [vimtex][53]
|
||||

|
||||
|
||||
#### [localsearch][54]
|
||||

|
||||
|
||||
#### [LanguageClient][57]
|
||||

|
||||
|
||||
## Extras
|
||||
|
||||
vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also:
|
||||
@@ -189,6 +195,13 @@ vim-airline also supplies some supplementary stand-alone extensions. In additio
|
||||
#### whitespace
|
||||

|
||||
|
||||
### statusline on top
|
||||
The statusline can alternatively by 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.
|
||||
|
||||

|
||||
|
||||
## Configurable and extensible
|
||||
|
||||
#### Fine-tuned configuration
|
||||
@@ -233,7 +246,7 @@ 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` to generate help tags |
|
||||
| manual | copy all of the files into your `~/.vim` directory |
|
||||
|
||||
@@ -263,9 +276,9 @@ The [minivimrc][7] project has some helper mappings to troubleshoot performance
|
||||
|
||||
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 hunderet percent correct all the times (especially if you often change highlighting groups yourself using `:hi` commands). To set this up do `:let g:airline_highlighting_cache = 1`. A `:AirlineRefresh` will however clear the cache.
|
||||
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][55], which does not change highlighting groups once they are defined. Also please check the [FAQ][27] for more information on how to diagnose and fix the problem.
|
||||
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
|
||||
|
||||
@@ -279,7 +292,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-2019 Bailey Ling & Contributors.
|
||||
|
||||
[1]: https://github.com/Lokaltog/vim-powerline
|
||||
[2]: https://github.com/Lokaltog/powerline
|
||||
@@ -318,7 +331,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
|
||||
@@ -334,5 +347,8 @@ 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/
|
||||
[55]: https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/dark_minimal.vim
|
||||
[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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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)
|
||||
@@ -52,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(tolower(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
|
||||
@@ -99,66 +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)
|
||||
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#getwinvar(winnr(), 'airline_disabled', 0)
|
||||
return
|
||||
endif
|
||||
for nr in a:range
|
||||
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) }
|
||||
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 !has_key(s:contexts, a:winnr)
|
||||
return ''
|
||||
endif
|
||||
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 = ['normal']
|
||||
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']
|
||||
@@ -189,8 +263,23 @@ function! airline#check_mode(winnr)
|
||||
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#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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 C.Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -6,6 +6,7 @@ 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)
|
||||
@@ -37,7 +38,7 @@ endfunction
|
||||
|
||||
function! s:po_output(buf, file)
|
||||
if !empty(a:buf)
|
||||
let b:airline_po_stats = printf("[%s]", a:buf)
|
||||
let b:airline_po_stats = printf("%s", a:buf)
|
||||
else
|
||||
let b:airline_po_stats = ''
|
||||
endif
|
||||
@@ -53,6 +54,57 @@ function! s:valid_dir(dir)
|
||||
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
|
||||
@@ -123,7 +175,33 @@ if v:version >= 800 && has("job")
|
||||
let s:po_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
function airline#async#vim_vcs_untracked(config, file)
|
||||
function! airline#async#vim_vcs_clean(cmd, file, vcs)
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
let cmd = a:cmd
|
||||
else
|
||||
let cmd = ['sh', '-c', 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'
|
||||
let cmd = a:config['cmd'] . shellescape(a:file)
|
||||
else
|
||||
@@ -221,6 +299,34 @@ elseif has("nvim")
|
||||
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'
|
||||
let cmd = a:cmd
|
||||
else
|
||||
let cmd = ['sh', '-c', 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
|
||||
@@ -242,7 +348,12 @@ function! airline#async#nvim_vcs_untracked(cfg, file, vcs)
|
||||
" 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
|
||||
@@ -252,3 +363,15 @@ function! airline#async#nvim_vcs_untracked(cfg, file, vcs)
|
||||
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'
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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,7 +73,7 @@ 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)
|
||||
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')
|
||||
@@ -102,7 +127,7 @@ 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
|
||||
@@ -117,7 +142,6 @@ 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)
|
||||
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.'#'
|
||||
@@ -132,7 +156,7 @@ function! s:get_transitioned_seperator(self, prev_group, group, side)
|
||||
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
|
||||
@@ -141,6 +165,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
|
||||
@@ -150,6 +175,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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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,26 @@ endfunction
|
||||
let s:script_path = tolower(resolve(expand('<sfile>:p:h')))
|
||||
|
||||
let s:filetype_overrides = {
|
||||
\ 'nerdtree': [ 'NERD', '' ],
|
||||
\ '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', '' ],
|
||||
\ 'nerdtree': [ get(g:, 'NERDTreeStatusline', 'NERD'), '' ],
|
||||
\ 'startify': [ 'startify', '' ],
|
||||
\ 'vim-plug': [ 'Plugins', '' ],
|
||||
\ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ],
|
||||
\ 'vimshell': ['vimshell','%{vimshell#get_status_string()}'],
|
||||
\ }
|
||||
|
||||
if exists(':Gina') && (v:version > 704 || (v:version == 704 && has("patch1898")))
|
||||
" Gina needs the Vim 7.4.1898, which introduce the <mods> flag for custom commands
|
||||
let s:filetype_overrides['gina-status'] = ['gina', '%{gina#component#repo#preset()}' ]
|
||||
let s:filetype_overrides['diff'] = ['gina', '%{gina#component#repo#preset()}' ]
|
||||
let s:filetype_overrides['gina-log'] = ['gina', '%{gina#component#repo#preset()}' ]
|
||||
let s:filetype_overrides['gina-tag'] = ['gina', '%{gina#component#repo#preset()}' ]
|
||||
endif
|
||||
|
||||
let s:filetype_regex_overrides = {}
|
||||
|
||||
function! s:check_defined_section(name)
|
||||
@@ -56,19 +69,17 @@ 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
|
||||
@@ -77,11 +88,20 @@ function! airline#extensions#apply(...)
|
||||
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 +133,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
|
||||
@@ -136,31 +148,32 @@ function! airline#extensions#load()
|
||||
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)
|
||||
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)
|
||||
call airline#extensions#denite#init(s:ext)
|
||||
call add(loaded_ext, 'denite')
|
||||
call add(s:loaded_ext, 'denite')
|
||||
endif
|
||||
|
||||
if exists(':NetrwSettings')
|
||||
call airline#extensions#netrw#init(s:ext)
|
||||
call add(loaded_ext, 'netrw')
|
||||
call add(s:loaded_ext, 'netrw')
|
||||
endif
|
||||
|
||||
if has("terminal")
|
||||
if (has("terminal") || has('nvim')) &&
|
||||
\ get(g:, 'airline#extensions#term#enabled', 1)
|
||||
call airline#extensions#term#init(s:ext)
|
||||
call add(loaded_ext, 'term')
|
||||
call add(s:loaded_ext, 'term')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#ycm#enabled', 0)
|
||||
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)
|
||||
@@ -169,172 +182,212 @@ 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'))
|
||||
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)
|
||||
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 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_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#fugitiveline#enabled', 1)
|
||||
\ && exists('*fugitive#head')
|
||||
\ && airline#util#has_fugitive()
|
||||
\ && index(s:loaded_ext, 'bufferline') == -1
|
||||
call airline#extensions#fugitiveline#init(s:ext)
|
||||
call add(loaded_ext, 'fugitiveline')
|
||||
call add(s:loaded_ext, 'fugitiveline')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV)))
|
||||
call airline#extensions#virtualenv#init(s:ext)
|
||||
call add(loaded_ext, 'virtualenv')
|
||||
call add(s:loaded_ext, 'virtualenv')
|
||||
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#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
|
||||
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#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(loaded_ext, 'keymap')
|
||||
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(loaded_ext, 'cursormode')
|
||||
call add(s:loaded_ext, 'cursormode')
|
||||
endif
|
||||
|
||||
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
|
||||
@@ -347,14 +400,20 @@ 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
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#get_loaded_extensions()
|
||||
return s:loaded_ext
|
||||
endfunction
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bjorn Neergaard, w0rp et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bjorn Neergaard, w0rp et al.
|
||||
" Plugin: https://github.com/dense-analysis/ale
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:')
|
||||
|
||||
function! s:airline_ale_count(cnt, symbol)
|
||||
return a:cnt ? a:symbol. a:cnt : ''
|
||||
endfunction
|
||||
|
||||
function! s:airline_ale_get_line_number(cnt, type) abort
|
||||
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
|
||||
@@ -31,18 +33,62 @@ function! s:airline_ale_get_line_number(cnt, type) abort
|
||||
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 is_err = a:type ==# 'error'
|
||||
let symbol = 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)
|
||||
|
||||
let is_err = a:type ==# 'error'
|
||||
|
||||
if ale#engine#IsCheckingBuffer(bufnr('')) == 1
|
||||
return is_err ? '' : checking_symbol
|
||||
endif
|
||||
|
||||
let symbol = is_err ? error_symbol : warning_symbol
|
||||
|
||||
let counts = ale#statusline#Count(bufnr(''))
|
||||
let symbol = is_err ? s:error_symbol : s:warning_symbol
|
||||
|
||||
if type(counts) == type({}) && has_key(counts, 'error')
|
||||
" Use the current Dictionary format.
|
||||
let errors = counts.error + counts.style_error
|
||||
@@ -52,7 +98,11 @@ function! airline#extensions#ale#get(type)
|
||||
let num = is_err ? counts[0] : counts[1]
|
||||
endif
|
||||
|
||||
return s:airline_ale_count(num, symbol) . <sid>airline_ale_get_line_number(num, a:type)
|
||||
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
|
||||
|
||||
function! airline#extensions#ale#get_warning()
|
||||
@@ -69,11 +119,12 @@ function! airline#extensions#ale#init(ext)
|
||||
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'
|
||||
exe ':AirlineRefresh!'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
30
autoload/airline/extensions/bookmark.vim
Normal file
30
autoload/airline/extensions/bookmark.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
" MIT License. Copyright (c) 2019 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()
|
||||
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)
|
||||
call airline#parts#define_function('bookmark', 'airline#extensions#bookmark#currentbookmark')
|
||||
endfunction
|
||||
@@ -1,16 +1,9 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: fugitive, 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
|
||||
|
||||
" 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
|
||||
@@ -25,6 +18,7 @@ let s:vcs_config = {
|
||||
\ 'git': {
|
||||
\ 'exe': 'git',
|
||||
\ 'cmd': 'git status --porcelain -- ',
|
||||
\ 'dirty': 'git status -uno --porcelain --ignore-submodules',
|
||||
\ 'untracked_mark': '??',
|
||||
\ 'exclude': '\.git',
|
||||
\ 'update_branch': 's:update_git_branch',
|
||||
@@ -35,6 +29,7 @@ let s:vcs_config = {
|
||||
\ 'mercurial': {
|
||||
\ 'exe': 'hg',
|
||||
\ 'cmd': 'hg status -u -- ',
|
||||
\ 'dirty': 'hg status -mard',
|
||||
\ 'untracked_mark': '?',
|
||||
\ 'exclude': '\.hg',
|
||||
\ 'update_branch': 's:update_hg_branch',
|
||||
@@ -59,6 +54,7 @@ function! s:init_buffer()
|
||||
let b:buffer_vcs_config[vcs] = {
|
||||
\ 'branch': '',
|
||||
\ 'untracked': '',
|
||||
\ 'dirty': 0,
|
||||
\ }
|
||||
endfor
|
||||
unlet! b:airline_head
|
||||
@@ -89,13 +85,15 @@ let s:names = {'0': 'index', '1': 'orig', '2':'fetch', '3':'merge'}
|
||||
let s:sha1size = get(g:, 'airline#extensions#branch#sha1_len', 7)
|
||||
|
||||
function! s:update_git_branch()
|
||||
if !s:has_fugitive
|
||||
if !airline#util#has_fugitive()
|
||||
let s:vcs_config['git'].branch = ''
|
||||
return
|
||||
endif
|
||||
|
||||
let s:vcs_config['git'].branch = fugitive#head(s:sha1size)
|
||||
if s:vcs_config['git'].branch is# 'master' && winwidth(0) < 81
|
||||
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
|
||||
@@ -104,7 +102,7 @@ endfunction
|
||||
function! s:display_git_branch()
|
||||
let name = b:buffer_vcs_config['git'].branch
|
||||
try
|
||||
let commit = fugitive#buffer().commit()
|
||||
let commit = matchstr(FugitiveParse()[0], '^\x\+')
|
||||
|
||||
if has_key(s:names, commit)
|
||||
let name = get(s:names, commit)."(".name.")"
|
||||
@@ -113,7 +111,7 @@ function! s:display_git_branch()
|
||||
if ref !~ "^fatal: no tag exactly matches"
|
||||
let name = s:format_name(substitute(ref, '\v\C^%(heads/|remotes/|tags/)=','',''))."(".name.")"
|
||||
else
|
||||
let name = commit[0:s:sha1size-1]."(".name.")"
|
||||
let name = matchstr(commit, '.\{'.s:sha1size.'}')."(".name.")"
|
||||
endif
|
||||
endif
|
||||
catch
|
||||
@@ -123,19 +121,19 @@ function! s:display_git_branch()
|
||||
endfunction
|
||||
|
||||
function! s:update_hg_branch()
|
||||
if s:has_lawrencium
|
||||
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
|
||||
call airline#async#get_mq_async(cmd, file)
|
||||
noa call airline#async#get_mq_async(cmd, file)
|
||||
elseif has("nvim")
|
||||
call airline#async#nvim_get_mq_async(cmd, file)
|
||||
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]
|
||||
call airline#async#mq_output(output, file)
|
||||
noa call airline#async#mq_output(output, file)
|
||||
endif
|
||||
endif
|
||||
" do not do mq check anymore
|
||||
@@ -178,11 +176,12 @@ endfunction
|
||||
|
||||
function! s:update_untracked()
|
||||
let file = expand("%:p")
|
||||
if empty(file) || isdirectory(file)
|
||||
if empty(file) || isdirectory(file) || !empty(&buftype)
|
||||
return
|
||||
endif
|
||||
|
||||
let needs_update = 1
|
||||
let vcs_checks = get(g:, "airline#extensions#branch#vcs_checks", ["untracked", "dirty"])
|
||||
for vcs in keys(s:vcs_config)
|
||||
if file =~ s:vcs_config[vcs].exclude
|
||||
" Skip check for files that live in the exclude directory
|
||||
@@ -199,17 +198,25 @@ function! s:update_untracked()
|
||||
endif
|
||||
|
||||
for vcs in keys(s:vcs_config)
|
||||
" 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()
|
||||
continue
|
||||
elseif vcs is# 'mercurial' && !airline#util#has_lawrencium()
|
||||
continue
|
||||
endif
|
||||
let config = s:vcs_config[vcs]
|
||||
if g:airline#init#vim_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 airline#async#vim_vcs_untracked(config, file)
|
||||
else
|
||||
" nvim async or vim without job-feature
|
||||
call airline#async#nvim_vcs_untracked(config, file, 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
|
||||
@@ -244,36 +251,53 @@ function! airline#extensions#branch#head()
|
||||
let b:airline_head .= s:vcs_config[vcs].exe .':'
|
||||
endif
|
||||
let b:airline_head .= s:format_name({s:vcs_config[vcs].display_branch}())
|
||||
let b:airline_head .= b:buffer_vcs_config[vcs].untracked
|
||||
let 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(heads)
|
||||
if s:has_vcscommand
|
||||
call VCSCommandEnableBufferSetup()
|
||||
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 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
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2019 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/tpope/vim-capslock
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
48
autoload/airline/extensions/coc.vim
Normal file
48
autoload/airline/extensions/coc.vim
Normal file
@@ -0,0 +1,48 @@
|
||||
" MIT License. Copyright (c) 2019 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()
|
||||
return airline#extensions#coc#get('warning')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#coc#get_error()
|
||||
return airline#extensions#coc#get('error')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#coc#get(type)
|
||||
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#init(ext)
|
||||
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')
|
||||
endfunction
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/wincent/command-t
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/chrisbra/csv.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/ctrlpvim/ctrlp.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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
|
||||
let s:cs = ctrlspace#context#Configuration().Symbols.CS
|
||||
|
||||
function! airline#extensions#ctrlspace#statusline(...)
|
||||
let spc = g:airline_symbols.space
|
||||
let padding = spc . spc . spc
|
||||
let cs = ctrlspace#context#Configuration().Symbols.CS
|
||||
|
||||
let b = airline#builder#new({ 'active': 1 })
|
||||
call b.add_section('airline_b', s:cs . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding))
|
||||
call b.add_section('airline_b', cs . padding . ctrlspace#api#StatuslineModeSegment(s: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
|
||||
|
||||
|
||||
@@ -1,23 +1,7 @@
|
||||
" Copyright (C) 2014 Andrea Cedraro <a.cedraro@gmail.com>
|
||||
" 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>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the "Software"),
|
||||
" to deal in the Software without restriction, including without limitation
|
||||
" the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
" and/or sell copies of the Software, and to permit persons to whom the
|
||||
" Software is furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
" OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -40,8 +24,12 @@ 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 = mode()
|
||||
let mode = s:get_mode()
|
||||
if mode !=# s:last_mode
|
||||
let s:last_mode = mode
|
||||
call s:set_cursor_color_for(mode)
|
||||
@@ -107,7 +95,7 @@ endfunction
|
||||
|
||||
augroup airline#extensions#cursormode
|
||||
autocmd!
|
||||
autocmd VimLeave * call s:set_cursor_color_for(g:cursormode_exit_mode)
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2017-2018 Thomas Dy et al.
|
||||
" MIT License. Copyright (c) 2017-2019 Thomas Dy et al.
|
||||
" Plugin: https://github.com/Shougo/denite.nvim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -7,15 +8,21 @@ 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)
|
||||
if &filetype != 'denite'
|
||||
if &filetype !=# 'denite' || &filetype !=# 'denite-filter'
|
||||
return ''
|
||||
endif
|
||||
let mode = split(denite#get_status_mode(), ' ')
|
||||
let mode = tolower(mode[1])
|
||||
|
||||
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
|
||||
@@ -24,13 +31,20 @@ function! airline#extensions#denite#check_denite_mode(bufnr)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#denite#apply(...)
|
||||
if &ft == 'denite'
|
||||
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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" PLugin: https://eclim.org
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,40 +1,47 @@
|
||||
" MIT License. Copyright (c) 2017-2018 Cimbali et al
|
||||
" MIT License. Copyright (c) 2017-2019 Cimbali et al
|
||||
" Plugin: https://github.com/tpope/vim-fugitive
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('*fugitive#head')
|
||||
if !airline#util#has_fugitive()
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
if exists("+autochdir") && &autochdir == 1
|
||||
let s:fmod = ':p'
|
||||
else
|
||||
let s:fmod = ':.'
|
||||
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
|
||||
let buffer = fugitive#buffer()
|
||||
if buffer.type('blob')
|
||||
let b:fugitive_name = buffer.repo().translate(buffer.path())
|
||||
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('%'), s:fmod)
|
||||
return fnamemodify(bufname('%'), fmod)
|
||||
else
|
||||
return fnamemodify(b:fugitive_name, s:fmod)
|
||||
return fnamemodify(b:fugitive_name, fmod). " [git]"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#fugitiveline#init(ext)
|
||||
if exists("+autochdir") && &autochdir == 1
|
||||
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
|
||||
|
||||
18
autoload/airline/extensions/grepper.vim
Normal file
18
autoload/airline/extensions/grepper.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
" MIT License. Copyright (c) 2014-2019 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
|
||||
18
autoload/airline/extensions/gutentags.vim
Normal file
18
autoload/airline/extensions/gutentags.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
" MIT License. Copyright (c) 2014-2019 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
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: vim-gitgutter, vim-signify, changesPlugin, quickfixsigns
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -42,7 +43,7 @@ function! s:get_hunks_empty()
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks()
|
||||
function! airline#extensions#hunks#get_raw_hunks()
|
||||
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'
|
||||
@@ -66,25 +67,26 @@ function! airline#extensions#hunks#get_hunks()
|
||||
" Cache values, so that it isn't called too often
|
||||
if exists("b:airline_hunks") &&
|
||||
\ get(b:, 'airline_changenr', 0) == b:changedtick &&
|
||||
\ winwidth(0) == get(s:, 'airline_winwidth', 0) &&
|
||||
\ 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_changes'
|
||||
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)
|
||||
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
|
||||
let b:airline_hunks = string
|
||||
let b:airline_changenr = b:changedtick
|
||||
let s:airline_winwidth = winwidth(0)
|
||||
let s:airline_winwidth = airline#util#winwidth()
|
||||
return string
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Doron Behar, C.Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Doron Behar, C.Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
105
autoload/airline/extensions/languageclient.vim
Normal file
105
autoload/airline/extensions/languageclient.vim
Normal file
@@ -0,0 +1,105 @@
|
||||
" MIT License. Copyright (c) 2013-2019 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)
|
||||
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
|
||||
36
autoload/airline/extensions/localsearch.vim
Normal file
36
autoload/airline/extensions/localsearch.vim
Normal file
@@ -0,0 +1,36 @@
|
||||
" MIT License. Copyright (c) 2018-2019 mox et al.
|
||||
" Plugin: https://github.com/mox-mox/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
|
||||
|
||||
function! airline#extensions#localsearch#load_theme(palette)
|
||||
call airline#highlighter#exec('localsearch_dark', [ '#ffffff' , '#000000' , 15 , 1 , ''])
|
||||
endfunction
|
||||
|
||||
|
||||
function! airline#extensions#localsearch#init(ext)
|
||||
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(...)
|
||||
" 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') " If localsearch mode is enabled
|
||||
call builder.add_section('localsearch_dark', s:spc.airline#section#create('LS').s:spc)
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/neomake/neomake
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':Neomake')
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: http://www.drchip.org/astronaut/vim/#NETRW
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/tpope/vim-obsession
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,21 +1,59 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
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' ? '…' : '.'). ']'
|
||||
endif
|
||||
endif
|
||||
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
|
||||
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', '')
|
||||
let b:airline_po_stats = printf('%s%s%s', fuzzy, (empty(fuzzy) || empty(untranslated) ? '' : '/'), untranslated)
|
||||
if strlen(b:airline_po_stats) < 8
|
||||
let b:airline_po_stats = messages. (!empty(b:airline_po_stats) ? '/':''). 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
|
||||
|
||||
@@ -35,8 +73,7 @@ function! airline#extensions#po#stats()
|
||||
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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/edkolev/promptline.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/vim-syntastic/syntastic
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -22,9 +23,9 @@ 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 = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%e(#%fe)]}')
|
||||
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%fe(#%e)]}')
|
||||
else
|
||||
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_warn', '%W{[%w(#%fw)]}')
|
||||
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_warn', '%W{[%fw(#%w)]}')
|
||||
endif
|
||||
let cnt = SyntasticStatuslineFlag()
|
||||
if !empty(_backup)
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
|
||||
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)
|
||||
|
||||
function! airline#extensions#tabline#init(ext)
|
||||
if has('gui_running')
|
||||
@@ -30,15 +30,26 @@ function! s:toggle_off()
|
||||
if s:ctrlspace
|
||||
call airline#extensions#tabline#ctrlspace#off()
|
||||
endif
|
||||
if s:tabws
|
||||
call airline#extensions#tabline#tabws#off()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:toggle_on()
|
||||
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
|
||||
@@ -48,22 +59,36 @@ function! s:update_tabline()
|
||||
return
|
||||
endif
|
||||
let match = expand('<afile>')
|
||||
let ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat',
|
||||
\ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree')
|
||||
if pumvisible()
|
||||
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, ignore_bufadd_pat) > -1
|
||||
elseif empty(match) || airline#util#ignore_buf(match)
|
||||
\ || isdirectory(expand("<afile>"))
|
||||
return
|
||||
endif
|
||||
doautocmd User BufMRUChange
|
||||
call airline#util#doautocmd('BufMRUChange')
|
||||
call airline#extensions#tabline#redraw()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#redraw()
|
||||
" sometimes, the tabline is not correctly updated see #1580
|
||||
" so force redraw here
|
||||
let &tabline = &tabline
|
||||
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()
|
||||
if &lines > 3
|
||||
set showtabline=2
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#load_theme(palette)
|
||||
@@ -95,6 +120,8 @@ function! airline#extensions#tabline#load_theme(palette)
|
||||
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)
|
||||
@@ -105,6 +132,7 @@ function! airline#extensions#tabline#load_theme(palette)
|
||||
"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)
|
||||
@@ -124,6 +152,7 @@ function! airline#extensions#tabline#get()
|
||||
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#*')
|
||||
@@ -131,6 +160,8 @@ function! airline#extensions#tabline#get()
|
||||
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
|
||||
@@ -181,7 +212,7 @@ function! airline#extensions#tabline#new_builder()
|
||||
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|')
|
||||
endif
|
||||
|
||||
return airline#builder#new(builder_context)
|
||||
return airline#extensions#tabline#builder#new(builder_context)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
|
||||
@@ -204,9 +235,16 @@ function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
|
||||
return group
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#add_label(dict, type)
|
||||
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',
|
||||
\ get(g:, 'airline#extensions#tabline#'.a:type.'_label', '['.a:type.']'))
|
||||
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#add_tab_label(dict)
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_count', 1) && tabpagenr('$') > 1
|
||||
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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()))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -33,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
|
||||
|
||||
@@ -52,13 +55,12 @@ function! airline#extensions#tabline#buffers#get()
|
||||
" 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 index = 1
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
let tab_bufs = tabpagebuflist(tabpagenr())
|
||||
let show_buf_label_first = 0
|
||||
@@ -67,118 +69,103 @@ function! airline#extensions#tabline#buffers#get()
|
||||
let show_buf_label_first = 1
|
||||
endif
|
||||
if show_buf_label_first
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
call airline#extensions#tabline#add_label(b, 'buffers', 0)
|
||||
endif
|
||||
let pgroup = ''
|
||||
for nr in s:get_visible_buffers()
|
||||
if nr < 0
|
||||
call b.add_raw('%#airline_tabhid#...')
|
||||
continue
|
||||
|
||||
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@')
|
||||
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
|
||||
let space= (pgroup == group ? s:spc : '')
|
||||
endif
|
||||
|
||||
let space= (pgroup == group ? s:spc : '')
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
|
||||
if len(s:number_map) > 0
|
||||
call b.add_section(group, space. get(s:number_map, index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
|
||||
return space. s:get_number(a:i) . '%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)' . s:spc
|
||||
else
|
||||
call b.add_section(group, '['.index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
|
||||
return '['.(a:i+1).s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)'.']'
|
||||
endif
|
||||
let index += 1
|
||||
else
|
||||
call b.add_section(group, space.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
|
||||
return space.'%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)'.s:spc
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if has("tablineat")
|
||||
call b.add_raw('%X')
|
||||
endif
|
||||
let pgroup=group
|
||||
endfor
|
||||
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 !show_buf_label_first
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
call airline#extensions#tabline#add_label(b, 'buffers', 1)
|
||||
endif
|
||||
|
||||
if tabpagenr('$') > 1
|
||||
call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
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('%')
|
||||
if get(g:, 'airline#extensions#tabline#current_first', 0)
|
||||
if index(buffers, cur) > -1
|
||||
call remove(buffers, index(buffers, cur))
|
||||
endif
|
||||
let buffers = [cur] + buffers
|
||||
function! s:get_number(index)
|
||||
if len(s:number_map) == 0
|
||||
return a:index
|
||||
endif
|
||||
|
||||
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
|
||||
let bidx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
|
||||
if bidx_mode > 1
|
||||
return join(map(split(a:index+11, '\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)
|
||||
@@ -187,7 +174,6 @@ function! s:select_tab(buf_index)
|
||||
\ ['vimfiler', 'nerdtree']), &ft)
|
||||
return
|
||||
endif
|
||||
|
||||
let idx = a:buf_index
|
||||
if s:current_visible_buffers[0] == -1
|
||||
let idx = idx + 1
|
||||
@@ -195,8 +181,8 @@ 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)
|
||||
@@ -208,18 +194,21 @@ function! s:jump_to_tab(offset)
|
||||
endfunction
|
||||
|
||||
function! s:map_keys()
|
||||
if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1)
|
||||
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
|
||||
for i in range(11, 99)
|
||||
exe printf('noremap <silent> <Plug>AirlineSelectTab%d :call <SID>select_tab(%d)<CR>', i, i-11)
|
||||
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
|
||||
|
||||
@@ -235,7 +224,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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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
|
||||
|
||||
232
autoload/airline/extensions/tabline/builder.vim
Normal file
232
autoload/airline/extensions/tabline/builder.vim
Normal file
@@ -0,0 +1,232 @@
|
||||
" MIT License. Copyright (c) 2013-2019 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
|
||||
@@ -1,11 +1,14 @@
|
||||
" MIT License. Copyright (c) 2016-2018 Kevin Sapper et al.
|
||||
" MIT License. Copyright (c) 2016-2019 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:highlight_groups = ['hid', 0, '', 'sel', 'mod_unsel', 0, 'mod_unsel', 'mod']
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#off()
|
||||
augroup airline_tabline_ctrlspace
|
||||
@@ -25,77 +28,55 @@ 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
|
||||
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 = ctrlspace#api#BufferList(a:cur_tab)
|
||||
|
||||
let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab)
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if the current buffer no in the buffer list
|
||||
" return false and no redraw tabline.
|
||||
" return false and no redraw tabline.
|
||||
" Fixes #1515. if there a BufEnter autocmd execute redraw. The tabline may no update.
|
||||
let bufnr_list = map(copy(s:buffer_list), 'v:val["index"]')
|
||||
if index(bufnr_list, a:cur_buf) == -1
|
||||
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 buffer in s:buffer_list
|
||||
if a:cur_buf == buffer.index
|
||||
if buffer.modified
|
||||
let group = 'airline_tabmod'.pos_extension
|
||||
else
|
||||
let group = 'airline_tabsel'.pos_extension
|
||||
endif
|
||||
else
|
||||
if buffer.modified
|
||||
let group = 'airline_tabmod_unsel'.pos_extension
|
||||
elseif buffer.visible
|
||||
let group = 'airline_tab'.pos_extension
|
||||
else
|
||||
let group = 'airline_tabhid'.pos_extension
|
||||
endif
|
||||
endif
|
||||
let s:current_modified = getbufvar(a:cur_buf, '&modified')
|
||||
|
||||
let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)'
|
||||
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
|
||||
|
||||
if has("tablineat")
|
||||
let buf_name = '%'.buffer.index.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X'
|
||||
endif
|
||||
let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)'
|
||||
|
||||
call a:builder.add_section_spaced(group, buf_name)
|
||||
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
|
||||
|
||||
" 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, pos)
|
||||
if a:pos == 0
|
||||
let pos_extension = ''
|
||||
else
|
||||
let pos_extension = '_right'
|
||||
endif
|
||||
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 s:tab_list
|
||||
if tab.current
|
||||
if tab.modified
|
||||
let group = 'airline_tabmod'.pos_extension
|
||||
else
|
||||
let group = 'airline_tabsel'.pos_extension
|
||||
endif
|
||||
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
|
||||
if tab.modified
|
||||
let group = 'airline_tabmod_unsel'.pos_extension
|
||||
else
|
||||
let group = 'airline_tabhid'.pos_extension
|
||||
endif
|
||||
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
|
||||
|
||||
call a:builder.add_section_spaced(group, '%'.tab.index.'T'.tab.title.ctrlspace#api#TabBuffersNumber(tab.index).'%T')
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
@@ -107,68 +88,69 @@ function! airline#extensions#tabline#ctrlspace#get()
|
||||
|
||||
try
|
||||
call airline#extensions#tabline#tabs#map_keys()
|
||||
catch
|
||||
" no-op
|
||||
endtry
|
||||
let s:tab_list = ctrlspace#api#TabList()
|
||||
for tab in s:tab_list
|
||||
if tab.current
|
||||
let cur_tab = tab.index
|
||||
endif
|
||||
endfor
|
||||
|
||||
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 get(g:, 'airline#extensions#tabline#show_buffers', 1) == 0
|
||||
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
|
||||
elseif get(g:, 'airline#extensions#tabline#show_tabs', 1) == 0
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if current buffer no in the buffer list, does't update tabline
|
||||
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0
|
||||
return s:current_tabline
|
||||
endif
|
||||
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 == 0
|
||||
call builder.add_section_spaced('airline_tabtype', buffer_label)
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if current buffer no in the buffer list, does't update tabline
|
||||
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0
|
||||
return s:current_tabline
|
||||
endif
|
||||
if !switch_buffers_and_tabs
|
||||
call AppendLabel(buffer_label)
|
||||
let ignore_update = !AppendBuffers(0)
|
||||
else
|
||||
call builder.add_section_spaced('airline_tabtype', tab_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 get(g:, 'airline#extensions#tabline#show_buffers', 1) == 0
|
||||
call builder.add_section_spaced('airline_tabtype', tab_label)
|
||||
elseif get(g:, 'airline#extensions#tabline#show_tabs', 1) == 0
|
||||
call builder.add_section_spaced('airline_tabtype', buffer_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 switch_buffers_and_tabs == 0
|
||||
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1)
|
||||
call builder.add_section_spaced('airline_tabtype', tab_label)
|
||||
if !switch_buffers_and_tabs
|
||||
call AppendTabs(1)
|
||||
call AppendLabel(tab_label)
|
||||
else
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if current buffer no in the buffer list, does't update tabline
|
||||
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1) == 0
|
||||
return s:current_tabline
|
||||
endif
|
||||
call builder.add_section_spaced('airline_tabtype', buffer_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()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -18,7 +18,9 @@ function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
|
||||
let _ .= '[No Name]'
|
||||
else
|
||||
if s:fnamecollapse
|
||||
let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
|
||||
" 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -7,7 +7,7 @@ function! airline#extensions#tabline#formatters#jsformatter#format(bufnr, buffer
|
||||
let buf = bufname(a:bufnr)
|
||||
let filename = fnamemodify(buf, ':t')
|
||||
|
||||
if filename == 'index.js' || filename == 'index.jsx'
|
||||
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)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
" MIT License. Copyright (c) 2013-2019 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]'
|
||||
else
|
||||
let _ .= fnamemodify(name, ':p:h:t') . '/' . fnamemodify(name, ':t')
|
||||
endif
|
||||
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||
endfunction
|
||||
@@ -1,14 +1,15 @@
|
||||
" MIT License. Copyright (c) 2017-2018 C.Brabandt et al.
|
||||
" MIT License. Copyright (c) 2017-2019 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 (g:airline_symbols.space).'%{len(tabpagebuflist('.a:nr.'))}'
|
||||
return spc. '%{len(tabpagebuflist('.a:nr.'))}'
|
||||
elseif a:tab_nr_type == 1 " tab number
|
||||
return (g:airline_symbols.space).a:nr
|
||||
return spc. a:nr
|
||||
else "== 2 splits and tab number
|
||||
return (g:airline_symbols.space).a:nr.'.%{len(tabpagebuflist('.a:nr.'))}'
|
||||
return spc. a:nr. '.%{len(tabpagebuflist('.a:nr.'))}'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -10,7 +10,7 @@ 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 has_key(tails, tail)
|
||||
@@ -23,11 +23,12 @@ function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffer
|
||||
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.')
|
||||
for nr in values(duplicates)
|
||||
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(bufname(nr), fmod))
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(name, fmod))
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -33,45 +33,45 @@ function! airline#extensions#tabline#tabs#get()
|
||||
catch
|
||||
" no-op
|
||||
endtry
|
||||
if curbuf == s:current_bufnr && curtab == s:current_tabnr
|
||||
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
|
||||
endif
|
||||
|
||||
let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
|
||||
call airline#extensions#tabline#add_label(b, 'tabs')
|
||||
" always have current tabpage first
|
||||
let tablist = range(1, tabpagenr('$'))
|
||||
if get(g:, 'airline#extensions#tabline#current_first', 0)
|
||||
if index(tablist, curtab) > -1
|
||||
call remove(tablist, index(tablist, curtab))
|
||||
endif
|
||||
let tablist = [curtab] + tablist
|
||||
endif
|
||||
for i in tablist
|
||||
if i == curtab
|
||||
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 get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||
let val .= airline#extensions#tabline#tabs#tabnr_formatter(tab_nr_type, i)
|
||||
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()
|
||||
@@ -88,35 +88,47 @@ function! airline#extensions#tabline#tabs#get()
|
||||
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
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
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()
|
||||
if exists("s:airline_tabline_map_key")
|
||||
if maparg('<Plug>AirlineSelectTab1', 'n') is# ':1tabn<CR>'
|
||||
return
|
||||
endif
|
||||
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>
|
||||
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>
|
||||
let s:airline_tabline_map_key = 1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i)
|
||||
function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i) abort
|
||||
let formatter = get(g:, 'airline#extensions#tabline#tabnr_formatter', 'tabnr')
|
||||
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, a:i)
|
||||
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
|
||||
|
||||
154
autoload/airline/extensions/tabline/tabws.vim
Normal file
154
autoload/airline/extensions/tabline/tabws.vim
Normal file
@@ -0,0 +1,154 @@
|
||||
" MIT License. Copyright (c) 2016-2019 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
|
||||
396
autoload/airline/extensions/tabline/xtabline.vim
Normal file
396
autoload/airline/extensions/tabline/xtabline.vim
Normal file
@@ -0,0 +1,396 @@
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" xTabline - Reduced version for vim-airline
|
||||
" Plugin: https://github.com/mg979/vim-xtabline
|
||||
" MIT License Copyright (C) 2018-2019 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-2019 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
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/majutsushi/tagbar
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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:section_a = airline#section#create_left(['terminal', 'tmode'])
|
||||
|
||||
function! airline#extensions#term#apply(...)
|
||||
if &buftype == 'terminal'
|
||||
if &buftype == 'terminal' || bufname('%')[0] == '!'
|
||||
let spc = g:airline_symbols.space
|
||||
|
||||
call a:1.add_section('airline_a', spc.'TERMINAL'.spc)
|
||||
call a:1.add_section('airline_a', spc.s:section_a.spc)
|
||||
call a:1.add_section('airline_b', '')
|
||||
call a:1.add_section('airline_c', spc.'%f')
|
||||
call a:1.add_section('airline_term', spc.s:termname())
|
||||
call a:1.split()
|
||||
call a:1.add_section('airline_y', '')
|
||||
call a:1.add_section('airline_z', spc.airline#section#create_right(['linenr', 'maxlinenr']))
|
||||
@@ -17,6 +21,43 @@ function! airline#extensions#term#apply(...)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#term#inactive_apply(...)
|
||||
if getbufvar(a:2.bufnr, '&buftype') == 'terminal'
|
||||
let spc = g:airline_symbols.space
|
||||
call a:1.add_section('airline_a', spc.'TERMINAL'.spc)
|
||||
call a:1.add_section('airline_b', spc.'%f')
|
||||
let neoterm_id = getbufvar(a:2.bufnr, 'neoterm_id')
|
||||
if neoterm_id != ''
|
||||
call a:1.add_section('airline_c', spc.'neoterm_'.neoterm_id.spc)
|
||||
endif
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#term#termmode()
|
||||
let mode = airline#parts#mode()[0]
|
||||
if mode ==? 'T'
|
||||
" don't need to output T, statusline already says "TERMINAL"
|
||||
let mode=''
|
||||
endif
|
||||
return mode
|
||||
endfunction
|
||||
|
||||
function! s:termname()
|
||||
let bufname = bufname('%')
|
||||
if has('nvim')
|
||||
return matchstr(bufname, 'term.*:\zs.*')
|
||||
else
|
||||
" get rid of leading '!'
|
||||
if bufname[0] is# '!'
|
||||
return bufname[1:]
|
||||
else
|
||||
return bufname
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#term#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#term#apply')
|
||||
call a:ext.add_inactive_statusline_func('airline#extensions#term#inactive_apply')
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/edkolev/tmuxline.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/chrisbra/unicode.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/Shougo/unite.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" MIT License. Copyright (c) 2016-2018 Jerome Reybert et al.
|
||||
" MIT License. Copyright (c) 2016-2019 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)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/lervag/vimtex
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" This plugin replace the whole section_a when in vimagit buffer
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/jmcantrell/vim-virtualenv
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
15
autoload/airline/extensions/vista.vim
Normal file
15
autoload/airline/extensions/vista.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
" MIT License. Copyright (c) 2019 s1341 (github@shmarya.net)
|
||||
" Plugin: https://github.com/liuchngxu/vista.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#vista#currenttag()
|
||||
if get(w:, 'airline_active', 0)
|
||||
return get(b:, 'vista_nearest_method_or_function', '')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vista#init(ext)
|
||||
call airline#parts#define_function('vista', 'airline#extensions#vista#currenttag')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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,10 +7,10 @@ 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:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
|
||||
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
|
||||
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file']}
|
||||
|
||||
function! s:check_mixed_indent()
|
||||
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
|
||||
@@ -31,7 +31,7 @@ endfunction
|
||||
|
||||
function! s:check_mixed_indent_file()
|
||||
let c_like_langs = get(g:, 'airline#extensions#c_like_langs',
|
||||
\ [ 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ])
|
||||
\ [ '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(^ +\*@!)'
|
||||
@@ -47,24 +47,34 @@ function! s:check_mixed_indent_file()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:conflict_marker()
|
||||
" Checks for git conflict markers
|
||||
let annotation = '\%([0-9A-Za-z_.:]\+\)\?'
|
||||
let pattern = '^\%(\%(<\{7} '.annotation. '\)\|\%(=\{7\}\)\|\%(>\{7\} '.annotation.'\)\)$'
|
||||
return search(pattern, 'nw')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#check()
|
||||
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 occurred evaluating '. regexp
|
||||
call airline#util#warning(printf('Whitespace: error occurred evaluating "%s"', regexp))
|
||||
echomsg v:exception
|
||||
return ''
|
||||
endtry
|
||||
@@ -72,13 +82,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
|
||||
|
||||
@@ -87,7 +97,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)
|
||||
@@ -112,6 +127,10 @@ function! airline#extensions#whitespace#check()
|
||||
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
|
||||
endif
|
||||
@@ -137,7 +156,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()
|
||||
@@ -162,7 +181,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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: https://github.com/wesQ3/vim-windowswap
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,43 +1,116 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
" MIT License. Copyright (c) 2013-2019 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', 'org', 'rst', 'tex', 'text'])
|
||||
" export current filetypes settings to global namespace
|
||||
let g:airline#extensions#wordcount#filetypes = filetypes
|
||||
|
||||
" Check if filetype needs testing
|
||||
if did_filetype()
|
||||
|
||||
" Select test based on type of "filetypes": new=list, old=string
|
||||
if type(filetypes) == get(v:, 't_list', type([]))
|
||||
\ ? index(filetypes, &filetype) > -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
|
||||
|
||||
@@ -1,66 +1,39 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#wordcount#formatters#default#format()
|
||||
let fmt = get(g:, 'airline#extensions#wordcount#formatter#default#fmt', '%s words')
|
||||
let fmt_short = get(g:, 'airline#extensions#wordcount#formatter#default#fmt_short', fmt == '%s words' ? '%sW' : fmt)
|
||||
let words = string(s:wordcount())
|
||||
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(fmt, words). result
|
||||
else
|
||||
let result = printf(fmt_short, words). 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 '.'
|
||||
endif
|
||||
return ''
|
||||
return str . g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2018 YoungHoon Rhiu et al.
|
||||
" MIT License. Copyright (c) 2017-2019 YoungHoon Rhiu et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -10,7 +10,7 @@ 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 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]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2015-2018 Evgeny Firsov et al.
|
||||
" MIT License. Copyright (c) 2015-2019 Evgeny Firsov et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -22,6 +22,18 @@ function! s:gui2cui(rgb, fallback)
|
||||
return airline#msdos#round_msdos_colors(rgb)
|
||||
endfunction
|
||||
|
||||
function! s:group_not_done(list, name)
|
||||
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)
|
||||
if !exists("g:airline_gui_mode")
|
||||
let g:airline_gui_mode = airline#init#gui_mode()
|
||||
@@ -53,21 +65,22 @@ function! airline#highlighter#reset_hlcache()
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#get_highlight(group, ...)
|
||||
let reverse = get(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')
|
||||
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group)
|
||||
return 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 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')
|
||||
let bold = synIDattr(synIDtrans(hlID(a:group)), 'bold')
|
||||
let opts = a:000
|
||||
if bold
|
||||
let opts = ['bold']
|
||||
if reverse
|
||||
let res = s:get_array(bg, fg, bold ? ['bold'] : a:000)
|
||||
else
|
||||
let res = s:get_array(fg, bg, bold ? ['bold'] : a:000)
|
||||
endif
|
||||
let res = reverse ? s:get_array(bg, fg, opts) : s:get_array(fg, bg, opts)
|
||||
endif
|
||||
let s:hl_groups[a:group] = res
|
||||
return res
|
||||
@@ -108,11 +121,7 @@ function! airline#highlighter#exec(group, colors)
|
||||
endif
|
||||
let colors = s:CheckDefined(colors)
|
||||
if old_hi != new_hi || !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='))
|
||||
let cmd = printf('hi %s%s', a:group, s:GetHiCmd(colors))
|
||||
exe cmd
|
||||
if has_key(s:hl_groups, a:group)
|
||||
let s:hl_groups[a:group] = colors
|
||||
@@ -152,22 +161,38 @@ function! s:CheckDefined(colors)
|
||||
return a:colors[0:1] + [fg, bg] + [a:colors[4]]
|
||||
endfunction
|
||||
|
||||
function! s:Get(dict, key, prefix)
|
||||
let res=get(a:dict, a:key, '')
|
||||
if res is ''
|
||||
return ''
|
||||
else
|
||||
return a:prefix. res
|
||||
endif
|
||||
function! s:GetHiCmd(list)
|
||||
" 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)
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
let group = a:from.'_to_'.a:to.a:suffix
|
||||
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
|
||||
@@ -222,12 +247,15 @@ function! airline#highlighter#highlight(modes, ...)
|
||||
" 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 mode == 'inactive' && winnr('$') == 1
|
||||
" there exist no inactive windows, don't need to create all those
|
||||
" highlighting groups
|
||||
continue
|
||||
endif
|
||||
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)
|
||||
@@ -236,7 +264,22 @@ function! airline#highlighter#highlight(modes, ...)
|
||||
if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive'
|
||||
let name = 'airline_c'.bufnr
|
||||
endif
|
||||
call airline#highlighter#exec(name.suffix, mode_colors)
|
||||
" 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
|
||||
if s:group_not_done(airline_grouplist, name.suffix)
|
||||
call airline#highlighter#exec(name.suffix, mode_colors)
|
||||
endif
|
||||
|
||||
for accent in keys(s:accents)
|
||||
if !has_key(p.accents, accent)
|
||||
@@ -254,12 +297,21 @@ function! airline#highlighter#highlight(modes, ...)
|
||||
else
|
||||
call add(colors, get(p.accents[accent], 4, ''))
|
||||
endif
|
||||
call airline#highlighter#exec(name.suffix.'_'.accent, colors)
|
||||
if s:group_not_done(airline_grouplist, name.suffix.'_'.accent)
|
||||
call airline#highlighter#exec(name.suffix.'_'.accent, colors)
|
||||
endif
|
||||
endfor
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -36,21 +36,28 @@ function! airline#init#bootstrap()
|
||||
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',
|
||||
@@ -70,7 +77,8 @@ function! airline#init#bootstrap()
|
||||
\ 'spell': 'SPELL',
|
||||
\ 'modified': '+',
|
||||
\ 'space': ' ',
|
||||
\ 'keymap': 'Keymap:'
|
||||
\ 'keymap': 'Keymap:',
|
||||
\ 'ellipsis': '...'
|
||||
\ }, 'keep')
|
||||
|
||||
if get(g:, 'airline_powerline_fonts', 0)
|
||||
@@ -79,7 +87,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",
|
||||
@@ -87,6 +95,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)
|
||||
@@ -104,6 +113,7 @@ function! airline#init#bootstrap()
|
||||
\ 'branch': "\u16A0",
|
||||
\ 'notexists': "\u0246",
|
||||
\ 'crypt': nr2char(0x1F512),
|
||||
\ 'dirty': '!',
|
||||
\ }, 'keep')
|
||||
else
|
||||
" Symbols for ASCII terminals
|
||||
@@ -119,6 +129,7 @@ function! airline#init#bootstrap()
|
||||
\ 'branch': '',
|
||||
\ 'notexists': '?',
|
||||
\ 'crypt': 'cr',
|
||||
\ 'dirty': '!',
|
||||
\ }, 'keep')
|
||||
endif
|
||||
|
||||
@@ -144,11 +155,22 @@ function! airline#init#bootstrap()
|
||||
\ '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_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',
|
||||
\ 'languageclient_error_count', 'languageclient_warning_count',
|
||||
\ 'coc_warning_count', 'coc_error_count', 'vista'])
|
||||
call airline#parts#define_text('bookmark', '')
|
||||
call airline#parts#define_text('capslock', '')
|
||||
call airline#parts#define_text('gutentags', '')
|
||||
call airline#parts#define_text('grepper', '')
|
||||
call airline#parts#define_text('xkblayout', '')
|
||||
call airline#parts#define_text('keymap', '')
|
||||
|
||||
@@ -156,9 +178,7 @@ function! airline#init#bootstrap()
|
||||
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'
|
||||
return has('gui_running') || (has("termguicolors") && &termguicolors == 1) ? 'gui' : 'cterm'
|
||||
endfunction
|
||||
|
||||
function! airline#init#sections()
|
||||
@@ -180,22 +200,22 @@ function! airline#init#sections()
|
||||
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', '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
|
||||
if airline#util#winwidth() > 79
|
||||
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
|
||||
else
|
||||
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3v'])
|
||||
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', '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', 'languageclient_warning_count', 'whitespace', 'coc_warning_count'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -67,9 +67,10 @@ endfunction
|
||||
function! airline#parts#spell()
|
||||
let spelllang = g:airline_detect_spelllang ? printf(" [%s]", toupper(substitute(&spelllang, ',', '/', 'g'))) : ''
|
||||
if g:airline_detect_spell && &spell
|
||||
if winwidth(0) >= 90
|
||||
let winwidth = airline#util#winwidth()
|
||||
if winwidth >= 90
|
||||
return g:airline_symbols.spell . spelllang
|
||||
elseif winwidth(0) >= 70
|
||||
elseif winwidth >= 70
|
||||
return g:airline_symbols.spell
|
||||
else
|
||||
return split(g:airline_symbols.spell, '\zs')[0]
|
||||
@@ -86,6 +87,11 @@ function! airline#parts#iminsert()
|
||||
endfunction
|
||||
|
||||
function! airline#parts#readonly()
|
||||
" 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
|
||||
@@ -94,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()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -38,6 +38,9 @@ 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
|
||||
@@ -45,8 +48,7 @@ function! airline#themes#patch(palette)
|
||||
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]
|
||||
let a:palette[mode]['airline_term'] = airline#highlighter#get_highlight('airline_c')
|
||||
let a:palette[mode]['airline_term'] = [ '#9cffd3', '#202020', 85, 232]
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 tw=80
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -130,6 +130,12 @@ let g:airline#themes#dark#palette.inactive_modified = {
|
||||
\ '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'
|
||||
@@ -153,4 +159,3 @@ if get(g:, 'loaded_ctrlp', 0)
|
||||
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
|
||||
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,16 +1,31 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 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')
|
||||
|
||||
" TODO: Try to cache winwidth(0) function
|
||||
" e.g. store winwidth per window and access that, only update it, if the size
|
||||
" actually changed.
|
||||
scriptencoding utf-8
|
||||
|
||||
call airline#init#bootstrap()
|
||||
let s:spc = g:airline_symbols.space
|
||||
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.'}$')
|
||||
@@ -24,14 +39,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
|
||||
@@ -45,7 +60,7 @@ 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
|
||||
@@ -86,3 +101,63 @@ else
|
||||
return 0
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" 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_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'])
|
||||
endfunction
|
||||
|
||||
1475
doc/airline.txt
1475
doc/airline.txt
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -21,29 +21,46 @@ function! s:init()
|
||||
let s:theme_in_vimrc = exists('g:airline_theme')
|
||||
if s:theme_in_vimrc
|
||||
try
|
||||
if g:airline_theme is# 'random'
|
||||
let g:airline_theme=s:random_theme()
|
||||
endif
|
||||
let palette = g:airline#themes#{g:airline_theme}#palette
|
||||
catch
|
||||
echom 'Could not resolve airline theme "' . g:airline_theme . '". Themes have been migrated to github.com/vim-airline/vim-airline-themes.'
|
||||
call airline#util#warning(printf('Could not resolve airline theme "%s". Themes have been migrated to github.com/vim-airline/vim-airline-themes.', g:airline_theme))
|
||||
let g:airline_theme = 'dark'
|
||||
endtry
|
||||
silent call airline#switch_theme(g:airline_theme)
|
||||
try
|
||||
silent call airline#switch_theme(g:airline_theme)
|
||||
catch
|
||||
call airline#util#warning(printf('Could not find airline theme "%s".', g:airline_theme))
|
||||
let g:airline_theme = 'dark'
|
||||
silent call airline#switch_theme(g:airline_theme)
|
||||
endtry
|
||||
else
|
||||
let g:airline_theme = 'dark'
|
||||
silent call s:on_colorscheme_changed()
|
||||
endif
|
||||
|
||||
silent doautocmd User AirlineAfterInit
|
||||
call airline#util#doautocmd('AirlineAfterInit')
|
||||
endfunction
|
||||
|
||||
function! s:on_window_changed()
|
||||
let s:active_winnr = -1
|
||||
function! s:on_window_changed(event)
|
||||
let s:active_winnr = winnr()
|
||||
|
||||
if pumvisible() && (!&previewwindow || g:airline_exclude_preview)
|
||||
return
|
||||
endif
|
||||
" work around a neovim bug: do not trigger on floating windows
|
||||
" Disabled, Bug is fixed in Neovim, TODO: should be removed soon
|
||||
" if exists("*nvim_win_get_config") && !empty(nvim_win_get_config(0).relative)
|
||||
" return
|
||||
" endif
|
||||
" Handle each window only once, since we might come here several times for
|
||||
" different autocommands.
|
||||
let l:key = [bufnr('%'), winnr(), winnr('$'), tabpagenr(), &ft]
|
||||
let l:key = [bufnr('%'), s:active_winnr, winnr('$'), tabpagenr(), &ft]
|
||||
if get(g:, 'airline_last_window_changed', []) == l:key
|
||||
\ && &stl is# '%!airline#statusline('.winnr().')'
|
||||
\ && &stl is# '%!airline#statusline('.s:active_winnr.')'
|
||||
\ && &ft !~? 'gitcommit'
|
||||
" fugitive is special, it changes names and filetypes several times,
|
||||
" make sure the caching does not get into its way
|
||||
@@ -54,6 +71,13 @@ function! s:on_window_changed()
|
||||
call airline#update_statusline()
|
||||
endfunction
|
||||
|
||||
function! s:on_cursor_moved()
|
||||
if winnr() != s:active_winnr || !exists('w:airline_active')
|
||||
call s:on_window_changed('CursorMoved')
|
||||
endif
|
||||
call airline#update_tabline()
|
||||
endfunction
|
||||
|
||||
function! s:on_colorscheme_changed()
|
||||
call s:init()
|
||||
unlet! g:airline#highlighter#normal_fg_hi
|
||||
@@ -81,78 +105,177 @@ function! s:airline_toggle()
|
||||
if exists("s:stl")
|
||||
let &stl = s:stl
|
||||
endif
|
||||
if exists("s:tal")
|
||||
let [&tal, &showtabline] = s:tal
|
||||
endif
|
||||
call airline#highlighter#reset_hlcache()
|
||||
|
||||
silent doautocmd User AirlineToggledOff
|
||||
call airline#util#doautocmd('AirlineToggledOff')
|
||||
else
|
||||
let s:stl = &statusline
|
||||
let s:tal = [&tabline, &showtabline]
|
||||
augroup airline
|
||||
autocmd!
|
||||
|
||||
autocmd CmdwinEnter *
|
||||
\ call airline#add_statusline_func('airline#cmdwinenter')
|
||||
\ | call <sid>on_window_changed()
|
||||
\ | call <sid>on_window_changed('CmdwinEnter')
|
||||
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
|
||||
|
||||
autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed()
|
||||
" Refresh airline for :syntax off
|
||||
autocmd SourcePre */syntax/*syntax.vim call <sid>airline_refresh()
|
||||
autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload *
|
||||
\ call <sid>on_window_changed()
|
||||
if exists('#CompleteDone')
|
||||
autocmd CompleteDone * call <sid>on_window_changed()
|
||||
if exists("##OptionSet")
|
||||
" Make sure that g_airline_gui_mode is refreshed
|
||||
autocmd OptionSet termguicolors call <sid>on_colorscheme_changed()
|
||||
endif
|
||||
" Set all statuslines to inactive
|
||||
autocmd FocusLost * call airline#update_statusline_focuslost()
|
||||
" Refresh airline for :syntax off
|
||||
autocmd SourcePre */syntax/syntax.vim
|
||||
\ call airline#extensions#tabline#buffers#invalidate()
|
||||
autocmd VimEnter * call <sid>on_window_changed('VimEnter')
|
||||
autocmd WinEnter * call <sid>on_window_changed('WinEnter')
|
||||
autocmd FileType * call <sid>on_window_changed('FileType')
|
||||
autocmd BufWinEnter * call <sid>on_window_changed('BufWinEnter')
|
||||
autocmd BufUnload * call <sid>on_window_changed('BufUnload')
|
||||
if exists('##CompleteDone')
|
||||
autocmd CompleteDone * call <sid>on_window_changed('CompleteDone')
|
||||
endif
|
||||
" non-trivial number of external plugins use eventignore=all, so we need to account for that
|
||||
autocmd CursorMoved * call <sid>on_cursor_moved()
|
||||
|
||||
autocmd VimResized * unlet! w:airline_lastmode | :call <sid>airline_refresh()
|
||||
if exists('*timer_start') && exists('*funcref')
|
||||
" do not trigger FocusGained on startup, it might erase the intro screen (see #1817)
|
||||
" needs funcref() (needs 7.4.2137) and timers (7.4.1578)
|
||||
let Handler=funcref('<sid>FocusGainedHandler')
|
||||
let s:timer=timer_start(5000, Handler)
|
||||
else
|
||||
autocmd FocusGained * unlet! w:airline_lastmode | :call <sid>airline_refresh()
|
||||
endif
|
||||
|
||||
if exists("##TerminalOpen")
|
||||
" Using the same function with the TermOpen autocommand
|
||||
" breaks for Neovim see #1828, looks like a neovim bug.
|
||||
autocmd TerminalOpen * :call airline#load_theme() " reload current theme for Terminal, forces the terminal extension to be loaded
|
||||
endif
|
||||
autocmd TabEnter * :unlet! w:airline_lastmode | let w:airline_active=1
|
||||
autocmd BufWritePost */autoload/airline/themes/*.vim
|
||||
\ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0]
|
||||
\ | call airline#load_theme()
|
||||
autocmd User AirlineModeChanged nested call airline#mode_changed()
|
||||
|
||||
if get(g:, 'airline_statusline_ontop', 0)
|
||||
" Force update of tabline more often
|
||||
autocmd InsertEnter,InsertLeave,CursorMovedI * :call airline#update_tabline()
|
||||
endif
|
||||
augroup END
|
||||
|
||||
if &laststatus < 2
|
||||
set laststatus=2
|
||||
endif
|
||||
if s:airline_initialized
|
||||
call s:on_window_changed()
|
||||
call s:on_window_changed('Init')
|
||||
endif
|
||||
|
||||
silent doautocmd User AirlineToggledOn
|
||||
call airline#util#doautocmd('AirlineToggledOn')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_airline_themes(a, l, p)
|
||||
let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:a.'*'), "\n")
|
||||
return map(files, 'fnamemodify(v:val, ":t:r")')
|
||||
return airline#util#themes(a:a)
|
||||
endfunction
|
||||
|
||||
function! s:airline_theme(...)
|
||||
if a:0
|
||||
call airline#switch_theme(a:1)
|
||||
try
|
||||
let theme = a:1
|
||||
if theme is# 'random'
|
||||
let theme = s:random_theme()
|
||||
endif
|
||||
call airline#switch_theme(theme)
|
||||
catch " discard error
|
||||
endtry
|
||||
if a:1 is# 'random'
|
||||
echo g:airline_theme
|
||||
endif
|
||||
else
|
||||
echo g:airline_theme
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:airline_refresh()
|
||||
function! s:airline_refresh(...)
|
||||
" a:1, fast refresh, do not reload the theme
|
||||
let fast=!empty(get(a:000, 0, 0))
|
||||
if !exists("#airline")
|
||||
" disabled
|
||||
return
|
||||
endif
|
||||
let nomodeline=''
|
||||
if v:version > 703 || v:version == 703 && has("patch438")
|
||||
let nomodeline = '<nomodeline>'
|
||||
endif
|
||||
exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline)
|
||||
call airline#util#doautocmd('AirlineBeforeRefresh')
|
||||
call airline#highlighter#reset_hlcache()
|
||||
call airline#load_theme()
|
||||
if !fast
|
||||
call airline#load_theme()
|
||||
endif
|
||||
call airline#update_statusline()
|
||||
call airline#update_tabline()
|
||||
endfunction
|
||||
|
||||
function! s:FocusGainedHandler(timer)
|
||||
if exists("s:timer") && a:timer == s:timer
|
||||
augroup airline
|
||||
au FocusGained * unlet! w:airline_lastmode | :call <sid>airline_refresh()
|
||||
augroup END
|
||||
endif
|
||||
endfu
|
||||
|
||||
function! s:airline_extensions()
|
||||
let loaded = airline#extensions#get_loaded_extensions()
|
||||
let files = split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n")
|
||||
call map(files, 'fnamemodify(v:val, ":t:r")')
|
||||
if empty(files)
|
||||
echo "No extensions loaded"
|
||||
return
|
||||
endif
|
||||
echohl Title
|
||||
echo printf("%-15s\t%s\t%s", "Extension", "Extern", "Status")
|
||||
echohl Normal
|
||||
let set=[]
|
||||
for ext in sort(files)
|
||||
if index(set, ext) > -1
|
||||
continue
|
||||
endif
|
||||
let indx=match(loaded, '^'.ext.'\*\?$')
|
||||
let external = (indx > -1 && loaded[indx] =~ '\*$')
|
||||
echo printf("%-15s\t%s\t%sloaded", ext, external, indx == -1 ? 'not ' : '')
|
||||
call add(set, ext)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:rand(max) abort
|
||||
if has("reltime")
|
||||
let timerstr=reltimestr(reltime())
|
||||
let number=split(timerstr, '\.')[1]+0
|
||||
elseif has("win32") && &shell =~ 'cmd'
|
||||
let number=system("echo %random%")+0
|
||||
else
|
||||
" best effort, bash and zsh provide $RANDOM
|
||||
" cmd.exe on windows provides %random%, but expand()
|
||||
" does not seem to be able to expand this correctly.
|
||||
" In the worst case, this always returns zero
|
||||
let number=expand("$RANDOM")+0
|
||||
endif
|
||||
return number % a:max
|
||||
endfunction
|
||||
|
||||
function! s:random_theme() abort
|
||||
let themes=airline#util#themes('')
|
||||
return themes[s:rand(len(themes))]
|
||||
endfunction
|
||||
|
||||
command! -bar -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
|
||||
command! -bar AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
|
||||
command! -bar AirlineToggle call s:airline_toggle()
|
||||
command! -bar AirlineRefresh call s:airline_refresh()
|
||||
command! -bar AirlineToggle call s:airline_toggle()
|
||||
command! -bar -bang AirlineRefresh call s:airline_refresh(<q-bang>)
|
||||
command! AirlineExtensions call s:airline_extensions()
|
||||
|
||||
call airline#init#bootstrap()
|
||||
call s:airline_toggle()
|
||||
|
||||
@@ -84,4 +84,3 @@ describe 'airline'
|
||||
Expect airline#statusline(1) =~ 'airline#check_mode'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -105,4 +105,3 @@ describe 'inactive builder'
|
||||
Expect stl == '%#Normal_inactive#hello%#foo_inactive#fooworld'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -32,4 +32,3 @@ describe 'commands'
|
||||
Expect exists(':AirlineRefresh') to_be_true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -28,4 +28,3 @@ describe 'default'
|
||||
wincmd c
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
21
t/extensions_tabline.vim
Normal file
21
t/extensions_tabline.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
|
||||
source plugin/airline.vim
|
||||
doautocmd VimEnter
|
||||
|
||||
describe 'default'
|
||||
|
||||
it 'should use a tabline'
|
||||
e! CHANGELOG.md
|
||||
sp CONTRIBUTING.md
|
||||
Expect airline#extensions#tabline#get() == "%#airline_tabhid#...| %(%{airline#extensions#tabline#get_buffer_name(3)}%) %#airline_tabhid_to_airline_tab# %#airline_tab#%(%{airline#extensions#tabline#get_buffer_name(4)}%) %#airline_tab_to_airline_tabsel# %#airline_tabsel#%(%{airline#extensions#tabline#get_buffer_name(5)}%) %#airline_tabsel_to_airline_tabfill# %#airline_tabfill#%=%#airline_tabfill_to_airline_tabfill#%#airline_tabfill#%#airline_tabfill_to_airline_tablabel_right#%#airline_tablabel_right# buffers "
|
||||
end
|
||||
|
||||
it 'Trigger on BufDelete autocommands'
|
||||
e! CHANGELOG.md
|
||||
sp CONTRIBUTING.md
|
||||
sp README.md
|
||||
2bd
|
||||
Expect airline#extensions#tabline#get() == "%#airline_tabhid#...%#airline_tabhid_to_airline_tab# %#airline_tab#%(%{airline#extensions#tabline#get_buffer_name(4)}%) | %(%{airline#extensions#tabline#get_buffer_name(5)}%) %#airline_tab_to_airline_tabsel# %#airline_tabsel#%(%{airline#extensions#tabline#get_buffer_name(6)}%) %#airline_tabsel_to_airline_tabfill# %#airline_tabfill#%=%#airline_tabfill_to_airline_tabfill#%#airline_tabfill#%#airline_tabfill_to_airline_tablabel_right#%#airline_tablabel_right# buffers "
|
||||
end
|
||||
end
|
||||
@@ -18,4 +18,3 @@ describe 'highlighter'
|
||||
Expect hlID('airline_c_red') != 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ describe 'init sections'
|
||||
end
|
||||
|
||||
it 'section x should be filetype'
|
||||
Expect g:airline_section_x == '%{airline#util#wrap(airline#parts#filetype(),0)}'
|
||||
Expect g:airline_section_x == '%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#wrap(airline#parts#filetype(),0)}'
|
||||
end
|
||||
|
||||
it 'section y should be fenc and ff'
|
||||
@@ -74,6 +74,8 @@ describe 'init sections'
|
||||
Expect airline#parts#get('windowswap').raw == ''
|
||||
Expect airline#parts#get('ycm_error_count').raw == ''
|
||||
Expect airline#parts#get('ycm_warning_count').raw == ''
|
||||
Expect airline#parts#get('languageclient_error_count').raw == ''
|
||||
Expect airline#parts#get('languageclient_warning_count').raw == ''
|
||||
end
|
||||
end
|
||||
|
||||
@@ -84,4 +86,3 @@ describe 'init parts'
|
||||
Expect g:airline_section_z =~ 'bar'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -36,4 +36,3 @@ describe 'parts'
|
||||
Expect airline#parts#get('part').accent == 'red'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -78,4 +78,3 @@ describe 'section'
|
||||
Expect s == '%{airline#util#prepend(airline#parts#ffenc(),0)}%{strftime("%H:%M")}'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -70,4 +70,3 @@ describe 'themes'
|
||||
Expect map.airline_z[0] == 6
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -51,4 +51,3 @@ describe 'util'
|
||||
Expect airline#util#wrap('foo', 99999) == ''
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user