mirror of
https://github.com/vim-airline/vim-airline.git
synced 2026-01-26 21:07:26 +08:00
Compare commits
400 Commits
v0.11
...
vim9script
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6886f2997 | ||
|
|
1962371666 | ||
|
|
2062dd2f98 | ||
|
|
0e91eeb548 | ||
|
|
4b02724d0c | ||
|
|
f54f7859a3 | ||
|
|
4bce179ed3 | ||
|
|
2083bfe890 | ||
|
|
084dfe017d | ||
|
|
ad7dcbdece | ||
|
|
bb204d1fee | ||
|
|
a678556366 | ||
|
|
def61b1450 | ||
|
|
3de44bc58f | ||
|
|
dcb36f0480 | ||
|
|
21f329cd70 | ||
|
|
0eee611a0e | ||
|
|
4e4663c71c | ||
|
|
0a80997100 | ||
|
|
f08b7912c6 | ||
|
|
d49b655e72 | ||
|
|
70dc69fcd8 | ||
|
|
cdb265c410 | ||
|
|
de3dbfcb3c | ||
|
|
cc2a836b9a | ||
|
|
6ff95bac4e | ||
|
|
c8c30c9e3e | ||
|
|
a77cd28ecc | ||
|
|
6a6945d45d | ||
|
|
d5ffa5fd58 | ||
|
|
b10c1107e1 | ||
|
|
4f59fef538 | ||
|
|
e59a654d17 | ||
|
|
18ae588bad | ||
|
|
86c466d81e | ||
|
|
c08b1c0c75 | ||
|
|
3d536ef950 | ||
|
|
02aaaf94e8 | ||
|
|
bbc70019f6 | ||
|
|
0bc7ff3629 | ||
|
|
7880f0a73c | ||
|
|
5502e5302d | ||
|
|
59c906da4d | ||
|
|
19f8be42b6 | ||
|
|
e81d400b09 | ||
|
|
5062eeeaed | ||
|
|
e6bd342293 | ||
|
|
caaa553ce9 | ||
|
|
b4e38be8b8 | ||
|
|
252b89bb1f | ||
|
|
b271c279d6 | ||
|
|
9387517f01 | ||
|
|
8ec6f1e40f | ||
|
|
0d0c380940 | ||
|
|
9f7557df44 | ||
|
|
f615f8bad3 | ||
|
|
f5e2f97003 | ||
|
|
14fd943dc6 | ||
|
|
e9d4ff75da | ||
|
|
9b32ed3229 | ||
|
|
58b2a8bbc8 | ||
|
|
5ac55ea4e5 | ||
|
|
56ba4b34a7 | ||
|
|
798a346a91 | ||
|
|
4f8675434a | ||
|
|
5391b3e246 | ||
|
|
7310ca6cbf | ||
|
|
9ae38b43e4 | ||
|
|
2441084898 | ||
|
|
d9947beb0f | ||
|
|
a6b7267979 | ||
|
|
90de76359f | ||
|
|
0238d386bb | ||
|
|
19861861fd | ||
|
|
687fb52d9f | ||
|
|
aa8bd171f3 | ||
|
|
b152059a98 | ||
|
|
4d75c9940c | ||
|
|
ae3af85ca2 | ||
|
|
a9f525f8da | ||
|
|
3e93c212cc | ||
|
|
a8afa434e3 | ||
|
|
b0d4a44f0c | ||
|
|
0abcdbeba5 | ||
|
|
609205f1e8 | ||
|
|
06117a61e1 | ||
|
|
79eac1558a | ||
|
|
157af8ad8b | ||
|
|
cbf0a8e69a | ||
|
|
a168ca7a28 | ||
|
|
a48f67657f | ||
|
|
332fff9206 | ||
|
|
c378a0aeb7 | ||
|
|
91a8ada0f9 | ||
|
|
beb20cb49f | ||
|
|
536667191d | ||
|
|
5eae08609e | ||
|
|
731bdb11d2 | ||
|
|
df096e16ae | ||
|
|
7091b8a6ff | ||
|
|
9267cef0f8 | ||
|
|
bb760710cc | ||
|
|
f6f8666533 | ||
|
|
bd5ae9c584 | ||
|
|
5f2421fa39 | ||
|
|
3f4b811510 | ||
|
|
1ed922265a | ||
|
|
83804f3c6d | ||
|
|
d64e5f8dd7 | ||
|
|
dcebc6d2aa | ||
|
|
193460137a | ||
|
|
44b7b72938 | ||
|
|
c8c0e7d9ff | ||
|
|
38c9f9ca3d | ||
|
|
42b31b966b | ||
|
|
8608270bd3 | ||
|
|
85c64a668d | ||
|
|
34968bf65c | ||
|
|
19ab70ee87 | ||
|
|
83bd08a97a | ||
|
|
14abb40287 | ||
|
|
4e03ac85f9 | ||
|
|
9c0a85de2f | ||
|
|
659693c250 | ||
|
|
2762f7e6e5 | ||
|
|
06747d11be | ||
|
|
7087c475be | ||
|
|
2ad2eeb9ca | ||
|
|
0a5753813c | ||
|
|
aa773f5cdf | ||
|
|
f117de553b | ||
|
|
958ffe059a | ||
|
|
9614105d09 | ||
|
|
3fc5ad231c | ||
|
|
3740312de0 | ||
|
|
d40e5f9a1d | ||
|
|
bf4bba4c5a | ||
|
|
3272a2d490 | ||
|
|
af556115de | ||
|
|
98683125f6 | ||
|
|
27b52acee7 | ||
|
|
47c9205127 | ||
|
|
aed3523ee3 | ||
|
|
30287992e2 | ||
|
|
f5693986c4 | ||
|
|
2a69254d21 | ||
|
|
51f599e2cf | ||
|
|
dd5a3c91a1 | ||
|
|
2daabc2cce | ||
|
|
7f91b54a44 | ||
|
|
c77d89046e | ||
|
|
0f5eedff74 | ||
|
|
5d3cfa4045 | ||
|
|
3a55368320 | ||
|
|
ef4666bd86 | ||
|
|
a738664dcc | ||
|
|
02c529efe4 | ||
|
|
c1134da741 | ||
|
|
f84683a8c2 | ||
|
|
ad80550252 | ||
|
|
c78c1fb870 | ||
|
|
5770e8befd | ||
|
|
0cebac6bb0 | ||
|
|
19d1990f86 | ||
|
|
8e0d5cd95d | ||
|
|
f4aaa7c76f | ||
|
|
12f1934d38 | ||
|
|
6a1c2a74e9 | ||
|
|
a294f0cb7e | ||
|
|
8037c373d0 | ||
|
|
21e47ca5b3 | ||
|
|
f26a01cd02 | ||
|
|
16935cc666 | ||
|
|
8cd824b4ac | ||
|
|
16f88fe363 | ||
|
|
0e2cc23d49 | ||
|
|
782774c0dc | ||
|
|
ffa44b8327 | ||
|
|
e4077b1725 | ||
|
|
a836e09e91 | ||
|
|
1ca2428f51 | ||
|
|
2a027e992d | ||
|
|
7ff5fdc349 | ||
|
|
b322ee6728 | ||
|
|
19fdf61efe | ||
|
|
13a92b1474 | ||
|
|
7bb3ec24ba | ||
|
|
7fc51f6952 | ||
|
|
72a19ed9ed | ||
|
|
b6d6485a90 | ||
|
|
a7716dec4d | ||
|
|
f655add4e9 | ||
|
|
767107070e | ||
|
|
c4ee72f2d9 | ||
|
|
768bd0f5c6 | ||
|
|
08bab60614 | ||
|
|
46c35b80a1 | ||
|
|
ee4afdeedb | ||
|
|
2fec415a5d | ||
|
|
416897c73d | ||
|
|
0a0d61af6c | ||
|
|
48d49075ec | ||
|
|
fab4a02838 | ||
|
|
b843321428 | ||
|
|
7cd12641c7 | ||
|
|
ba9b3e1839 | ||
|
|
cb03578a7c | ||
|
|
b96e02c649 | ||
|
|
2d9e88794d | ||
|
|
2c45d3c1aa | ||
|
|
d0aaa061c2 | ||
|
|
476bba726c | ||
|
|
8be6a2ecd5 | ||
|
|
bc8fdfe946 | ||
|
|
bcabad32cf | ||
|
|
e352adda69 | ||
|
|
5ce3e63658 | ||
|
|
e58c4a493c | ||
|
|
cc6d3a7df1 | ||
|
|
88894aa0ad | ||
|
|
ee85ed4c67 | ||
|
|
fab1ee3117 | ||
|
|
90f7210413 | ||
|
|
8177d63e07 | ||
|
|
d221dc5312 | ||
|
|
de76234a0e | ||
|
|
0de31196b6 | ||
|
|
6ddda74126 | ||
|
|
64c0374423 | ||
|
|
b929452f32 | ||
|
|
c744fb81b6 | ||
|
|
ba2c1b4e25 | ||
|
|
e0838c704a | ||
|
|
d232ec08b9 | ||
|
|
3fa0e0ce0c | ||
|
|
e23978fb68 | ||
|
|
a133605d01 | ||
|
|
f244ff9987 | ||
|
|
68024ec33d | ||
|
|
1e6f5c7705 | ||
|
|
aa46603214 | ||
|
|
ffdf52e38d | ||
|
|
1f1a71ae2b | ||
|
|
3b46a4d9a3 | ||
|
|
915c7cfcd7 | ||
|
|
0ac474fdc4 | ||
|
|
62e7fc6ab1 | ||
|
|
96d37d2fbe | ||
|
|
48064e24d5 | ||
|
|
e7f78bbc0f | ||
|
|
ad3132da33 | ||
|
|
ff3f66ed30 | ||
|
|
d2513b8460 | ||
|
|
eff4828b37 | ||
|
|
f00a9e6e7a | ||
|
|
76c1998753 | ||
|
|
379e0f5bc2 | ||
|
|
2eb95b2e09 | ||
|
|
cce6b55a27 | ||
|
|
c8fe296c52 | ||
|
|
0074044413 | ||
|
|
15a1a3ccc7 | ||
|
|
37273299f7 | ||
|
|
7c31850381 | ||
|
|
12aa326dae | ||
|
|
9840b26fa4 | ||
|
|
a100e89671 | ||
|
|
487d21e7ff | ||
|
|
5902a23e78 | ||
|
|
87d4648172 | ||
|
|
acd7e82d2b | ||
|
|
23374c491c | ||
|
|
576710f7a5 | ||
|
|
adf2afae7c | ||
|
|
29eec37c66 | ||
|
|
74ca43a9b6 | ||
|
|
5a490dd9ac | ||
|
|
c70f3da583 | ||
|
|
185bcc5e88 | ||
|
|
c05fff8504 | ||
|
|
a13bed2f51 | ||
|
|
02a0ab4b59 | ||
|
|
5b994f77b1 | ||
|
|
2f2003be52 | ||
|
|
8a7172e1c2 | ||
|
|
99c2dfd569 | ||
|
|
f8a3afa4a1 | ||
|
|
e671a68b48 | ||
|
|
0278e9095d | ||
|
|
16223d0bc3 | ||
|
|
119477060d | ||
|
|
352e6dd19d | ||
|
|
b36542d509 | ||
|
|
254d1a2d8d | ||
|
|
dd72442fee | ||
|
|
b2cd5baa24 | ||
|
|
4e2546a209 | ||
|
|
fe94d52c4c | ||
|
|
fdafa44b2f | ||
|
|
418fb24982 | ||
|
|
3b339fee98 | ||
|
|
0860036454 | ||
|
|
9e3a0626bf | ||
|
|
71a7e23f32 | ||
|
|
6115527e7e | ||
|
|
774cd8b08f | ||
|
|
bc19a18b3c | ||
|
|
256eb1b5a1 | ||
|
|
7e042e7b70 | ||
|
|
c2ff76829f | ||
|
|
0b26834648 | ||
|
|
d7692e1fe5 | ||
|
|
9bbeb75dd8 | ||
|
|
fc09bf751a | ||
|
|
7e00ee1107 | ||
|
|
3fdfdc9963 | ||
|
|
7cc49c9386 | ||
|
|
099dd92eeb | ||
|
|
0654fec1be | ||
|
|
985d15613e | ||
|
|
73502997ff | ||
|
|
3481cebe22 | ||
|
|
a6a3eab8d9 | ||
|
|
5e470bcf0b | ||
|
|
5c1f3b426b | ||
|
|
f659a98d50 | ||
|
|
e22f735f80 | ||
|
|
abf54b60a4 | ||
|
|
24900181f4 | ||
|
|
dd247a0f85 | ||
|
|
8fbb16f838 | ||
|
|
a201689e38 | ||
|
|
2e9d36e220 | ||
|
|
c3cda92272 | ||
|
|
eb916c0c57 | ||
|
|
f4795532c6 | ||
|
|
52175cec3d | ||
|
|
70c91d70c5 | ||
|
|
d4502d02a1 | ||
|
|
ce45960049 | ||
|
|
1240403ce5 | ||
|
|
a676af7c8a | ||
|
|
62976a21b0 | ||
|
|
4a4be9cd99 | ||
|
|
8d694cba9c | ||
|
|
f0317f6dd4 | ||
|
|
c1de3d3370 | ||
|
|
cf6dcf5e19 | ||
|
|
66f77d4a77 | ||
|
|
07e16116fd | ||
|
|
0755196c4d | ||
|
|
3d0f51152a | ||
|
|
48917f34a3 | ||
|
|
98f03df8e5 | ||
|
|
d199186df0 | ||
|
|
892c9ad6b5 | ||
|
|
5a87ca631a | ||
|
|
c6283b5185 | ||
|
|
dee74777db | ||
|
|
61bcec3b57 | ||
|
|
9779a7a340 | ||
|
|
bc0e2a3438 | ||
|
|
b93492b40b | ||
|
|
be85daa23f | ||
|
|
3b6b2474a2 | ||
|
|
6f440ff679 | ||
|
|
98326670b6 | ||
|
|
44b1e3df5d | ||
|
|
929cf2e21f | ||
|
|
aee2c7f91d | ||
|
|
e142bbd1bf | ||
|
|
d4e2bfe892 | ||
|
|
60aaed01ae | ||
|
|
f1c48e9820 | ||
|
|
72286b27cc | ||
|
|
f8e1f85fde | ||
|
|
9f00b402c5 | ||
|
|
5f9ae83f44 | ||
|
|
e395afed51 | ||
|
|
30725e6eb2 | ||
|
|
9c3f84fc67 | ||
|
|
758c83acbf | ||
|
|
58b9b3ec81 | ||
|
|
6ef37e4b3e | ||
|
|
c24f3c7c4d | ||
|
|
f472e1bafb | ||
|
|
b1ca153b72 | ||
|
|
2daef1bcb8 | ||
|
|
806f071348 | ||
|
|
ce932f3825 | ||
|
|
47be64d7f2 | ||
|
|
81fdc3b988 | ||
|
|
19c655b420 | ||
|
|
b9eb941201 | ||
|
|
6bc040a3a5 | ||
|
|
29549aa55a | ||
|
|
17ec87f503 | ||
|
|
e3e2b1af44 | ||
|
|
8a3eeddc80 | ||
|
|
e4e4ba3c7b |
@@ -19,3 +19,5 @@ if you are using Neovim:
|
||||
#### expected behavior
|
||||
|
||||
????
|
||||
|
||||
#### screen shot (if possible)
|
||||
52
.github/workflows/ci.yml
vendored
Normal file
52
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- vim9script
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
vim_version:
|
||||
- 'v8.2.1000'
|
||||
- 'v8.2.0000'
|
||||
- 'v8.1.0000'
|
||||
- 'v8.0.0000'
|
||||
- 'v7.4'
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: actions/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: '2.6'
|
||||
|
||||
- name: Setup Bundle
|
||||
run: |
|
||||
gem install bundler
|
||||
bundle install --jobs 4 --retry 3
|
||||
|
||||
- name: Setup Vim
|
||||
uses: thinca/action-setup-vim@v1
|
||||
with:
|
||||
vim_version: ${{ matrix.vim_version }}
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/simple.vim" -o autoload/airline/themes/simple.vim
|
||||
curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/molokai.vim" -o autoload/airline/themes/molokai.vim
|
||||
mkdir colors && curl -f -L 'https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim' -o colors/molokai.vim
|
||||
|
||||
- name: Run Test
|
||||
run: rake ci
|
||||
22
.github/workflows/reviewdog.yml
vendored
Normal file
22
.github/workflows/reviewdog.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: reviewdog
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
vint:
|
||||
name: runner / vint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: vint
|
||||
uses: reviewdog/action-vint@v1
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
level: error
|
||||
reporter: github-pr-check
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,4 +1,8 @@
|
||||
.DS_Store
|
||||
doc/tags
|
||||
*.lock
|
||||
.vim-flavor
|
||||
*.swp
|
||||
.bundle
|
||||
vendor
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
language: ruby
|
||||
before_install:
|
||||
- curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/simple.vim" -o autoload/airline/themes/simple.vim
|
||||
- curl -f -L "https://raw.githubusercontent.com/vim-airline/vim-airline-themes/master/autoload/airline/themes/molokai.vim" -o autoload/airline/themes/molokai.vim
|
||||
- mkdir colors && curl -f -L 'https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim' -o colors/molokai.vim
|
||||
#rvm:
|
||||
# - 1.9.3
|
||||
script: rake ci
|
||||
27
CHANGELOG.md
27
CHANGELOG.md
@@ -3,6 +3,29 @@
|
||||
This is the Changelog for the vim-airline project.
|
||||
|
||||
## [0.12] - Unreleased
|
||||
- New features
|
||||
- Extensions:
|
||||
- [poetv](https://github.com/petobens/poet-v) support
|
||||
- [vim-lsp](https://github.com/prabirshrestha/vim-lsp) support
|
||||
- [zoomwintab](https://github.com/troydm/zoomwintab.vim) support
|
||||
- [Vaffle](https://github.com/cocopon/vaffle.vim) support
|
||||
- [vim-dirvish](https://github.com/justinmk/vim-dirvish) support
|
||||
- [fzf.vim](https://github.com/junegunn/fzf.vim) support
|
||||
- [OmniSharp](https://github.com/OmniSharp/omnisharp-vim) support
|
||||
- [searchcount](https://vim-jp.org/vimdoc-en/eval.html#searchcount()) support
|
||||
- [fern.vim](https://github.com/lambdalisue/fern.vim) support
|
||||
- [Vim-CMake](https://github.com/cdelledonne/vim-cmake) support
|
||||
- [battery.vim](https://github.com/lambdalisue/battery.vim) support
|
||||
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) support
|
||||
- [gen_tags.vim](https://github.com/jsfaint/gen_tags.vim) support
|
||||
- Improvements
|
||||
- git branch can also be displayed using [gina.vim](https://github.com/lambdalisue/gina.vim)
|
||||
- coc extensions can also show additional status messages
|
||||
- [coc-git](https://github.com/neoclide/coc-git) extension integrated into hunks extension
|
||||
- Other
|
||||
- Introduce Vim script static analysis using [reviewdog](https://github.com/reviewdog/action-vint)
|
||||
- Added multiple Vim versions to unit tests using Travis CI
|
||||
- Added option to show short paths in the status line
|
||||
|
||||
## [0.11] - 2019-11-10
|
||||
- New features
|
||||
@@ -123,7 +146,7 @@ This is the Changelog for the vim-airline project.
|
||||
- [taboo](https://github.com/gcmt/taboo.vim)
|
||||
- [vim-ctrlspace](https://github.com/szw/vim-ctrlspace)
|
||||
- [quickfixsigns](https://github.com/tomtom/quickfixsigns_vim)
|
||||
- [YouCompleteMe](https://github.com/Valloric/YouCompleteMe)
|
||||
- [YouCompleteMe](https://github.com/ycm-core/YouCompleteMe)
|
||||
- [po.vim](http://www.vim.org/scripts/script.php?script_id=695)
|
||||
- [unicode.vim](https://github.com/chrisbra/unicode.vim)
|
||||
- wordcount
|
||||
@@ -212,7 +235,7 @@ This is the Changelog for the vim-airline project.
|
||||
- support for themes: 8 included
|
||||
|
||||
[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.11]: https://github.com/vim-airline/vim-airline/compare/v0.10...v0.11
|
||||
[0.10]: https://github.com/vim-airline/vim-airline/compare/v0.9...v0.10
|
||||
[0.9]: https://github.com/vim-airline/vim-airline/compare/v0.8...v0.9
|
||||
[0.8]: https://github.com/vim-airline/vim-airline/compare/v0.7...v0.8
|
||||
|
||||
@@ -4,17 +4,15 @@ Contributions and pull requests are welcome. Please take note of the following
|
||||
|
||||
* Adhere to the existing style as much as possible; notably, 2 space indents and long-form keywords.
|
||||
* Keep the history clean! Squash your branches before you submit a pull request. `pull --rebase` is your friend.
|
||||
* Any changes to the core should be tested against Vim 7.2.
|
||||
* Any changes to the core should be tested against Vim 7.4.
|
||||
|
||||
# Bugs
|
||||
|
||||
Tracking down bugs can take a very long time due to different configurations, versions, and operating systems. To ensure a timely response, please help me out by doing the following:
|
||||
|
||||
* Reproduce it with this [minivimrc][7] repository to rule out any configuration conflicts. Even better, create a `gist` of your vimrc that is compatible with [pathogen][11].
|
||||
* And to make it easier to reproduce, please supply the following:
|
||||
* the `:version` of vim
|
||||
* the commit of vim-airline you're using
|
||||
* the OS that you're using, including terminal emulator, GUI vs non-GUI
|
||||
* the `:version` of vim
|
||||
* the commit of vim-airline you're using
|
||||
* the OS that you're using, including terminal emulator, GUI vs non-GUI
|
||||
|
||||
# Themes
|
||||
|
||||
@@ -26,7 +24,5 @@ Tracking down bugs can take a very long time due to different configurations, ve
|
||||
If you would like to take a more active role in improving vim-airline, please consider [becoming a maintainer][43].
|
||||
|
||||
|
||||
[7]: https://github.com/bling/minivimrc
|
||||
[11]: https://github.com/tpope/vim-pathogen
|
||||
[14]: https://github.com/vim-airline/vim-airline/wiki/Screenshots
|
||||
[43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -1,2 +1,2 @@
|
||||
source 'https://rubygems.org'
|
||||
gem 'vim-flavor', '~> 1.1'
|
||||
gem 'vim-flavor', '~> 2.2.2'
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2013-2019 Bailey Ling, Christian Brabandt, et al.
|
||||
Copyright (C) 2013-2020 Bailey Ling, Christian Brabandt, et al.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
|
||||
44
README.md
44
README.md
@@ -1,11 +1,11 @@
|
||||
# vim-airline [](https://travis-ci.org/vim-airline/vim-airline)[](https://saythanks.io/to/chrisbra)
|
||||
# vim-airline [](https://travis-ci.org/vim-airline/vim-airline) [](https://saythanks.io/to/cb%40256bit.org) [](https://github.com/vim-airline/vim-airline/actions?query=workflow%3Areviewdog+event%3Apush+branch%3Amaster)
|
||||
|
||||
Lean & mean status/tabline for vim that's light as air.
|
||||
Lean & mean status/tabline for vim that's light as air.
|
||||
|
||||

|
||||
|
||||
When the plugin is correctly loaded, Vim will draw a nice statusline at the
|
||||
bottom of each window.
|
||||
When the plugin is correctly loaded, there will be a nice statusline at the
|
||||
bottom of each vim window.
|
||||
|
||||
That line consists of several sections, each one displaying some piece of
|
||||
information. By default (without configuration) this line will look like this:
|
||||
@@ -16,7 +16,7 @@ information. By default (without configuration) this line will look like this:
|
||||
|~ |
|
||||
|~ VIM - Vi IMproved |
|
||||
|~ |
|
||||
|~ version 8.0 |
|
||||
|~ version 8.2 |
|
||||
|~ by Bram Moolenaar et al. |
|
||||
|~ Vim is open source and freely distributable |
|
||||
|~ |
|
||||
@@ -36,7 +36,7 @@ The statusline is the colored line at the bottom, which contains the sections
|
||||
section|meaning (example)
|
||||
-------|------------------
|
||||
A | displays the mode + additional flags like crypt/spell/paste (INSERT)
|
||||
B | VCS information (branch, hunk summary) (master)
|
||||
B | Environment status (VCS information - branch, hunk summary (master), [battery][61] level)
|
||||
C | filename + read-only flag (~/.vim/vimrc RO)
|
||||
X | filetype (vim)
|
||||
Y | file encoding[fileformat] (utf-8[unix])
|
||||
@@ -66,11 +66,12 @@ For a better look, those sections can be colored differently, depending on vario
|
||||
[undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29],
|
||||
[vim-signify][30], [quickfixsigns][39], [syntastic][5], [eclim][34],
|
||||
[lawrencium][21], [virtualenv][31], [tmuxline][35], [taboo.vim][37],
|
||||
[ctrlspace][38], [vim-bufmru][47], [vimagit][50], [denite][51] and more.
|
||||
[ctrlspace][38], [vim-bufmru][47], [vimagit][50], [denite][51],
|
||||
[vim.battery][61] and more.
|
||||
* Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
|
||||
* Optimized for speed; it loads in under a millisecond.
|
||||
* Optimized for speed - loads in under a millisecond.
|
||||
* Extensive suite of themes for popular color schemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others.
|
||||
Note these are now external to this plugin. See [below][46] for detail.
|
||||
Note these are now external to this plugin. More details can be found in the [themes repository][46].
|
||||
* Supports 7.2 as the minimum Vim version.
|
||||
* The master branch tries to be as stable as possible, and new features are merged in only after they have gone through a [full regression test][33].
|
||||
* Unit testing suite.
|
||||
@@ -93,7 +94,7 @@ Plugin 'vim-airline/vim-airline'
|
||||
Plugin 'vim-airline/vim-airline-themes'
|
||||
```
|
||||
|
||||
See https://github.com/vim-airline/vim-airline-themes for more.
|
||||
See [vim-airline-themes][46] for more.
|
||||
|
||||
## Automatic truncation
|
||||
|
||||
@@ -158,7 +159,7 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
|
||||
#### [syntastic][5]
|
||||

|
||||
|
||||
#### hunks ([vim-gitgutter][29] & [vim-signify][30])
|
||||
#### hunks ([vim-gitgutter][29] & [vim-signify][30] & [coc-git][59])
|
||||

|
||||
|
||||
#### [vimagit][50]
|
||||
@@ -188,6 +189,12 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
|
||||
#### [LanguageClient][57]
|
||||

|
||||
|
||||
#### [Vim-CMake][60]
|
||||

|
||||
|
||||
#### [vim.battery][61]
|
||||

|
||||
|
||||
## Extras
|
||||
|
||||
vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also:
|
||||
@@ -196,7 +203,7 @@ vim-airline also supplies some supplementary stand-alone extensions. In additio
|
||||

|
||||
|
||||
### statusline on top
|
||||
The statusline can alternatively by drawn on top, making room for other plugins to use the statusline:
|
||||
The statusline can alternatively be drawn on top, making room for other plugins to use the statusline:
|
||||
The example shows a custom statusline setting, that imitates Vims default statusline, while allowing
|
||||
to call custom functions. Use `:let g:airline_statusline_ontop=1` to enable it.
|
||||
|
||||
@@ -247,7 +254,7 @@ This plugin follows the standard runtime path structure, and as such it can be i
|
||||
| [VAM][22] | `call vam#ActivateAddons([ 'vim-airline' ])` |
|
||||
| [Dein][52] | `call dein#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 |
|
||||
| pack feature (native Vim 8 package feature)| `git clone https://github.com/vim-airline/vim-airline ~/.vim/pack/dist/start/vim-airline`<br/>Remember to run `:helptags ~/.vim/pack/dist/start/vim-airline/doc` to generate help tags |
|
||||
| manual | copy all of the files into your `~/.vim` directory |
|
||||
|
||||
# Documentation
|
||||
@@ -266,7 +273,7 @@ Solutions to common problems can be found in the [Wiki][27].
|
||||
|
||||
# Performance
|
||||
|
||||
Whoa! Everything got slow all of a sudden...
|
||||
Whoa! Everything got slow all of a sudden...
|
||||
|
||||
vim-airline strives to make it easy to use out of the box, which means that by default it will look for all compatible plugins that you have installed and enable the relevant extension.
|
||||
|
||||
@@ -292,7 +299,7 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
|
||||
|
||||
# License
|
||||
|
||||
[MIT License][58]. Copyright (c) 2013-2019 Bailey Ling & Contributors.
|
||||
[MIT License][58]. Copyright (c) 2013-2020 Bailey Ling & Contributors.
|
||||
|
||||
[1]: https://github.com/Lokaltog/vim-powerline
|
||||
[2]: https://github.com/Lokaltog/powerline
|
||||
@@ -311,7 +318,7 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
|
||||
[15]: https://github.com/techlivezheng/vim-plugin-minibufexpl
|
||||
[16]: https://github.com/sjl/gundo.vim
|
||||
[17]: https://github.com/mbbill/undotree
|
||||
[18]: https://github.com/scrooloose/nerdtree
|
||||
[18]: https://github.com/preservim/nerdtree
|
||||
[19]: https://github.com/majutsushi/tagbar
|
||||
[20]: https://powerline.readthedocs.org/en/master/installation.html#patched-fonts
|
||||
[21]: https://bitbucket.org/ludovicchabant/vim-lawrencium
|
||||
@@ -339,7 +346,7 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
|
||||
[43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer
|
||||
[44]: https://github.com/mhartington
|
||||
[45]: https://github.com/vim-airline/vim-airline/commit/d7fd8ca649e441b3865551a325b10504cdf0711b
|
||||
[46]: https://github.com/vim-airline/vim-airline#themes
|
||||
[46]: https://github.com/vim-airline/vim-airline-themes#vim-airline-themes--
|
||||
[47]: https://github.com/mildred/vim-bufmru
|
||||
[48]: https://github.com/ierton/xkb-switch
|
||||
[49]: https://github.com/vovkasm/input-source-switcher
|
||||
@@ -352,3 +359,6 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
|
||||
[56]: https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/dark_minimal.vim
|
||||
[57]: https://github.com/autozimu/LanguageClient-neovim
|
||||
[58]: https://github.com/vim-airline/vim-airline/blob/master/LICENSE
|
||||
[59]: https://github.com/neoclide/coc-git
|
||||
[60]: https://github.com/cdelledonne/vim-cmake
|
||||
[61]: http://github.com/lambdalisue/battery.vim/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -125,7 +125,7 @@ endfunction
|
||||
|
||||
" Update the statusline
|
||||
function! airline#update_statusline()
|
||||
if airline#util#getwinvar(winnr(), 'airline_disabled', 0)
|
||||
if airline#util#stl_disabled(winnr())
|
||||
return
|
||||
endif
|
||||
let range = filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||
@@ -154,11 +154,11 @@ endfunction
|
||||
|
||||
" Function to draw inactive statuslines for inactive windows
|
||||
function! airline#update_statusline_inactive(range)
|
||||
if airline#util#getwinvar(winnr(), 'airline_disabled', 0)
|
||||
if airline#util#stl_disabled(winnr())
|
||||
return
|
||||
endif
|
||||
for nr in a:range
|
||||
if airline#util#getwinvar(nr, 'airline_disabled', 0)
|
||||
if airline#util#stl_disabled(nr)
|
||||
continue
|
||||
endif
|
||||
call setwinvar(nr, 'airline_active', 0)
|
||||
@@ -221,7 +221,7 @@ function! airline#check_mode(winnr)
|
||||
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:mode = ['insert']
|
||||
let l:m = 'ni'
|
||||
else
|
||||
let l:mode = ['normal']
|
||||
@@ -262,7 +262,7 @@ function! airline#check_mode(winnr)
|
||||
let mode_string = join(l:mode)
|
||||
if get(w:, 'airline_lastmode', '') != mode_string
|
||||
call airline#highlighter#highlight_modified_inactive(context.bufnr)
|
||||
call airline#highlighter#highlight(l:mode, context.bufnr)
|
||||
call airline#highlighter#highlight(l:mode, string(context.bufnr))
|
||||
call airline#util#doautocmd('AirlineModeChanged')
|
||||
let w:airline_lastmode = mode_string
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -131,10 +131,10 @@ if v:version >= 800 && has("job")
|
||||
endfunction
|
||||
|
||||
function! airline#async#get_mq_async(cmd, file)
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
|
||||
let cmd = a:cmd
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd]
|
||||
let cmd = [&shell, &shellcmdflag, a:cmd]
|
||||
endif
|
||||
|
||||
let options = {'cmd': a:cmd, 'buf': '', 'file': a:file}
|
||||
@@ -153,9 +153,12 @@ if v:version >= 800 && has("job")
|
||||
endfunction
|
||||
|
||||
function! airline#async#get_msgfmt_stat(cmd, file)
|
||||
if g:airline#init#is_windows || !executable('msgfmt')
|
||||
" no msgfmt on windows?
|
||||
if !executable('msgfmt')
|
||||
" no msgfmt
|
||||
return
|
||||
endif
|
||||
if g:airline#init#is_windows
|
||||
let cmd = 'cmd /C ' . a:cmd. shellescape(a:file)
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
|
||||
endif
|
||||
@@ -176,10 +179,10 @@ if v:version >= 800 && has("job")
|
||||
endfunction
|
||||
|
||||
function! airline#async#vim_vcs_clean(cmd, file, vcs)
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
|
||||
let cmd = a:cmd
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd]
|
||||
let cmd = [&shell, &shellcmdflag, a:cmd]
|
||||
endif
|
||||
|
||||
let options = {'buf': '', 'vcs': a:vcs, 'file': a:file}
|
||||
@@ -202,10 +205,10 @@ if v:version >= 800 && has("job")
|
||||
endfunction
|
||||
|
||||
function! airline#async#vim_vcs_untracked(config, file)
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
|
||||
let cmd = a:config['cmd'] . shellescape(a:file)
|
||||
else
|
||||
let cmd = ['sh', '-c', a:config['cmd'] . shellescape(a:file)]
|
||||
let cmd = [&shell, &shellcmdflag, a:config['cmd'] . shellescape(a:file)]
|
||||
endif
|
||||
|
||||
let options = {'cfg': a:config, 'buf': '', 'file': a:file}
|
||||
@@ -263,10 +266,10 @@ elseif has("nvim")
|
||||
\ 'on_stderr': function('s:nvim_output_handler'),
|
||||
\ 'on_exit': function('s:nvim_mq_job_handler')
|
||||
\ }
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
|
||||
let cmd = a:cmd
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd]
|
||||
let cmd = [&shell, &shellcmdflag, a:cmd]
|
||||
endif
|
||||
|
||||
if has_key(s:mq_jobs, a:file)
|
||||
@@ -285,11 +288,11 @@ elseif has("nvim")
|
||||
\ 'on_stderr': function('s:nvim_output_handler'),
|
||||
\ 'on_exit': function('s:nvim_po_job_handler')
|
||||
\ }
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
|
||||
" no msgfmt on windows?
|
||||
return
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
|
||||
let cmd = [&shell, &shellcmdflag, a:cmd. shellescape(a:file)]
|
||||
endif
|
||||
|
||||
if has_key(s:po_jobs, a:file)
|
||||
@@ -308,10 +311,10 @@ elseif has("nvim")
|
||||
\ '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'
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell'
|
||||
let cmd = a:cmd
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd]
|
||||
let cmd = [&shell, &shellcmdflag, a:cmd]
|
||||
endif
|
||||
|
||||
if !has_key(s:clean_jobs, a:vcs)
|
||||
@@ -369,6 +372,8 @@ function! airline#async#vim7_vcs_clean(cmd, file, vcs)
|
||||
" don't want to to see error messages
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
let cmd = a:cmd .' 2>nul'
|
||||
elseif g:airline#init#is_windows && &shell =~ 'powerline'
|
||||
let cmd = a:cmd .' 2> $null'
|
||||
else
|
||||
let cmd = a:cmd .' 2>/dev/null'
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -133,11 +133,8 @@ function! airline#builder#should_change_group(group1, group2)
|
||||
endif
|
||||
let color1 = airline#highlighter#get_highlight(a:group1)
|
||||
let color2 = airline#highlighter#get_highlight(a:group2)
|
||||
if g:airline_gui_mode ==# 'gui'
|
||||
return color1[1] != color2[1] || color1[0] != color2[0]
|
||||
else
|
||||
return color1[3] != color2[3] || color1[2] != color2[2]
|
||||
endif
|
||||
return color1[1] != color2[1] || color1[0] != color2[0]
|
||||
\ || color1[2] != color2[2] || color1[3] != color2[3]
|
||||
endfunction
|
||||
|
||||
function! s:get_transitioned_seperator(self, prev_group, group, side)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -23,24 +23,23 @@ endfunction
|
||||
let s:script_path = tolower(resolve(expand('<sfile>:p:h')))
|
||||
|
||||
let s:filetype_overrides = {
|
||||
\ 'coc-explorer': [ 'CoC Explorer', '' ],
|
||||
\ 'defx': ['defx', '%{b:defx.paths[0]}'],
|
||||
\ 'fugitive': ['fugitive', '%{airline#util#wrap(airline#extensions#branch#get_head(),80)}'],
|
||||
\ 'gundo': [ 'Gundo', '' ],
|
||||
\ '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()}'],
|
||||
\ 'vaffle' : [ 'Vaffle', '%{b:vaffle.dir}' ],
|
||||
\ }
|
||||
|
||||
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()}' ]
|
||||
if get(g:, 'airline#extensions#nerdtree_statusline', 1)
|
||||
let s:filetype_overrides['nerdtree'] = [ get(g:, 'NERDTreeStatusline', 'NERD'), '' ]
|
||||
else
|
||||
let s:filetype_overrides['nerdtree'] = ['NERDTree', '']
|
||||
endif
|
||||
|
||||
let s:filetype_regex_overrides = {}
|
||||
@@ -82,7 +81,7 @@ function! airline#extensions#apply(...)
|
||||
let w:airline_section_y = ''
|
||||
endif
|
||||
|
||||
if &previewwindow
|
||||
if &previewwindow && empty(get(w:, 'airline_section_a', ''))
|
||||
let w:airline_section_a = 'Preview'
|
||||
let w:airline_section_b = ''
|
||||
let w:airline_section_c = bufname(winbufnr(winnr()))
|
||||
@@ -142,7 +141,9 @@ function! airline#extensions#load()
|
||||
call airline#extensions#{ext}#init(s:ext)
|
||||
catch /^Vim\%((\a\+)\)\=:E117/ " E117, function does not exist
|
||||
call airline#util#warning("Extension '".ext."' not installed, ignoring!")
|
||||
continue
|
||||
endtry
|
||||
call add(s:loaded_ext, ext)
|
||||
endfor
|
||||
return
|
||||
endif
|
||||
@@ -150,28 +151,50 @@ function! airline#extensions#load()
|
||||
call airline#extensions#quickfix#init(s:ext)
|
||||
call add(s:loaded_ext, 'quickfix')
|
||||
|
||||
if get(g:, 'loaded_unite', 0)
|
||||
if get(g:, 'loaded_unite', 0) && get(g:, 'airline#extensions#unite#enabled', 1)
|
||||
call airline#extensions#unite#init(s:ext)
|
||||
call add(s:loaded_ext, 'unite')
|
||||
endif
|
||||
|
||||
if get(g:, 'loaded_denite', 0)
|
||||
if get(g:, 'loaded_denite', 0) && get(g:, 'airline#extensions#denite#enabled', 1)
|
||||
call airline#extensions#denite#init(s:ext)
|
||||
call add(s:loaded_ext, 'denite')
|
||||
endif
|
||||
|
||||
if get(g:, 'loaded_gina', 0) && get(g:, 'airline#extensions#gina#enabled', 1)
|
||||
call airline#extensions#gina#init(s:ext)
|
||||
call add(s:loaded_ext, 'gina')
|
||||
endif
|
||||
|
||||
if get(g:, 'fern_loaded', 0) && get(g:, 'airline#extensions#fern#enabled', 1)
|
||||
call airline#extensions#fern#init(s:ext)
|
||||
call add(s:loaded_ext, 'fern')
|
||||
endif
|
||||
|
||||
if exists(':NetrwSettings')
|
||||
call airline#extensions#netrw#init(s:ext)
|
||||
call add(s:loaded_ext, 'netrw')
|
||||
endif
|
||||
|
||||
" fzf buffers are also terminal buffers, so this must be above term.
|
||||
if exists(':FZF') && get(g:, 'airline#extensions#fzf#enabled', 1)
|
||||
call airline#extensions#fzf#init(s:ext)
|
||||
call add(s:loaded_ext, 'fzf')
|
||||
endif
|
||||
|
||||
" Vim-CMake buffers are also terminal buffers, so this must be above term.
|
||||
if get(g:, 'loaded_cmake', 0) && get(g:, 'airline#extensions#vimcmake#enabled', 1)
|
||||
call airline#extensions#vimcmake#init(s:ext)
|
||||
call add(s:loaded_ext, 'vimcmake')
|
||||
endif
|
||||
|
||||
if (has("terminal") || has('nvim')) &&
|
||||
\ get(g:, 'airline#extensions#term#enabled', 1)
|
||||
call airline#extensions#term#init(s:ext)
|
||||
call add(s:loaded_ext, 'term')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#ycm#enabled', 0)
|
||||
if get(g:, 'airline#extensions#ycm#enabled', 0) && exists('g:loaded_youcompleteme')
|
||||
call airline#extensions#ycm#init(s:ext)
|
||||
call add(s:loaded_ext, 'ycm')
|
||||
endif
|
||||
@@ -206,7 +229,11 @@ function! airline#extensions#load()
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#hunks#enabled', 1)
|
||||
\ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes') || exists('g:loaded_quickfixsigns'))
|
||||
\ && (exists('g:loaded_signify')
|
||||
\ || exists('g:loaded_gitgutter')
|
||||
\ || exists('g:loaded_changes')
|
||||
\ || exists('g:loaded_quickfixsigns')
|
||||
\ || exists(':CocCommand'))
|
||||
call airline#extensions#hunks#init(s:ext)
|
||||
call add(s:loaded_ext, 'hunks')
|
||||
endif
|
||||
@@ -224,6 +251,7 @@ function! airline#extensions#load()
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#vista#enabled', 1)
|
||||
\ && exists(':Vista')
|
||||
call airline#extensions#vista#init(s:ext)
|
||||
call add(s:loaded_ext, 'vista')
|
||||
endif
|
||||
@@ -240,12 +268,18 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'csv')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#zoomwintab#enabled', 0)
|
||||
call airline#extensions#zoomwintab#init(s:ext)
|
||||
call add(s:loaded_ext, 'zoomwintab')
|
||||
endif
|
||||
|
||||
if exists(':VimShell')
|
||||
let s:filetype_regex_overrides['^int-'] = ['vimshell','%{substitute(&ft, "int-", "", "")}']
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#branch#enabled', 1) && (
|
||||
\ airline#util#has_fugitive() ||
|
||||
\ airline#util#has_gina() ||
|
||||
\ airline#util#has_lawrencium() ||
|
||||
\ airline#util#has_vcscommand() ||
|
||||
\ airline#util#has_custom_scm())
|
||||
@@ -266,9 +300,20 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'fugitiveline')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV)))
|
||||
" NOTE: This means that if both virtualenv and poetv are enabled and
|
||||
" available, poetv silently takes precedence and the virtualenv
|
||||
" extension won't be initialized. Since both extensions currently just
|
||||
" add a virtualenv identifier section to the airline, this seems
|
||||
" acceptable.
|
||||
if (get(g:, 'airline#extensions#poetv#enabled', 0) && (exists(':PoetvActivate')))
|
||||
call airline#extensions#poetv#init(s:ext)
|
||||
call add(s:loaded_ext, 'poetv')
|
||||
elseif (get(g:, 'airline#extensions#virtualenv#enabled', 0) && (exists(':VirtualEnvList')))
|
||||
call airline#extensions#virtualenv#init(s:ext)
|
||||
call add(s:loaded_ext, 'virtualenv')
|
||||
elseif (get(g:, 'airline#extensions#poetv#enabled', 0) && (isdirectory($VIRTUAL_ENV)))
|
||||
call airline#extensions#poetv#init(s:ext)
|
||||
call add(s:loaded_ext, 'poetv')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate'))
|
||||
@@ -287,6 +332,17 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'ale')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#lsp#enabled', 1) && exists(':LspDeclaration'))
|
||||
call airline#extensions#lsp#init(s:ext)
|
||||
call add(s:loaded_ext, 'lsp')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#nvimlsp#enabled', 1)
|
||||
\ && exists(':LspInstallInfo'))
|
||||
call airline#extensions#nvimlsp#init(s:ext)
|
||||
call add(s:loaded_ext, 'nvimlsp')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#coc#enabled', 1) && exists(':CocCommand'))
|
||||
call airline#extensions#coc#init(s:ext)
|
||||
call add(s:loaded_ext, 'coc')
|
||||
@@ -332,7 +388,7 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'promptline')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2
|
||||
if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && get(g:, 'loaded_nrrw_rgn', 0)
|
||||
call airline#extensions#nrrwrgn#init(s:ext)
|
||||
call add(s:loaded_ext, 'nrrwrgn')
|
||||
endif
|
||||
@@ -352,6 +408,11 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'gutentags')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#gen_tags#enabled', 1) && (get(g:, 'loaded_gentags#gtags', 0) || get(g:, 'loaded_gentags#ctags', 0))
|
||||
call airline#extensions#gen_tags#init(s:ext)
|
||||
call add(s:loaded_ext, 'gen_tags')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#grepper#enabled', 1) && get(g:, 'loaded_grepper', 0))
|
||||
call airline#extensions#grepper#init(s:ext)
|
||||
call add(s:loaded_ext, 'grepper')
|
||||
@@ -390,6 +451,16 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'cursormode')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#searchcount#enabled', 1) && exists('*searchcount')
|
||||
call airline#extensions#searchcount#init(s:ext)
|
||||
call add(s:loaded_ext, 'searchcount')
|
||||
endif
|
||||
|
||||
if get(g:, 'loaded_battery', 0) && get(g:, 'airline#extensions#battery#enabled', 0)
|
||||
call airline#extensions#battery#init(s:ext)
|
||||
call add(s:loaded_ext, 'battery')
|
||||
endif
|
||||
|
||||
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
|
||||
" load all other extensions, which are not part of the default distribution.
|
||||
" (autoload/airline/extensions/*.vim outside of our s:script_path).
|
||||
@@ -412,6 +483,17 @@ function! airline#extensions#load()
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if exists(':Dirvish') && get(g:, 'airline#extensions#dirvish#enabled', 1)
|
||||
call airline#extensions#dirvish#init(s:ext)
|
||||
call add(s:loaded_ext, 'dirvish')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#omnisharp#enabled', 1) && get(g:, 'OmniSharp_loaded', 0))
|
||||
call airline#extensions#omnisharp#init(s:ext)
|
||||
call add(s:loaded_ext, 'omnisharp')
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#get_loaded_extensions()
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bjorn Neergaard, w0rp et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bjorn Neergaard, w0rp et al.
|
||||
" Plugin: https://github.com/dense-analysis/ale
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_ale_dont_use_this_in_other_plugins_please', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! s:airline_ale_count(cnt, symbol)
|
||||
return a:cnt ? a:symbol. a:cnt : ''
|
||||
endfunction
|
||||
|
||||
23
autoload/airline/extensions/battery.vim
Normal file
23
autoload/airline/extensions/battery.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/lambdalisue/battery.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('g:loaded_battery')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#battery#status(...) abort
|
||||
if !exists('g:battery#update_statusline')
|
||||
let g:battery#update_statusline = 1
|
||||
call battery#update()
|
||||
endif
|
||||
|
||||
let bat = battery#component()
|
||||
return bat
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#battery#init(ext) abort
|
||||
call airline#parts#define_function('battery', 'airline#extensions#battery#status')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2019 Bjoern Petri <bjoern.petri@sundevil.de>
|
||||
" MIT License. Copyright (c) 2020 Bjoern Petri <bjoern.petri@sundevil.de>
|
||||
" Plugin: https://github.com/MattesGroeger/vim-bookmarks
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -8,23 +8,23 @@ if !exists(':BookmarkToggle')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#bookmark#currentbookmark()
|
||||
function! airline#extensions#bookmark#currentbookmark() abort
|
||||
if get(w:, 'airline_active', 0)
|
||||
let file = expand("%:p")
|
||||
if file ==# ""
|
||||
return
|
||||
endif
|
||||
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'] : ""
|
||||
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 annotation
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#bookmark#init(ext)
|
||||
function! airline#extensions#bookmark#init(ext) abort
|
||||
call airline#parts#define_function('bookmark', 'airline#extensions#bookmark#currentbookmark')
|
||||
endfunction
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: fugitive, lawrencium and vcscommand
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: fugitive, gina, lawrencium and vcscommand
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -85,21 +85,37 @@ 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 !airline#util#has_fugitive()
|
||||
call airline#util#ignore_next_focusgain()
|
||||
if !airline#util#has_fugitive() && !airline#util#has_gina()
|
||||
let s:vcs_config['git'].branch = ''
|
||||
return
|
||||
endif
|
||||
|
||||
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'
|
||||
if airline#util#has_fugitive()
|
||||
let s:vcs_config['git'].branch = exists("*FugitiveHead") ?
|
||||
\ FugitiveHead(s:sha1size) : fugitive#head(s:sha1size)
|
||||
if s:vcs_config['git'].branch is# 'master' &&
|
||||
\ airline#util#winwidth() < 81
|
||||
" Shorten default a bit
|
||||
let s:vcs_config['git'].branch='mas'
|
||||
endif
|
||||
else
|
||||
try
|
||||
let g:gina#component#repo#commit_length = s:sha1size
|
||||
let s:vcs_config['git'].branch = gina#component#repo#branch()
|
||||
catch
|
||||
endtry
|
||||
if s:vcs_config['git'].branch is# 'master' &&
|
||||
\ airline#util#winwidth() < 81
|
||||
" Shorten default a bit
|
||||
let s:vcs_config['git'].branch='mas'
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:display_git_branch()
|
||||
" disable FocusGained autocommand, might cause loops because system() causes
|
||||
" a refresh, which causes a system() command again #2029
|
||||
call airline#util#ignore_next_focusgain()
|
||||
let name = b:buffer_vcs_config['git'].branch
|
||||
try
|
||||
let commit = matchstr(FugitiveParse()[0], '^\x\+')
|
||||
@@ -116,7 +132,6 @@ function! s:display_git_branch()
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
|
||||
return name
|
||||
endfunction
|
||||
|
||||
@@ -200,7 +215,7 @@ function! s:update_untracked()
|
||||
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()
|
||||
if vcs is# 'git' && (!airline#util#has_fugitive() && !airline#util#has_gina())
|
||||
continue
|
||||
elseif vcs is# 'mercurial' && !airline#util#has_lawrencium()
|
||||
continue
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/bling/vim-bufferline
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2019 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/tpope/vim-capslock
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -9,7 +9,7 @@ if !exists('*CapsLockStatusline')
|
||||
endif
|
||||
|
||||
function! airline#extensions#capslock#status()
|
||||
return tolower(CapsLockStatusline()) == '[caps]' ? 'CAPS' : ''
|
||||
return tolower(CapsLockStatusline()) ==# '[caps]' ? get(g:, 'airline#extensions#capslock#symbol', 'CAPS') : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#capslock#init(ext)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2019 Peng Guanwen et al.
|
||||
" MIT License. Copyright (c) 2019-2020 Peng Guanwen et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
" Plugin: https://github.com/neoclide/coc
|
||||
|
||||
@@ -7,16 +7,16 @@ 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()
|
||||
function! airline#extensions#coc#get_warning() abort
|
||||
return airline#extensions#coc#get('warning')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#coc#get_error()
|
||||
function! airline#extensions#coc#get_error() abort
|
||||
return airline#extensions#coc#get('error')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#coc#get(type)
|
||||
if !exists(":CocCommand")
|
||||
function! airline#extensions#coc#get(type) abort
|
||||
if !exists(':CocCommand')
|
||||
return ''
|
||||
endif
|
||||
let _backup = get(g:, 'coc_stl_format', '')
|
||||
@@ -42,7 +42,13 @@ function! airline#extensions#coc#get(type)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#coc#init(ext)
|
||||
function! airline#extensions#coc#get_status() abort
|
||||
" Shorten text for windows < 91 characters
|
||||
return airline#util#shorten(get(g:, 'coc_status', ''), 91, 9)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#coc#init(ext) abort
|
||||
call airline#parts#define_function('coc_error_count', 'airline#extensions#coc#get_error')
|
||||
call airline#parts#define_function('coc_warning_count', 'airline#extensions#coc#get_warning')
|
||||
call airline#parts#define_function('coc_status', 'airline#extensions#coc#get_status')
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/wincent/command-t
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/chrisbra/csv.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/ctrlpvim/ctrlp.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/szw/vim-ctrlspace
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#ctrlspace#statusline(...)
|
||||
function! airline#extensions#ctrlspace#statusline(...) abort
|
||||
let spc = g:airline_symbols.space
|
||||
let padding = spc . spc . spc
|
||||
let l:padding = spc . spc . spc
|
||||
let cs = ctrlspace#context#Configuration().Symbols.CS
|
||||
|
||||
let b = airline#builder#new({ 'active': 1 })
|
||||
call b.add_section('airline_b', cs . padding . ctrlspace#api#StatuslineModeSegment(s:padding))
|
||||
call b.add_section('airline_b', cs . l:padding . ctrlspace#api#StatuslineModeSegment(l:padding))
|
||||
call b.split()
|
||||
call b.add_section('airline_x', spc . ctrlspace#api#StatuslineTabSegment() . spc)
|
||||
return b.build()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ctrlspace#init(ext)
|
||||
function! airline#extensions#ctrlspace#init(ext) abort
|
||||
let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()"
|
||||
endfunction
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if exists('g:loaded_cursormode')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_cursormode = 1
|
||||
|
||||
let s:is_win = has('win32') || has('win64')
|
||||
let s:is_iTerm = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'iTerm.app'
|
||||
let s:is_AppleTerminal = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'Apple_Terminal'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2019 Thomas Dy et al.
|
||||
" MIT License. Copyright (c) 2017-2020 Thomas Dy et al.
|
||||
" Plugin: https://github.com/Shougo/denite.nvim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -12,8 +12,8 @@ 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' || &filetype !=# 'denite-filter'
|
||||
function! airline#extensions#denite#check_denite_mode(bufnr) abort
|
||||
if &filetype !=# 'denite' && &filetype !=# 'denite-filter'
|
||||
return ''
|
||||
endif
|
||||
|
||||
@@ -30,7 +30,7 @@ function! airline#extensions#denite#check_denite_mode(bufnr)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#denite#apply(...)
|
||||
function! airline#extensions#denite#apply(...) abort
|
||||
if &filetype ==# 'denite' || &filetype ==# 'denite-filter'
|
||||
let w:airline_skip_empty_sections = 0
|
||||
call a:1.add_section('airline_a', ' Denite %{airline#extensions#denite#check_denite_mode('.a:2['bufnr'].')}')
|
||||
@@ -49,7 +49,7 @@ function! airline#extensions#denite#apply(...)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#denite#init(ext)
|
||||
function! airline#extensions#denite#init(ext) abort
|
||||
call denite#custom#option('_', 'statusline', 0)
|
||||
call a:ext.add_statusline_func('airline#extensions#denite#apply')
|
||||
endfunction
|
||||
|
||||
36
autoload/airline/extensions/dirvish.vim
Normal file
36
autoload/airline/extensions/dirvish.vim
Normal file
@@ -0,0 +1,36 @@
|
||||
" MIT Licsense
|
||||
" Plugin: https://github.com/justinmk/vim-dirvish
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_dirvish', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! airline#extensions#dirvish#init(ext) abort
|
||||
call a:ext.add_statusline_func('airline#extensions#dirvish#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#dirvish#apply(...) abort
|
||||
if &filetype ==# 'dirvish' && exists('b:dirvish')
|
||||
let w:airline_section_a = 'Dirvish'
|
||||
|
||||
let w:airline_section_b = exists('*airline#extensions#branch#get_head')
|
||||
\ ? '%{airline#extensions#branch#get_head()}'
|
||||
\ : ''
|
||||
|
||||
let w:airline_section_c = '%{b:dirvish._dir}'
|
||||
|
||||
let w:airline_section_x = ''
|
||||
let w:airline_section_y = ''
|
||||
|
||||
let current_column_regex = ':%\dv'
|
||||
let w:airline_section_z = join(filter(
|
||||
\ split(get(w:, 'airline_section_z', g:airline_section_z)),
|
||||
\ 'v:val !~ current_column_regex'
|
||||
\ ))
|
||||
endif
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" PLugin: https://eclim.org
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
36
autoload/airline/extensions/fern.vim
Normal file
36
autoload/airline/extensions/fern.vim
Normal file
@@ -0,0 +1,36 @@
|
||||
" MIT License. Copyright (c) 2013-2020
|
||||
" Plugin: https://github.com/lambdalisue/fern.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
if !get(g:, 'fern_loaded', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#fern#apply(...) abort
|
||||
if (&ft =~# 'fern')
|
||||
let spc = g:airline_symbols.space
|
||||
let fri = fern#fri#parse(expand('%f'))
|
||||
|
||||
call a:1.add_section('airline_a', spc.'fern'.spc)
|
||||
if exists('*airline#extensions#branch#get_head')
|
||||
call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc)
|
||||
else
|
||||
call a:1.add_section('airline_b', '')
|
||||
endif
|
||||
if !(fri.authority =~# '^drawer')
|
||||
let abspath = substitute(fri.path, 'file://', '', '')
|
||||
call a:1.add_section('airline_c', spc.fnamemodify(abspath, ':~'))
|
||||
call a:1.split()
|
||||
if len(get(g:, 'fern#comparators', {}))
|
||||
call a:1.add_section('airline_y', spc.'%{fern#comparator}'.spc)
|
||||
endif
|
||||
endif
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#fern#init(ext) abort
|
||||
let g:fern_force_overwrite_statusline = 0
|
||||
call a:ext.add_statusline_func('airline#extensions#fern#apply')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2019 Cimbali et al
|
||||
" MIT License. Copyright (c) 2017-2020 Cimbali et al
|
||||
" Plugin: https://github.com/tpope/vim-fugitive
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
44
autoload/airline/extensions/fzf.vim
Normal file
44
autoload/airline/extensions/fzf.vim
Normal file
@@ -0,0 +1,44 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/junegunn/fzf, https://github.com/junegunn/fzf.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#fzf#init(ext) abort
|
||||
" Remove the custom statusline that fzf.vim sets by removing its `FileType
|
||||
" fzf` autocmd. Ideally we'd use `let g:fzf_statusline = 0`, but this
|
||||
" variable is checked *before* airline#extensions#init() is called.
|
||||
augroup _fzf_statusline
|
||||
autocmd!
|
||||
augroup END
|
||||
|
||||
call a:ext.add_statusline_func('airline#extensions#fzf#apply')
|
||||
call a:ext.add_inactive_statusline_func('airline#extensions#fzf#inactive_apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#fzf#statusline(...) abort
|
||||
let spc = g:airline_symbols.space
|
||||
|
||||
let builder = airline#builder#new({ 'active': 1 })
|
||||
call builder.add_section('airline_a', spc.'FZF'.spc)
|
||||
call builder.add_section('airline_c', '')
|
||||
return builder.build()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#fzf#apply(...) abort
|
||||
if &filetype ==# 'fzf'
|
||||
let spc = g:airline_symbols.space
|
||||
call a:1.add_section('airline_a', spc.'FZF'.spc)
|
||||
call a:1.add_section('airline_c', '')
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#fzf#inactive_apply(...) abort
|
||||
if getbufvar(a:2.bufnr, '&filetype') ==# 'fzf'
|
||||
let spc = g:airline_symbols.space
|
||||
call a:1.add_section('airline_a', spc.'FZF'.spc)
|
||||
call a:1.add_section('airline_c', '')
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
19
autoload/airline/extensions/gen_tags.vim
Normal file
19
autoload/airline/extensions/gen_tags.vim
Normal file
@@ -0,0 +1,19 @@
|
||||
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
|
||||
" Written by Kamil Cukrowski 2020
|
||||
" Plugin: https://github.com/jsfaint/gen_tags.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !(get(g:, 'loaded_gentags#gtags', 0) || get(g:, 'loaded_gentags#ctags', 0))
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#gen_tags#status(...) abort
|
||||
return gen_tags#job#is_running() != 0 ? 'Gen. gen_tags' : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#gen_tags#init(ext) abort
|
||||
call airline#parts#define_function('gen_tags', 'airline#extensions#gen_tags#status')
|
||||
endfunction
|
||||
|
||||
24
autoload/airline/extensions/gina.vim
Normal file
24
autoload/airline/extensions/gina.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
" MIT License. Copyright (c) 2013-2020
|
||||
" Plugin: https://github.com/lambdalisue/gina.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
if !get(g:, 'loaded_gina', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#gina#apply(...) abort
|
||||
if (&ft =~# 'gina' && &ft !~# 'blame') || &ft ==# 'diff'
|
||||
call a:1.add_section('airline_a', ' gina ')
|
||||
call a:1.add_section('airline_b', ' %{gina#component#repo#branch()} ')
|
||||
call a:1.split()
|
||||
call a:1.add_section('airline_y', ' staged %{gina#component#status#staged()} ')
|
||||
call a:1.add_section('airline_z', ' unstaged %{gina#component#status#unstaged()} ')
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#gina#init(ext) abort
|
||||
let g:gina_force_overwrite_statusline = 0
|
||||
call a:ext.add_statusline_func('airline#extensions#gina#apply')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2019 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/mhinz/vim-grepper
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2019 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/ludovicchabant/vim-gutentags
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,17 +1,32 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" Plugin: vim-gitgutter, vim-signify, changesPlugin, quickfixsigns
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: vim-gitgutter, vim-signify, changesPlugin, quickfixsigns, coc-git
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) && !get(g:, 'loaded_quickfixsigns', 0)
|
||||
if !get(g:, 'loaded_signify', 0)
|
||||
\ && !get(g:, 'loaded_gitgutter', 0)
|
||||
\ && !get(g:, 'loaded_changes', 0)
|
||||
\ && !get(g:, 'loaded_quickfixsigns', 0)
|
||||
\ && !exists("*CocAction")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:non_zero_only = get(g:, 'airline#extensions#hunks#non_zero_only', 0)
|
||||
let s:hunk_symbols = get(g:, 'airline#extensions#hunks#hunk_symbols', ['+', '~', '-'])
|
||||
|
||||
function! s:get_hunks_signify()
|
||||
function! s:coc_git_enabled() abort
|
||||
if !exists("*CocAction") ||
|
||||
\ !get(g:, 'airline#extensions#hunks#coc_git', 0)
|
||||
" coc-git extension is disabled by default
|
||||
" unless specifically being enabled by the user
|
||||
" (as requested from coc maintainer)
|
||||
return 0
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_signify() abort
|
||||
let hunks = sy#repo#get_stats()
|
||||
if hunks[0] >= 0
|
||||
return hunks
|
||||
@@ -19,31 +34,46 @@ function! s:get_hunks_signify()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
function! s:is_branch_empty()
|
||||
function! s:get_hunks_coc() abort
|
||||
let hunks = get(b:, 'coc_git_status', '')
|
||||
if empty(hunks)
|
||||
return []
|
||||
endif
|
||||
let result = [0, 0, 0]
|
||||
for val in split(hunks)
|
||||
if val[0] is# '+'
|
||||
let result[0] = val[1:] + 0
|
||||
elseif val[0] is# '~'
|
||||
let result[1] = val[1:] + 0
|
||||
elseif val[0] is# '-'
|
||||
let result[2] = val[1:] + 0
|
||||
endif
|
||||
endfor
|
||||
return result
|
||||
endfunction
|
||||
|
||||
function! s:is_branch_empty() abort
|
||||
return exists('*airline#extensions#branch#head') &&
|
||||
\ empty(get(b:, 'airline_head', ''))
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_gitgutter()
|
||||
function! s:get_hunks_gitgutter() abort
|
||||
if !get(g:, 'gitgutter_enabled', 0) || s:is_branch_empty()
|
||||
return ''
|
||||
endif
|
||||
return GitGutterGetHunkSummary()
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_changes()
|
||||
if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty()
|
||||
return []
|
||||
endif
|
||||
function! s:get_hunks_changes() abort
|
||||
let hunks = changes#GetStats()
|
||||
return hunks == [0, 0, 0] ? [] : hunks
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_empty()
|
||||
function! s:get_hunks_empty() abort
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#hunks#get_raw_hunks()
|
||||
function! airline#extensions#hunks#get_raw_hunks() abort
|
||||
if !exists('b:source_func') || get(b:, 'source_func', '') is# 's:get_hunks_empty'
|
||||
if get(g:, 'loaded_signify') && sy#buffer_is_active()
|
||||
let b:source_func = 's:get_hunks_signify'
|
||||
@@ -53,6 +83,8 @@ function! airline#extensions#hunks#get_raw_hunks()
|
||||
let b:source_func = 's:get_hunks_changes'
|
||||
elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary')
|
||||
let b:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary'
|
||||
elseif s:coc_git_enabled()
|
||||
let b:source_func = 's:get_hunks_coc'
|
||||
else
|
||||
let b:source_func = 's:get_hunks_empty'
|
||||
endif
|
||||
@@ -60,7 +92,7 @@ function! airline#extensions#hunks#get_raw_hunks()
|
||||
return {b:source_func}()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#hunks#get_hunks()
|
||||
function! airline#extensions#hunks#get_hunks() abort
|
||||
if !get(w:, 'airline_active', 0)
|
||||
return ''
|
||||
endif
|
||||
@@ -71,25 +103,32 @@ function! airline#extensions#hunks#get_hunks()
|
||||
\ 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'
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_changes' &&
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_coc'
|
||||
return b:airline_hunks
|
||||
endif
|
||||
let hunks = airline#extensions#hunks#get_raw_hunks()
|
||||
let string = ''
|
||||
let winwidth = get(airline#parts#get('hunks'), 'minwidth', 100)
|
||||
if !empty(hunks)
|
||||
" hunks should contain [added, changed, deleted]
|
||||
for i in [0, 1, 2]
|
||||
if (s:non_zero_only == 0 && airline#util#winwidth() > winwidth) || hunks[i] > 0
|
||||
let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i])
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
if index(airline#extensions#get_loaded_extensions(), 'branch') == -1 && string[-1:] == ' '
|
||||
" branch extension not loaded, skip trailing whitespace
|
||||
let string = string[0:-2]
|
||||
endif
|
||||
|
||||
let b:airline_hunks = string
|
||||
let b:airline_changenr = b:changedtick
|
||||
let s:airline_winwidth = airline#util#winwidth()
|
||||
return string
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#hunks#init(ext)
|
||||
function! airline#extensions#hunks#init(ext) abort
|
||||
call airline#parts#define_function('hunks', 'airline#extensions#hunks#get_hunks')
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Doron Behar, C.Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Doron Behar, C.Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -9,7 +9,18 @@ endif
|
||||
|
||||
function! airline#extensions#keymap#status()
|
||||
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap'))
|
||||
return printf('%s', (!empty(&keymap) ? (g:airline_symbols.keymap . ' '. &keymap) : ''))
|
||||
let short_codes = get(g:, 'airline#extensions#keymap#short_codes', {})
|
||||
let label = get(g:, 'airline#extensions#keymap#label', g:airline_symbols.keymap)
|
||||
let default = get(g:, 'airline#extensions#keymap#default', '')
|
||||
if (label !=# '')
|
||||
let label .= ' '
|
||||
endif
|
||||
let keymap = &keymap
|
||||
if has_key(short_codes, keymap)
|
||||
let keymap = short_codes[keymap]
|
||||
endif
|
||||
return printf('%s', (!empty(keymap) && &iminsert ? (label . keymap) :
|
||||
\ (!empty(default) ? label . default : default)))
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bjorn Neergaard, hallettj et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bjorn Neergaard, hallettj et al.
|
||||
" Plugin: https://github.com/autozimu/LanguageClient-neovim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -66,6 +66,10 @@ function! s:airline_languageclient_get_line_number(type) abort
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#languageclient#get(type)
|
||||
if get(b:, 'LanguageClient_isServerRunning', 0) ==# 0
|
||||
return ''
|
||||
endif
|
||||
|
||||
let is_err = a:type == s:severity_error
|
||||
let symbol = is_err ? s:error_symbol : s:warning_symbol
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
" MIT License. Copyright (c) 2018-2019 mox et al.
|
||||
" Plugin: https://github.com/mox-mox/localsearch
|
||||
" MIT License. Copyright (c) 2018-2020 mox et al.
|
||||
" Plugin: https://github.com/mox-mox/vim-localsearch
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -12,25 +12,30 @@ let g:airline#extensions#localsearch#loaded = 001
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! airline#extensions#localsearch#load_theme(palette)
|
||||
let g:airline#extensions#localsearch#inverted = get(g:, 'airline#extensions#localsearch#inverted', 0)
|
||||
|
||||
function! airline#extensions#localsearch#load_theme(palette) abort
|
||||
call airline#highlighter#exec('localsearch_dark', [ '#ffffff' , '#000000' , 15 , 1 , ''])
|
||||
endfunction
|
||||
|
||||
|
||||
function! airline#extensions#localsearch#init(ext)
|
||||
call a:ext.add_theme_func('airline#extensions#localsearch#load_theme')
|
||||
call a:ext.add_statusline_func('airline#extensions#localsearch#apply')
|
||||
function! airline#extensions#localsearch#init(ext) abort
|
||||
call a:ext.add_theme_func('airline#extensions#localsearch#load_theme')
|
||||
call a:ext.add_statusline_func('airline#extensions#localsearch#apply')
|
||||
endfunction
|
||||
|
||||
|
||||
function! airline#extensions#localsearch#apply(...)
|
||||
function! airline#extensions#localsearch#apply(...) abort
|
||||
" first variable is the statusline builder
|
||||
let builder = a:1
|
||||
|
||||
""""" WARNING: the API for the builder is not finalized and may change
|
||||
if exists('#localsearch#WinEnter') " If localsearch mode is enabled
|
||||
if exists('#localsearch#WinEnter') && !g:airline#extensions#localsearch#inverted " If localsearch mode is enabled and 'invert' option is false
|
||||
call builder.add_section('localsearch_dark', s:spc.airline#section#create('LS').s:spc)
|
||||
endif
|
||||
if !exists('#localsearch#WinEnter') && g:airline#extensions#localsearch#inverted " If localsearch mode is disabled and 'invert' option is true
|
||||
call builder.add_section('localsearch_dark', s:spc.airline#section#create('GS').s:spc)
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
|
||||
67
autoload/airline/extensions/lsp.vim
Normal file
67
autoload/airline/extensions/lsp.vim
Normal file
@@ -0,0 +1,67 @@
|
||||
" MIT License. Copyright (c) 2013-2020 François-Xavier Carton et al.
|
||||
" Plugin: https://github.com/prabirshrestha/vim-lsp
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'lsp_loaded', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! s:airline_lsp_count(cnt, symbol) abort
|
||||
return a:cnt ? a:symbol. a:cnt : ''
|
||||
endfunction
|
||||
|
||||
function! s:airline_lsp_get_line_number(cnt, type) abort
|
||||
let result = ''
|
||||
|
||||
if a:type ==# 'error'
|
||||
let result = lsp#get_buffer_first_error_line()
|
||||
endif
|
||||
|
||||
if empty(result)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let open_lnum_symbol =
|
||||
\ get(g:, 'airline#extensions#lsp#open_lnum_symbol', '(L')
|
||||
let close_lnum_symbol =
|
||||
\ get(g:, 'airline#extensions#lsp#close_lnum_symbol', ')')
|
||||
|
||||
return open_lnum_symbol . result . close_lnum_symbol
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#lsp#get(type) abort
|
||||
if !exists(':LspDeclaration')
|
||||
return ''
|
||||
endif
|
||||
|
||||
let error_symbol = get(g:, 'airline#extensions#lsp#error_symbol', 'E:')
|
||||
let warning_symbol = get(g:, 'airline#extensions#lsp#warning_symbol', 'W:')
|
||||
let show_line_numbers = get(g:, 'airline#extensions#lsp#show_line_numbers', 1)
|
||||
|
||||
let is_err = a:type ==# 'error'
|
||||
|
||||
let symbol = is_err ? error_symbol : warning_symbol
|
||||
|
||||
let num = lsp#get_buffer_diagnostics_counts()[a:type]
|
||||
|
||||
if show_line_numbers == 1
|
||||
return s:airline_lsp_count(num, symbol) . <sid>airline_lsp_get_line_number(num, a:type)
|
||||
else
|
||||
return s:airline_lsp_count(num, symbol)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#lsp#get_warning() abort
|
||||
return airline#extensions#lsp#get('warning')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#lsp#get_error() abort
|
||||
return airline#extensions#lsp#get('error')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#lsp#init(ext) abort
|
||||
call airline#parts#define_function('lsp_error_count', 'airline#extensions#lsp#get_error')
|
||||
call airline#parts#define_function('lsp_warning_count', 'airline#extensions#lsp#get_warning')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/neomake/neomake
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: http://www.drchip.org/astronaut/vim/#NETRW
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -31,5 +31,5 @@ endfunction
|
||||
|
||||
function! airline#extensions#netrw#sortstring()
|
||||
let order = (get(g:, 'netrw_sort_direction', 'n') =~ 'n') ? '+' : '-'
|
||||
return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']'
|
||||
return get(g:, 'netrw_sort_by', '') . (g:airline_symbols.space) . '[' . order . ']'
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/chrisbra/NrrwRgn
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
48
autoload/airline/extensions/nvimlsp.vim
Normal file
48
autoload/airline/extensions/nvimlsp.vim
Normal file
@@ -0,0 +1,48 @@
|
||||
" Apache 2.0 license. Copyright (c) 2019-2020 Copyright Neovim contributors.
|
||||
" Plugin: https://github.com/neovim/nvim-lsp
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !(get(g:, 'airline#extensions#nvimlsp#enabled', 1)
|
||||
\ && exists(':LspInstallInfo'))
|
||||
finish
|
||||
endif
|
||||
|
||||
function! s:airline_nvimlsp_count(cnt, symbol) abort
|
||||
return a:cnt ? a:symbol. a:cnt : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#nvimlsp#get(type) abort
|
||||
if !exists(':LspInstallInfo')
|
||||
return ''
|
||||
endif
|
||||
|
||||
let error_symbol = get(g:, 'airline#extensions#nvimlsp#error_symbol', 'E:')
|
||||
let warning_symbol = get(g:, 'airline#extensions#nvimlsp#warning_symbol', 'W:')
|
||||
|
||||
let is_err = a:type ==# 'Error'
|
||||
|
||||
let symbol = is_err ? error_symbol : warning_symbol
|
||||
|
||||
if luaeval("pcall(require, 'vim.lsp.diagnostic')")
|
||||
let num = v:lua.vim.lsp.diagnostic.get_count(0, a:type)
|
||||
else
|
||||
let num = v:lua.vim.lsp.util.buf_diagnostics_count(a:type)
|
||||
endif
|
||||
|
||||
return s:airline_nvimlsp_count(num, symbol)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#nvimlsp#get_warning() abort
|
||||
return airline#extensions#nvimlsp#get('Warning')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#nvimlsp#get_error() abort
|
||||
return airline#extensions#nvimlsp#get('Error')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#nvimlsp#init(ext) abort
|
||||
call airline#parts#define_function('nvimlsp_error_count', 'airline#extensions#nvimlsp#get_error')
|
||||
call airline#parts#define_function('nvimlsp_warning_count', 'airline#extensions#nvimlsp#get_warning')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/tpope/vim-obsession
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
45
autoload/airline/extensions/omnisharp.vim
Normal file
45
autoload/airline/extensions/omnisharp.vim
Normal file
@@ -0,0 +1,45 @@
|
||||
" MIT License
|
||||
" Plugin: https://github.com/OmniSharp/omnisharp-vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'OmniSharp_loaded', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#omnisharp#server_status(...) abort
|
||||
if !exists(':OmniSharpGotoDefinition') || !get(g:, 'OmniSharp_server_stdio', 0)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let host = OmniSharp#GetHost(bufnr('%'))
|
||||
if type(host.job) != v:t_dict || get(host.job, 'stopped')
|
||||
return ''
|
||||
endif
|
||||
|
||||
let sln = fnamemodify(host.sln_or_dir, ':t')
|
||||
|
||||
if get(host.job, 'loaded', 0)
|
||||
return sln
|
||||
endif
|
||||
|
||||
try
|
||||
let projectsloaded = OmniSharp#project#CountLoaded()
|
||||
let projectstotal = OmniSharp#project#CountTotal()
|
||||
catch
|
||||
" The CountLoaded and CountTotal functions are very new - catch the error
|
||||
" when they don't exist
|
||||
let projectsloaded = 0
|
||||
let projectstotal = 0
|
||||
endtry
|
||||
return printf('%s(%d/%d)', sln, projectsloaded, projectstotal)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#omnisharp#init(ext) abort
|
||||
call airline#parts#define_function('omnisharp', 'airline#extensions#omnisharp#server_status')
|
||||
augroup airline_omnisharp
|
||||
autocmd!
|
||||
autocmd User OmniSharpStarted,OmniSharpReady,OmniSharpStopped AirlineRefresh!
|
||||
augroup END
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -10,7 +10,7 @@ function! airline#extensions#po#shorten()
|
||||
if exists("g:airline#extensions#po#displayed_limit")
|
||||
let w:displayed_po_limit = g:airline#extensions#po#displayed_limit
|
||||
if len(b:airline_po_stats) > w:displayed_po_limit - 1
|
||||
let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 2)].(&encoding==?'utf-8' ? '…' : '.'). ']'
|
||||
let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 2)].(&encoding==?'utf-8' ? '…' : '.')
|
||||
endif
|
||||
endif
|
||||
if strlen(get(b:, 'airline_po_stats', '')) >= 30 && airline#util#winwidth() < 150
|
||||
@@ -19,24 +19,27 @@ function! airline#extensions#po#shorten()
|
||||
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', '')
|
||||
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', '')
|
||||
let untranslated = substitute(b:airline_po_stats, '.\{-}\(\d\+\) untranslated.*', '\1U', '')
|
||||
if untranslated == '0U'
|
||||
let untranslated = ''
|
||||
endif
|
||||
endif
|
||||
let messages = substitute(b:airline_po_stats, '\(\d\+\) translated.*', '\1T', '')
|
||||
if messages ==# '0T'
|
||||
let messages = ''
|
||||
endif
|
||||
let b:airline_po_stats = printf('%s%s%s', fuzzy, (empty(fuzzy) || empty(untranslated) ? '' : '/'), untranslated)
|
||||
if strlen(b:airline_po_stats) < 8
|
||||
let b:airline_po_stats = messages. (!empty(b:airline_po_stats) ? '/':''). b:airline_po_stats
|
||||
if strlen(b:airline_po_stats) < 10
|
||||
let b:airline_po_stats = messages. (!empty(b:airline_po_stats) && !empty(messages) ? '/':''). b:airline_po_stats
|
||||
endif
|
||||
endif
|
||||
let b:airline_po_stats = '['.b:airline_po_stats. ']'
|
||||
let b:airline_po_stats = '['.b:airline_po_stats. '] '
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#po#on_winenter()
|
||||
@@ -62,7 +65,11 @@ function! airline#extensions#po#stats()
|
||||
return b:airline_po_stats
|
||||
endif
|
||||
|
||||
let cmd = 'msgfmt --statistics -o /dev/null -- '
|
||||
if g:airline#init#is_windows
|
||||
let cmd = 'msgfmt --statistics -o NUL '
|
||||
else
|
||||
let cmd = 'msgfmt --statistics -o /dev/null -- '
|
||||
endif
|
||||
if g:airline#init#vim_async
|
||||
call airline#async#get_msgfmt_stat(cmd, expand('%:p'))
|
||||
elseif has("nvim")
|
||||
|
||||
32
autoload/airline/extensions/poetv.vim
Normal file
32
autoload/airline/extensions/poetv.vim
Normal file
@@ -0,0 +1,32 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/petobens/poet_v
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! airline#extensions#poetv#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#poetv#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#poetv#apply(...)
|
||||
if &filetype =~# 'python'
|
||||
if get(g:, 'poetv_loaded', 0)
|
||||
let statusline = poetv#statusline()
|
||||
else
|
||||
let statusline = fnamemodify($VIRTUAL_ENV, ':t')
|
||||
endif
|
||||
if !empty(statusline)
|
||||
call airline#extensions#append_to_section('x',
|
||||
\ s:spc.g:airline_right_alt_sep.s:spc.statusline)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#poetv#update()
|
||||
if &filetype =~# 'python'
|
||||
call airline#extensions#poetv#apply()
|
||||
call airline#update_statusline()
|
||||
endif
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/edkolev/promptline.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
43
autoload/airline/extensions/searchcount.vim
Normal file
43
autoload/airline/extensions/searchcount.vim
Normal file
@@ -0,0 +1,43 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" This extension is inspired by vim-anzu <https://github.com/osyo-manga/vim-anzu>.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('*searchcount')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#searchcount#init(ext) abort
|
||||
call a:ext.add_statusline_func('airline#extensions#searchcount#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#searchcount#apply(...) abort
|
||||
call airline#extensions#append_to_section('y',
|
||||
\ '%{v:hlsearch ? airline#extensions#searchcount#status() : ""}')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#searchcount#status() abort
|
||||
try
|
||||
let result = searchcount(#{recompute: 1, maxcount: -1})
|
||||
if empty(result) || result.total ==# 0
|
||||
return ''
|
||||
endif
|
||||
if result.incomplete ==# 1 " timed out
|
||||
return printf(' /%s [?/??]', @/)
|
||||
elseif result.incomplete ==# 2 " max count exceeded
|
||||
if result.total > result.maxcount &&
|
||||
\ result.current > result.maxcount
|
||||
return printf('%s[>%d/>%d]', @/,
|
||||
\ result.current, result.total)
|
||||
elseif result.total > result.maxcount
|
||||
return printf('%s[%d/>%d]', @/,
|
||||
\ result.current, result.total)
|
||||
endif
|
||||
endif
|
||||
return printf('%s[%d/%d]', @/,
|
||||
\ result.current, result.total)
|
||||
catch
|
||||
return ''
|
||||
endtry
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/vim-syntastic/syntastic
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et fdm=marker
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -10,231 +10,19 @@ endif
|
||||
|
||||
let s:ctrlspace = get(g:, 'CtrlSpaceLoaded', 0)
|
||||
let s:tabws = get(g:, 'tabws_loaded', 0)
|
||||
let s:current_tabcnt = -1
|
||||
|
||||
function! airline#extensions#tabline#init(ext)
|
||||
if has('gui_running')
|
||||
if has('gui_running') && match(&guioptions, 'e') > -1
|
||||
set guioptions-=e
|
||||
endif
|
||||
|
||||
autocmd User AirlineToggledOn call s:toggle_on()
|
||||
autocmd User AirlineToggledOff call s:toggle_off()
|
||||
|
||||
call s:toggle_on()
|
||||
call a:ext.add_theme_func('airline#extensions#tabline#load_theme')
|
||||
endfunction
|
||||
|
||||
function! s:toggle_off()
|
||||
call airline#extensions#tabline#autoshow#off()
|
||||
call airline#extensions#tabline#tabs#off()
|
||||
call airline#extensions#tabline#buffers#off()
|
||||
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
|
||||
|
||||
function! s:update_tabline()
|
||||
if get(g:, 'airline#extensions#tabline#disable_refresh', 0)
|
||||
return
|
||||
endif
|
||||
let match = expand('<afile>')
|
||||
if pumvisible()
|
||||
return
|
||||
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
|
||||
return
|
||||
" return, if buffer matches ignore pattern or is directory (netrw)
|
||||
elseif empty(match) || airline#util#ignore_buf(match)
|
||||
\ || isdirectory(expand("<afile>"))
|
||||
return
|
||||
endif
|
||||
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
|
||||
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)
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
let colors = get(a:palette, 'tabline', {})
|
||||
let tablabel = get(colors, 'airline_tablabel', a:palette.normal.airline_b)
|
||||
" Theme for tabs on the left
|
||||
let tab = get(colors, 'airline_tab', a:palette.normal.airline_b)
|
||||
let tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
|
||||
let tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
|
||||
let tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
|
||||
let tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
|
||||
let tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c)
|
||||
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
|
||||
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
|
||||
else
|
||||
"Fall back to normal airline_c if modified airline_c isn't present
|
||||
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
|
||||
endif
|
||||
call airline#highlighter#exec('airline_tablabel', tablabel)
|
||||
call airline#highlighter#exec('airline_tab', tab)
|
||||
call airline#highlighter#exec('airline_tabsel', tabsel)
|
||||
call airline#highlighter#exec('airline_tabtype', tabtype)
|
||||
call airline#highlighter#exec('airline_tabfill', tabfill)
|
||||
call airline#highlighter#exec('airline_tabmod', tabmod)
|
||||
call airline#highlighter#exec('airline_tabmod_unsel', tabmodu)
|
||||
call airline#highlighter#exec('airline_tabhid', tabhid)
|
||||
|
||||
" Theme for tabs on the right
|
||||
" label on the right
|
||||
let tablabel_r = get(colors, 'airline_tablabel', a:palette.normal.airline_b)
|
||||
let tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
|
||||
let tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
|
||||
let tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
|
||||
let tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c)
|
||||
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
|
||||
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c)
|
||||
else
|
||||
"Fall back to normal airline_c if modified airline_c isn't present
|
||||
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
|
||||
endif
|
||||
call airline#highlighter#exec('airline_tablabel_right', tablabel_r)
|
||||
call airline#highlighter#exec('airline_tab_right', tab_right)
|
||||
call airline#highlighter#exec('airline_tabsel_right', tabsel_right)
|
||||
call airline#highlighter#exec('airline_tabmod_right', tabmod_right)
|
||||
call airline#highlighter#exec('airline_tabhid_right', tabhid_right)
|
||||
call airline#highlighter#exec('airline_tabmod_unsel_right', tabmodu_right)
|
||||
endfunction
|
||||
|
||||
let s:current_tabcnt = -1
|
||||
|
||||
function! airline#extensions#tabline#get()
|
||||
let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
||||
|
||||
let curtabcnt = tabpagenr('$')
|
||||
if curtabcnt != s:current_tabcnt
|
||||
let s:current_tabcnt = curtabcnt
|
||||
call airline#extensions#tabline#tabs#invalidate()
|
||||
call airline#extensions#tabline#buffers#invalidate()
|
||||
call airline#extensions#tabline#ctrlspace#invalidate()
|
||||
call airline#extensions#tabline#tabws#invalidate()
|
||||
endif
|
||||
|
||||
if !exists('#airline#BufAdd#*')
|
||||
autocmd airline BufAdd * call <sid>update_tabline()
|
||||
endif
|
||||
if s:ctrlspace
|
||||
return airline#extensions#tabline#ctrlspace#get()
|
||||
elseif s:tabws
|
||||
return airline#extensions#tabline#tabws#get()
|
||||
elseif show_buffers && curtabcnt == 1 || !show_tabs
|
||||
return airline#extensions#tabline#buffers#get()
|
||||
else
|
||||
return airline#extensions#tabline#tabs#get()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#title(n)
|
||||
let title = ''
|
||||
if s:taboo
|
||||
let title = TabooTabTitle(a:n)
|
||||
endif
|
||||
|
||||
if empty(title) && exists('*gettabvar')
|
||||
let title = gettabvar(a:n, 'title')
|
||||
endif
|
||||
|
||||
if empty(title)
|
||||
let buflist = tabpagebuflist(a:n)
|
||||
let winnr = tabpagewinnr(a:n)
|
||||
let all_buffers = airline#extensions#tabline#buflist#list()
|
||||
return airline#extensions#tabline#get_buffer_name(
|
||||
\ buflist[winnr - 1],
|
||||
\ filter(buflist, 'index(all_buffers, v:val) != -1'))
|
||||
endif
|
||||
|
||||
return title
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#get_buffer_name(nr, ...)
|
||||
let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list()
|
||||
let formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
|
||||
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, buffers)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#new_builder()
|
||||
let builder_context = {
|
||||
\ 'active' : 1,
|
||||
\ 'tabline' : 1,
|
||||
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep),
|
||||
\ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep),
|
||||
\ }
|
||||
if get(g:, 'airline_powerline_fonts', 0)
|
||||
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep)
|
||||
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep)
|
||||
else
|
||||
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ')
|
||||
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|')
|
||||
endif
|
||||
|
||||
return airline#extensions#tabline#builder#new(builder_context)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
|
||||
let cur = bufnr('%')
|
||||
if cur == a:bufnr
|
||||
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
|
||||
let group = 'airline_tabmod'
|
||||
else
|
||||
let group = 'airline_tabsel'
|
||||
endif
|
||||
else
|
||||
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
|
||||
let group = 'airline_tabmod_unsel'
|
||||
elseif index(a:tab_bufs, a:bufnr) > -1
|
||||
let group = 'airline_tab'
|
||||
else
|
||||
let group = 'airline_tabhid'
|
||||
endif
|
||||
endif
|
||||
return group
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#add_label(dict, type, right)
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
call a:dict.add_section_spaced('airline_tablabel'.
|
||||
@@ -244,7 +32,456 @@ function! airline#extensions#tabline#add_label(dict, type, right)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#add_tab_label(dict)
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_count', 1) && tabpagenr('$') > 1
|
||||
let show_tab_count = get(g:, 'airline#extensions#tabline#show_tab_count', 1)
|
||||
if show_tab_count == 2
|
||||
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
elseif show_tab_count == 1 && tabpagenr('$') > 1
|
||||
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
|
||||
" Legacy VimScript implementation " {{{1
|
||||
function! s:toggle_off() " {{{2
|
||||
call airline#extensions#tabline#autoshow#off()
|
||||
call airline#extensions#tabline#tabs#off()
|
||||
call airline#extensions#tabline#buffers#off()
|
||||
if s:ctrlspace
|
||||
call airline#extensions#tabline#ctrlspace#off()
|
||||
endif
|
||||
if s:tabws
|
||||
call airline#extensions#tabline#tabws#off()
|
||||
endif
|
||||
endfunction
|
||||
function! s:toggle_on() " {{{2
|
||||
if get(g:, 'airline_statusline_ontop', 0)
|
||||
call airline#extensions#tabline#enable()
|
||||
let &tabline='%!airline#statusline('.winnr().')'
|
||||
return
|
||||
endif
|
||||
call airline#extensions#tabline#autoshow#on()
|
||||
call airline#extensions#tabline#tabs#on()
|
||||
call airline#extensions#tabline#buffers#on()
|
||||
if s:ctrlspace
|
||||
call airline#extensions#tabline#ctrlspace#on()
|
||||
endif
|
||||
if s:tabws
|
||||
call airline#extensions#tabline#tabws#on()
|
||||
endif
|
||||
|
||||
set tabline=%!airline#extensions#tabline#get()
|
||||
endfunction
|
||||
function! s:update_tabline(forceit) " {{{2
|
||||
if get(g:, 'airline#extensions#tabline#disable_refresh', 0)
|
||||
return
|
||||
endif
|
||||
" loading a session file
|
||||
" On SessionLoadPost, g:SessionLoad variable is still set :/
|
||||
if !a:forceit && get(g:, 'SessionLoad', 0)
|
||||
return
|
||||
endif
|
||||
let match = expand('<afile>')
|
||||
if pumvisible()
|
||||
return
|
||||
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
|
||||
return
|
||||
" return, if buffer matches ignore pattern or is directory (netrw)
|
||||
elseif empty(match) || airline#util#ignore_buf(match) || isdirectory(match)
|
||||
return
|
||||
endif
|
||||
call airline#util#doautocmd('BufMRUChange')
|
||||
call airline#extensions#tabline#redraw()
|
||||
endfunction
|
||||
function! airline#extensions#tabline#redraw() " {{{2
|
||||
" sometimes, the tabline is not correctly updated see #1580
|
||||
" so force redraw here
|
||||
if exists(":redrawtabline") == 2
|
||||
redrawtabline
|
||||
else
|
||||
" Have to set a property equal to itself to get airline to re-eval.
|
||||
" Setting `let &tabline=&tabline` destroys the cursor position so we
|
||||
" need something less invasive.
|
||||
let &ro = &ro
|
||||
endif
|
||||
endfunction
|
||||
function! airline#extensions#tabline#enable() " {{{2
|
||||
if &lines > 3
|
||||
set showtabline=2
|
||||
endif
|
||||
endfunction
|
||||
function! airline#extensions#tabline#load_theme(palette) " {{{2
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
let colors = get(a:palette, 'tabline', {})
|
||||
let tablabel = get(colors, 'airline_tablabel', a:palette.normal.airline_b)
|
||||
" Theme for tabs on the left
|
||||
let tab = get(colors, 'airline_tab', a:palette.inactive.airline_c)
|
||||
let tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
|
||||
let tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
|
||||
let tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
|
||||
let tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
|
||||
let tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c)
|
||||
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
|
||||
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
|
||||
else
|
||||
"Fall back to normal airline_c if modified airline_c isn't present
|
||||
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
|
||||
endif
|
||||
call airline#highlighter#exec('airline_tablabel', tablabel)
|
||||
call airline#highlighter#exec('airline_tab', tab)
|
||||
call airline#highlighter#exec('airline_tabsel', tabsel)
|
||||
call airline#highlighter#exec('airline_tabtype', tabtype)
|
||||
call airline#highlighter#exec('airline_tabfill', tabfill)
|
||||
call airline#highlighter#exec('airline_tabmod', tabmod)
|
||||
call airline#highlighter#exec('airline_tabmod_unsel', tabmodu)
|
||||
call airline#highlighter#exec('airline_tabhid', tabhid)
|
||||
|
||||
" Theme for tabs on the right
|
||||
" label on the right
|
||||
let tablabel_r = get(colors, 'airline_tablabel', a:palette.normal.airline_b)
|
||||
let tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
|
||||
let tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
|
||||
let tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
|
||||
let tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c)
|
||||
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
|
||||
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c)
|
||||
else
|
||||
"Fall back to normal airline_c if modified airline_c isn't present
|
||||
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
|
||||
endif
|
||||
call airline#highlighter#exec('airline_tablabel_right', tablabel_r)
|
||||
call airline#highlighter#exec('airline_tab_right', tab_right)
|
||||
call airline#highlighter#exec('airline_tabsel_right', tabsel_right)
|
||||
call airline#highlighter#exec('airline_tabmod_right', tabmod_right)
|
||||
call airline#highlighter#exec('airline_tabhid_right', tabhid_right)
|
||||
call airline#highlighter#exec('airline_tabmod_unsel_right', tabmodu_right)
|
||||
endfunction
|
||||
function! airline#extensions#tabline#get() " {{{2
|
||||
let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
||||
|
||||
let curtabcnt = tabpagenr('$')
|
||||
if curtabcnt != s:current_tabcnt
|
||||
let s:current_tabcnt = curtabcnt
|
||||
call airline#extensions#tabline#tabs#invalidate()
|
||||
call airline#extensions#tabline#buffers#invalidate()
|
||||
call airline#extensions#tabline#ctrlspace#invalidate()
|
||||
call airline#extensions#tabline#tabws#invalidate()
|
||||
endif
|
||||
|
||||
if !exists('#airline#BufAdd#*')
|
||||
autocmd airline BufAdd * call <sid>update_tabline(0)
|
||||
endif
|
||||
if !exists('#airline#SessionLoadPost')
|
||||
autocmd airline SessionLoadPost * call <sid>update_tabline(1)
|
||||
endif
|
||||
if s:ctrlspace
|
||||
return airline#extensions#tabline#ctrlspace#get()
|
||||
elseif s:tabws
|
||||
return airline#extensions#tabline#tabws#get()
|
||||
elseif show_buffers && curtabcnt == 1 || !show_tabs
|
||||
return airline#extensions#tabline#buffers#get()
|
||||
else
|
||||
return airline#extensions#tabline#tabs#get()
|
||||
endif
|
||||
endfunction
|
||||
function! airline#extensions#tabline#title(n) " {{{2
|
||||
let title = ''
|
||||
if s:taboo
|
||||
let title = TabooTabTitle(a:n)
|
||||
endif
|
||||
|
||||
if empty(title) && exists('*gettabvar')
|
||||
let title = gettabvar(a:n, 'title')
|
||||
endif
|
||||
|
||||
let formatter = get(g:, 'airline#extensions#tabline#tabtitle_formatter')
|
||||
if empty(title) && formatter !=# '' && exists("*".formatter)
|
||||
let title = call(formatter, [a:n])
|
||||
endif
|
||||
|
||||
if empty(title)
|
||||
let buflist = tabpagebuflist(a:n)
|
||||
let winnr = tabpagewinnr(a:n)
|
||||
let all_buffers = airline#extensions#tabline#buflist#list()
|
||||
let curbuf = filter(buflist, 'index(all_buffers, v:val) != -1')
|
||||
if len(curbuf) == 0
|
||||
call add(curbuf, tabpagebuflist()[0])
|
||||
endif
|
||||
return airline#extensions#tabline#get_buffer_name(curbuf[0], curbuf)
|
||||
endif
|
||||
return title
|
||||
endfunction
|
||||
function! airline#extensions#tabline#get_buffer_name(nr, ...) " {{{2
|
||||
let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list()
|
||||
let formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
|
||||
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, buffers)
|
||||
endfunction
|
||||
function! airline#extensions#tabline#new_builder() " {{{2
|
||||
let builder_context = {
|
||||
\ 'active' : 1,
|
||||
\ 'tabline' : 1,
|
||||
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep),
|
||||
\ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep),
|
||||
\ }
|
||||
if get(g:, 'airline_powerline_fonts', 0)
|
||||
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep)
|
||||
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep)
|
||||
else
|
||||
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ')
|
||||
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|')
|
||||
endif
|
||||
return airline#extensions#tabline#builder#new(builder_context)
|
||||
endfunction
|
||||
function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr) " {{{2
|
||||
let cur = bufnr('%')
|
||||
if cur == a:bufnr
|
||||
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
|
||||
let group = 'airline_tabmod'
|
||||
else
|
||||
let group = 'airline_tabsel'
|
||||
endif
|
||||
else
|
||||
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
|
||||
let group = 'airline_tabmod_unsel'
|
||||
elseif index(a:tab_bufs, a:bufnr) > -1
|
||||
let group = 'airline_tab'
|
||||
else
|
||||
let group = 'airline_tabhid'
|
||||
endif
|
||||
endif
|
||||
return group
|
||||
endfunction
|
||||
function! airline#extensions#tabline#add_tab_label(dict) " {{{2
|
||||
let show_tab_count = get(g:, 'airline#extensions#tabline#show_tab_count', 1)
|
||||
if show_tab_count == 2
|
||||
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
elseif show_tab_count == 1 && tabpagenr('$') > 1
|
||||
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
endif
|
||||
endfunction
|
||||
else
|
||||
" Vim9 Script implementation
|
||||
"def airline#extensions#tabline#init(ext: dict<any>): void # {{{2
|
||||
" Seems not to work yet :(
|
||||
" if has('gui_running') && match(&guioptions, 'e') > -1
|
||||
" :set guioptions-=e
|
||||
" endif
|
||||
" autocmd User AirlineToggledOn call s:toggle_on()
|
||||
" autocmd User AirlineToggledOff call s:toggle_off()
|
||||
" s:toggle_on()
|
||||
" try
|
||||
" ext.add_theme_func('airline#extensions#tabline#load_theme')
|
||||
" catch
|
||||
" endtry
|
||||
"enddef
|
||||
def s:toggle_off(): void # {{{2
|
||||
airline#extensions#tabline#autoshow#off()
|
||||
airline#extensions#tabline#tabs#off()
|
||||
airline#extensions#tabline#buffers#off()
|
||||
if s:ctrlspace
|
||||
airline#extensions#tabline#ctrlspace#off()
|
||||
endif
|
||||
if s:tabws
|
||||
airline#extensions#tabline#tabws#off()
|
||||
endif
|
||||
enddef
|
||||
def s:toggle_on(): void # {{{2
|
||||
if get(g:, 'airline_statusline_ontop', 0)
|
||||
airline#extensions#tabline#enable()
|
||||
&tabline = '%!airline#statusline(' .. winnr() .. ')'
|
||||
return
|
||||
endif
|
||||
airline#extensions#tabline#autoshow#on()
|
||||
airline#extensions#tabline#tabs#on()
|
||||
airline#extensions#tabline#buffers#on()
|
||||
if s:ctrlspace
|
||||
airline#extensions#tabline#ctrlspace#on()
|
||||
endif
|
||||
if s:tabws
|
||||
airline#extensions#tabline#tabws#on()
|
||||
endif
|
||||
&tabline = '%!airline#extensions#tabline#get()'
|
||||
enddef
|
||||
def s:update_tabline(forceit: number): void # {{{2
|
||||
if get(g:, 'airline#extensions#tabline#disable_refresh', 0)
|
||||
return
|
||||
endif
|
||||
if !forceit && get(g:, 'SessionLoad', 0)
|
||||
return
|
||||
endif
|
||||
var match = expand('<afile>')
|
||||
if pumvisible()
|
||||
return
|
||||
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
|
||||
return
|
||||
# return, if buffer matches ignore pattern or is directory (netrw)
|
||||
elseif empty(match) || airline#util#ignore_buf(match) || isdirectory(match)
|
||||
return
|
||||
endif
|
||||
airline#util#doautocmd('BufMRUChange')
|
||||
airline#extensions#tabline#redraw()
|
||||
enddef
|
||||
def airline#extensions#tabline#redraw(): void # {{{2
|
||||
# TODO: Is this still needed?
|
||||
:redrawtabline
|
||||
enddef
|
||||
def airline#extensions#tabline#enable(): void # {{{2
|
||||
if &lines > 3
|
||||
&showtabline = 2
|
||||
endif
|
||||
enddef
|
||||
def airline#extensions#tabline#load_theme(palette: dict<any>): void # {{{2
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
var colors = get(palette, 'tabline', {})
|
||||
var tablabel = get(colors, 'airline_tablabel', palette.normal.airline_b)
|
||||
# Theme for tabs on the left
|
||||
var tab = get(colors, 'airline_tab', palette.inactive.airline_c)
|
||||
var tabsel = get(colors, 'airline_tabsel', palette.normal.airline_a)
|
||||
var tabtype = get(colors, 'airline_tabtype', palette.visual.airline_a)
|
||||
var tabfill = get(colors, 'airline_tabfill', palette.normal.airline_c)
|
||||
var tabmod = get(colors, 'airline_tabmod', palette.insert.airline_a)
|
||||
var tabhid = get(colors, 'airline_tabhid', palette.normal.airline_c)
|
||||
var tabmodu = tabhid
|
||||
var tabmodu_right = tabhid
|
||||
if has_key(palette, 'normal_modified') && has_key(palette.normal_modified, 'airline_c')
|
||||
tabmodu = get(colors, 'airline_tabmod_unsel', palette.normal_modified.airline_c)
|
||||
tabmodu_right = get(colors, 'airline_tabmod_unsel_right', palette.normal_modified.airline_c)
|
||||
else
|
||||
# Fall back to normal airline_c if modified airline_c isn't present
|
||||
tabmodu = get(colors, 'airline_tabmod_unsel', palette.normal.airline_c)
|
||||
tabmodu_right = get(colors, 'airline_tabmod_unsel_right', palette.normal.airline_c)
|
||||
endif
|
||||
airline#highlighter#exec('airline_tablabel', tablabel)
|
||||
airline#highlighter#exec('airline_tab', tab)
|
||||
airline#highlighter#exec('airline_tabsel', tabsel)
|
||||
airline#highlighter#exec('airline_tabtype', tabtype)
|
||||
airline#highlighter#exec('airline_tabfill', tabfill)
|
||||
airline#highlighter#exec('airline_tabmod', tabmod)
|
||||
airline#highlighter#exec('airline_tabmod_unsel', tabmodu)
|
||||
airline#highlighter#exec('airline_tabmod_unsel_right', tabmodu_right)
|
||||
airline#highlighter#exec('airline_tabhid', tabhid)
|
||||
# Theme for tabs on the right
|
||||
var tablabel_r = get(colors, 'airline_tablabel', palette.normal.airline_b)
|
||||
var tabsel_right = get(colors, 'airline_tabsel_right', palette.normal.airline_a)
|
||||
var tab_right = get(colors, 'airline_tab_right', palette.inactive.airline_c)
|
||||
var tabmod_right = get(colors, 'airline_tabmod_right', palette.insert.airline_a)
|
||||
var tabhid_right = get(colors, 'airline_tabhid_right', palette.normal.airline_c)
|
||||
airline#highlighter#exec('airline_tablabel_right', tablabel_r)
|
||||
airline#highlighter#exec('airline_tab_right', tab_right)
|
||||
airline#highlighter#exec('airline_tabsel_right', tabsel_right)
|
||||
airline#highlighter#exec('airline_tabmod_right', tabmod_right)
|
||||
airline#highlighter#exec('airline_tabhid_right', tabhid_right)
|
||||
enddef
|
||||
def airline#extensions#tabline#get(): string # {{{2
|
||||
var show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
var show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
||||
|
||||
var curtabcnt = tabpagenr('$')
|
||||
if curtabcnt != s:current_tabcnt
|
||||
s:current_tabcnt = curtabcnt
|
||||
airline#extensions#tabline#tabs#invalidate()
|
||||
airline#extensions#tabline#buffers#invalidate()
|
||||
airline#extensions#tabline#ctrlspace#invalidate()
|
||||
airline#extensions#tabline#tabws#invalidate()
|
||||
endif
|
||||
|
||||
if !exists('#airline#BufAdd#*')
|
||||
autocmd airline BufAdd * call <sid>update_tabline(0)
|
||||
endif
|
||||
if !exists('#airline#SessionLoadPost')
|
||||
autocmd airline SessionLoadPost * call <sid>update_tabline(1)
|
||||
endif
|
||||
if s:ctrlspace
|
||||
return airline#extensions#tabline#ctrlspace#get()
|
||||
elseif s:tabws
|
||||
return airline#extensions#tabline#tabws#get()
|
||||
elseif show_buffers && curtabcnt == 1 || !show_tabs
|
||||
return airline#extensions#tabline#buffers#get()
|
||||
else
|
||||
return airline#extensions#tabline#tabs#get()
|
||||
endif
|
||||
enddef
|
||||
def airline#extensions#tabline#title(n: number): string # {{{2
|
||||
var title = ''
|
||||
if get(g:, 'airline#extensions#taboo#enabled', 1) &&
|
||||
get(g:, 'loaded_taboo', 0) && exists("*TabooTabTitle")
|
||||
title = call("TabooTabTitle", [n])
|
||||
endif
|
||||
|
||||
if empty(title)
|
||||
title = gettabvar(n, 'title')
|
||||
endif
|
||||
|
||||
var formatter = get(g:, 'airline#extensions#tabline#tabtitle_formatter', '')
|
||||
if empty(title) && !empty(formatter) && exists("*" .. formatter)
|
||||
title = call(formatter, [n])
|
||||
endif
|
||||
|
||||
if empty(title)
|
||||
var buflist = tabpagebuflist(n)
|
||||
var winnr = tabpagewinnr(n)
|
||||
var all_buffers = airline#extensions#tabline#buflist#list()
|
||||
var curbuf = filter(buflist, {_, v -> index(all_buffers, v) != -1})
|
||||
if len(curbuf) == 0
|
||||
add(curbuf, tabpagebuflist()[0])
|
||||
endif
|
||||
return airline#extensions#tabline#get_buffer_name(curbuf[0], curbuf)
|
||||
endif
|
||||
return title
|
||||
enddef
|
||||
def airline#extensions#tabline#get_buffer_name(nr: number, buffers = airline#extensions#tabline#buflist#list()): string # {{{2
|
||||
var Formatter = 'airline#extensions#tabline#formatters#' .. get(g:, 'airline#extensions#tabline#formatter', 'default') .. '#format'
|
||||
return call(Formatter, [ nr, buffers] )
|
||||
enddef
|
||||
def airline#extensions#tabline#new_builder(): dict<any> # {{{2
|
||||
var builder_context = {
|
||||
'active': 1,
|
||||
'tabline': 1,
|
||||
'right_sep': get(g:, 'airline#extensions#tabline#right_sep', g:airline_right_sep),
|
||||
'right_alt_sep': get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep),
|
||||
'left_sep': get(g:, 'airline#extensions#tabline#left_sep', g:airline_left_sep),
|
||||
'left_alt_sep': get(g:, 'airline#extensions#tabline#left_alt_sep', g:airline_left_alt_sep),
|
||||
}
|
||||
return airline#extensions#tabline#builder#new(builder_context)
|
||||
enddef
|
||||
def airline#extensions#tabline#group_of_bufnr(tab_bufs: list<number>, bufnr: number): string # {{{2
|
||||
var cur = bufnr('%')
|
||||
var group = ''
|
||||
if cur == bufnr
|
||||
if g:airline_detect_modified && getbufvar(bufnr, '&modified')
|
||||
group = 'airline_tabmod'
|
||||
else
|
||||
group = 'airline_tabsel'
|
||||
endif
|
||||
else
|
||||
if g:airline_detect_modified && getbufvar(bufnr, '&modified')
|
||||
group = 'airline_tabmod_unsel'
|
||||
elseif index(tab_bufs, bufnr) > -1
|
||||
group = 'airline_tab'
|
||||
else
|
||||
group = 'airline_tabhid'
|
||||
endif
|
||||
endif
|
||||
return group
|
||||
enddef
|
||||
"def airline#extensions#tabline#add_label(dict: dict<any>, type: string, right: number): void # {{{2
|
||||
" # Seems not to work yet :(
|
||||
" if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
" dict.add_section_spaced('airline_tablabel' .. (right ? '_right' : ''),
|
||||
" get(g:, 'airline#extensions#tabline#' .. type .. '_label', type))
|
||||
" endif
|
||||
"enddef
|
||||
" def airline#extensions#tabline#add_tab_label(dict: dict<any>): void # {{{2
|
||||
" var show_tab_count = get(g:, 'airline#extensions#tabline#show_tab_count', 1)
|
||||
" if show_tab_count == 2
|
||||
" dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
" elseif show_tab_count == 1 && tabpagenr('$') > 1
|
||||
" dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
" endif
|
||||
" enddef
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -162,7 +162,9 @@ function! s:get_number(index)
|
||||
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, "")'), '')
|
||||
let l:count = bidx_mode == 2 ? a:index+11 : a:index+1
|
||||
return join(map(split(printf('%02d', l:count), '\zs'),
|
||||
\ 'get(s:number_map, v:val, "")'), '')
|
||||
else
|
||||
return get(s:number_map, a:index+1, '')
|
||||
endif
|
||||
@@ -170,7 +172,7 @@ endfunction
|
||||
|
||||
function! s:select_tab(buf_index)
|
||||
" no-op when called in 'keymap_ignored_filetypes'
|
||||
if count(get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes',
|
||||
if count(get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes',
|
||||
\ ['vimfiler', 'nerdtree']), &ft)
|
||||
return
|
||||
endif
|
||||
@@ -201,8 +203,9 @@ function! s:map_keys()
|
||||
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)
|
||||
let start_idx = bidx_mode == 2 ? 11 : 1
|
||||
for i in range(start_idx, 99)
|
||||
exe printf('noremap <silent> <Plug>AirlineSelectTab%02d :call <SID>select_tab(%d)<CR>', i, i-start_idx)
|
||||
endfor
|
||||
endif
|
||||
noremap <silent> <Plug>AirlineSelectPrevTab :<C-u>call <SID>jump_to_tab(-v:count1)<CR>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016-2019 Kevin Sapper et al.
|
||||
" MIT License. Copyright (c) 2016-2020 Kevin Sapper et al.
|
||||
" Plugin: https://github.com/szw/vim-ctrlspace
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -30,7 +30,15 @@ endfunction
|
||||
|
||||
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 buffer_list = []
|
||||
for bufferindex in sort(keys(ctrlspace#api#Buffers(a:cur_tab)), 'N')
|
||||
for buffer in ctrlspace#api#BufferList(a:cur_tab)
|
||||
if buffer['index'] == bufferindex
|
||||
call add(buffer_list, buffer)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if the current buffer no in the buffer list
|
||||
|
||||
@@ -1,43 +1,82 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et fdm=marker
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
|
||||
let s:fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
|
||||
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
|
||||
let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
|
||||
let s:buf_modified_symbol = g:airline_symbols.modified
|
||||
if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
" Legacy VimScript implementation {{{1
|
||||
function! airline#extensions#tabline#formatters#default#format(bufnr, buffers) " {{{2
|
||||
let fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
let _ = ''
|
||||
|
||||
function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
let _ = ''
|
||||
|
||||
let name = bufname(a:bufnr)
|
||||
if empty(name)
|
||||
let _ .= '[No Name]'
|
||||
else
|
||||
if s:fnamecollapse
|
||||
" 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))
|
||||
let name = bufname(a:bufnr)
|
||||
if empty(name)
|
||||
let _ .= '[No Name]'
|
||||
elseif name =~ 'term://'
|
||||
" Neovim Terminal
|
||||
let _ = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
|
||||
else
|
||||
let _ .= fnamemodify(name, fmod)
|
||||
if get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
|
||||
" Does not handle non-ascii characters like Cyrillic: 'D/Учёба/t.c'
|
||||
"let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
|
||||
let _ .= pathshorten(fnamemodify(name, fmod))
|
||||
else
|
||||
let _ .= fnamemodify(name, fmod)
|
||||
endif
|
||||
if a:bufnr != bufnr('%') && fnametruncate && strlen(_) > fnametruncate
|
||||
let _ = airline#util#strcharpart(_, 0, fnametruncate)
|
||||
endif
|
||||
endif
|
||||
if a:bufnr != bufnr('%') && s:fnametruncate && strlen(_) > s:fnametruncate
|
||||
let _ = strpart(_, 0, s:fnametruncate)
|
||||
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name) " {{{2
|
||||
let buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
|
||||
let buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
|
||||
|
||||
let _ = buf_nr_show ? printf(buf_nr_format, a:bufnr) : ''
|
||||
let _ .= substitute(a:buffer_name, '\\', '/', 'g')
|
||||
|
||||
if getbufvar(a:bufnr, '&modified') == 1
|
||||
let _ .= g:airline_symbols.modified
|
||||
endif
|
||||
endif
|
||||
return _
|
||||
endfunction
|
||||
else
|
||||
" New Vim9 script implementation {{{1
|
||||
def airline#extensions#tabline#formatters#default#format(bufnr: number, buffers: list<number>): string # {{{2
|
||||
var fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
var result = ''
|
||||
var fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
|
||||
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name)
|
||||
let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : ''
|
||||
let _ .= substitute(a:buffer_name, '\\', '/', 'g')
|
||||
|
||||
if getbufvar(a:bufnr, '&modified') == 1
|
||||
let _ .= s:buf_modified_symbol
|
||||
endif
|
||||
return _
|
||||
endfunction
|
||||
var name = bufname(bufnr)
|
||||
if empty(name)
|
||||
result = '[No Name]'
|
||||
elseif name =~ 'term://'
|
||||
# Neovim Terminal
|
||||
result = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
|
||||
else
|
||||
if get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
|
||||
result = pathshorten(fnamemodify(name, fmod))
|
||||
else
|
||||
result = fnamemodify(name, fmod)
|
||||
endif
|
||||
if bufnr != bufnr('%') && fnametruncate && strlen(result) > fnametruncate
|
||||
result = airline#util#strcharpart(result, 0, fnametruncate)
|
||||
endif
|
||||
endif
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(bufnr, result)
|
||||
enddef
|
||||
def airline#extensions#tabline#formatters#default#wrap_name(bufnr: number, buffer_name: string): string # {{{2
|
||||
var buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
|
||||
var buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
|
||||
var result = buf_nr_show ? printf(buf_nr_format, bufnr) : ''
|
||||
result = result .. substitute(buffer_name, '\\', '/', 'g')
|
||||
if getbufvar(bufnr, '&modified') == 1
|
||||
result = result .. g:airline_symbols.modified
|
||||
endif
|
||||
return result
|
||||
enddef
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -11,6 +11,9 @@ function! airline#extensions#tabline#formatters#short_path#format(bufnr, buffers
|
||||
let name = bufname(a:bufnr)
|
||||
if empty(name)
|
||||
let _ .= '[No Name]'
|
||||
elseif name =~ 'term://'
|
||||
" Neovim Terminal
|
||||
let _ = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
|
||||
else
|
||||
let _ .= fnamemodify(name, ':p:h:t') . '/' . fnamemodify(name, ':t')
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2019 Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2017-2020 Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -12,7 +12,12 @@ function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffer
|
||||
if empty(name)
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, '[No Name]')
|
||||
else
|
||||
let tail = fnamemodify(name, ':s?/\+$??:t')
|
||||
if name =~ 'term://'
|
||||
" Neovim Terminal
|
||||
let tail = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
|
||||
else
|
||||
let tail = fnamemodify(name, ':s?/\+$??:t')
|
||||
endif
|
||||
if has_key(tails, tail)
|
||||
let duplicates[nr] = nr
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016-2019 Kevin Sapper et al.
|
||||
" MIT License. Copyright (c) 2016-2020 Kevin Sapper et al.
|
||||
" PLugin: https://github.com/s1341/vim-tabws
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" 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>
|
||||
" MIT License Copyright (C) 2018-2020 Gianmaria Bajo <mg1979.git@gmail.com>
|
||||
" tabpagecd:
|
||||
" expanded version by mg979
|
||||
" MIT License Copyright (C) 2012-2013 Kana Natsuno <http://whileimautomaton.net/>
|
||||
" MIT License Copyright (C) 2018-2019 Gianmaria Bajo <mg1979.git@gmail.com>
|
||||
" MIT License Copyright (C) 2018-2020 Gianmaria Bajo <mg1979.git@gmail.com>
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/majutsushi/tagbar
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,55 +1,64 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
call airline#parts#define_function('tmode', 'airline#extensions#term#termmode')
|
||||
call airline#parts#define('terminal', {'text': get(g:airline_mode_map, 't', 't'), 'accent': 'bold'})
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
let s:section_a = airline#section#create_left(['terminal', 'tmode'])
|
||||
let s:section_z = airline#section#create(['linenr', 'maxlinenr'])
|
||||
|
||||
function! airline#extensions#term#apply(...)
|
||||
if &buftype == 'terminal' || bufname('%')[0] == '!'
|
||||
let spc = g:airline_symbols.space
|
||||
|
||||
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_term', spc.s:termname())
|
||||
function! airline#extensions#term#apply(...) abort
|
||||
if &buftype ==? 'terminal' || bufname(a:2.bufnr)[0] ==? '!'
|
||||
call a:1.add_section_spaced('airline_a', s:section_a)
|
||||
call a:1.add_section_spaced('airline_b', s:neoterm_id(a:2.bufnr))
|
||||
call a:1.add_section('airline_term', s:spc.s:termname(a:2.bufnr))
|
||||
call a:1.split()
|
||||
call a:1.add_section('airline_y', '')
|
||||
call a:1.add_section('airline_z', spc.airline#section#create_right(['linenr', 'maxlinenr']))
|
||||
call a:1.add_section_spaced('airline_z', s:section_z)
|
||||
return 1
|
||||
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
|
||||
function! airline#extensions#term#inactive_apply(...) abort
|
||||
if getbufvar(a:2.bufnr, '&buftype') ==? 'terminal'
|
||||
call a:1.add_section_spaced('airline_a', s:section_a)
|
||||
call a:1.add_section_spaced('airline_b', s:neoterm_id(a:2.bufnr))
|
||||
call a:1.add_section('airline_term', s:spc.s:termname(a:2.bufnr))
|
||||
call a:1.split()
|
||||
call a:1.add_section('airline_y', '')
|
||||
call a:1.add_section_spaced('airline_z', s:section_z)
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#term#termmode()
|
||||
function! airline#extensions#term#termmode() abort
|
||||
let mode = airline#parts#mode()[0]
|
||||
if mode ==? 'T'
|
||||
" don't need to output T, statusline already says "TERMINAL"
|
||||
let mode=''
|
||||
if mode ==? 'T' || mode ==? '-'
|
||||
" We don't need to output T, the statusline already says "TERMINAL".
|
||||
" Also we don't want to output "-" on an inactive statusline.
|
||||
let mode = ''
|
||||
endif
|
||||
return mode
|
||||
endfunction
|
||||
|
||||
function! s:termname()
|
||||
let bufname = bufname('%')
|
||||
function! s:termname(bufnr) abort
|
||||
let bufname = bufname(a:bufnr)
|
||||
if has('nvim')
|
||||
return matchstr(bufname, 'term.*:\zs.*')
|
||||
" Get rid of the leading "term", working dir and process ID.
|
||||
" Afterwards, remove the possibly added neoterm ID.
|
||||
return substitute(matchstr(bufname, 'term.*:\zs.*'),
|
||||
\ ';#neoterm-\d\+', '', '')
|
||||
else
|
||||
" get rid of leading '!'
|
||||
if bufname[0] is# '!'
|
||||
if bufname =~? 'neoterm-\d\+'
|
||||
" Do not return a redundant buffer name, when this is a neoterm terminal.
|
||||
return ''
|
||||
endif
|
||||
" Get rid of the leading "!".
|
||||
if bufname[0] ==? '!'
|
||||
return bufname[1:]
|
||||
else
|
||||
return bufname
|
||||
@@ -57,7 +66,15 @@ function! s:termname()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#term#init(ext)
|
||||
function! s:neoterm_id(bufnr) abort
|
||||
let id = getbufvar(a:bufnr, 'neoterm_id')
|
||||
if id !=? ''
|
||||
let id = 'neoterm-'.id
|
||||
endif
|
||||
return id
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#term#init(ext) abort
|
||||
call a:ext.add_statusline_func('airline#extensions#term#apply')
|
||||
call a:ext.add_inactive_statusline_func('airline#extensions#term#inactive_apply')
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/edkolev/tmuxline.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/mbbill/undotree
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/chrisbra/unicode.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/Shougo/unite.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016-2019 Jerome Reybert et al.
|
||||
" MIT License. Copyright (c) 2016-2020 Jerome Reybert et al.
|
||||
" Plugin: https://github.com/jreybert/vimagit
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -9,26 +9,21 @@ if !get(g:, 'loaded_magit', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#vimagit#init(ext)
|
||||
let s:commit_mode = {'ST': 'STAGING', 'CC': 'COMMIT', 'CA': 'AMEND'}
|
||||
|
||||
function! airline#extensions#vimagit#init(ext) abort
|
||||
call a:ext.add_statusline_func('airline#extensions#vimagit#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimagit#get_mode()
|
||||
function! airline#extensions#vimagit#get_mode() abort
|
||||
if ( exists("*magit#get_current_mode") )
|
||||
return magit#get_current_mode()
|
||||
else
|
||||
if ( b:magit_current_commit_mode == '' )
|
||||
return "STAGING"
|
||||
elseif ( b:magit_current_commit_mode == 'CC' )
|
||||
return "COMMIT"
|
||||
elseif ( b:magit_current_commit_mode == 'CA' )
|
||||
return "AMEND"
|
||||
else
|
||||
return "???"
|
||||
endif
|
||||
return get(s:commit_mode, b:magit_current_commit_mode, '???')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimagit#apply(...)
|
||||
function! airline#extensions#vimagit#apply(...) abort
|
||||
if ( &filetype == 'magit' )
|
||||
let w:airline_section_a = '%{airline#extensions#vimagit#get_mode()}'
|
||||
endif
|
||||
|
||||
30
autoload/airline/extensions/vimcmake.vim
Normal file
30
autoload/airline/extensions/vimcmake.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/cdelledonne/vim-cmake
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#vimcmake#init(ext) abort
|
||||
call a:ext.add_statusline_func('airline#extensions#vimcmake#apply')
|
||||
call a:ext.add_inactive_statusline_func('airline#extensions#vimcmake#inactive_apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimcmake#apply(...) abort
|
||||
if &filetype ==# 'vimcmake'
|
||||
let spc = g:airline_symbols.space
|
||||
call a:1.add_section('airline_a', spc.'CMake'.spc)
|
||||
call a:1.add_section('airline_b', spc.'%{cmake#statusline#GetBuildInfo(1)}'.spc)
|
||||
call a:1.add_section('airline_c', spc.'%{cmake#statusline#GetCmdInfo()}'.spc)
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimcmake#inactive_apply(...) abort
|
||||
if getbufvar(a:2.bufnr, '&filetype') ==# 'vimcmake'
|
||||
let spc = g:airline_symbols.space
|
||||
call a:1.add_section('airline_a', spc.'[CMake]')
|
||||
call a:1.add_section('airline_b', spc.'%{cmake#statusline#GetBuildInfo(0)}')
|
||||
call a:1.add_section('airline_c', spc.'%{cmake#statusline#GetCmdInfo()}')
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/lervag/vimtex
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/jmcantrell/vim-virtualenv
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
" MIT License. Copyright (c) 2019 s1341 (github@shmarya.net)
|
||||
" Plugin: https://github.com/liuchngxu/vista.vim
|
||||
" MIT License. Copyright (c) 2020 s1341 (github@shmarya.net)
|
||||
" Plugin: https://github.com/liuchengxu/vista.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
if !get(g:, 'loaded_vista', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#vista#currenttag()
|
||||
function! airline#extensions#vista#currenttag() abort
|
||||
if get(w:, 'airline_active', 0)
|
||||
return get(b:, 'vista_nearest_method_or_function', '')
|
||||
return airline#util#shorten(get(b:, 'vista_nearest_method_or_function', ''), 91, 9)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vista#init(ext)
|
||||
function! airline#extensions#vista#init(ext) abort
|
||||
call airline#parts#define_function('vista', 'airline#extensions#vista#currenttag')
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
|
||||
@@ -10,7 +10,8 @@ let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols
|
||||
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'],
|
||||
\ 'csv': ['indent', 'mixed-indent-file']}
|
||||
|
||||
function! s:check_mixed_indent()
|
||||
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
|
||||
@@ -23,9 +24,9 @@ function! s:check_mixed_indent()
|
||||
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
|
||||
return search('\v' . t_s_t . '|' . t_l_s, 'nw')
|
||||
elseif indent_algo == 2
|
||||
return search('\v(^\t* +\t\s*\S)', 'nw')
|
||||
return search('\v(^\t* +\t\s*\S)', 'nw', 0, 500)
|
||||
else
|
||||
return search('\v(^\t+ +)|(^ +\t+)', 'nw')
|
||||
return search('\v(^\t+ +)|(^ +\t+)', 'nw', 0, 500)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -50,7 +51,12 @@ endfunction
|
||||
function! s:conflict_marker()
|
||||
" Checks for git conflict markers
|
||||
let annotation = '\%([0-9A-Za-z_.:]\+\)\?'
|
||||
let pattern = '^\%(\%(<\{7} '.annotation. '\)\|\%(=\{7\}\)\|\%(>\{7\} '.annotation.'\)\)$'
|
||||
if &ft is# 'rst'
|
||||
" rst filetypes use '=======' as header
|
||||
let pattern = '^\%(\%(<\{7} '.annotation. '\)\|\%(>\{7\} '.annotation.'\)\)$'
|
||||
else
|
||||
let pattern = '^\%(\%(<\{7} '.annotation. '\)\|\%(=\{7\}\)\|\%(>\{7\} '.annotation.'\)\)$'
|
||||
endif
|
||||
return search(pattern, 'nw')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: https://github.com/wesQ3/vim-windowswap
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 fdm=marker
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -87,16 +87,18 @@ endfunction
|
||||
" default filetypes:
|
||||
function! airline#extensions#wordcount#apply(...)
|
||||
let filetypes = get(g:, 'airline#extensions#wordcount#filetypes',
|
||||
\ ['asciidoc', 'help', 'mail', 'markdown', 'org', 'rst', 'tex', 'text'])
|
||||
\ ['asciidoc', 'help', 'mail', 'markdown', 'nroff', 'org', 'rst', 'plaintex', 'tex', 'text'])
|
||||
" export current filetypes settings to global namespace
|
||||
let g:airline#extensions#wordcount#filetypes = filetypes
|
||||
|
||||
" Check if filetype needs testing
|
||||
if did_filetype()
|
||||
" correctly test for compound filetypes (e.g. markdown.pandoc)
|
||||
let ft = substitute(&filetype, '\.', '\\|', 'g')
|
||||
|
||||
" Select test based on type of "filetypes": new=list, old=string
|
||||
if type(filetypes) == get(v:, 't_list', type([]))
|
||||
\ ? index(filetypes, &filetype) > -1 || index(filetypes, 'all') > -1
|
||||
\ ? match(filetypes, '\<'. ft. '\>') > -1 || index(filetypes, 'all') > -1
|
||||
\ : match(&filetype, filetypes) > -1
|
||||
let b:airline_changedtick = -1
|
||||
call s:update_wordcount(1) " force update: ensures initial worcount exists
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -10,6 +10,7 @@ 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'))
|
||||
@@ -35,5 +36,12 @@ function! airline#extensions#wordcount#formatters#default#to_string(wordcount)
|
||||
else
|
||||
let str = printf(s:fmt_short, a:wordcount)
|
||||
endif
|
||||
return str . g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space
|
||||
|
||||
let str .= g:airline_symbols.space
|
||||
|
||||
if !empty(g:airline_right_alt_sep)
|
||||
let str .= g:airline_right_alt_sep . g:airline_symbols.space
|
||||
endif
|
||||
|
||||
return str
|
||||
endfunction
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#wordcount#formatters#readingtime#update_fmt(...) abort
|
||||
let s:fmt = get(g:, 'airline#extensions#wordcount#formatter#readingtime#fmt', 'About %s minutes')
|
||||
let s:fmt_short = get(g:, 'airline#extensions#wordcount#formatter#readingtime#fmt_short', s:fmt ==# 'About %s minutes' ? '%sW' : s:fmt)
|
||||
endfunction
|
||||
|
||||
" Reload format when statusline is rebuilt
|
||||
call airline#extensions#wordcount#formatters#readingtime#update_fmt()
|
||||
|
||||
if index(g:airline_statusline_funcrefs, function('airline#extensions#wordcount#formatters#readingtime#update_fmt')) == -1
|
||||
" only add it, if not already done
|
||||
call airline#add_statusline_funcref(function('airline#extensions#wordcount#formatters#readingtime#update_fmt'))
|
||||
endif
|
||||
|
||||
if match(get(v:, 'lang', ''), '\v\cC|en') > -1
|
||||
let s:decimal_group = ','
|
||||
elseif match(get(v:, 'lang', ''), '\v\cde|dk|fr|pt') > -1
|
||||
let s:decimal_group = '.'
|
||||
else
|
||||
let s:decimal_group = ''
|
||||
endif
|
||||
|
||||
function! airline#extensions#wordcount#formatters#readingtime#to_string(wordcount) abort
|
||||
if airline#util#winwidth() > 85
|
||||
if a:wordcount > 999
|
||||
" Format number according to locale, e.g. German: 1.245 or English: 1,245
|
||||
let wordcount = substitute(a:wordcount, '\d\@<=\(\(\d\{3\}\)\+\)$', s:decimal_group.'&', 'g')
|
||||
else
|
||||
let wordcount = a:wordcount
|
||||
endif
|
||||
let str = printf(s:fmt, ceil(wordcount / 200.0))
|
||||
else
|
||||
let str = printf(s:fmt_short, ceil(a:wordcount / 200.0))
|
||||
endif
|
||||
|
||||
let str .= g:airline_symbols.space
|
||||
|
||||
if !empty(g:airline_right_alt_sep)
|
||||
let str .= g:airline_right_alt_sep . g:airline_symbols.space
|
||||
endif
|
||||
|
||||
return str
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2019 YoungHoon Rhiu et al.
|
||||
" MIT License. Copyright (c) 2017-2020 YoungHoon Rhiu et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -9,7 +9,7 @@ endif
|
||||
|
||||
function! airline#extensions#xkblayout#status()
|
||||
let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
|
||||
let keyboard_layout = split(keyboard_layout, '\.')[-1]
|
||||
let keyboard_layout = get(split(keyboard_layout, '\.'), -1, '')
|
||||
let short_codes = get(g:, 'airline#extensions#xkblayout#short_codes', {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'})
|
||||
|
||||
if has_key(short_codes, keyboard_layout)
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
" MIT License. Copyright (c) 2015-2019 Evgeny Firsov et al.
|
||||
" MIT License. Copyright (c) 2015-2020 Evgeny Firsov et al.
|
||||
" Plugin: https://github.com/ycm-core/YouCompleteMe
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_youcompleteme', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
let s:error_symbol = get(g:, 'airline#extensions#ycm#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#ycm#warning_symbol', 'W:')
|
||||
@@ -12,8 +17,8 @@ function! airline#extensions#ycm#init(ext)
|
||||
call airline#parts#define_function('ycm_warning_count', 'airline#extensions#ycm#get_warning_count')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ycm#get_error_count()
|
||||
if exists(':YcmDiag') && exists("*youcompleteme#GetErrorCount")
|
||||
function! airline#extensions#ycm#get_error_count() abort
|
||||
if exists("*youcompleteme#GetErrorCount")
|
||||
let cnt = youcompleteme#GetErrorCount()
|
||||
|
||||
if cnt != 0
|
||||
@@ -25,7 +30,7 @@ function! airline#extensions#ycm#get_error_count()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ycm#get_warning_count()
|
||||
if exists(':YcmDiag') && exists("*youcompleteme#GetWarningCount")
|
||||
if exists("*youcompleteme#GetWarningCount")
|
||||
let cnt = youcompleteme#GetWarningCount()
|
||||
|
||||
if cnt != 0
|
||||
|
||||
27
autoload/airline/extensions/zoomwintab.vim
Normal file
27
autoload/airline/extensions/zoomwintab.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
" MIT License. Copyright (c) 2020 Dmitry Geurkov (d.geurkov@gmail.com)
|
||||
" Plugin: https://github.com/troydm/zoomwintab.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
|
||||
" Avoid installing twice
|
||||
if exists('g:loaded_vim_airline_zoomwintab')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_vim_airline_zoomwintab = 1
|
||||
|
||||
let s:zoomwintab_status_zoomed_in =
|
||||
\ get(g:, 'airline#extensions#zoomwintab#status_zoomed_in', g:airline_left_alt_sep.' Zoomed')
|
||||
let s:zoomwintab_status_zoomed_out =
|
||||
\ get(g:, 'airline#extensions#zoomwintab#status_zoomed_out', '')
|
||||
|
||||
function! airline#extensions#zoomwintab#apply(...) abort
|
||||
call airline#extensions#prepend_to_section('gutter',
|
||||
\ exists('t:zoomwintab') ? s:zoomwintab_status_zoomed_in : s:zoomwintab_status_zoomed_out)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#zoomwintab#init(ext) abort
|
||||
call a:ext.add_statusline_func('airline#extensions#zoomwintab#apply')
|
||||
endfunction
|
||||
8
autoload/airline/formatter/short_path.vim
Normal file
8
autoload/airline/formatter/short_path.vim
Normal file
@@ -0,0 +1,8 @@
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#formatter#short_path#format(val) abort
|
||||
if get(g:, 'airline_stl_path_style', 'default') ==# 'short'
|
||||
return '%{pathshorten(expand("'.a:val.'"))}'
|
||||
endif
|
||||
return a:val
|
||||
endfunction
|
||||
@@ -1,319 +1,629 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2 fdm=marker et
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:is_win32term = (has('win32') || has('win64')) &&
|
||||
\ !has('gui_running') &&
|
||||
\ (empty($CONEMUBUILD) || &term !=? 'xterm') &&
|
||||
\ empty($WTSESSION) &&
|
||||
\ !(exists("+termguicolors") && &termguicolors)
|
||||
|
||||
let s:separators = {}
|
||||
let s:accents = {}
|
||||
let s:hl_groups = {}
|
||||
|
||||
function! s:gui2cui(rgb, fallback)
|
||||
if a:rgb == ''
|
||||
return a:fallback
|
||||
elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1
|
||||
return a:rgb
|
||||
endif
|
||||
let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)')
|
||||
return airline#msdos#round_msdos_colors(rgb)
|
||||
endfunction
|
||||
|
||||
function! s: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)
|
||||
if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
" Legacy VimScript implementation {{{1
|
||||
function! s:gui2cui(rgb, fallback) abort " {{{2
|
||||
if a:rgb == ''
|
||||
return a:fallback
|
||||
elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1
|
||||
return a:rgb
|
||||
endif
|
||||
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()
|
||||
endif
|
||||
let color = ''
|
||||
if hlexists(a:group)
|
||||
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode)
|
||||
endif
|
||||
if empty(color) || color == -1
|
||||
" should always exists
|
||||
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode)
|
||||
" however, just in case
|
||||
if empty(color) || color == -1
|
||||
let color = 'NONE'
|
||||
endif
|
||||
endif
|
||||
return color
|
||||
endfunction
|
||||
|
||||
function! s:get_array(fg, bg, opts)
|
||||
let opts=empty(a:opts) ? '' : join(a:opts, ',')
|
||||
return g:airline_gui_mode ==# 'gui'
|
||||
\ ? [ a:fg, a:bg, '', '', opts ]
|
||||
\ : [ '', '', a:fg, a:bg, opts ]
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#reset_hlcache()
|
||||
let s:hl_groups = {}
|
||||
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)
|
||||
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 bold = synIDattr(synIDtrans(hlID(a:group)), 'bold')
|
||||
if reverse
|
||||
let res = s:get_array(bg, fg, bold ? ['bold'] : a:000)
|
||||
let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)')
|
||||
return airline#msdos#round_msdos_colors(rgb)
|
||||
endfunction
|
||||
function! s:group_not_done(list, name) abort " {{{2
|
||||
if index(a:list, a:name) == -1
|
||||
call add(a:list, a:name)
|
||||
return 1
|
||||
else
|
||||
let res = s:get_array(fg, bg, bold ? ['bold'] : a:000)
|
||||
if &vbs
|
||||
echomsg printf("airline: group: %s already done, skipping", a:name)
|
||||
endif
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
let s:hl_groups[a:group] = res
|
||||
return res
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#get_highlight2(fg, bg, ...)
|
||||
let fg = s:get_syn(a:fg[0], a:fg[1])
|
||||
let bg = s:get_syn(a:bg[0], a:bg[1])
|
||||
return s:get_array(fg, bg, a:000)
|
||||
endfunction
|
||||
|
||||
function! s:hl_group_exists(group)
|
||||
if !hlexists(a:group)
|
||||
return 0
|
||||
elseif empty(synIDattr(hlID(a:group), 'fg'))
|
||||
return 0
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#exec(group, colors)
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
let colors = a:colors
|
||||
if s:is_win32term
|
||||
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
|
||||
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
|
||||
endif
|
||||
let old_hi = airline#highlighter#get_highlight(a:group)
|
||||
if len(colors) == 4
|
||||
call add(colors, '')
|
||||
endif
|
||||
if g:airline_gui_mode ==# 'gui'
|
||||
let new_hi = [colors[0], colors[1], '', '', colors[4]]
|
||||
else
|
||||
let new_hi = ['', '', printf("%s", colors[2]), printf("%s", colors[3]), colors[4]]
|
||||
endif
|
||||
let colors = s:CheckDefined(colors)
|
||||
if old_hi != new_hi || !s:hl_group_exists(a:group)
|
||||
let cmd = printf('hi %s%s', a:group, s:GetHiCmd(colors))
|
||||
exe cmd
|
||||
if has_key(s:hl_groups, a:group)
|
||||
let s:hl_groups[a:group] = colors
|
||||
endfu
|
||||
function! s:get_syn(group, what, mode) abort "{{{2
|
||||
let color = ''
|
||||
if hlexists(a:group)
|
||||
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, a:mode)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
if empty(color) || color == -1
|
||||
" should always exist
|
||||
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, a:mode)
|
||||
" however, just in case
|
||||
if empty(color) || color == -1
|
||||
let color = 'NONE'
|
||||
endif
|
||||
endif
|
||||
return color
|
||||
endfunction
|
||||
function! s:get_array(guifg, guibg, ctermfg, ctermbg, opts) abort " {{{2
|
||||
return [ a:guifg, a:guibg, a:ctermfg, a:ctermbg, empty(a:opts) ? '' : join(a:opts, ',') ]
|
||||
endfunction
|
||||
function! airline#highlighter#reset_hlcache() abort " {{{2
|
||||
let s:hl_groups = {}
|
||||
endfunction
|
||||
function! airline#highlighter#get_highlight(group, ...) abort " {{{2
|
||||
" only check for the cterm reverse attribute
|
||||
" TODO: do we need to check all modes (gui, term, as well)?
|
||||
let reverse = synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
|
||||
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group)
|
||||
let res = s:hl_groups[a:group]
|
||||
return reverse ? [ res[1], res[0], res[3], res[2], res[4] ] : res
|
||||
else
|
||||
let ctermfg = s:get_syn(a:group, 'fg', 'cterm')
|
||||
let ctermbg = s:get_syn(a:group, 'bg', 'cterm')
|
||||
let guifg = s:get_syn(a:group, 'fg', 'gui')
|
||||
let guibg = s:get_syn(a:group, 'bg', 'gui')
|
||||
let bold = synIDattr(synIDtrans(hlID(a:group)), 'bold')
|
||||
if reverse
|
||||
let res = s:get_array(guibg, guifg, ctermbg, ctermfg, bold ? ['bold'] : a:000)
|
||||
else
|
||||
let res = s:get_array(guifg, guibg, ctermfg, ctermbg, bold ? ['bold'] : a:000)
|
||||
endif
|
||||
endif
|
||||
let s:hl_groups[a:group] = res
|
||||
return res
|
||||
endfunction
|
||||
function! airline#highlighter#get_highlight2(fg, bg, ...) abort " {{{2
|
||||
let guifg = s:get_syn(a:fg[0], a:fg[1], 'gui')
|
||||
let guibg = s:get_syn(a:bg[0], a:bg[1], 'gui')
|
||||
let ctermfg = s:get_syn(a:fg[0], a:fg[1], 'cterm')
|
||||
let ctermbg = s:get_syn(a:bg[0], a:bg[1], 'cterm')
|
||||
return s:get_array(guifg, guibg, ctermfg, ctermbg, a:000)
|
||||
endfunction
|
||||
function! s:hl_group_exists(group) abort " {{{2
|
||||
if !hlexists(a:group)
|
||||
return 0
|
||||
elseif empty(synIDattr(synIDtrans(hlID(a:group)), 'fg'))
|
||||
return 0
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
function! airline#highlighter#exec(group, colors) abort " {{{2
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
let colors = a:colors
|
||||
if s:is_win32term
|
||||
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
|
||||
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
|
||||
endif
|
||||
let old_hi = airline#highlighter#get_highlight(a:group)
|
||||
if len(colors) == 4
|
||||
call add(colors, '')
|
||||
endif
|
||||
let new_hi = [colors[0], colors[1], printf('%s', colors[2]), printf('%s', colors[3]), colors[4]]
|
||||
let colors = s:CheckDefined(colors)
|
||||
if old_hi != new_hi || !s:hl_group_exists(a:group)
|
||||
let cmd = printf('hi %s%s', a:group, s:GetHiCmd(colors))
|
||||
try
|
||||
exe cmd
|
||||
catch
|
||||
echoerr "Error when running command: ". cmd
|
||||
endtry
|
||||
if has_key(s:hl_groups, a:group)
|
||||
let s:hl_groups[a:group] = colors
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
function! s:CheckDefined(colors) abort " {{{2
|
||||
" Checks, whether the definition of the colors is valid and is not empty or NONE
|
||||
" e.g. if the colors would expand to this:
|
||||
" hi airline_c ctermfg=NONE ctermbg=NONE
|
||||
" that means to clear that highlighting group, therefore, fallback to Normal
|
||||
" highlighting group for the cterm values
|
||||
|
||||
function! s:CheckDefined(colors)
|
||||
" Checks, whether the definition of the colors is valid and is not empty or NONE
|
||||
" e.g. if the colors would expand to this:
|
||||
" hi airline_c ctermfg=NONE ctermbg=NONE
|
||||
" that means to clear that highlighting group, therefore, fallback to Normal
|
||||
" highlighting group for the cterm values
|
||||
|
||||
" This only works, if the Normal highlighting group is actually defined, so
|
||||
" return early, if it has been cleared
|
||||
if !exists("g:airline#highlighter#normal_fg_hi")
|
||||
let g:airline#highlighter#normal_fg_hi = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm')
|
||||
endif
|
||||
if empty(g:airline#highlighter#normal_fg_hi) || g:airline#highlighter#normal_fg_hi < 0
|
||||
return a:colors
|
||||
endif
|
||||
|
||||
for val in a:colors
|
||||
if !empty(val) && val !=# 'NONE'
|
||||
" This only works, if the Normal highlighting group is actually defined, so
|
||||
" return early, if it has been cleared
|
||||
if !exists("g:airline#highlighter#normal_fg_hi")
|
||||
let g:airline#highlighter#normal_fg_hi = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm')
|
||||
endif
|
||||
if empty(g:airline#highlighter#normal_fg_hi) || g:airline#highlighter#normal_fg_hi < 0
|
||||
return a:colors
|
||||
endif
|
||||
endfor
|
||||
" this adds the bold attribute to the term argument of the :hi command,
|
||||
" but at least this makes sure, the group will be defined
|
||||
let fg = g:airline#highlighter#normal_fg_hi
|
||||
let bg = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm')
|
||||
if bg < 0
|
||||
" in case there is no background color defined for Normal
|
||||
let bg = a:colors[3]
|
||||
endif
|
||||
return a:colors[0:1] + [fg, bg] + [a:colors[4]]
|
||||
endfunction
|
||||
|
||||
function! s: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
|
||||
for val in a:colors
|
||||
if !empty(val) && val !=# 'NONE'
|
||||
return a:colors
|
||||
endif
|
||||
endfor
|
||||
" this adds the bold attribute to the term argument of the :hi command,
|
||||
" but at least this makes sure, the group will be defined
|
||||
let fg = g:airline#highlighter#normal_fg_hi
|
||||
let bg = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm')
|
||||
if bg < 0
|
||||
" in case there is no background color defined for Normal
|
||||
let bg = a:colors[3]
|
||||
endif
|
||||
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)
|
||||
if a:inverse
|
||||
let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ]
|
||||
else
|
||||
let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ]
|
||||
endif
|
||||
let a:dict[group] = colors
|
||||
call airline#highlighter#exec(group, colors)
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#load_theme()
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
||||
endfor
|
||||
call airline#highlighter#highlight(['inactive'])
|
||||
if getbufvar( bufnr('%'), '&modified' )
|
||||
call airline#highlighter#highlight(['normal', 'modified'])
|
||||
else
|
||||
call airline#highlighter#highlight(['normal'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#add_separator(from, to, inverse)
|
||||
let s:separators[a:from.a:to] = [a:from, a:to, a:inverse]
|
||||
call <sid>exec_separator({}, a:from, a:to, a:inverse, '')
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#add_accent(accent)
|
||||
let s:accents[a:accent] = 1
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#highlight_modified_inactive(bufnr)
|
||||
if getbufvar(a:bufnr, '&modified')
|
||||
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c')
|
||||
\ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : []
|
||||
else
|
||||
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c')
|
||||
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : []
|
||||
endif
|
||||
|
||||
if !empty(colors)
|
||||
call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#highlight(modes, ...)
|
||||
let bufnr = a:0 ? a:1 : ''
|
||||
let p = g:airline#themes#{g:airline_theme}#palette
|
||||
|
||||
" draw the base mode, followed by any overrides
|
||||
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
|
||||
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
|
||||
let airline_grouplist = []
|
||||
let buffers_in_tabpage = sort(tabpagebuflist())
|
||||
if exists("*uniq")
|
||||
let buffers_in_tabpage = uniq(buffers_in_tabpage)
|
||||
endif
|
||||
" mapped might be something like ['normal', 'normal_modified']
|
||||
" if a group is in both modes available, only define the second
|
||||
" that is how this was done previously overwrite the previous definition
|
||||
for mode in reverse(mapped)
|
||||
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
|
||||
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
|
||||
for kvp in items(dict)
|
||||
let mode_colors = kvp[1]
|
||||
let name = kvp[0]
|
||||
if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive'
|
||||
let name = 'airline_c'.bufnr
|
||||
endif
|
||||
" do not re-create highlighting for buffers that are no longer visible
|
||||
" in the current tabpage
|
||||
if name =~# 'airline_c\d\+'
|
||||
let bnr = matchstr(name, 'airline_c\zs\d\+') + 0
|
||||
if bnr > 0 && index(buffers_in_tabpage, bnr) == -1
|
||||
continue
|
||||
endif
|
||||
elseif (name =~# '_to_') || (name[0:10] is# 'airline_tab' && !empty(suffix))
|
||||
" group will be redefined below at exec_separator
|
||||
" or is not needed for tabline with '_inactive' suffix
|
||||
" since active flag is 1 for builder)
|
||||
continue
|
||||
endif
|
||||
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)
|
||||
continue
|
||||
endif
|
||||
let colors = copy(mode_colors)
|
||||
if p.accents[accent][0] != ''
|
||||
let colors[0] = p.accents[accent][0]
|
||||
endif
|
||||
if p.accents[accent][2] != ''
|
||||
let colors[2] = p.accents[accent][2]
|
||||
endif
|
||||
if len(colors) >= 5
|
||||
let colors[4] = get(p.accents[accent], 4, '')
|
||||
else
|
||||
call add(colors, get(p.accents[accent], 4, ''))
|
||||
endif
|
||||
if s:group_not_done(airline_grouplist, name.suffix.'_'.accent)
|
||||
call airline#highlighter#exec(name.suffix.'_'.accent, colors)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
if empty(s:separators)
|
||||
" nothing to be done
|
||||
return a:colors[0:1] + [fg, bg] + [a:colors[4]]
|
||||
endfunction
|
||||
function! s:GetHiCmd(list) abort " {{{2
|
||||
" a:list needs to have 5 items!
|
||||
let res = ''
|
||||
let i = -1
|
||||
while i < 4
|
||||
let i += 1
|
||||
let item = get(a:list, i, '')
|
||||
if item is ''
|
||||
continue
|
||||
endif
|
||||
" 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
|
||||
if i == 0
|
||||
let res .= ' guifg='.item
|
||||
elseif i == 1
|
||||
let res .= ' guibg='.item
|
||||
elseif i == 2
|
||||
let res .= ' ctermfg='.item
|
||||
elseif i == 3
|
||||
let res .= ' ctermbg='.item
|
||||
elseif i == 4
|
||||
let res .= printf(' gui=%s cterm=%s term=%s', item, item, item)
|
||||
endif
|
||||
endwhile
|
||||
return res
|
||||
endfunction
|
||||
function! s:exec_separator(dict, from, to, inverse, suffix) abort " {{{2
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
let group = a:from.'_to_'.a:to.a:suffix
|
||||
let from = airline#themes#get_highlight(a:from.a:suffix)
|
||||
let to = airline#themes#get_highlight(a:to.a:suffix)
|
||||
if a:inverse
|
||||
let colors = [ from[1], to[1], from[3], to[3] ]
|
||||
else
|
||||
let colors = [ to[1], from[1], to[3], from[3] ]
|
||||
endif
|
||||
let a:dict[group] = colors
|
||||
call airline#highlighter#exec(group, colors)
|
||||
endfunction
|
||||
function! airline#highlighter#load_theme() abort " {{{2
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
||||
endfor
|
||||
call airline#highlighter#highlight(['inactive'])
|
||||
if getbufvar( bufnr('%'), '&modified' )
|
||||
call airline#highlighter#highlight(['normal', 'modified'])
|
||||
else
|
||||
call airline#highlighter#highlight(['normal'])
|
||||
endif
|
||||
endfunction
|
||||
function! airline#highlighter#add_separator(from, to, inverse) abort " {{{2
|
||||
let s:separators[a:from.a:to] = [a:from, a:to, a:inverse]
|
||||
call <sid>exec_separator({}, a:from, a:to, a:inverse, '')
|
||||
endfunction
|
||||
function! airline#highlighter#add_accent(accent) abort " {{{2
|
||||
let s:accents[a:accent] = 1
|
||||
endfunction
|
||||
function! airline#highlighter#highlight_modified_inactive(bufnr) abort " {{{2
|
||||
if getbufvar(a:bufnr, '&modified')
|
||||
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c')
|
||||
\ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : []
|
||||
else
|
||||
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c')
|
||||
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : []
|
||||
endif
|
||||
|
||||
if !empty(colors)
|
||||
call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors)
|
||||
endif
|
||||
endfunction
|
||||
function! airline#highlighter#highlight(modes, ...) abort " {{{2
|
||||
let bufnr = a:0 ? a:1 : ''
|
||||
let p = g:airline#themes#{g:airline_theme}#palette
|
||||
|
||||
" draw the base mode, followed by any overrides
|
||||
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
|
||||
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
|
||||
let airline_grouplist = []
|
||||
let buffers_in_tabpage = sort(tabpagebuflist())
|
||||
if exists("*uniq")
|
||||
let buffers_in_tabpage = uniq(buffers_in_tabpage)
|
||||
endif
|
||||
" mapped might be something like ['normal', 'normal_modified']
|
||||
" if a group is in both modes available, only define the second
|
||||
" that is how this was done previously overwrite the previous definition
|
||||
for mode in reverse(mapped)
|
||||
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
|
||||
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
|
||||
for kvp in items(dict)
|
||||
let mode_colors = kvp[1]
|
||||
let name = kvp[0]
|
||||
if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive'
|
||||
let name = 'airline_c'.bufnr
|
||||
endif
|
||||
" do not re-create highlighting for buffers that are no longer visible
|
||||
" in the current tabpage
|
||||
if name =~# 'airline_c\d\+'
|
||||
let bnr = matchstr(name, 'airline_c\zs\d\+') + 0
|
||||
if bnr > 0 && index(buffers_in_tabpage, bnr) == -1
|
||||
continue
|
||||
endif
|
||||
elseif (name =~# '_to_') || (name[0:10] is# 'airline_tab' && !empty(suffix))
|
||||
" group will be redefined below at exec_separator
|
||||
" or is not needed for tabline with '_inactive' suffix
|
||||
" since active flag is 1 for builder)
|
||||
continue
|
||||
endif
|
||||
if s:group_not_done(airline_grouplist, name.suffix)
|
||||
call airline#highlighter#exec(name.suffix, mode_colors)
|
||||
endif
|
||||
|
||||
if !has_key(p, 'accents')
|
||||
" work around a broken installation
|
||||
" shouldn't actually happen, p should always contain accents
|
||||
continue
|
||||
endif
|
||||
|
||||
for accent in keys(s:accents)
|
||||
if !has_key(p.accents, accent)
|
||||
continue
|
||||
endif
|
||||
let colors = copy(mode_colors)
|
||||
if p.accents[accent][0] != ''
|
||||
let colors[0] = p.accents[accent][0]
|
||||
endif
|
||||
if p.accents[accent][2] != ''
|
||||
let colors[2] = p.accents[accent][2]
|
||||
endif
|
||||
if len(colors) >= 5
|
||||
let colors[4] = get(p.accents[accent], 4, '')
|
||||
else
|
||||
call add(colors, get(p.accents[accent], 4, ''))
|
||||
endif
|
||||
if s:group_not_done(airline_grouplist, name.suffix.'_'.accent)
|
||||
call airline#highlighter#exec(name.suffix.'_'.accent, colors)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
if empty(s:separators)
|
||||
" nothing to be done
|
||||
continue
|
||||
endif
|
||||
" TODO: optimize this
|
||||
for sep in items(s:separators)
|
||||
" we cannot check, that the group already exists, else the separators
|
||||
" might not be correctly defined. But perhaps we can skip above groups
|
||||
" that match the '_to_' name, because they would be redefined here...
|
||||
call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
finish
|
||||
else
|
||||
" This is using Vim9 script " {{{1
|
||||
def s:gui2cui(rgb: string, fallback: string): string # {{{2
|
||||
if empty(rgb)
|
||||
return fallback
|
||||
elseif match(rgb, '^\%(NONE\|[fb]g\)$') > -1
|
||||
return rgb
|
||||
endif
|
||||
var _rgb = []
|
||||
_rgb = map(split(rgb[1:], '..\zs'), {_, v -> ("0x" .. v)->str2nr(16)})
|
||||
return airline#msdos#round_msdos_colors(_rgb)
|
||||
enddef
|
||||
def s:group_not_done(list: list<string>, name: string): bool # {{{2
|
||||
if index(list, name) == -1
|
||||
add(list, name)
|
||||
return true
|
||||
else
|
||||
if &vbs
|
||||
:echomsg printf("airline: group: %s already done, skipping", name)
|
||||
endif
|
||||
return false
|
||||
endif
|
||||
enddef
|
||||
def s:get_syn(group: string, what: string, mode: string): string # {{{2
|
||||
var color = ''
|
||||
if hlexists(group)
|
||||
color = hlID(group)->synIDtrans()->synIDattr(what, mode)
|
||||
endif
|
||||
if empty(color) || str2nr(color) == -1
|
||||
# Normal highlighting group should always exist
|
||||
color = hlID('Normal')->synIDtrans()->synIDattr(what, mode)
|
||||
# however, just in case
|
||||
if empty(color) || str2nr(color) == -1
|
||||
color = 'NONE'
|
||||
endif
|
||||
endif
|
||||
return color
|
||||
enddef
|
||||
def s:get_array(guifg: string, guibg: string, ctermfg: string, ctermbg: string, opts: list<string>): list<string> # {{{2
|
||||
return [ guifg, guibg, ctermfg, ctermbg, empty(opts) ? '' : join(opts, ',') ]
|
||||
enddef
|
||||
def airline#highlighter#reset_hlcache(): void # {{{2
|
||||
s:hl_groups = {}
|
||||
enddef
|
||||
def airline#highlighter#get_highlight(group: string, rest: list<string> = ['']): list<string> # {{{2
|
||||
# only check for the cterm reverse attribute
|
||||
# TODO: do we need to check all modes (gui, term, as well)?
|
||||
var reverse = false
|
||||
var res = []
|
||||
var ctermfg: string
|
||||
var ctermbg: string
|
||||
var guifg: string
|
||||
var guibg: string
|
||||
var bold: bool
|
||||
if hlID(group)->synIDtrans()->synIDattr('reverse', 'cterm')->str2nr()
|
||||
reverse = true
|
||||
endif
|
||||
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, group)
|
||||
res = s:hl_groups[group]
|
||||
return reverse ? [ res[1], res[0], res[3], res[2], res[4] ] : res
|
||||
else
|
||||
ctermfg = s:get_syn(group, 'fg', 'cterm')
|
||||
ctermbg = s:get_syn(group, 'bg', 'cterm')
|
||||
guifg = s:get_syn(group, 'fg', 'gui')
|
||||
guibg = s:get_syn(group, 'bg', 'gui')
|
||||
if hlID(group)->synIDtrans()->synIDattr('bold')->str2nr()
|
||||
bold = true
|
||||
endif
|
||||
if reverse
|
||||
res = s:get_array(guibg, guifg, ctermbg, ctermfg, bold ? ['bold'] : rest)
|
||||
else
|
||||
res = s:get_array(guifg, guibg, ctermfg, ctermbg, bold ? ['bold'] : rest)
|
||||
endif
|
||||
endif
|
||||
s:hl_groups[group] = res
|
||||
return res
|
||||
enddef
|
||||
def airline#highlighter#get_highlight2(fg: list<string>, bg: list<string>, rest1: string = '', rest2: string = '', rest3: string = ''): list<string> # {{{2
|
||||
var guifg = s:get_syn(fg[0], fg[1], 'gui')
|
||||
var guibg = s:get_syn(bg[0], bg[1], 'gui')
|
||||
var ctermfg = s:get_syn(fg[0], fg[1], 'cterm')
|
||||
var ctermbg = s:get_syn(bg[0], bg[1], 'cterm')
|
||||
var rest = [ rest1, rest2, rest3 ]
|
||||
return s:get_array(guifg, guibg, ctermfg, ctermbg, filter(rest, {_, v -> !empty(v)}))
|
||||
enddef
|
||||
def s:hl_group_exists(group: string): bool # {{{2
|
||||
if !hlexists(group)
|
||||
return false
|
||||
elseif hlID(group)->synIDtrans()->synIDattr('fg')->empty()
|
||||
return false
|
||||
endif
|
||||
return true
|
||||
enddef
|
||||
def s:CheckDefined(colors: list<any>): list<any> # {{{2
|
||||
# Checks, whether the definition of the colors is valid and is not empty or NONE
|
||||
# e.g. if the colors would expand to this:
|
||||
# hi airline_c ctermfg=NONE ctermbg=NONE
|
||||
# that means to clear that highlighting group, therefore, fallback to Normal
|
||||
# highlighting group for the cterm values
|
||||
|
||||
# This only works, if the Normal highlighting group is actually defined,
|
||||
# so return early, if it has been cleared
|
||||
if !exists("g:airline#highlighter#normal_fg_hi")
|
||||
g:airline#highlighter#normal_fg_hi = hlID('Normal')->synIDtrans()->synIDattr('fg', 'cterm')
|
||||
endif
|
||||
if empty(g:airline#highlighter#normal_fg_hi) || str2nr(g:airline#highlighter#normal_fg_hi) < 0
|
||||
return colors
|
||||
endif
|
||||
|
||||
for val in colors
|
||||
if !empty(val) && val !=# 'NONE'
|
||||
return colors
|
||||
endif
|
||||
endfor
|
||||
# this adds the bold attribute to the term argument of the :hi command,
|
||||
# but at least this makes sure, the group will be defined
|
||||
var fg = g:airline#highlighter#normal_fg_hi
|
||||
var bg = hlID('Normal')->synIDtrans()->synIDattr('bg', 'cterm')
|
||||
if str2nr(bg) < 0
|
||||
# in case there is no background color defined for Normal
|
||||
bg = colors[3]
|
||||
endif
|
||||
return colors[0:1] + [fg, bg] + [colors[4]]
|
||||
enddef
|
||||
def s:GetHiCmd(list: list<string>): string # {{{2
|
||||
# list needs to have 5 items!
|
||||
var res: string
|
||||
var i = -1
|
||||
var item: string
|
||||
while i < 4
|
||||
i += 1
|
||||
item = get(list, i, '')
|
||||
if item is ''
|
||||
continue
|
||||
endif
|
||||
if i == 0
|
||||
res = res .. ' guifg=' .. item
|
||||
elseif i == 1
|
||||
res = res .. ' guibg=' .. item
|
||||
elseif i == 2
|
||||
res = res .. ' ctermfg=' .. item
|
||||
elseif i == 3
|
||||
res = res .. ' ctermbg=' .. item
|
||||
elseif i == 4
|
||||
res = res .. printf(' gui=%s cterm=%s term=%s', item, item, item)
|
||||
endif
|
||||
endwhile
|
||||
return res
|
||||
enddef
|
||||
def airline#highlighter#exec(group: string, clrs: list<any>): void # {{{2
|
||||
# TODO: is clrs: list<any> correct? Should probably be list<number> instead
|
||||
# convert all themes to use strings in cterm color definition
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
var colors: list<string>
|
||||
colors = map(copy(clrs), { _, v -> type(v) != type('') ? string(v) : v})
|
||||
if len(colors) == 4
|
||||
add(colors, '')
|
||||
endif
|
||||
if s:is_win32term
|
||||
colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
|
||||
colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
|
||||
endif
|
||||
var old_hi: list<string> = airline#highlighter#get_highlight(group)
|
||||
var new_hi: list<string> = colors
|
||||
colors = s:CheckDefined(colors)
|
||||
if old_hi != new_hi || !s:hl_group_exists(group)
|
||||
var cmd = ''
|
||||
cmd = printf('hi %s%s', group, s:GetHiCmd(colors))
|
||||
:exe cmd
|
||||
if has_key(s:hl_groups, group)
|
||||
s:hl_groups[group] = colors
|
||||
endif
|
||||
endif
|
||||
enddef
|
||||
def s:exec_separator(dict: dict<any>, from_arg: string, to_arg: string, inverse: bool, suffix: string): void # {{{2
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
var group = from_arg .. '_to_' .. to_arg .. suffix
|
||||
var from = map(airline#themes#get_highlight(from_arg .. suffix),
|
||||
{_, v -> type(v) != type('') ? string(v) : v})
|
||||
var colors = []
|
||||
var to = map(airline#themes#get_highlight(to_arg .. suffix),
|
||||
{_, v -> type(v) != type('') ? string(v) : v})
|
||||
if inverse
|
||||
colors = [ from[1], to[1], from[3], to[3] ]
|
||||
else
|
||||
colors = [ to[1], from[1], to[3], from[3] ]
|
||||
endif
|
||||
dict[group] = colors
|
||||
airline#highlighter#exec(group, colors)
|
||||
enddef
|
||||
def airline#highlighter#load_theme(): void # {{{2
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
for winnr in filter(range(1, winnr('$')), {_, v -> v != winnr()})
|
||||
airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
||||
endfor
|
||||
airline#highlighter#highlight(['inactive'])
|
||||
if getbufvar( bufnr('%'), '&modified' )
|
||||
airline#highlighter#highlight(['normal', 'modified'])
|
||||
else
|
||||
airline#highlighter#highlight(['normal'])
|
||||
endif
|
||||
enddef
|
||||
def airline#highlighter#add_separator(from: string, to: string, inverse: bool): void # {{{2
|
||||
s:separators[from .. to] = [from, to, inverse]
|
||||
s:exec_separator({}, from, to, inverse, '')
|
||||
enddef
|
||||
def airline#highlighter#add_accent(accent: string): void # {{{2
|
||||
s:accents[accent] = 1
|
||||
enddef
|
||||
def airline#highlighter#highlight_modified_inactive(bufnr: number): void # {{{2
|
||||
var colors: list<any>
|
||||
var dict1 = eval('g:airline#themes#' .. g:airline_theme .. '#palette')->get('inactive_modified', {})
|
||||
var dict2 = eval('g:airline#themes#' .. g:airline_theme .. '#palette')->get('inactive', {})
|
||||
|
||||
if empty(dict2)
|
||||
return
|
||||
endif
|
||||
|
||||
if getbufvar(bufnr, '&modified')
|
||||
colors = get(dict1, 'airline_c', [])
|
||||
else
|
||||
colors = get(dict2, 'airline_c', [])
|
||||
endif
|
||||
if !empty(colors)
|
||||
airline#highlighter#exec('airline_c' .. bufnr .. '_inactive', colors)
|
||||
endif
|
||||
enddef
|
||||
def airline#highlighter#highlight(modes: list<string>, bufnr: string = ''): void # {{{2
|
||||
var p: dict<any> = eval('g:airline#themes#' .. g:airline_theme .. '#palette')
|
||||
|
||||
# draw the base mode, followed by any overrides
|
||||
var mapped = map(modes, {_, v -> v == modes[0] ? v : modes[0] .. "_" .. v})
|
||||
var suffix = ''
|
||||
if modes[0] == 'inactive'
|
||||
suffix = '_inactive'
|
||||
endif
|
||||
var airline_grouplist = []
|
||||
var dict: dict<any>
|
||||
var bnr: number = 0
|
||||
|
||||
var buffers_in_tabpage: list<number> = uniq(sort(tabpagebuflist()))
|
||||
# mapped might be something like ['normal', 'normal_modified']
|
||||
# if a group is in both modes available, only define the second
|
||||
# that is how this was done previously overwrite the previous definition
|
||||
for mode in reverse(mapped)
|
||||
if exists('g:airline#themes#' .. g:airline_theme .. '#palette.' .. mode)
|
||||
dict = eval('g:airline#themes#' .. g:airline_theme .. '#palette.' .. mode)
|
||||
for kvp in items(dict)
|
||||
var mode_colors = kvp[1]
|
||||
var name = kvp[0]
|
||||
if name == 'airline_c' && !empty(bufnr) && suffix == '_inactive'
|
||||
name = 'airline_c' .. bufnr
|
||||
endif
|
||||
# do not re-create highlighting for buffers that are no longer visible
|
||||
# in the current tabpage
|
||||
if name =~# 'airline_c\d\+'
|
||||
bnr = str2nr(matchstr(name, 'airline_c\zs\d\+'))
|
||||
if bnr > 0 && index(buffers_in_tabpage, bnr) == -1
|
||||
continue
|
||||
endif
|
||||
elseif (name =~ '_to_') || (name[0:10] == 'airline_tab' && !empty(suffix))
|
||||
# group will be redefined below at exec_separator
|
||||
# or is not needed for tabline with '_inactive' suffix
|
||||
# since active flag is 1 for builder)
|
||||
continue
|
||||
endif
|
||||
if s:group_not_done(airline_grouplist, name .. suffix)
|
||||
airline#highlighter#exec(name .. suffix, mode_colors)
|
||||
endif
|
||||
|
||||
if !has_key(p, 'accents')
|
||||
# shouldn't actually happen, p should always contain accents
|
||||
continue
|
||||
endif
|
||||
|
||||
for accent in keys(s:accents)
|
||||
if !has_key(p.accents, accent)
|
||||
continue
|
||||
endif
|
||||
var colors = copy(mode_colors)
|
||||
if p.accents[accent][0] != ''
|
||||
colors[0] = p.accents[accent][0]
|
||||
endif
|
||||
if type(get(p.accents[accent], 2, '')) == type('')
|
||||
colors[2] = get(p.accents[accent], 2, '')
|
||||
else
|
||||
colors[2] = string(p.accents[accent][2])
|
||||
endif
|
||||
if len(colors) >= 5
|
||||
colors[4] = get(p.accents[accent], 4, '')
|
||||
else
|
||||
add(colors, get(p.accents[accent], 4, ''))
|
||||
endif
|
||||
if s:group_not_done(airline_grouplist, name .. suffix .. '_' .. accent)
|
||||
airline#highlighter#exec(name .. suffix .. '_' .. accent, colors)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
if empty(s:separators)
|
||||
continue
|
||||
endif
|
||||
for sep in items(s:separators)
|
||||
# we cannot check, that the group already exists, else the separators
|
||||
# might not be correctly defined. But perhaps we can skip above groups
|
||||
# that match the '_to_' name, because they would be redefined here...
|
||||
s:exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
enddef
|
||||
endif " }}}1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -31,7 +31,6 @@ function! airline#init#bootstrap()
|
||||
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])
|
||||
call s:check_defined('g:airline_exclude_filetypes', [])
|
||||
call s:check_defined('g:airline_exclude_preview', 0)
|
||||
call s:check_defined('g:airline_gui_mode', airline#init#gui_mode())
|
||||
|
||||
call s:check_defined('g:airline_mode_map', {})
|
||||
call extend(g:airline_mode_map, {
|
||||
@@ -146,10 +145,10 @@ function! airline#init#bootstrap()
|
||||
\ 'function': 'airline#parts#readonly',
|
||||
\ 'accent': 'red',
|
||||
\ })
|
||||
call airline#parts#define_raw('file', '%f%m')
|
||||
call airline#parts#define_raw('file', airline#formatter#short_path#format('%f%m'))
|
||||
call airline#parts#define_raw('path', '%F%m')
|
||||
call airline#parts#define('linenr', {
|
||||
\ 'raw': '%{g:airline_symbols.linenr}%4l',
|
||||
\ 'raw': '%{g:airline_symbols.linenr}%l',
|
||||
\ 'accent': 'bold'})
|
||||
call airline#parts#define('maxlinenr', {
|
||||
\ 'raw': '/%L%{g:airline_symbols.maxlinenr}',
|
||||
@@ -161,61 +160,69 @@ function! airline#init#bootstrap()
|
||||
call airline#parts#define('branch', {
|
||||
\ 'raw': '',
|
||||
\ 'minwidth': 80})
|
||||
call airline#parts#define('coc_status', {
|
||||
\ 'raw': '',
|
||||
\ 'accent': 'bold'
|
||||
\ })
|
||||
call airline#parts#define_empty(['obsession', 'tagbar', 'syntastic-warn',
|
||||
\ 'syntastic-err', 'eclim', 'whitespace','windowswap',
|
||||
\ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count',
|
||||
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count',
|
||||
\ 'lsp_error_count', 'lsp_warning_count',
|
||||
\ 'nvimlsp_error_count', 'nvimlsp_warning_count',
|
||||
\ 'languageclient_error_count', 'languageclient_warning_count',
|
||||
\ 'coc_warning_count', 'coc_error_count', 'vista'])
|
||||
\ 'coc_warning_count', 'coc_error_count', 'vista', 'battery'])
|
||||
call airline#parts#define_text('bookmark', '')
|
||||
call airline#parts#define_text('capslock', '')
|
||||
call airline#parts#define_text('gutentags', '')
|
||||
call airline#parts#define_text('gen_tags', '')
|
||||
call airline#parts#define_text('grepper', '')
|
||||
call airline#parts#define_text('xkblayout', '')
|
||||
call airline#parts#define_text('keymap', '')
|
||||
call airline#parts#define_text('omnisharp', '')
|
||||
|
||||
unlet g:airline#init#bootstrapping
|
||||
endfunction
|
||||
|
||||
function! airline#init#gui_mode()
|
||||
return has('gui_running') || (has("termguicolors") && &termguicolors == 1) ? 'gui' : 'cterm'
|
||||
endfunction
|
||||
|
||||
function! airline#init#sections()
|
||||
let spc = g:airline_symbols.space
|
||||
if !exists('g:airline_section_a')
|
||||
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'keymap', 'spell', 'capslock', 'xkblayout', 'iminsert'])
|
||||
endif
|
||||
if !exists('g:airline_section_b')
|
||||
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
|
||||
if airline#util#winwidth() > 99
|
||||
let g:airline_section_b = airline#section#create(['hunks', 'branch', 'battery'])
|
||||
else
|
||||
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
|
||||
endif
|
||||
endif
|
||||
if !exists('g:airline_section_c')
|
||||
if exists("+autochdir") && &autochdir == 1
|
||||
let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly'])
|
||||
let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly', 'coc_status'])
|
||||
else
|
||||
let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly'])
|
||||
let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly', 'coc_status'])
|
||||
endif
|
||||
endif
|
||||
if !exists('g:airline_section_gutter')
|
||||
let g:airline_section_gutter = airline#section#create(['%='])
|
||||
endif
|
||||
if !exists('g:airline_section_x')
|
||||
let g:airline_section_x = airline#section#create_right(['bookmark', 'tagbar', 'vista', 'gutentags', 'grepper', 'filetype'])
|
||||
let g:airline_section_x = airline#section#create_right(['bookmark', 'tagbar', 'vista', 'gutentags', 'gen_tags', 'omnisharp', 'grepper', 'filetype'])
|
||||
endif
|
||||
if !exists('g:airline_section_y')
|
||||
let g:airline_section_y = airline#section#create_right(['ffenc'])
|
||||
endif
|
||||
if !exists('g:airline_section_z')
|
||||
if airline#util#winwidth() > 79
|
||||
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
|
||||
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%p%%'.spc, 'linenr', 'maxlinenr', ':%v'])
|
||||
else
|
||||
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3v'])
|
||||
let g:airline_section_z = airline#section#create(['%p%%'.spc, 'linenr', ':%v'])
|
||||
endif
|
||||
endif
|
||||
if !exists('g:airline_section_error')
|
||||
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count', 'languageclient_error_count', 'coc_error_count'])
|
||||
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count', 'lsp_error_count', 'nvimlsp_error_count', 'languageclient_error_count', 'coc_error_count'])
|
||||
endif
|
||||
if !exists('g:airline_section_warning')
|
||||
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'languageclient_warning_count', 'whitespace', 'coc_warning_count'])
|
||||
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'lsp_warning_count', 'nvimlsp_warning_count', 'languageclient_warning_count', 'whitespace', 'coc_warning_count'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -22,7 +22,7 @@ scriptencoding utf-8
|
||||
" 14 Yellow
|
||||
" 15 White
|
||||
|
||||
let s:basic16 = [
|
||||
const s:basic16 = [
|
||||
\ [ 0x00, 0x00, 0x00 ],
|
||||
\ [ 0x00, 0x00, 0x80 ],
|
||||
\ [ 0x00, 0x80, 0x00 ],
|
||||
@@ -41,6 +41,26 @@ let s:basic16 = [
|
||||
\ [ 0xFF, 0xFF, 0xFF ]
|
||||
\ ]
|
||||
|
||||
if exists(":def")
|
||||
def airline#msdos#round_msdos_colors(rgblist: list<number>): string
|
||||
# Check for values from MSDOS 16 color terminal
|
||||
var best = []
|
||||
var min = 100000
|
||||
var t = 0
|
||||
for value in s:basic16
|
||||
t = abs(value[0] - rgblist[0]) +
|
||||
abs(value[1] - rgblist[1]) +
|
||||
abs(value[2] - rgblist[2])
|
||||
if min > t
|
||||
min = t
|
||||
best = value
|
||||
endif
|
||||
endfor
|
||||
return string(index(s:basic16, best))
|
||||
enddef
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#msdos#round_msdos_colors(rgblist)
|
||||
" Check for values from MSDOS 16 color terminal
|
||||
let best = []
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,78 +1,151 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" generates a dictionary which defines the colors for each highlight group
|
||||
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...)
|
||||
let palette = {
|
||||
\ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] ,
|
||||
\ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] ,
|
||||
\ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] ,
|
||||
\ }
|
||||
if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
" generates a dictionary which defines the colors for each highlight group
|
||||
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...)
|
||||
let palette = {
|
||||
\ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] ,
|
||||
\ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] ,
|
||||
\ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] ,
|
||||
\ }
|
||||
|
||||
if a:0 > 0
|
||||
call extend(palette, {
|
||||
\ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] ,
|
||||
\ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] ,
|
||||
\ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] ,
|
||||
\ })
|
||||
else
|
||||
call extend(palette, {
|
||||
\ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] ,
|
||||
\ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] ,
|
||||
\ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] ,
|
||||
\ })
|
||||
endif
|
||||
|
||||
return palette
|
||||
endfunction
|
||||
|
||||
function! airline#themes#get_highlight(group, ...)
|
||||
return call('airline#highlighter#get_highlight', [a:group] + a:000)
|
||||
endfunction
|
||||
|
||||
function! airline#themes#get_highlight2(fg, bg, ...)
|
||||
return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000)
|
||||
endfunction
|
||||
|
||||
function! airline#themes#patch(palette)
|
||||
for mode in keys(a:palette)
|
||||
if mode == 'accents'
|
||||
continue
|
||||
if a:0 > 0
|
||||
call extend(palette, {
|
||||
\ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] ,
|
||||
\ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] ,
|
||||
\ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] ,
|
||||
\ })
|
||||
else
|
||||
call extend(palette, {
|
||||
\ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] ,
|
||||
\ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] ,
|
||||
\ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] ,
|
||||
\ })
|
||||
endif
|
||||
if !has_key(a:palette[mode], 'airline_warning')
|
||||
let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ]
|
||||
endif
|
||||
if !has_key(a:palette[mode], 'airline_error')
|
||||
let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
|
||||
endif
|
||||
if !has_key(a:palette[mode], 'airline_term')
|
||||
let a:palette[mode]['airline_term'] = [ '#9cffd3', '#202020', 85, 232]
|
||||
endif
|
||||
endfor
|
||||
|
||||
let a:palette.accents = get(a:palette, 'accents', {})
|
||||
let a:palette.accents.none = [ '', '', '', '', '' ]
|
||||
let a:palette.accents.bold = [ '', '', '', '', 'bold' ]
|
||||
let a:palette.accents.italic = [ '', '', '', '', 'italic' ]
|
||||
return palette
|
||||
endfunction
|
||||
|
||||
if !has_key(a:palette.accents, 'red')
|
||||
let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'green')
|
||||
let a:palette.accents.green = [ '#008700' , '' , 22 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'blue')
|
||||
let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'yellow')
|
||||
let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'orange')
|
||||
let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'purple')
|
||||
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ]
|
||||
endif
|
||||
endfunction
|
||||
function! airline#themes#get_highlight(group, ...)
|
||||
return call('airline#highlighter#get_highlight', [a:group] + a:000)
|
||||
endfunction
|
||||
|
||||
function! airline#themes#get_highlight2(fg, bg, ...)
|
||||
return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000)
|
||||
endfunction
|
||||
|
||||
function! airline#themes#patch(palette)
|
||||
for mode in keys(a:palette)
|
||||
if mode == 'accents'
|
||||
continue
|
||||
endif
|
||||
if !has_key(a:palette[mode], 'airline_warning')
|
||||
let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ]
|
||||
endif
|
||||
if !has_key(a:palette[mode], 'airline_error')
|
||||
let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
|
||||
endif
|
||||
if !has_key(a:palette[mode], 'airline_term')
|
||||
let a:palette[mode]['airline_term'] = [ '#9cffd3', '#202020', 85, 232]
|
||||
endif
|
||||
endfor
|
||||
|
||||
let a:palette.accents = get(a:palette, 'accents', {})
|
||||
let a:palette.accents.none = [ '', '', '', '', '' ]
|
||||
let a:palette.accents.bold = [ '', '', '', '', 'bold' ]
|
||||
let a:palette.accents.italic = [ '', '', '', '', 'italic' ]
|
||||
|
||||
if !has_key(a:palette.accents, 'red')
|
||||
let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'green')
|
||||
let a:palette.accents.green = [ '#008700' , '' , 22 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'blue')
|
||||
let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'yellow')
|
||||
let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'orange')
|
||||
let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'purple')
|
||||
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ]
|
||||
endif
|
||||
endfunction
|
||||
else
|
||||
" New Vim9script implementation
|
||||
def airline#themes#generate_color_map(sect1: list<string>, sect2: list<any>, sect3: list<any>): dict<any>
|
||||
# Only allows for 3 arguments currently, because Vim9 Script does not
|
||||
# allow for a:000
|
||||
|
||||
# all sections should be string
|
||||
map(sect2, {_, v -> type(v) != type('') ? string(v) : v})
|
||||
var palette = {
|
||||
'airline_a': [ sect1[0], sect1[1], sect1[2], sect1[3], get(sect1, 4, '') ],
|
||||
'airline_b': [ sect2[0], sect2[1], sect2[2], sect2[3], get(sect2, 4, '') ],
|
||||
'airline_c': [ sect3[0], sect3[1], sect3[2], sect3[3], get(sect3, 4, '') ],
|
||||
}
|
||||
|
||||
extend(palette, {
|
||||
'airline_x': [ sect3[0], sect3[1], sect3[2], sect3[3], '' ],
|
||||
'airline_y': [ sect2[0], sect2[1], sect2[2], sect2[3], '' ],
|
||||
'airline_z': [ sect1[0], sect1[1], sect1[2], sect1[3], '' ],
|
||||
})
|
||||
|
||||
return palette
|
||||
enddef
|
||||
|
||||
def airline#themes#get_highlight(group: string): list<string>
|
||||
return call('airline#highlighter#get_highlight', [group])
|
||||
enddef
|
||||
|
||||
def airline#themes#get_highlight2(fg: list<string>, bg: list<string>): list<string>
|
||||
return call('airline#highlighter#get_highlight2', [fg, bg])
|
||||
enddef
|
||||
|
||||
def airline#themes#patch(palette: dict<any>): void
|
||||
for mode in keys(palette)
|
||||
if mode == 'accents'
|
||||
continue
|
||||
endif
|
||||
if !has_key(palette[mode], 'airline_warning')
|
||||
extend(palette[mode], #{airline_warning: [ '#000000', '#df5f00', '232', '166', '' ]})
|
||||
endif
|
||||
if !has_key(palette[mode], 'airline_error')
|
||||
extend(palette[mode], #{airline_error: [ '#000000', '#990000', '232', '160', '' ]})
|
||||
endif
|
||||
if !has_key(palette[mode], 'airline_term')
|
||||
extend(palette[mode], #{airline_term: [ '#9cffd3', '#202020', '85', '232', '']})
|
||||
endif
|
||||
endfor
|
||||
|
||||
palette.accents = get(palette, 'accents', {})
|
||||
extend(palette.accents, #{none: [ '', '', '', '', '' ]})
|
||||
extend(palette.accents, #{bold: [ '', '', '', '', 'bold' ]})
|
||||
extend(palette.accents, #{italic: [ '', '', '', '', 'italic' ]})
|
||||
|
||||
if !has_key(palette.accents, 'red')
|
||||
extend(palette.accents, #{red: [ '#ff0000', '', '160', '' ]})
|
||||
endif
|
||||
if !has_key(palette.accents, 'green')
|
||||
extend(palette.accents, #{green: [ '#008700', '', '22', '' ]})
|
||||
endif
|
||||
if !has_key(palette.accents, 'blue')
|
||||
extend(palette.accents, #{blue: [ '#005fff', '', '27', '' ]})
|
||||
endif
|
||||
if !has_key(palette.accents, 'yellow')
|
||||
extend(palette.accents, #{yellow: [ '#dfff00', '', '190', '' ]})
|
||||
endif
|
||||
if !has_key(palette.accents, 'orange')
|
||||
extend(palette.accents, #{orange: [ '#df5f00', '', '166', '' ]})
|
||||
endif
|
||||
if !has_key(palette.accents, 'purple')
|
||||
extend(palette.accents, #{purple: [ '#af00df', '', '128', '' ]})
|
||||
endif
|
||||
enddef
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 tw=80
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -18,6 +18,7 @@ scriptencoding utf-8
|
||||
" * replace
|
||||
" * visual
|
||||
" * inactive
|
||||
" * terminal
|
||||
" The last one is actually no real mode as returned by mode(), but used by
|
||||
" airline to style inactive statuslines (e.g. windows, where the cursor
|
||||
" currently does not reside in).
|
||||
@@ -60,9 +61,9 @@ let g:airline#themes#dark#palette = {}
|
||||
" airline_x/y/z, respectively.
|
||||
|
||||
" The dark.vim theme:
|
||||
let s:airline_a_normal = [ '#00005f' , '#dfff00' , 17 , 190 ]
|
||||
let s:airline_b_normal = [ '#ffffff' , '#444444' , 255 , 238 ]
|
||||
let s:airline_c_normal = [ '#9cffd3' , '#202020' , 85 , 234 ]
|
||||
let s:airline_a_normal = [ '#00005f' , '#dfff00' , '17' , '190' ]
|
||||
let s:airline_b_normal = [ '#ffffff' , '#444444' , '255' , '238' ]
|
||||
let s:airline_c_normal = [ '#9cffd3' , '#202020' , '85' , '234' ]
|
||||
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:airline_a_normal, s:airline_b_normal, s:airline_c_normal)
|
||||
|
||||
" It should be noted the above is equivalent to:
|
||||
@@ -92,49 +93,50 @@ let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:a
|
||||
" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are
|
||||
" declared.
|
||||
let g:airline#themes#dark#palette.normal_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , '255' , '53' , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:airline_a_insert = [ '#00005f' , '#00dfff' , 17 , 45 ]
|
||||
let s:airline_b_insert = [ '#ffffff' , '#005fff' , 255 , 27 ]
|
||||
let s:airline_c_insert = [ '#ffffff' , '#000080' , 15 , 17 ]
|
||||
let s:airline_a_insert = [ '#00005f' , '#00dfff' , '17' , '45' ]
|
||||
let s:airline_b_insert = [ '#ffffff' , '#005fff' , '255' , '27' ]
|
||||
let s:airline_c_insert = [ '#ffffff' , '#000080' , '15' , '17' ]
|
||||
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:airline_a_insert, s:airline_b_insert, s:airline_c_insert)
|
||||
let g:airline#themes#dark#palette.insert_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , '255' , '53' , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#dark#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:airline_a_insert[0] , '#d78700' , s:airline_a_insert[2] , 172 , '' ] ,
|
||||
\ 'airline_a': [ s:airline_a_insert[0] , '#d78700' , s:airline_a_insert[2] , '172' , '' ] ,
|
||||
\ }
|
||||
|
||||
let g:airline#themes#dark#palette.terminal = airline#themes#generate_color_map(s:airline_a_insert, s:airline_b_insert, s:airline_c_insert)
|
||||
|
||||
let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert)
|
||||
let g:airline#themes#dark#palette.replace.airline_a = [ s:airline_b_insert[0] , '#af0000' , s:airline_b_insert[2] , 124 , '' ]
|
||||
let g:airline#themes#dark#palette.replace.airline_a = [ s:airline_b_insert[0] , '#af0000' , s:airline_b_insert[2] , '124' , '' ]
|
||||
let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified
|
||||
|
||||
|
||||
let s:airline_a_visual = [ '#000000' , '#ffaf00' , 232 , 214 ]
|
||||
let s:airline_b_visual = [ '#000000' , '#ff5f00' , 232 , 202 ]
|
||||
let s:airline_c_visual = [ '#ffffff' , '#5f0000' , 15 , 52 ]
|
||||
let s:airline_a_visual = [ '#000000' , '#ffaf00' , '232' , '214' ]
|
||||
let s:airline_b_visual = [ '#000000' , '#ff5f00' , '232' , '202' ]
|
||||
let s:airline_c_visual = [ '#ffffff' , '#5f0000' , '15' , '52' ]
|
||||
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:airline_a_visual, s:airline_b_visual, s:airline_c_visual)
|
||||
let g:airline#themes#dark#palette.visual_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , '255' , '53' , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:airline_a_inactive = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
|
||||
let s:airline_b_inactive = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
|
||||
let s:airline_c_inactive = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
|
||||
let s:airline_a_inactive = [ '#4e4e4e' , '#1c1c1c' , '239' , '234' , '' ]
|
||||
let s:airline_b_inactive = [ '#4e4e4e' , '#262626' , '239' , '235' , '' ]
|
||||
let s:airline_c_inactive = [ '#4e4e4e' , '#303030' , '239' , '236' , '' ]
|
||||
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:airline_a_inactive, s:airline_b_inactive, s:airline_c_inactive)
|
||||
let g:airline#themes#dark#palette.inactive_modified = {
|
||||
\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
|
||||
\ 'airline_c': [ '#875faf' , '' , '97' , '' , '' ] ,
|
||||
\ }
|
||||
|
||||
" For commandline mode, we use the colors from normal mode, except the mode
|
||||
" indicator should be colored differently, e.g. light green
|
||||
let s:airline_a_commandline = [ '#0000ff' , '#0cff00' , 17 , 40 ]
|
||||
let s:airline_b_commandline = [ '#ffffff' , '#444444' , 255 , 238 ]
|
||||
let s:airline_c_commandline = [ '#9cffd3' , '#202020' , 85 , 234 ]
|
||||
let 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
|
||||
@@ -145,17 +147,17 @@ let g:airline#themes#dark#palette.commandline = airline#themes#generate_color_ma
|
||||
" will be red instead of the section's foreground color. You can also have
|
||||
" multiple parts with accents within a section.
|
||||
let g:airline#themes#dark#palette.accents = {
|
||||
\ 'red': [ '#ff0000' , '' , 160 , '' ]
|
||||
\ 'red': [ '#ff0000' , '' , '160' , '' ]
|
||||
\ }
|
||||
|
||||
|
||||
" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp
|
||||
" variable so that related functionality is loaded iff the user is using
|
||||
" variable so that related functionality is loaded if the user is using
|
||||
" ctrlp. Note that this is optional, and if you do not define ctrlp colors
|
||||
" they will be chosen automatically from the existing palette.
|
||||
if get(g:, 'loaded_ctrlp', 0)
|
||||
let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ],
|
||||
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
|
||||
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])
|
||||
\ [ '#d7d7ff' , '#5f00af' , '189' , '55' , '' ],
|
||||
\ [ '#ffffff' , '#875fd7' , '231' , '98' , '' ],
|
||||
\ [ '#5f00af' , '#ffffff' , '55' , '231' , 'bold' ])
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2019 Bailey Ling Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -11,6 +11,7 @@ let s:spc = g:airline_symbols.space
|
||||
let s:nomodeline = (v:version > 703 || (v:version == 703 && has("patch438"))) ? '<nomodeline>' : ''
|
||||
let s:has_strchars = exists('*strchars')
|
||||
let s:has_strcharpart = exists('*strcharpart')
|
||||
let s:focusgained_ignore_time = 0
|
||||
|
||||
" TODO: Try to cache winwidth(0) function
|
||||
" e.g. store winwidth per window and access that, only update it, if the size
|
||||
@@ -66,6 +67,17 @@ function! airline#util#prepend(text, minwidth)
|
||||
return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc
|
||||
endfunction
|
||||
|
||||
if v:version >= 704
|
||||
function! airline#util#getbufvar(bufnr, key, def)
|
||||
return getbufvar(a:bufnr, a:key, a:def)
|
||||
endfunction
|
||||
else
|
||||
function! airline#util#getbufvar(bufnr, key, def)
|
||||
let bufvals = getbufvar(a:bufnr, '')
|
||||
return get(bufvals, a:key, a:def)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if v:version >= 704
|
||||
function! airline#util#getwinvar(winnr, key, def)
|
||||
return getwinvar(a:winnr, a:key, a:def)
|
||||
@@ -135,6 +147,14 @@ function! airline#util#has_fugitive()
|
||||
return s:has_fugitive
|
||||
endfunction
|
||||
|
||||
function! airline#util#has_gina()
|
||||
if !exists("s:has_gina")
|
||||
let s:has_gina = (exists(':Gina') && v:version >= 800)
|
||||
endif
|
||||
return s:has_gina
|
||||
endfunction
|
||||
|
||||
|
||||
function! airline#util#has_lawrencium()
|
||||
if !exists("s:has_lawrencium")
|
||||
let s:has_lawrencium = exists('*lawrencium#statusline')
|
||||
@@ -159,5 +179,34 @@ 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'])
|
||||
return sort(map(files, 'fnamemodify(v:val, ":t:r")') + ('random' =~ a:match ? ['random'] : []))
|
||||
endfunction
|
||||
|
||||
function! airline#util#stl_disabled(winnr)
|
||||
" setting the statusline is disabled,
|
||||
" either globally, per window, or per buffer
|
||||
" w:airline_disabled is deprecated!
|
||||
return get(g:, 'airline_disable_statusline', 0) ||
|
||||
\ airline#util#getwinvar(a:winnr, 'airline_disable_statusline', 0) ||
|
||||
\ airline#util#getwinvar(a:winnr, 'airline_disabled', 0) ||
|
||||
\ airline#util#getbufvar(winbufnr(a:winnr), 'airline_disable_statusline', 0)
|
||||
endfunction
|
||||
|
||||
function! airline#util#ignore_next_focusgain()
|
||||
if has('win32')
|
||||
" Setup an ignore for platforms that trigger FocusLost on calls to
|
||||
" system(). macvim (gui and terminal) and Linux terminal vim do not.
|
||||
let s:focusgained_ignore_time = localtime()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#try_focusgained()
|
||||
" Ignore lasts for at most one second and is cleared on the first
|
||||
" focusgained. We use ignore to prevent system() calls from triggering
|
||||
" FocusGained (which occurs 100% on win32 and seem to sometimes occur under
|
||||
" tmux).
|
||||
let dt = localtime() - s:focusgained_ignore_time
|
||||
let s:focusgained_ignore_time = 0
|
||||
return dt >= 1
|
||||
endfunction
|
||||
|
||||
|
||||
310
doc/airline.txt
310
doc/airline.txt
@@ -167,6 +167,14 @@ values):
|
||||
endif
|
||||
endfunction
|
||||
<
|
||||
* if you want to update your highlights without effecting the airline theme,
|
||||
you can do so using the AirlineAfterTheme autocmd. >
|
||||
function! s:update_highlights()
|
||||
hi CursorLine ctermbg=none guibg=none
|
||||
hi VertSplit ctermbg=none guibg=none
|
||||
endfunction
|
||||
autocmd User AirlineAfterTheme call s:update_highlights()
|
||||
<
|
||||
* By default, airline will use unicode symbols if your encoding matches
|
||||
utf-8. If you want the powerline symbols set this variable: >
|
||||
let g:airline_powerline_fonts = 1
|
||||
@@ -212,7 +220,9 @@ values):
|
||||
(for section a and b): >
|
||||
|
||||
let g:airline_filetype_overrides = {
|
||||
\ 'coc-explorer': [ 'CoC Explorer', '' ],
|
||||
\ 'defx': ['defx', '%{b:defx.paths[0]}'],
|
||||
\ 'fugitive': ['fugitive', '%{airline#util#wrap(airline#extensions#branch#get_head(),80)}'],
|
||||
\ 'gundo': [ 'Gundo', '' ],
|
||||
\ 'help': [ 'Help', '%f' ],
|
||||
\ 'minibufexpl': [ 'MiniBufExplorer', '' ],
|
||||
@@ -221,21 +231,36 @@ values):
|
||||
\ 'vim-plug': [ 'Plugins', '' ],
|
||||
\ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ],
|
||||
\ 'vimshell': ['vimshell','%{vimshell#get_status_string()}'],
|
||||
\ 'vaffle' : [ 'Vaffle', '%{b:vaffle.dir}' ],
|
||||
\ }
|
||||
<
|
||||
* defines whether the preview window should be excluded from have its window
|
||||
* defines whether the preview window should be excluded from having its window
|
||||
statusline modified (may help with plugins which use the preview window
|
||||
heavily) >
|
||||
let g:airline_exclude_preview = 0
|
||||
<
|
||||
* disable the Airline customization for selected windows (this is a
|
||||
* disable the Airline statusline customization for selected windows (this is a
|
||||
window-local variable so you can disable it per-window) >
|
||||
let w:airline_disabled = 1
|
||||
let w:airline_disable_statusline = 1
|
||||
<
|
||||
Old deprecated name: `w:airline_disabled`
|
||||
|
||||
See also the following options, for disabling setting the statusline
|
||||
globally or per-buffer
|
||||
* Disable setting the statusline option: >
|
||||
" disable globally
|
||||
let g:airline_disable_statusline = 1
|
||||
|
||||
" disable per-buffer
|
||||
let b:airline_disable_statusline = 1
|
||||
|
||||
< This setting disables setting the 'statusline' option. This allows to use
|
||||
e.g. the tabline extension (|airline-tabline|) but keep the 'statusline'
|
||||
option totally configurable by a custom configuration.
|
||||
* Do not draw separators for empty sections (only for the active window) >
|
||||
let g:airline_skip_empty_sections = 1
|
||||
<
|
||||
This variable can be overriden by setting a window-local variable with
|
||||
This variable can be overridden by setting a window-local variable with
|
||||
the same name (in the correct window): >
|
||||
let w:airline_skip_empty_sections = 0
|
||||
<
|
||||
@@ -265,6 +290,10 @@ values):
|
||||
To force updating the tabline on mode changes, call `airline#check_mode()`
|
||||
in your custom statusline setting: `:set stl=%!airline#check_mode(winnr())`
|
||||
will correctly update the tabline on mode changes.
|
||||
|
||||
* Display a short path in statusline: >
|
||||
let g:airline_stl_path_style = 'short'
|
||||
>
|
||||
=============================================================================
|
||||
COMMANDS *airline-commands*
|
||||
|
||||
@@ -341,7 +370,7 @@ its contents. >
|
||||
let g:airline_symbols.readonly = ''
|
||||
let g:airline_symbols.linenr = '☰'
|
||||
let g:airline_symbols.maxlinenr = ''
|
||||
let g:airline_symbols.dirty=⚡
|
||||
let g:airline_symbols.dirty='⚡'
|
||||
|
||||
" old vim-powerline symbols
|
||||
let g:airline_left_sep = '⮀'
|
||||
@@ -454,6 +483,13 @@ ale <https://github.com/dense-analysis/ale>
|
||||
* ale close_lnum_symbol >
|
||||
let airline#extensions#ale#close_lnum_symbol = ')'
|
||||
|
||||
------------------------------------- *airline-battery*
|
||||
vim-battery <https://github.com/lambdalisue/battery.vim>
|
||||
|
||||
* enable/disable battery integration >
|
||||
let g:airline#extensions#battery#enabled = 1
|
||||
< default: 0
|
||||
|
||||
------------------------------------- *airline-bookmark*
|
||||
vim-bookmark <https://github.com/MattesGroeger/vim-bookmarks>
|
||||
|
||||
@@ -465,6 +501,7 @@ vim-airline will display the branch-indicator together with the branch name
|
||||
in the statusline, if one of the following plugins is installed:
|
||||
|
||||
fugitive.vim <https://github.com/tpope/vim-fugitive>
|
||||
gina.vim <https://github.com/lambdalisue/gina.vim>
|
||||
lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
|
||||
vcscommand <http://www.vim.org/scripts/script.php?script_id=90>
|
||||
|
||||
@@ -472,6 +509,13 @@ If a file is edited, that is not yet in the repository, the
|
||||
notexists symbol will be displayed after the branch name. If the repository
|
||||
is not clean, the dirty symbol will be displayed after the branch name.
|
||||
|
||||
* notexists symbol means you are editing a file, that has not been
|
||||
committed yet
|
||||
default: '?'
|
||||
|
||||
* the dirty symbol basically means your working directory is dirty
|
||||
default: '!'
|
||||
|
||||
Note: the branch extension will be disabled for windows smaller than 80
|
||||
characters.
|
||||
|
||||
@@ -553,6 +597,9 @@ vim-capslock <https://github.com/tpope/vim-capslock>
|
||||
* enable/disable vim-capslock integration >
|
||||
let g:airline#extensions#capslock#enabled = 1
|
||||
|
||||
* change vim-capslock symbol >
|
||||
let g:airline#extensions#capslock#symbol = 'CAPS' (default)
|
||||
|
||||
------------------------------------- *airline-coc*
|
||||
coc <https://github.com/neoclide/coc.nvim>
|
||||
|
||||
@@ -673,7 +720,15 @@ you can use.
|
||||
------------------------------------- *airline-denite*
|
||||
Denite <https://github.com/Shougo/denite.nvim>
|
||||
|
||||
No configuration available.
|
||||
* enable/disable denite integration >
|
||||
let g:airline#extensions#denite#enabled = 1
|
||||
|
||||
------------------------------------- *airline-dirvish*
|
||||
vim-dirvish <https://github.com/justinmk/vim-dirvish>
|
||||
|
||||
* enable/disable vim-dirvish integration >
|
||||
let g:airline#extensions#dirvish#enabled = 1
|
||||
< default: 1
|
||||
|
||||
------------------------------------- *airline-eclim*
|
||||
eclim <https://eclim.org>
|
||||
@@ -682,6 +737,16 @@ eclim <https://eclim.org>
|
||||
|airline-syntastic| extension. >
|
||||
let g:airline#extensions#eclim#enabled = 1
|
||||
|
||||
------------------------------------- *airline-fern*
|
||||
fern.vim <https://github.com/lambdalisue/fern.vim>
|
||||
|
||||
Airline displays the fern.vim specific statusline.
|
||||
(for details, see the help of fern.vim)
|
||||
|
||||
* enable/disable bufferline integration >
|
||||
let g:airline#extensions#fern#enabled = 1
|
||||
< default: 1
|
||||
|
||||
------------------------------------- *airline-fugitiveline*
|
||||
This extension hides the fugitive://**// part of the buffer names, to only
|
||||
show the file name as if it were in the current working tree.
|
||||
@@ -693,12 +758,23 @@ It is deactivated by default if |airline-bufferline| is activated.
|
||||
If enabled, the buffer that comes from fugitive, will have added a trailing
|
||||
"[git]" to be able do distinguish between fugitive and non-fugitive buffers.
|
||||
|
||||
------------------------------------- *airline-fzf*
|
||||
fzf <https://github.com/junegunn/fzf>
|
||||
fzf.vim <https://github.com/junegunn/fzf.vim>
|
||||
|
||||
* enable/disable fzf integration >
|
||||
let g:airline#extensions#fzf#enabled = 1
|
||||
|
||||
------------------------------------- *airline-gina*
|
||||
gina.vim <https://github.com/lambdalisue/gina.vim>
|
||||
|
||||
Airline displays the gina.vim specific statusline.
|
||||
(for details, see the help of gina.vim)
|
||||
|
||||
* enable/disable bufferline integration >
|
||||
let g:airline#extensions#gina#enabled = 1
|
||||
< default: 1
|
||||
|
||||
------------------------------------- *airline-grepper*
|
||||
vim-grepper <https://github.com/mhinz/vim-grepper>
|
||||
|
||||
@@ -711,11 +787,18 @@ vim-gutentags <https://github.com/ludovicchabant/vim-gutentags>
|
||||
* enable/disable vim-gutentags integration >
|
||||
let g:airline#extensions#gutentags#enabled = 1
|
||||
|
||||
------------------------------------- *gen_tags.vim*
|
||||
gen_tags.vim <https://github.com/jsfaint/gen_tags.vim>
|
||||
|
||||
* enable/disable gen_tags.vim integration >
|
||||
let g:airline#extensions#gen_tags#enabled = 1
|
||||
|
||||
------------------------------------- *airline-hunks*
|
||||
vim-gitgutter <https://github.com/airblade/vim-gitgutter>
|
||||
vim-signify <https://github.com/mhinz/vim-signify>
|
||||
changesPlugin <https://github.com/chrisbra/changesPlugin>
|
||||
quickfixsigns <https://github.com/tomtom/quickfixsigns_vim>
|
||||
coc-git <https://github.com/neoclide/coc-git>
|
||||
|
||||
You can use `airline#extensions#hunks#get_raw_hunks()` to get the full hunks,
|
||||
without shortening. This allows for advanced customization, or a quick way of
|
||||
@@ -729,6 +812,11 @@ querying how many changes you got. It will return something like '+4 ~2 -1'.
|
||||
<
|
||||
* set hunk count symbols. >
|
||||
let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-']
|
||||
|
||||
* enable coc-git extension.
|
||||
If not set to 1, vim-airline will not consider to use coc-git for the hunks
|
||||
extension. Make sure to have the coc-git extension enabled. >
|
||||
let g:airline#extensions#hunks#coc_git = 1
|
||||
<
|
||||
------------------------------------- *airline-keymap*
|
||||
vim-keymap
|
||||
@@ -738,6 +826,15 @@ This extension displays the current 'keymap' in use.
|
||||
* enable/disable vim-keymap extension >
|
||||
let g:airline#extensions#keymap#enabled = 1
|
||||
|
||||
* set label for a keymap (default is from g:airline_symbols.keymap) >
|
||||
let g:airline#extensions#keymap#label = 'Layout:'
|
||||
|
||||
* set name for default lauout (empty to disable it completely) >
|
||||
let g:airline#extensions#keymap#default = ''
|
||||
|
||||
* set short codes for layout names >
|
||||
let g:airline#extensions#keymap#short_codes = {'russian-jcukenwin': 'ru'}
|
||||
|
||||
------------------------------------- *airline-languageclient*
|
||||
LanguageClient <https://github.com/autozimu/LanguageClient-neovim>
|
||||
(despite its name, it can be used for Vim and Neovim).
|
||||
@@ -761,11 +858,37 @@ LanguageClient <https://github.com/autozimu/LanguageClient-neovim>
|
||||
let airline#extensions#languageclient#close_lnum_symbol = ')'
|
||||
|
||||
------------------------------------- *airline-localsearch*
|
||||
localsearch <https://github.com/mox-mox/localsearch>
|
||||
localsearch <https://github.com/mox-mox/vim-localsearch>
|
||||
|
||||
* enable/disable localsearch indicator integration >
|
||||
let g:airline#extensions#localsearch#enabled = 1
|
||||
|
||||
* invert the localsearch indicator
|
||||
if set to 1, the indicator shall only be shown when localsearch is disabled
|
||||
the text will also change from 'LS' to 'GS' (Global Search) >
|
||||
let g:airline#extensions#localsearch#inverted = 0
|
||||
|
||||
------------------------------------- *airline-lsp*
|
||||
lsp <https://github.com/prabirshrestha/vim-lsp>
|
||||
|
||||
* enable/disable lsp integration >
|
||||
let g:airline#extensions#lsp#enabled = 1
|
||||
|
||||
* lsp error_symbol >
|
||||
let airline#extensions#lsp#error_symbol = 'E:'
|
||||
<
|
||||
* lsp warning >
|
||||
let airline#extensions#lsp#warning_symbol = 'W:'
|
||||
|
||||
* lsp show_line_numbers >
|
||||
let airline#extensions#lsp#show_line_numbers = 1
|
||||
<
|
||||
* lsp open_lnum_symbol >
|
||||
let airline#extensions#lsp#open_lnum_symbol = '(L'
|
||||
<
|
||||
* lsp close_lnum_symbol >
|
||||
let airline#extensions#lsp#close_lnum_symbol = ')'
|
||||
|
||||
------------------------------------- *airline-neomake*
|
||||
neomake <https://github.com/neomake/neomake>
|
||||
|
||||
@@ -779,18 +902,34 @@ neomake <https://github.com/neomake/neomake>
|
||||
let airline#extensions#neomake#warning_symbol = 'W:'
|
||||
<
|
||||
------------------------------------- *airline-nerdtree*
|
||||
NerdTree <https://github.com/scrooloose/nerdtree.git>
|
||||
NerdTree <https://github.com/preservim/nerdtree.git>
|
||||
|
||||
Airline displays the Nerdtree specific statusline (which can be configured
|
||||
using the |'NerdTreeStatusline'| variable (for details, see the help of
|
||||
NerdTree)
|
||||
|
||||
* enable/disable nerdtree's statusline integration >
|
||||
let g:airline#extensions#nerdtree_statusline = 1
|
||||
< default: 1
|
||||
|
||||
------------------------------------- *airline-nrrwrgn*
|
||||
NrrwRgn <https://github.com/chrisbra/NrrwRgn>
|
||||
|
||||
* enable/disable NrrwRgn integration >
|
||||
let g:airline#extensions#nrrwrgn#enabled = 1
|
||||
|
||||
------------------------------------- *airline-nvimlsp*
|
||||
nvimlsp <https://github.com/neovim/nvim-lsp>
|
||||
|
||||
* enable/disable nvimlsp integration >
|
||||
let g:airline#extensions#nvimlsp#enabled = 1
|
||||
|
||||
* nvimlsp error_symbol >
|
||||
let airline#extensions#nvimlsp#error_symbol = 'E:'
|
||||
<
|
||||
* nvimlsp warning >
|
||||
let airline#extensions#nvimlsp#warning_symbol = 'W:'
|
||||
|
||||
------------------------------------- *airline-obsession*
|
||||
vim-obsession <https://github.com/tpope/vim-obsession>
|
||||
|
||||
@@ -800,6 +939,12 @@ vim-obsession <https://github.com/tpope/vim-obsession>
|
||||
* set marked window indicator string >
|
||||
let g:airline#extensions#obsession#indicator_text = '$'
|
||||
<
|
||||
------------------------------------- *airline-omnisharp*
|
||||
OmniSharp <https://github.com/OmniSharp/omnisharp-vim>
|
||||
|
||||
* enable/disable OmniSharp integration >
|
||||
let g:airline#extensions#omnisharp#enabled = 1
|
||||
|
||||
------------------------------------- *airline-po*
|
||||
This extension will display the currently translated, untranslated and fuzzy
|
||||
messages when editing translations (po files). Related plugin (not necessary
|
||||
@@ -815,6 +960,12 @@ files with the 'filetype' "po".
|
||||
* truncate width names to a fixed length >
|
||||
let g:airline#extensions#po#displayed_limit = 0
|
||||
|
||||
------------------------------------- *airline-poetv*
|
||||
poetv <https://github.com/petobens/poet-v>
|
||||
|
||||
* enable/disable poetv integration >
|
||||
let g:airline#extensions#poetv#enabled = 1
|
||||
<
|
||||
------------------------------------- *airline-promptline*
|
||||
promptline <https://github.com/edkolev/promptline.vim>
|
||||
|
||||
@@ -846,6 +997,12 @@ title accordingly.
|
||||
* configure the title text for location list buffers >
|
||||
let g:airline#extensions#quickfix#location_text = 'Location'
|
||||
<
|
||||
------------------------------------- *airline-searchcount*
|
||||
The searchcount extension supports the searchcount() function in Vim script.
|
||||
|
||||
* enable/disable searchcount integration >
|
||||
let g:airline#extensions#searchcount#enabled = 1
|
||||
<
|
||||
------------------------------------- *airline-syntastic*
|
||||
syntastic <https://github.com/vim-syntastic/syntastic>
|
||||
|
||||
@@ -902,6 +1059,11 @@ with the middle mouse button to delete that buffer.
|
||||
|
||||
* enable/disable displaying number of tabs in the right side (c) >
|
||||
let g:airline#extensions#tabline#show_tab_count = 1
|
||||
|
||||
Note: Not displayed if the number of tabs is less than 1
|
||||
|
||||
* always displaying number of tabs in the right side (c) >
|
||||
let g:airline#extensions#tabline#show_tab_count = 2
|
||||
<
|
||||
* configure filename match rules to exclude from the tabline. >
|
||||
let g:airline#extensions#tabline#excludes = []
|
||||
@@ -952,11 +1114,13 @@ with the middle mouse button to delete that buffer.
|
||||
|
||||
* enable/disable displaying index of the buffer.
|
||||
|
||||
`buffer_idx_mode` allows 2 different modes to access buffers from the
|
||||
`buffer_idx_mode` allows 3 different modes to access buffers from the
|
||||
tabline. When enabled, numbers will be displayed in the tabline and
|
||||
mappings will be exposed to allow you to select a buffer directly.
|
||||
In default mode, when the variable is 1 Up to 11 mappings will be
|
||||
exposed: >
|
||||
exposed. Note: Those mappings are not automatically created, vim-airline
|
||||
just exposes those `<Plug>AirlineSeelctTab` keys for you to map to a
|
||||
convenient key >
|
||||
|
||||
let g:airline#extensions#tabline#buffer_idx_mode = 1
|
||||
nmap <leader>1 <Plug>AirlineSelectTab1
|
||||
@@ -971,9 +1135,7 @@ with the middle mouse button to delete that buffer.
|
||||
nmap <leader>- <Plug>AirlineSelectPrevTab
|
||||
nmap <leader>+ <Plug>AirlineSelectNextTab
|
||||
<
|
||||
In mode 2, (when the variable is 2) 89 mappings will be exposed
|
||||
(Note: To avoid ambiguity, there won't be <Plug>AirlineSelectTab1
|
||||
- <Plug>AirlineSelectTab9 maps): >
|
||||
In mode 2, (when the variable is 2) 89 mappings will be exposed: >
|
||||
|
||||
let g:airline#extensions#tabline#buffer_idx_mode = 2
|
||||
nmap <Leader>10 <Plug>AirlineSelectTab10
|
||||
@@ -986,6 +1148,22 @@ with the middle mouse button to delete that buffer.
|
||||
The <Plug>AirlineSelect<Prev/Next>Tab mapping handles counts as well,
|
||||
so one can handle arbirtrarily number of buffers/tabs.
|
||||
|
||||
Mode 3 is exactly the same as mode 2, except the indexing start at 01,
|
||||
exposing 99 mappings: >
|
||||
|
||||
let g:airline#extensions#tabline#buffer_idx_mode = 3
|
||||
nmap <Leader>01 <Plug>AirlineSelectTab01
|
||||
nmap <Leader>02 <Plug>AirlineSelectTab02
|
||||
nmap <Leader>03 <Plug>AirlineSelectTab03
|
||||
...
|
||||
nmap <Leader>99 <Plug>AirlineSelectTab99
|
||||
<
|
||||
This matches that of the numbering scheme of |:buffers|, letting
|
||||
`<Plug>AirlineSelectTab67` to reference buffer 67.
|
||||
|
||||
Note: To avoid ambiguity, there won't be <Plug>AirlineSelectTab1
|
||||
- <Plug>AirlineSelectTab9 maps in mode 2 and 3.
|
||||
|
||||
Note: Mappings will be ignored for filetypes that match
|
||||
`g:airline#extensions#tabline#keymap_ignored_filetypes`.
|
||||
|
||||
@@ -1059,8 +1237,8 @@ with the middle mouse button to delete that buffer.
|
||||
let g:airline#extensions#tabline#fnamecollapse = 1
|
||||
|
||||
" The `unique_tail_improved` - another algorithm, that will smartly
|
||||
" uniquify buffers names with similar filename, suppressing common
|
||||
" parts of paths.
|
||||
" uniquify buffers names with similar filename, suppressing common
|
||||
" parts of paths.
|
||||
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
|
||||
|
||||
" The `short_path` - is a simple formatter, that will show the
|
||||
@@ -1071,6 +1249,30 @@ with the middle mouse button to delete that buffer.
|
||||
|
||||
let g:airline#extensions#tabline#formatter = 'short_path'
|
||||
|
||||
* defines the customized format() function to display tab title in tab mode. >
|
||||
let g:airline#extensions#tabline#tabtitle_formatter = 'MyTabTitleFormatter'
|
||||
<
|
||||
Then define the MyTabTitleFormatter() function in your vimrc. >
|
||||
function MyTabTitleFormatter(n)
|
||||
let buflist = tabpagebuflist(a:n)
|
||||
let winnr = tabpagewinnr(a:n)
|
||||
let bufnr = buflist[winnr - 1]
|
||||
let winid = win_getid(winnr, a:n)
|
||||
let title = bufname(bufnr)
|
||||
|
||||
if empty(title)
|
||||
if getqflist({'qfbufnr' : 0}).qfbufnr == bufnr
|
||||
let title = '[Quickfix List]'
|
||||
elseif winid && getloclist(winid, {'qfbufnr' : 0}).qfbufnr == bufnr
|
||||
let title = '[Location List]'
|
||||
else
|
||||
let title = '[No Name]'
|
||||
endif
|
||||
endif
|
||||
|
||||
return title
|
||||
endfunction
|
||||
|
||||
* configure the minimum number of buffers needed to show the tabline. >
|
||||
let g:airline#extensions#tabline#buffer_min_count = 0
|
||||
<
|
||||
@@ -1110,6 +1312,26 @@ Note: Enabling this extension will modify 'showtabline' and 'guioptions'.
|
||||
(neovim specific, only works with buffers and not real tabs, default: 0) >
|
||||
let airline#extensions#tabline#middle_click_preserves_windows = 1
|
||||
<
|
||||
*airline-tabline-hlgroups*
|
||||
When the tabline is enabled, vim-airline exposes the following highlighting
|
||||
groups:
|
||||
|
||||
airline_tab: default highlighting group for the tabline
|
||||
airline_tab_right: idem, but for the right side of the tabline
|
||||
|
||||
airline_tabsel: highlighting group of the selected item
|
||||
airline_tabsel_right: idem, but for the right side of the tabline
|
||||
airline_tabmod: highlighting group for a 'modified' buffer
|
||||
airline_tabmod_right: idem, but on the right side
|
||||
airline_tabmod_unsel: unselected tab with modified buffer
|
||||
airline_tabmod_unsel_right: (unused)
|
||||
airline_tabtype: label group used by ctrlspace and tabws
|
||||
airline_tabfill: highlighting group for the filler space
|
||||
airline_tablabel: highlighting group for the label
|
||||
airline_tablabel_right: highlighting group for the label on the right side
|
||||
airline_tabhid: hidden buffer
|
||||
airline_tabhid_right: idem, but on the right
|
||||
|
||||
------------------------------------- *airline-taboo*
|
||||
taboo.vim <https://github.com/gcmt/taboo.vim>
|
||||
|
||||
@@ -1173,7 +1395,8 @@ No configuration available.
|
||||
------------------------------------- *airline-unite*
|
||||
Unite <https://github.com/Shougo/unite.vim>
|
||||
|
||||
No configuration available.
|
||||
* enable/disable unite integration >
|
||||
let g:airline#extensions#unite#enabled = 1
|
||||
|
||||
------------------------------------- *airline-vimagit*
|
||||
vimagit <https://github.com/jreybert/vimagit>
|
||||
@@ -1181,6 +1404,12 @@ vimagit <https://github.com/jreybert/vimagit>
|
||||
* enable/disable vimagit integration >
|
||||
let g:airline#extensions#vimagit#enabled = 1
|
||||
<
|
||||
------------------------------------- *airline-vimcmake*
|
||||
Vim-CMake <https://github.com/cdelledonne/vim-cmake>
|
||||
|
||||
* enable/disable Vim-CMake integration >
|
||||
let g:airline#extensions#vimcmake#enabled = 1
|
||||
<
|
||||
------------------------------------- *airline-vimtex*
|
||||
vimtex <https://github.com/lervag/vimtex>
|
||||
|
||||
@@ -1223,7 +1452,7 @@ virtualenv <https://github.com/jmcantrell/vim-virtualenv>
|
||||
let g:airline#extensions#virtualenv#enabled = 1
|
||||
<
|
||||
------------------------------------- *airline-vista*
|
||||
vista.vim <https://github.com/liuchngxu/vista.vim>
|
||||
vista.vim <https://github.com/liuchengxu/vista.vim>
|
||||
|
||||
* enable/disable vista integration >
|
||||
let g:airline#extensions#vista#enabled = 1
|
||||
@@ -1323,7 +1552,7 @@ vim-windowswap <https://github.com/wesQ3/vim-windowswap>
|
||||
" The default value matches filetypes typically used for documentation
|
||||
" such as markdown and help files. Default is:
|
||||
let g:airline#extensions#wordcount#filetypes =
|
||||
\ ['asciidoc', 'help', 'mail', 'markdown', 'org', 'rst', 'tex', 'text'])
|
||||
\ ['asciidoc', 'help', 'mail', 'markdown', 'nroff', 'org', 'plaintex', 'rst', 'tex', 'text'])
|
||||
" Use ['all'] to enable for all filetypes.
|
||||
|
||||
* defines the name of a formatter for word count will be displayed: >
|
||||
@@ -1331,6 +1560,9 @@ vim-windowswap <https://github.com/wesQ3/vim-windowswap>
|
||||
" e.g. 1,042 in English and 1.042 in German locale
|
||||
let g:airline#extensions#wordcount#formatter = 'default'
|
||||
|
||||
" enable reading time formatter
|
||||
let g:airline#extensions#wordcount#formatter = 'readingtime'
|
||||
|
||||
" here is how you can define a 'foo' formatter:
|
||||
" create a file in autoload/airline/extensions/wordcount/formatters/
|
||||
" called foo.vim, which defines the following function signature:
|
||||
@@ -1385,7 +1617,7 @@ features that you may not need. They both require |vim-airline| anyway.
|
||||
|
||||
Main features and default mappings of this extension are:
|
||||
|
||||
* tab cwd persistance, also across sessions if vim-obsession is being used.
|
||||
* tab cwd persistence, also across sessions if vim-obsession is being used.
|
||||
|
||||
* buffer filtering in the tabline: only buffers whose path is within the tab
|
||||
cwd will be shown in the tabline.
|
||||
@@ -1413,7 +1645,7 @@ Main features and default mappings of this extension are:
|
||||
let g:xtabline_alt_action = "buffer #"
|
||||
|
||||
Note: Make sure to also enable >
|
||||
:let g:airline_extensions#tabline#show_buffers = 1
|
||||
:let g:airline#extensions#tabline#show_buffers = 1
|
||||
otherwise the tabline might not actually be displayed correctly (see
|
||||
|airline-tabline|)
|
||||
|
||||
@@ -1444,7 +1676,7 @@ be updated automatically. Either re-enter the tab or press <F5> two times.
|
||||
\ airline#extensions#tabline#xtabline#prev_buffer(v:count) : "\<Left>"
|
||||
|
||||
------------------------------------- *airline-ycm*
|
||||
YouCompleteMe <https://github.com/Valloric/YouCompleteMe>
|
||||
YouCompleteMe <https://github.com/ycm-core/YouCompleteMe>
|
||||
|
||||
Shows number of errors and warnings in the current file detected by YCM.
|
||||
|
||||
@@ -1457,6 +1689,23 @@ Shows number of errors and warnings in the current file detected by YCM.
|
||||
* set warning count prefix >
|
||||
let g:airline#extensions#ycm#warning_symbol = 'W:'
|
||||
<
|
||||
|
||||
------------------------------------- *airline-zoomwintab*
|
||||
zoomwintab <https://github.com/troydm/zoomwintab.vim>
|
||||
|
||||
* enable/disable zoomwintab integration >
|
||||
let g:airline#extensions#zoomwintab#enabled = 1
|
||||
|
||||
* zoomwintab's zoomin symbol >
|
||||
let g:airline#extensions#zoomwintab#status_zoomed_in = 'Currently Zoomed In'
|
||||
|
||||
default: '> Zoomed'
|
||||
|
||||
* zoomwintab's zoomout symbol >
|
||||
let g:airline#extensions#zoomwintab#status_zoomed_out = 'Currently Zoomed Out'
|
||||
|
||||
default: ''
|
||||
|
||||
=============================================================================
|
||||
ADVANCED CUSTOMIZATION *airline-advanced-customization*
|
||||
|
||||
@@ -1508,10 +1757,11 @@ The following list of parts are predefined by vim-airline.
|
||||
And the following are defined for their respective extensions:
|
||||
|
||||
`ale_error_count` `ale_warning_count` `branch` `eclim` `hunks`
|
||||
`languageclient_error_count` `languageclient_warning_count`
|
||||
`neomake_error_count` `neomake_warning_count` `obsession` `syntastic-warn`
|
||||
`syntastic-err` `tagbar` `whitespace` `windowswap` `ycm_error_count`
|
||||
`ycm_warning_count`
|
||||
`languageclient_error_count` `languageclient_warning_count` `lsp_error_count`
|
||||
`lsp_warning_count``neomake_error_count` `neomake_warning_count`
|
||||
`nvimlsp_error_count` `nvimlsp_warning_count` `obsession`
|
||||
`syntastic-warn` `syntastic-err` `tagbar` `whitespace` `windowswap`
|
||||
`ycm_error_count` `ycm_warning_count`
|
||||
|
||||
------------------------------------- *airline-accents*
|
||||
Accents can be defined on any part, like so: >
|
||||
@@ -1530,10 +1780,10 @@ The defaults configure the mode and line number parts to be bold, and the
|
||||
readonly part to be red.
|
||||
|
||||
"none" is special. This can be used, to remove a bold accent from an existing
|
||||
theme. For example, usually the mode part of the statusline is usually
|
||||
defined to be bold. However, it can be hard to remove an existing bold
|
||||
accent from the default configuration. Therefore, you can use the none
|
||||
accent to remove existing accents, so if you put >
|
||||
theme. For example, the mode part of the statusline is usually defined to be
|
||||
bold. However, it can be hard to remove an existing bold accent from the
|
||||
default configuration. Therefore, you can use the none accent to remove
|
||||
existing accents, so if you put >
|
||||
call airline#parts#define_accent('mode', 'none')
|
||||
the mode section will be set to non-bold font style.
|
||||
|
||||
@@ -1740,7 +1990,7 @@ Contributions and pull requests are welcome.
|
||||
=============================================================================
|
||||
LICENSE *airline-license*
|
||||
|
||||
MIT License. Copyright © 2013-2019 Bailey Ling, Christian Brabandt, Mike
|
||||
MIT License. Copyright © 2013-2020 Bailey Ling, Christian Brabandt, Mike
|
||||
Hartington et al.
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user