mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-12-07 04:34:26 +08:00
Compare commits
297 Commits
vim9script
...
0c28f081a3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c28f081a3 | ||
|
|
4ef5e87931 | ||
|
|
81eca99486 | ||
|
|
f706e7c486 | ||
|
|
d7edaf8fd0 | ||
|
|
3cb60641e7 | ||
|
|
d25c049e61 | ||
|
|
02894b6ef4 | ||
|
|
16c1638f93 | ||
|
|
6cc2c5c9e9 | ||
|
|
c3d1d13b72 | ||
|
|
ff0f9a45a5 | ||
|
|
d9f42cb467 | ||
|
|
20a49bd494 | ||
|
|
ff7352e4bf | ||
|
|
3b9e149e19 | ||
|
|
ec74913b94 | ||
|
|
3854429d99 | ||
|
|
0adefd0c42 | ||
|
|
4757756ae0 | ||
|
|
f1ba5a03db | ||
|
|
e6bb8427dc | ||
|
|
65e77b970d | ||
|
|
cead8efb48 | ||
|
|
423fe9e2ac | ||
|
|
3776947590 | ||
|
|
5891a3f7be | ||
|
|
4eea2b7e3c | ||
|
|
515d4cbbec | ||
|
|
a532fed72a | ||
|
|
038e3a6ca5 | ||
|
|
1828172717 | ||
|
|
18b85395d3 | ||
|
|
c7460aa883 | ||
|
|
8fd91eaca9 | ||
|
|
31e01612f3 | ||
|
|
dc1b607f56 | ||
|
|
08cfcf9408 | ||
|
|
50a936608c | ||
|
|
9252c11d37 | ||
|
|
e4a57d0be4 | ||
|
|
1d9ae3f972 | ||
|
|
9eb4aa47a3 | ||
|
|
f46792ebcb | ||
|
|
04f95183e2 | ||
|
|
82aeea1276 | ||
|
|
1ecbc76682 | ||
|
|
1028c6ea12 | ||
|
|
4f5b641710 | ||
|
|
9007d19ab7 | ||
|
|
029797db1c | ||
|
|
0913c0a3b6 | ||
|
|
e9c09a2e66 | ||
|
|
785dbbe504 | ||
|
|
46f0a12bae | ||
|
|
9e2d021fc6 | ||
|
|
4e552414d4 | ||
|
|
6a4c82c950 | ||
|
|
46e517e8c2 | ||
|
|
994cfd80eb | ||
|
|
1cdb8824a0 | ||
|
|
13f3478b61 | ||
|
|
5f5e00faad | ||
|
|
2ae1475d0d | ||
|
|
62847a8cc9 | ||
|
|
25d53a80f4 | ||
|
|
3c9c2ba5d4 | ||
|
|
2654f838ae | ||
|
|
f65f27b9eb | ||
|
|
1e491727b2 | ||
|
|
a84ae5e069 | ||
|
|
29ef9e1f64 | ||
|
|
b86e5e09b2 | ||
|
|
d734be8cd3 | ||
|
|
364ffba120 | ||
|
|
009ba4e9d0 | ||
|
|
5c682e7bd3 | ||
|
|
d56f199405 | ||
|
|
92d3e90110 | ||
|
|
0ed7b8bb2e | ||
|
|
84823e5e7d | ||
|
|
8e989201c8 | ||
|
|
3fe71a6ce6 | ||
|
|
46dd872237 | ||
|
|
838c16a174 | ||
|
|
78abec3b83 | ||
|
|
dba64a910d | ||
|
|
a71f9a6417 | ||
|
|
e0056ae5b0 | ||
|
|
2cea8346cf | ||
|
|
90c6746311 | ||
|
|
f5a6597496 | ||
|
|
d1f2c13e4f | ||
|
|
9d20473e91 | ||
|
|
61042e3502 | ||
|
|
66a6e03a34 | ||
|
|
aee282c964 | ||
|
|
9c7790b030 | ||
|
|
b9318d7ac0 | ||
|
|
8e477c192b | ||
|
|
e581972997 | ||
|
|
4933ee0977 | ||
|
|
61dc750149 | ||
|
|
ebb89a0846 | ||
|
|
4a290d16fd | ||
|
|
39e49cbbe8 | ||
|
|
83d853adc7 | ||
|
|
fd56e87d00 | ||
|
|
b5f2eb418a | ||
|
|
e4f586b76b | ||
|
|
6105d0d74e | ||
|
|
91b67e3ca2 | ||
|
|
9bc66119a4 | ||
|
|
219c47ab9f | ||
|
|
1080056bca | ||
|
|
ee80fd85cd | ||
|
|
5b5d940f87 | ||
|
|
8cd5dd1f34 | ||
|
|
1a7d546448 | ||
|
|
9fad2c3fc4 | ||
|
|
8681d4d49e | ||
|
|
97a9aa4bdb | ||
|
|
ba50f598ee | ||
|
|
5d7e656081 | ||
|
|
c465570143 | ||
|
|
396116b059 | ||
|
|
13628d698d | ||
|
|
d421c35f94 | ||
|
|
0241bdb804 | ||
|
|
ce0e8d7e82 | ||
|
|
be5bda1f1d | ||
|
|
04bf4eabca | ||
|
|
904979339c | ||
|
|
98027a4680 | ||
|
|
35af3bf37f | ||
|
|
dc65eea5d9 | ||
|
|
927e142e94 | ||
|
|
a306a7abfd | ||
|
|
1b245800b5 | ||
|
|
0f237d8b6b | ||
|
|
1d486430cc | ||
|
|
e643f9fa7d | ||
|
|
2706bdc949 | ||
|
|
e2498d72dc | ||
|
|
24f2878080 | ||
|
|
031e6ee4b2 | ||
|
|
21cdbea7e6 | ||
|
|
d1f6514cef | ||
|
|
20d77c3220 | ||
|
|
64908db62a | ||
|
|
9a3568b815 | ||
|
|
bf5d785932 | ||
|
|
8e36c0a8ed | ||
|
|
de73a21903 | ||
|
|
841a355196 | ||
|
|
65a4d4dd43 | ||
|
|
8df0f3db4b | ||
|
|
2ed11e9536 | ||
|
|
f678b4c53d | ||
|
|
6716572b30 | ||
|
|
4b96f58902 | ||
|
|
ec761c2adf | ||
|
|
5841039679 | ||
|
|
646dd0a1c2 | ||
|
|
6e5439126f | ||
|
|
47bf6b1716 | ||
|
|
d134ae8c2f | ||
|
|
70904d7070 | ||
|
|
e542f5e9d0 | ||
|
|
69726073ca | ||
|
|
17f7dff748 | ||
|
|
f0ee8f193e | ||
|
|
0dd6f5e711 | ||
|
|
ddaf69804a | ||
|
|
86a8ac0f96 | ||
|
|
6800c9ea7f | ||
|
|
2b260aabfe | ||
|
|
c9820b0378 | ||
|
|
26f922753a | ||
|
|
0a7e1bc475 | ||
|
|
2e29ab9656 | ||
|
|
78cb6e6621 | ||
|
|
0de4c9df21 | ||
|
|
c39ec8ef35 | ||
|
|
2259e5c93e | ||
|
|
e519b53cab | ||
|
|
cc0d39b528 | ||
|
|
969c13c716 | ||
|
|
0cfd829c92 | ||
|
|
0f3feca572 | ||
|
|
b861f9d248 | ||
|
|
ec4bbabe4a | ||
|
|
4807a211cd | ||
|
|
84a04bbd5b | ||
|
|
a94d8034c3 | ||
|
|
9b113a02f5 | ||
|
|
49cdcb7b3e | ||
|
|
82b1b2e876 | ||
|
|
fdda58861b | ||
|
|
a8b3c254d0 | ||
|
|
3882146c41 | ||
|
|
b6f6cc9312 | ||
|
|
98aea41dc2 | ||
|
|
05bd105cab | ||
|
|
73025ea504 | ||
|
|
affe12b7e7 | ||
|
|
4a64fbfc4b | ||
|
|
ef232cfee1 | ||
|
|
03ec880101 | ||
|
|
51c79f61f4 | ||
|
|
1f94ec1556 | ||
|
|
ab4962b838 | ||
|
|
4c0c60bbf2 | ||
|
|
ecac148e19 | ||
|
|
e7eea7c6e8 | ||
|
|
a2f298ba8f | ||
|
|
7e295c859f | ||
|
|
19360bac63 | ||
|
|
7181950501 | ||
|
|
e608a0c016 | ||
|
|
725e881ac9 | ||
|
|
c0c6b0e216 | ||
|
|
390b243cf3 | ||
|
|
23e20bfada | ||
|
|
db78454a03 | ||
|
|
f7cbf8c429 | ||
|
|
76e42284e9 | ||
|
|
76c24d2126 | ||
|
|
2d650d2e83 | ||
|
|
7a87615cbe | ||
|
|
2e9df43962 | ||
|
|
06134df810 | ||
|
|
9e62ad962a | ||
|
|
8929bc72a1 | ||
|
|
38a90d8801 | ||
|
|
30f8ada1d6 | ||
|
|
4968c6bb18 | ||
|
|
c9eaf4c5d2 | ||
|
|
9b2c1e9915 | ||
|
|
2f6471a9e1 | ||
|
|
ef5a0b53ef | ||
|
|
0a87d08dbd | ||
|
|
07ab201a27 | ||
|
|
70b06be4b0 | ||
|
|
bc5945de65 | ||
|
|
ed60e1d369 | ||
|
|
2e421d3cd6 | ||
|
|
cba392dd7a | ||
|
|
75383ef2e7 | ||
|
|
3d7dfa8ef6 | ||
|
|
7d6adf9cc5 | ||
|
|
09dbd09ed3 | ||
|
|
a262ec6ce4 | ||
|
|
639a0038cf | ||
|
|
df956aa08b | ||
|
|
0a7c68afb2 | ||
|
|
fc639c0cf8 | ||
|
|
32d28421fe | ||
|
|
cb1bc19064 | ||
|
|
f107396118 | ||
|
|
c01977d027 | ||
|
|
82000c7cfc | ||
|
|
ecba959f28 | ||
|
|
a6dd1c3887 | ||
|
|
6def2f0a82 | ||
|
|
b9905f2445 | ||
|
|
50dfca52ed | ||
|
|
bffa7a4d23 | ||
|
|
c7a633ce8f | ||
|
|
74f1f0d990 | ||
|
|
0ca9576331 | ||
|
|
36f14c478a | ||
|
|
fdfc11f53a | ||
|
|
1651762e10 | ||
|
|
30bcbb07c3 | ||
|
|
c32215e94b | ||
|
|
0eb2ed4488 | ||
|
|
da6b076ee4 | ||
|
|
4d284a677c | ||
|
|
8a60582527 | ||
|
|
8a80369227 | ||
|
|
14c79dd2fe | ||
|
|
dad2c03cf5 | ||
|
|
0c8164b1b3 | ||
|
|
5601c0928e | ||
|
|
60083f35a8 | ||
|
|
17bf22e6fb | ||
|
|
505a7d75ca | ||
|
|
59b4826806 | ||
|
|
f39208f1a0 | ||
|
|
c0160d93a8 | ||
|
|
c074620bfd | ||
|
|
4858046e94 | ||
|
|
6d6afc527e | ||
|
|
9a3a11f966 | ||
|
|
2cea83eb88 | ||
|
|
9ce6f96f60 |
3
.github/ISSUE_TEMPLATE.md
vendored
3
.github/ISSUE_TEMPLATE.md
vendored
@@ -8,7 +8,10 @@
|
||||
if you are using terminal:
|
||||
- terminal: ????
|
||||
- $TERM variable: ???
|
||||
- terminal columns size: ???
|
||||
- terminal line size: ???
|
||||
- color configuration (:set t_Co?):
|
||||
|
||||
if you are using Neovim:
|
||||
- does it happen in Vim: ???
|
||||
|
||||
|
||||
53
.github/workflows/ci.yml
vendored
53
.github/workflows/ci.yml
vendored
@@ -3,50 +3,43 @@ name: CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- vim9script
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- master
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
vim_version:
|
||||
- 'v8.2.1000'
|
||||
- 'v8.2.0000'
|
||||
- 'v8.1.0000'
|
||||
- 'v8.0.0000'
|
||||
- 'v7.4'
|
||||
vim:
|
||||
- v9.1.0000
|
||||
- v9.0.0000
|
||||
- v8.2.1000
|
||||
- v8.2.0000
|
||||
- v8.1.0000
|
||||
- v8.0.0000
|
||||
- v7.4
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@main
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: actions/setup-ruby@v1
|
||||
- name: Checkout vim-themis
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
ruby-version: '2.6'
|
||||
|
||||
- name: Setup Bundle
|
||||
run: |
|
||||
gem install bundler
|
||||
bundle install --jobs 4 --retry 3
|
||||
repository: thinca/vim-themis
|
||||
path: vim-themis
|
||||
|
||||
- name: Setup Vim
|
||||
uses: thinca/action-setup-vim@v1
|
||||
uses: rhysd/action-setup-vim@v1
|
||||
id: vim
|
||||
with:
|
||||
vim_version: ${{ matrix.vim_version }}
|
||||
version: ${{ matrix.vim }}
|
||||
|
||||
- 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
|
||||
- name: Test
|
||||
env:
|
||||
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
|
||||
run: ./vim-themis/bin/themis --reporter spec
|
||||
|
||||
2
.github/workflows/reviewdog.yml
vendored
2
.github/workflows/reviewdog.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
name: runner / vint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@main
|
||||
- name: vint
|
||||
uses: reviewdog/action-vint@v1
|
||||
with:
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,4 +5,4 @@ doc/tags
|
||||
*.swp
|
||||
.bundle
|
||||
vendor
|
||||
|
||||
test/.deps
|
||||
|
||||
@@ -18,11 +18,14 @@ This is the Changelog for the vim-airline project.
|
||||
- [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
|
||||
- Ascii Scrollbar 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 extensions can also show additional status messages as well as the current function
|
||||
- [coc-git](https://github.com/neoclide/coc-git) extension integrated into hunks extension
|
||||
- rewrote parts using Vim9 Script for performance improvements
|
||||
- Other
|
||||
- Changed CI from travis-ci.org to GitHub Actions
|
||||
- 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
|
||||
@@ -46,9 +49,9 @@ This is the Changelog for the vim-airline project.
|
||||
- The branch extensions now also displays whether the repository is in a clean state
|
||||
(will append a ! or ⚡if the repository is considered dirty).
|
||||
- The whitespace extensions will also check for conflict markers
|
||||
- `:AirlineRefresh` command now takes an additional `!` attribute, that **skips**
|
||||
- `:AirlineRefresh` command now takes an additional `!` attribute, that **skips**
|
||||
recreating the highlighting groups (which might have a serious performance
|
||||
impact if done very often, as might be the case when the configuration variable
|
||||
impact if done very often, as might be the case when the configuration variable
|
||||
`airline_skip_empty_sections` is active).
|
||||
- airline can now also detect multiple cursor mode (issue [#1933](https://github.com/vim-airline/vim-airline/issues/1933))
|
||||
- expose hunks output using the function `airline#extensions#hunks#get_raw_hunks()` to the outside [#1877](https://github.com/vim-airline/vim-airline/pull/1877)
|
||||
|
||||
@@ -6,6 +6,23 @@ Contributions and pull requests are welcome. Please take note of the following
|
||||
* 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.4.
|
||||
|
||||
# Testing
|
||||
|
||||
Contributors should install [thinca/vim-themis](https://github.com/thinca/vim-themis) to run tests before sending a PR if they applied some modification to the code. PRs which do not pass tests won't be accepted.
|
||||
|
||||
## 1. Installation
|
||||
|
||||
```
|
||||
$ cd /path/to/vim-airline
|
||||
$ git submodule add https://github.com/thinca/vim-themis ./.themis-bin
|
||||
```
|
||||
|
||||
## 2. Running tests
|
||||
|
||||
```
|
||||
$ ./path/to/themis-bin/bin/themis path/to/vim-airline/test --reporter spec
|
||||
```
|
||||
|
||||
# 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:
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2013-2020 Bailey Ling, Christian Brabandt, et al.
|
||||
Copyright (C) 2013-2021 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"),
|
||||
|
||||
57
README.md
57
README.md
@@ -1,4 +1,8 @@
|
||||
# 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)
|
||||
# vim-airline
|
||||
|
||||
[](https://saythanks.io/to/chrisbra)
|
||||
[](https://github.com/vim-airline/vim-airline/actions?query=workflow%3Areviewdog+event%3Apush+branch%3Amaster)
|
||||
[](https://github.com/vim-airline/vim-airline/actions?query=workflow%3ACI)
|
||||
|
||||
Lean & mean status/tabline for vim that's light as air.
|
||||
|
||||
@@ -62,7 +66,7 @@ For a better look, those sections can be colored differently, depending on vario
|
||||
|
||||
* Tiny core written with extensibility in mind ([open/closed principle][8]).
|
||||
* Integrates with a variety of plugins, including: [vim-bufferline][6],
|
||||
[fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16],
|
||||
[fugitive][4], [flog][62], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16],
|
||||
[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],
|
||||
@@ -76,6 +80,22 @@ For a better look, those sections can be colored differently, depending on vario
|
||||
* 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.
|
||||
|
||||
# Installation
|
||||
|
||||
This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers:
|
||||
|
||||
| Plugin Manager | Install with... |
|
||||
| ------------- | ------------- |
|
||||
| [Pathogen][11] | `git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline`<br/>Remember to run `:Helptags` to generate help tags |
|
||||
| [NeoBundle][12] | `NeoBundle 'vim-airline/vim-airline'` |
|
||||
| [Vundle][13] | `Plugin 'vim-airline/vim-airline'` |
|
||||
| [Plug][40] | `Plug 'vim-airline/vim-airline'` |
|
||||
| [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 ~/.vim/pack/dist/start/vim-airline/doc` to generate help tags |
|
||||
| manual | copy all of the files into your `~/.vim` directory |
|
||||
|
||||
## Straightforward customization
|
||||
|
||||
If you don't like the defaults, you can replace all sections with standard `statusline` syntax. Give your statusline that you've built over the years a face lift.
|
||||
@@ -159,12 +179,15 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
|
||||
#### [syntastic][5]
|
||||

|
||||
|
||||
#### hunks ([vim-gitgutter][29] & [vim-signify][30] & [coc-git][59])
|
||||
#### hunks ([vim-gitgutter][29], [vim-signify][30], [coc-git][59] & [gitsigns.nvim][63])
|
||||

|
||||
|
||||
#### [vimagit][50]
|
||||

|
||||
|
||||
#### [flog][62]
|
||||

|
||||
|
||||
#### [virtualenv][31]
|
||||

|
||||
|
||||
@@ -241,22 +264,6 @@ What about [vim-powerline][1]?
|
||||
|
||||
I wrote the initial version on an airplane, and since it's light as air it turned out to be a good name. Thanks for flying vim!
|
||||
|
||||
# Installation
|
||||
|
||||
This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers:
|
||||
|
||||
| Plugin Manager | Install with... |
|
||||
| ------------- | ------------- |
|
||||
| [Pathogen][11] | `git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline`<br/>Remember to run `:Helptags` to generate help tags |
|
||||
| [NeoBundle][12] | `NeoBundle 'vim-airline/vim-airline'` |
|
||||
| [Vundle][13] | `Plugin 'vim-airline/vim-airline'` |
|
||||
| [Plug][40] | `Plug 'vim-airline/vim-airline'` |
|
||||
| [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 ~/.vim/pack/dist/start/vim-airline/doc` to generate help tags |
|
||||
| manual | copy all of the files into your `~/.vim` directory |
|
||||
|
||||
# Documentation
|
||||
|
||||
`:help airline`
|
||||
@@ -293,16 +300,16 @@ A full list of screenshots for various themes can be found in the [Wiki][14].
|
||||
|
||||
# Maintainers
|
||||
|
||||
The project is currently being maintained by [Bailey Ling][41], [Christian Brabandt][42], and [Mike Hartington][44].
|
||||
The project is currently being maintained by [Christian Brabandt][42] and [Bailey Ling][41].
|
||||
|
||||
If you are interested in becoming a maintainer (we always welcome more maintainers), please [go here][43].
|
||||
|
||||
# License
|
||||
|
||||
[MIT License][58]. Copyright (c) 2013-2020 Bailey Ling & Contributors.
|
||||
[MIT License][58]. Copyright (c) 2013-2021 Bailey Ling & Contributors.
|
||||
|
||||
[1]: https://github.com/Lokaltog/vim-powerline
|
||||
[2]: https://github.com/Lokaltog/powerline
|
||||
[2]: https://github.com/powerline/powerline
|
||||
[3]: https://github.com/Lokaltog/powerline-fonts
|
||||
[4]: https://github.com/tpope/vim-fugitive
|
||||
[5]: https://github.com/scrooloose/syntastic
|
||||
@@ -321,7 +328,7 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
|
||||
[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
|
||||
[21]: https://github.com/ludovicchabant/vim-lawrencium
|
||||
[22]: https://github.com/MarcWeber/vim-addon-manager
|
||||
[23]: https://github.com/altercation/solarized
|
||||
[24]: https://github.com/chriskempson/tomorrow-theme
|
||||
@@ -344,7 +351,6 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
|
||||
[41]: https://github.com/bling
|
||||
[42]: https://github.com/chrisbra
|
||||
[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#vim-airline-themes--
|
||||
[47]: https://github.com/mildred/vim-bufmru
|
||||
@@ -362,3 +368,6 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
|
||||
[59]: https://github.com/neoclide/coc-git
|
||||
[60]: https://github.com/cdelledonne/vim-cmake
|
||||
[61]: http://github.com/lambdalisue/battery.vim/
|
||||
[62]: http://github.com/rbong/vim-flog/
|
||||
[63]: https://github.com/lewis6991/gitsigns.nvim
|
||||
[64]: https://github.com/VimfanTPdvorak/vimodoro
|
||||
|
||||
14
Rakefile
14
Rakefile
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env rake
|
||||
|
||||
task :default => [:test]
|
||||
|
||||
task :ci => [:dump, :test]
|
||||
|
||||
task :dump do
|
||||
sh 'vim --version'
|
||||
end
|
||||
|
||||
task :test do
|
||||
sh 'bundle exec vim-flavor test'
|
||||
end
|
||||
|
||||
@@ -1,25 +1,35 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', [])
|
||||
let g:airline_inactive_funcrefs = get(g:, 'airline_inactive_statusline_funcrefs', [])
|
||||
|
||||
let s:sections = ['a','b','c','gutter','x','y','z', 'error', 'warning']
|
||||
let s:inactive_funcrefs = []
|
||||
let s:contexts = {}
|
||||
let s:core_funcrefs = [
|
||||
\ function('airline#extensions#apply'),
|
||||
\ function('airline#extensions#default#apply') ]
|
||||
|
||||
|
||||
function! airline#add_statusline_func(name)
|
||||
call airline#add_statusline_funcref(function(a:name))
|
||||
function! airline#add_statusline_func(name, ...)
|
||||
let warn = get(a:, 1, 1)
|
||||
call airline#add_statusline_funcref(function(a:name), warn)
|
||||
endfunction
|
||||
|
||||
function! airline#add_statusline_funcref(function)
|
||||
function! airline#add_inactive_statusline_func(name, ...)
|
||||
let warn = get(a:, 1, 1)
|
||||
call airline#add_inactive_statusline_funcref(function(a:name), warn)
|
||||
endfunction
|
||||
|
||||
|
||||
function! airline#add_statusline_funcref(function, ...)
|
||||
if index(g:airline_statusline_funcrefs, a:function) >= 0
|
||||
call airline#util#warning(printf('The airline statusline funcref "%s" has already been added.', string(a:function)))
|
||||
let warn = get(a:, 1, 1)
|
||||
if warn > 0
|
||||
call airline#util#warning(printf('The airline statusline funcref "%s" has already been added.', string(a:function)))
|
||||
endif
|
||||
return
|
||||
endif
|
||||
call add(g:airline_statusline_funcrefs, a:function)
|
||||
@@ -32,8 +42,15 @@ function! airline#remove_statusline_func(name)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#add_inactive_statusline_func(name)
|
||||
call add(s:inactive_funcrefs, function(a:name))
|
||||
function! airline#add_inactive_statusline_funcref(function, ...)
|
||||
if index(g:airline_inactive_funcrefs, a:function) >= 0
|
||||
let warn = get(a:, 1, 1)
|
||||
if warn > 0
|
||||
call airline#util#warning(printf('The airline inactive statusline funcref "%s" has already been added.', string(a:function)))
|
||||
endif
|
||||
return
|
||||
endif
|
||||
call add(g:airline_inactive_funcrefs, a:function)
|
||||
endfunction
|
||||
|
||||
function! airline#load_theme()
|
||||
@@ -53,6 +70,8 @@ function! airline#load_theme()
|
||||
call airline#highlighter#load_theme()
|
||||
call airline#extensions#load_theme()
|
||||
call airline#update_statusline()
|
||||
|
||||
call airline#util#doautocmd('AirlineAfterTheme')
|
||||
endfunction
|
||||
|
||||
" Load an airline theme
|
||||
@@ -93,8 +112,6 @@ function! airline#switch_theme(name, ...)
|
||||
unlet! w:airline_lastmode
|
||||
call airline#load_theme()
|
||||
|
||||
call airline#util#doautocmd('AirlineAfterTheme')
|
||||
|
||||
" this is required to prevent clobbering the startup info message, i don't know why...
|
||||
call airline#check_mode(winnr())
|
||||
endfunction
|
||||
@@ -125,9 +142,10 @@ endfunction
|
||||
|
||||
" Update the statusline
|
||||
function! airline#update_statusline()
|
||||
if airline#util#stl_disabled(winnr())
|
||||
if airline#util#stl_disabled(winnr()) || airline#util#is_popup_window(winnr())
|
||||
return
|
||||
endif
|
||||
" TODO: need to ignore popup windows here as well?
|
||||
let range = filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||
" create inactive statusline
|
||||
call airline#update_statusline_inactive(range)
|
||||
@@ -138,7 +156,12 @@ function! airline#update_statusline()
|
||||
" Now create the active statusline
|
||||
let w:airline_active = 1
|
||||
let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) }
|
||||
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
|
||||
try
|
||||
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
|
||||
catch /^Vim\%((\a\+)\)\=:E48:/
|
||||
" Catch: Sandbox mode
|
||||
" no-op
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Function to be called to make all statuslines inactive
|
||||
@@ -168,7 +191,12 @@ function! airline#update_statusline_inactive(range)
|
||||
\ 'left_sep': g:airline_left_alt_sep,
|
||||
\ 'right_sep': g:airline_right_alt_sep }, 'keep')
|
||||
endif
|
||||
call s:invoke_funcrefs(context, s:inactive_funcrefs)
|
||||
try
|
||||
call s:invoke_funcrefs(context, g:airline_inactive_funcrefs)
|
||||
catch /^Vim\%((\a\+)\)\=:E48:/
|
||||
" Catch: Sandbox mode
|
||||
" no-op
|
||||
endtry
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
@@ -203,66 +231,66 @@ function! airline#check_mode(winnr)
|
||||
let context = s:contexts[a:winnr]
|
||||
|
||||
if get(w:, 'airline_active', 1)
|
||||
let l:m = mode(1)
|
||||
if l:m ==# "i"
|
||||
let l:mode = ['insert']
|
||||
elseif l:m[0] ==# "i"
|
||||
let l:mode = ['insert']
|
||||
elseif l:m ==# "Rv"
|
||||
let l:mode =['replace']
|
||||
elseif l:m[0] ==# "R"
|
||||
let l:mode = ['replace']
|
||||
elseif l:m[0] =~# '\v(v|V||s|S|)'
|
||||
let l:mode = ['visual']
|
||||
elseif l:m ==# "t"
|
||||
let l:mode = ['terminal']
|
||||
elseif l:m[0] ==# "c"
|
||||
let l:mode = ['commandline']
|
||||
elseif l:m ==# "no" " does not work, most likely, Vim does not refresh the statusline in OP mode
|
||||
let l:mode = ['normal']
|
||||
elseif l:m[0:1] ==# 'ni'
|
||||
let l:mode = ['insert']
|
||||
let l:m = 'ni'
|
||||
let m = mode(1)
|
||||
" Refer :help mode() to see the list of modes
|
||||
" NB: 'let mode' here refers to the display colour _groups_,
|
||||
" not the literal mode's code (i.e., m). E.g., Select modes
|
||||
" v, S and ^V use 'visual' since they are of similar ilk.
|
||||
" Some modes do not get recognised for status line purposes:
|
||||
" no, nov, noV, no^V, !, cv, and ce.
|
||||
" Mode name displayed is handled in init.vim (g:airline_mode_map).
|
||||
"
|
||||
if m[0] ==# "i"
|
||||
let mode = ['insert'] " Insert modes + submodes (i, ic, ix)
|
||||
elseif m[0] == "R"
|
||||
let mode = ['replace'] " Replace modes + submodes (R, Rc, Rv, Rx) (NB: case sensitive as 'r' is a mode)
|
||||
elseif m[0] =~ '\v(v|V||s|S|)'
|
||||
let mode = ['visual'] " Visual and Select modes (v, V, ^V, s, S, ^S))
|
||||
elseif m ==# "t"
|
||||
let mode = ['terminal'] " Terminal mode (only has one mode (t))
|
||||
elseif m[0] =~ '\v(c|r|!)'
|
||||
let mode = ['commandline'] " c, cv, ce, r, rm, r? (NB: cv and ce stay showing as mode entered from)
|
||||
else
|
||||
let l:mode = ['normal']
|
||||
let mode = ['normal'] " Normal mode + submodes (n, niI, niR, niV; plus operator pendings no, nov, noV, no^V)
|
||||
endif
|
||||
if exists("*VMInfos") && !empty(VMInfos())
|
||||
" Vim plugin Multiple Cursors https://github.com/mg979/vim-visual-multi
|
||||
let l:m = 'multi'
|
||||
let m = 'multi'
|
||||
endif
|
||||
if index(['Rv', 'no', 'ni', 'ix', 'ic', 'multi'], l:m) == -1
|
||||
let l:m = l:m[0]
|
||||
" Adjust to handle additional modes, which don't display correctly otherwise
|
||||
if index(['niI', 'niR', 'niV', 'ic', 'ix', 'Rc', 'Rv', 'Rx', 'multi'], m) == -1
|
||||
let m = m[0]
|
||||
endif
|
||||
let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m)
|
||||
let w:airline_current_mode = get(g:airline_mode_map, m, m)
|
||||
else
|
||||
let l:mode = ['inactive']
|
||||
let mode = ['inactive']
|
||||
let w:airline_current_mode = get(g:airline_mode_map, '__')
|
||||
endif
|
||||
|
||||
if g:airline_detect_modified && &modified
|
||||
call add(l:mode, 'modified')
|
||||
call add(mode, 'modified')
|
||||
endif
|
||||
|
||||
if g:airline_detect_paste && &paste
|
||||
call add(l:mode, 'paste')
|
||||
call add(mode, 'paste')
|
||||
endif
|
||||
|
||||
if g:airline_detect_crypt && exists("+key") && !empty(&key)
|
||||
call add(l:mode, 'crypt')
|
||||
call add(mode, 'crypt')
|
||||
endif
|
||||
|
||||
if g:airline_detect_spell && &spell
|
||||
call add(l:mode, 'spell')
|
||||
call add(mode, 'spell')
|
||||
endif
|
||||
|
||||
if &readonly || ! &modifiable
|
||||
call add(l:mode, 'readonly')
|
||||
call add(mode, 'readonly')
|
||||
endif
|
||||
|
||||
let mode_string = join(l:mode)
|
||||
let mode_string = join(mode)
|
||||
if get(w:, 'airline_lastmode', '') != mode_string
|
||||
call airline#highlighter#highlight_modified_inactive(context.bufnr)
|
||||
call airline#highlighter#highlight(l:mode, string(context.bufnr))
|
||||
call airline#highlighter#highlight(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-2020 Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -90,7 +90,7 @@ function! s:prototype.build() dict
|
||||
" need to fix highlighting groups, since we
|
||||
" have skipped a section, we actually need
|
||||
" the previous previous group and so the
|
||||
" seperator goes from the previous previous group
|
||||
" separator goes from the previous previous group
|
||||
" to the current group
|
||||
let pgroup = group
|
||||
endif
|
||||
@@ -106,12 +106,12 @@ function! s:prototype.build() dict
|
||||
let line .= '%#'.group.'#'
|
||||
elseif split
|
||||
if !is_empty
|
||||
let line .= s:get_transitioned_seperator(self, prev_group, group, side)
|
||||
let line .= s:get_transitioned_separator(self, prev_group, group, side)
|
||||
endif
|
||||
let split = 0
|
||||
else
|
||||
if !is_empty
|
||||
let line .= s:get_seperator(self, prev_group, group, side)
|
||||
let line .= s:get_separator(self, prev_group, group, side)
|
||||
endif
|
||||
endif
|
||||
let line .= is_empty ? '' : s:get_accented_line(self, group, contents)
|
||||
@@ -137,7 +137,7 @@ function! airline#builder#should_change_group(group1, group2)
|
||||
\ || color1[2] != color2[2] || color1[3] != color2[3]
|
||||
endfunction
|
||||
|
||||
function! s:get_transitioned_seperator(self, prev_group, group, side)
|
||||
function! s:get_transitioned_separator(self, prev_group, group, side)
|
||||
let line = ''
|
||||
if get(a:self._context, 'tabline', 0) && get(g:, 'airline#extensions#tabline#alt_sep', 0) && a:group ==# 'airline_tabsel' && a:side
|
||||
call airline#highlighter#add_separator(a:prev_group, a:group, 0)
|
||||
@@ -152,9 +152,9 @@ function! s:get_transitioned_seperator(self, prev_group, group, side)
|
||||
return line
|
||||
endfunction
|
||||
|
||||
function! s:get_seperator(self, prev_group, group, side)
|
||||
function! s:get_separator(self, prev_group, group, side)
|
||||
if airline#builder#should_change_group(a:prev_group, a:group)
|
||||
return s:get_transitioned_seperator(a:self, a:prev_group, a:group, a:side)
|
||||
return s:get_transitioned_separator(a:self, a:prev_group, a:group, a:side)
|
||||
else
|
||||
return a:side ? a:self._context.left_alt_sep : a:self._context.right_alt_sep
|
||||
endif
|
||||
@@ -198,20 +198,27 @@ function! s:section_is_empty(self, content)
|
||||
if get(w:, 'airline_skip_empty_sections', -1) == 0
|
||||
return 0
|
||||
endif
|
||||
" assume accents sections to be never empty
|
||||
" (avoides, that on startup the mode message becomes empty)
|
||||
if match(a:content, '%#__accent_[^#]*#.*__restore__#') > -1
|
||||
return 0
|
||||
endif
|
||||
if empty(a:content)
|
||||
|
||||
" special case: When the content is %=, that is the
|
||||
" separation marker, which switches between left- and
|
||||
" right-aligned content.
|
||||
" Consider that to be empty, so that the previous previous
|
||||
" group is correctly remembered in the builder() function
|
||||
if empty(a:content) || a:content is# '%='
|
||||
return 1
|
||||
endif
|
||||
let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start)
|
||||
if empty(list)
|
||||
return 0 " no function in statusline text
|
||||
|
||||
let stripped = substitute(a:content,
|
||||
\ '\(%{.*}\|%#__accent_[^#]*#\|%#__restore__#\|%( \| %)\)', '', 'g')
|
||||
|
||||
if !empty(stripped)
|
||||
return 0 " There is content in the statusline
|
||||
endif
|
||||
while len(list) > 0
|
||||
let expr = list[0]
|
||||
|
||||
let exprlist = []
|
||||
call substitute(a:content, '%{\([^}]*\)}', '\=add(exprlist, submatch(1))', 'g')
|
||||
|
||||
for expr in exprlist
|
||||
try
|
||||
" catch all exceptions, just in case
|
||||
if !empty(eval(expr))
|
||||
@@ -220,9 +227,7 @@ function! s:section_is_empty(self, content)
|
||||
catch
|
||||
return 0
|
||||
endtry
|
||||
let start += 1
|
||||
let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start)
|
||||
endw
|
||||
endfor
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -26,6 +26,7 @@ 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)}'],
|
||||
\ 'floggraph': [ 'Flog', '%{get(b:, "flog_status_summary", "")}' ],
|
||||
\ 'gundo': [ 'Gundo', '' ],
|
||||
\ 'help': [ 'Help', '%f' ],
|
||||
\ 'minibufexpl': [ 'MiniBufExplorer', '' ],
|
||||
@@ -166,7 +167,7 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'gina')
|
||||
endif
|
||||
|
||||
if get(g:, 'fern_loaded', 0) && get(g:, 'airline#extensions#fern#enabled', 1)
|
||||
if get(g:, 'loaded_fern', 0) && get(g:, 'airline#extensions#fern#enabled', 1)
|
||||
call airline#extensions#fern#init(s:ext)
|
||||
call add(s:loaded_ext, 'fern')
|
||||
endif
|
||||
@@ -228,11 +229,17 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'undotree')
|
||||
endif
|
||||
|
||||
if exists(':RTM')
|
||||
call airline#extensions#vimodoro#init(s:ext)
|
||||
call add(s:loaded_ext, 'vimodoro')
|
||||
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(':Gitsigns')
|
||||
\ || exists(':CocCommand'))
|
||||
call airline#extensions#hunks#init(s:ext)
|
||||
call add(s:loaded_ext, 'hunks')
|
||||
@@ -249,6 +256,10 @@ function! airline#extensions#load()
|
||||
call airline#extensions#tagbar#init(s:ext)
|
||||
call add(s:loaded_ext, 'tagbar')
|
||||
endif
|
||||
if get(g:, 'airline#extensions#taglist#enabled', 1) && exists(':TlistShowTag')
|
||||
call airline#extensions#taglist#init(s:ext)
|
||||
call add(s:loaded_ext, 'taglist')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#vista#enabled', 1)
|
||||
\ && exists(':Vista')
|
||||
@@ -262,6 +273,11 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'bookmark')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#scrollbar#enabled', 0)
|
||||
call airline#extensions#scrollbar#init(s:ext)
|
||||
call add(s:loaded_ext, 'scrollbar')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#csv#enabled', 1)
|
||||
\ && (get(g:, 'loaded_csv', 0) || exists(':Table'))
|
||||
call airline#extensions#csv#init(s:ext)
|
||||
@@ -338,7 +354,8 @@ function! airline#extensions#load()
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#nvimlsp#enabled', 1)
|
||||
\ && exists(':LspInstallInfo'))
|
||||
\ && has('nvim')
|
||||
\ && luaeval('vim.lsp ~= nil'))
|
||||
call airline#extensions#nvimlsp#init(s:ext)
|
||||
call add(s:loaded_ext, 'nvimlsp')
|
||||
endif
|
||||
@@ -403,6 +420,11 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'capslock')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#codeium#enabled', 1) && get(g:, 'loaded_codeium', 0))
|
||||
call airline#extensions#codeium#init(s:ext)
|
||||
call add(s:loaded_ext, 'codeium')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#gutentags#enabled', 1) && get(g:, 'loaded_gutentags', 0))
|
||||
call airline#extensions#gutentags#init(s:ext)
|
||||
call add(s:loaded_ext, 'gutentags')
|
||||
@@ -418,7 +440,7 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'grepper')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib'))
|
||||
if get(g:, 'airline#extensions#xkblayout#enabled', 1) && (exists('g:XkbSwitchLib') || exists('*FcitxCurrentIM') || has('nvim'))
|
||||
call airline#extensions#xkblayout#init(s:ext)
|
||||
call add(s:loaded_ext, 'xkblayout')
|
||||
endif
|
||||
@@ -461,17 +483,22 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'battery')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#vim9lsp#enabled', 1) && exists('*lsp#lsp#ErrorCount'))
|
||||
call airline#extensions#vim9lsp#init(s:ext)
|
||||
call add(s:loaded_ext, 'vim9lsp')
|
||||
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).
|
||||
for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n")
|
||||
for file in split(globpath(&rtp, 'autoload/airline/extensions/*.vim', 1), "\n")
|
||||
" we have to check both resolved and unresolved paths, since it's possible
|
||||
" that they might not get resolved properly (see #187)
|
||||
if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0
|
||||
\ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0
|
||||
let name = fnamemodify(file, ':t:r')
|
||||
if !get(g:, 'airline#extensions#'.name.'#enabled', 1) ||
|
||||
\ index(s:loaded_ext, name) > -1
|
||||
\ index(s:loaded_ext, name.'*') > -1
|
||||
continue
|
||||
endif
|
||||
try
|
||||
@@ -494,6 +521,11 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'omnisharp')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#rufo#enabled', 0) && get(g:, 'rufo_loaded', 0))
|
||||
call airline#extensions#rufo#init(s:ext)
|
||||
call add(s:loaded_ext, 'rufo')
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#get_loaded_extensions()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bjorn Neergaard, w0rp et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bjorn Neergaard, w0rp et al.
|
||||
" Plugin: https://github.com/dense-analysis/ale
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -128,6 +128,10 @@ function! airline#extensions#ale#init(ext)
|
||||
endfunction
|
||||
|
||||
function! s:ale_refresh()
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
if get(g:, 'airline_skip_empty_sections', 0)
|
||||
exe ':AirlineRefresh!'
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2021 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/lambdalisue/battery.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2020 Bjoern Petri <bjoern.petri@sundevil.de>
|
||||
" MIT License. Copyright (c) 2021 Bjoern Petri <bjoern.petri@sundevil.de>
|
||||
" Plugin: https://github.com/MattesGroeger/vim-bookmarks
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: fugitive, gina, lawrencium and vcscommand
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -17,8 +17,8 @@ scriptencoding utf-8
|
||||
let s:vcs_config = {
|
||||
\ 'git': {
|
||||
\ 'exe': 'git',
|
||||
\ 'cmd': 'git status --porcelain -- ',
|
||||
\ 'dirty': 'git status -uno --porcelain --ignore-submodules',
|
||||
\ 'cmd': 'git --no-optional-locks status --porcelain -- ',
|
||||
\ 'dirty': 'git --no-optional-locks status -uno --porcelain --ignore-submodules',
|
||||
\ 'untracked_mark': '??',
|
||||
\ 'exclude': '\.git',
|
||||
\ 'update_branch': 's:update_git_branch',
|
||||
@@ -86,36 +86,39 @@ let s:sha1size = get(g:, 'airline#extensions#branch#sha1_len', 7)
|
||||
|
||||
function! s:update_git_branch()
|
||||
call airline#util#ignore_next_focusgain()
|
||||
if !airline#util#has_fugitive() && !airline#util#has_gina()
|
||||
if airline#util#has_fugitive()
|
||||
call s:config_fugitive_branch()
|
||||
elseif airline#util#has_gina()
|
||||
call s:config_gina_branch()
|
||||
else
|
||||
let s:vcs_config['git'].branch = ''
|
||||
return
|
||||
endif
|
||||
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
|
||||
endfunction
|
||||
|
||||
function! s:config_fugitive_branch() abort
|
||||
let s:vcs_config['git'].branch = FugitiveHead(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
|
||||
endfunction
|
||||
|
||||
function! s:config_gina_branch() abort
|
||||
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
|
||||
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\+')
|
||||
@@ -123,8 +126,15 @@ function! s:display_git_branch()
|
||||
if has_key(s:names, commit)
|
||||
let name = get(s:names, commit)."(".name.")"
|
||||
elseif !empty(commit)
|
||||
let ref = fugitive#repo().git_chomp('describe', '--all', '--exact-match', commit)
|
||||
if ref !~ "^fatal: no tag exactly matches"
|
||||
if exists('*FugitiveExecute')
|
||||
let ref = FugitiveExecute(['describe', '--all', '--exact-match', commit], bufnr('')).stdout[0]
|
||||
else
|
||||
noautocmd let ref = fugitive#repo().git_chomp('describe', '--all', '--exact-match', commit)
|
||||
if ref =~# ':'
|
||||
let ref = ''
|
||||
endif
|
||||
endif
|
||||
if !empty(ref)
|
||||
let name = s:format_name(substitute(ref, '\v\C^%(heads/|remotes/|tags/)=','',''))."(".name.")"
|
||||
else
|
||||
let name = matchstr(commit, '.\{'.s:sha1size.'}')."(".name.")"
|
||||
@@ -318,6 +328,10 @@ endfunction
|
||||
|
||||
function! s:reset_untracked_cache(shellcmdpost)
|
||||
" shellcmdpost - whether function was called as a result of ShellCmdPost hook
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
if !g:airline#init#vim_async && !has('nvim')
|
||||
if a:shellcmdpost
|
||||
" Clear cache only if there was no error or the script uses an
|
||||
@@ -339,11 +353,17 @@ function! s:reset_untracked_cache(shellcmdpost)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:sh_autocmd_handler()
|
||||
if exists('#airline')
|
||||
unlet! b:airline_head b:airline_do_mq_check
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#branch#init(ext)
|
||||
call airline#parts#define_function('branch', 'airline#extensions#branch#get_head')
|
||||
|
||||
autocmd ShellCmdPost,CmdwinLeave * unlet! b:airline_head b:airline_do_mq_check
|
||||
autocmd User AirlineBeforeRefresh unlet! b:airline_head b:airline_do_mq_check
|
||||
autocmd ShellCmdPost,CmdwinLeave * call s:sh_autocmd_handler()
|
||||
autocmd User AirlineBeforeRefresh call s:sh_autocmd_handler()
|
||||
autocmd BufWritePost * call s:reset_untracked_cache(0)
|
||||
autocmd ShellCmdPost * call s:reset_untracked_cache(1)
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/bling/vim-bufferline
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -20,7 +20,7 @@ function! airline#extensions#bufferline#init(ext)
|
||||
endif
|
||||
|
||||
if exists("+autochdir") && &autochdir == 1
|
||||
" if 'acd' is set, vim-airline uses the path section, so we need ot redefine this here as well
|
||||
" if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well
|
||||
call airline#parts#define_raw('path', '%{bufferline#refresh_status()}'.bufferline#get_status_string())
|
||||
else
|
||||
call airline#parts#define_raw('file', '%{bufferline#refresh_status()}'.bufferline#get_status_string())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2021 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/tpope/vim-capslock
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
" MIT License. Copyright (c) 2019-2020 Peng Guanwen et al.
|
||||
" MIT License. Copyright (c) 2019-2021 Peng Guanwen et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
" Plugin: https://github.com/neoclide/coc
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:error_symbol = get(g:, 'airline#extensions#coc#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#coc#warning_symbol', 'W:')
|
||||
let s:show_coc_status = get(g:, 'airline#extensions#coc#show_coc_status', 1)
|
||||
|
||||
function! airline#extensions#coc#get_warning() abort
|
||||
return airline#extensions#coc#get('warning')
|
||||
@@ -16,39 +15,40 @@ function! airline#extensions#coc#get_error() abort
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#coc#get(type) abort
|
||||
if !exists(':CocCommand')
|
||||
return ''
|
||||
endif
|
||||
let _backup = get(g:, 'coc_stl_format', '')
|
||||
if !exists(':CocCommand') | return '' | endif
|
||||
|
||||
let is_err = (a:type is# 'error')
|
||||
if is_err
|
||||
let g:coc_stl_format = get(g:, 'airline#extensions#coc#stl_format_err', '%E{[%e(#%fe)]}')
|
||||
else
|
||||
let g:coc_stl_format = get(g:, 'airline#extensions#coc#stl_format_warn', '%W{[%w(#%fw)]}')
|
||||
endif
|
||||
let info = get(b:, 'coc_diagnostic_info', {})
|
||||
if empty(info) | return '' | endif
|
||||
|
||||
|
||||
let cnt = get(info, a:type, 0)
|
||||
if !empty(_backup)
|
||||
let g:coc_stl_format = _backup
|
||||
endif
|
||||
if empty(cnt) | return '' | endif
|
||||
|
||||
if empty(cnt)
|
||||
return ''
|
||||
else
|
||||
return (is_err ? s:error_symbol : s:warning_symbol).cnt
|
||||
endif
|
||||
let error_symbol = get(g:, 'airline#extensions#coc#error_symbol', 'E:')
|
||||
let warning_symbol = get(g:, 'airline#extensions#coc#warning_symbol', 'W:')
|
||||
let error_format = get(g:, 'airline#extensions#coc#stl_format_err', '%C(L%L)')
|
||||
let warning_format = get(g:, 'airline#extensions#coc#stl_format_warn', '%C(L%L)')
|
||||
|
||||
" replace %C with error count and %L with line number
|
||||
return (is_err ? error_symbol : warning_symbol) .
|
||||
\ substitute(substitute(is_err ? error_format : warning_format,
|
||||
\ '%C', cnt, 'g'),
|
||||
\ '%L', (info.lnums)[is_err ? 0 : 1], 'g')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#coc#get_status() abort
|
||||
" Shorten text for windows < 91 characters
|
||||
return airline#util#shorten(get(g:, 'coc_status', ''), 91, 9)
|
||||
let status = airline#util#shorten(get(g:, 'coc_status', ''), 91, 9)
|
||||
return (s:show_coc_status ? status : '')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#coc#get_current_function() abort
|
||||
return get(b:, 'coc_current_function', '')
|
||||
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')
|
||||
call airline#parts#define_function('coc_current_function', 'airline#extensions#coc#get_current_function')
|
||||
endfunction
|
||||
|
||||
17
autoload/airline/extensions/codeium.vim
Normal file
17
autoload/airline/extensions/codeium.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
" MIT License. Copyright (c) 2014-2021 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/Exafunction/codeium.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_codeium', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#codeium#status() abort
|
||||
return '{…}' . codeium#GetStatusString()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#codeium#init(ext) abort
|
||||
call airline#parts#define_function('codeium', 'airline#extensions#codeium#status')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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-2020 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/ctrlpvim/ctrlp.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/szw/vim-ctrlspace
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -107,6 +107,10 @@ augroup airline#extensions#cursormode
|
||||
augroup END
|
||||
|
||||
function! airline#extensions#cursormode#activate()
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
let s:color_map = s:get_color_map()
|
||||
call airline#extensions#cursormode#set()
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -7,7 +7,7 @@ let s:section_use_groups = get(g:, 'airline#extensions#default#section_use_g
|
||||
let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', {
|
||||
\ 'b': 79,
|
||||
\ 'x': 60,
|
||||
\ 'y': 88,
|
||||
\ 'y': 80,
|
||||
\ 'z': 45,
|
||||
\ 'warning': 80,
|
||||
\ 'error': 80,
|
||||
@@ -76,17 +76,14 @@ else
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! airline#extensions#default#apply(builder, context)
|
||||
function! airline#extensions#default#apply(builder, context) abort
|
||||
let winnr = a:context.winnr
|
||||
let active = a:context.active
|
||||
|
||||
if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse))
|
||||
call s:build_sections(a:builder, a:context, s:layout[0])
|
||||
else
|
||||
let text = s:get_section(winnr, 'c')
|
||||
if empty(text)
|
||||
let text = ' %f%m '
|
||||
endif
|
||||
let text = !empty(s:get_section(winnr, 'c')) ? s:get_section(winnr, 'c') : ' %f%m '
|
||||
call a:builder.add_section('airline_c'.(a:context.bufnr), text)
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2020 Thomas Dy et al.
|
||||
" MIT License. Copyright (c) 2017-2021 Thomas Dy et al.
|
||||
" Plugin: https://github.com/Shougo/denite.nvim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -23,7 +23,7 @@ function! airline#extensions#example#init(ext)
|
||||
call airline#parts#define_raw('cats', '%{airline#extensions#example#get_cats()}')
|
||||
|
||||
" Next up we add a funcref so that we can run some code prior to the
|
||||
" statusline getting modifed.
|
||||
" statusline getting modified.
|
||||
call a:ext.add_statusline_func('airline#extensions#example#apply')
|
||||
|
||||
" You can also add a funcref for inactive statuslines.
|
||||
@@ -40,7 +40,7 @@ function! airline#extensions#example#apply(...)
|
||||
" section_c.
|
||||
let w:airline_section_c = get(w:, 'airline_section_c', g:airline_section_c)
|
||||
|
||||
" Then we just append this extenion to it, optionally using separators.
|
||||
" Then we just append this extension to it, optionally using separators.
|
||||
let w:airline_section_c .= s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#example#get_cats()}'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
" MIT License. Copyright (c) 2013-2020
|
||||
" MIT License. Copyright (c) 2013-2021
|
||||
" Plugin: https://github.com/lambdalisue/fern.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
if !get(g:, 'fern_loaded', 0)
|
||||
if !get(g:, 'loaded_fern', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2020 Cimbali et al
|
||||
" MIT License. Copyright (c) 2017-2021 Cimbali et al
|
||||
" Plugin: https://github.com/tpope/vim-fugitive
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -8,45 +8,54 @@ if !airline#util#has_fugitive()
|
||||
finish
|
||||
endif
|
||||
|
||||
function! s:ModifierFlags()
|
||||
return (exists("+autochdir") && &autochdir) ? ':p' : ':.'
|
||||
endfunction
|
||||
let s:has_percent_eval = v:version > 802 || (v:version == 802 && has("patch2854"))
|
||||
|
||||
function! airline#extensions#fugitiveline#bufname()
|
||||
function! airline#extensions#fugitiveline#bufname() abort
|
||||
if !exists('b:fugitive_name')
|
||||
let b:fugitive_name = ''
|
||||
try
|
||||
if bufname('%') =~? '^fugitive:' && exists('*FugitiveReal')
|
||||
let b:fugitive_name = FugitiveReal(bufname('%'))
|
||||
elseif exists('b:git_dir') && exists('*fugitive#repo')
|
||||
if get(b:, 'fugitive_type', '') is# 'blob'
|
||||
let b:fugitive_name = fugitive#repo().translate(FugitivePath(@%, ''))
|
||||
endif
|
||||
elseif exists('b:git_dir') && !exists('*fugitive#repo')
|
||||
let buffer = fugitive#buffer()
|
||||
if buffer.type('blob')
|
||||
let b:fugitive_name = buffer.repo().translate(buffer.path('/'))
|
||||
endif
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
|
||||
let fmod = s:ModifierFlags()
|
||||
let fmod = (exists("+autochdir") && &autochdir) ? ':p' : ':.'
|
||||
let result=''
|
||||
if empty(b:fugitive_name)
|
||||
return fnamemodify(bufname('%'), fmod)
|
||||
if empty(bufname('%'))
|
||||
return &buftype ==# 'nofile' ? '[Scratch]' : '[No Name]'
|
||||
endif
|
||||
return s:has_percent_eval ? '%f' : fnamemodify(bufname('%'), fmod)
|
||||
else
|
||||
return fnamemodify(b:fugitive_name, fmod). " [git]"
|
||||
return s:has_percent_eval ? '%f [git]' : (fnamemodify(b:fugitive_name, fmod). " [git]")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#fugitiveline#init(ext)
|
||||
function! s:sh_autocmd_handler()
|
||||
if exists('#airline')
|
||||
unlet! b:fugitive_name
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#fugitiveline#init(ext) abort
|
||||
let prct = s:has_percent_eval ? '%' : ''
|
||||
|
||||
if exists("+autochdir") && &autochdir
|
||||
" if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well
|
||||
call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m')
|
||||
if get(g:, 'airline_stl_path_style', 'default') ==# 'short'
|
||||
call airline#parts#define_raw('path', '%<%{'. prct. 'pathshorten(airline#extensions#fugitiveline#bufname())' . prct . '}%m')
|
||||
else
|
||||
call airline#parts#define_raw('path', '%<%{' . prct . 'airline#extensions#fugitiveline#bufname()' . prct . '}%m')
|
||||
endif
|
||||
else
|
||||
call airline#parts#define_raw('file', '%<%{airline#extensions#fugitiveline#bufname()}%m')
|
||||
if get(g:, 'airline_stl_path_style', 'default') ==# 'short'
|
||||
call airline#parts#define_raw('file', '%<%{' . prct . 'pathshorten(airline#extensions#fugitiveline#bufname())' . prct . '}%m')
|
||||
else
|
||||
call airline#parts#define_raw('file', '%<%{' . prct . 'airline#extensions#fugitiveline#bufname()' . prct . '}%m')
|
||||
endif
|
||||
endif
|
||||
autocmd ShellCmdPost,CmdwinLeave * unlet! b:fugitive_name
|
||||
autocmd User AirlineBeforeRefresh unlet! b:fugitive_name
|
||||
autocmd ShellCmdPost,CmdwinLeave * call s:sh_autocmd_handler()
|
||||
autocmd User AirlineBeforeRefresh call s:sh_autocmd_handler()
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/junegunn/fzf, https://github.com/junegunn/fzf.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2021 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020
|
||||
" MIT License. Copyright (c) 2013-2021
|
||||
" Plugin: https://github.com/lambdalisue/gina.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -8,7 +8,11 @@ if !get(g:, 'loaded_gina', 0)
|
||||
endif
|
||||
|
||||
function! airline#extensions#gina#apply(...) abort
|
||||
if (&ft =~# 'gina' && &ft !~# 'blame') || &ft ==# 'diff'
|
||||
" gina.vim seems to set b:gina_initialized = 1 in diff buffers it open,
|
||||
" where get(b:, 'gina_initialized', 0) returns 1.
|
||||
" In diff buffers not opened by gina.vim b:gina_initialized is not set,
|
||||
" so get(b:, 'gina_initialized', 0) returns 0.
|
||||
if (&ft =~# 'gina' && &ft !~# 'blame') || (&ft ==# 'diff' && get(b:, 'gina_initialized', 0))
|
||||
call a:1.add_section('airline_a', ' gina ')
|
||||
call a:1.add_section('airline_b', ' %{gina#component#repo#branch()} ')
|
||||
call a:1.split()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2020 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2021 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-2020 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2021 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/ludovicchabant/vim-gutentags
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" Plugin: vim-gitgutter, vim-signify, changesPlugin, quickfixsigns, coc-git
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: vim-gitgutter, vim-signify, changesPlugin, quickfixsigns, coc-git,
|
||||
" gitsigns.nvim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -8,6 +9,7 @@ if !get(g:, 'loaded_signify', 0)
|
||||
\ && !get(g:, 'loaded_gitgutter', 0)
|
||||
\ && !get(g:, 'loaded_changes', 0)
|
||||
\ && !get(g:, 'loaded_quickfixsigns', 0)
|
||||
\ && !exists(':Gitsigns')
|
||||
\ && !exists("*CocAction")
|
||||
finish
|
||||
endif
|
||||
@@ -26,6 +28,31 @@ function! s:coc_git_enabled() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! s:parse_hunk_status_dict(hunks) abort
|
||||
let result = [0, 0, 0]
|
||||
let result[0] = get(a:hunks, 'added', 0)
|
||||
let result[1] = get(a:hunks, 'changed', 0)
|
||||
let result[2] = get(a:hunks, 'removed', 0)
|
||||
return result
|
||||
endfunction
|
||||
|
||||
function! s:parse_hunk_status_decorated(hunks) abort
|
||||
if empty(a:hunks)
|
||||
return []
|
||||
endif
|
||||
let result = [0, 0, 0]
|
||||
for val in split(a:hunks)
|
||||
if val[0] is# '+'
|
||||
let result[0] = val[1:] + 0
|
||||
elseif val[0] is# '~'
|
||||
let result[1] = val[1:] + 0
|
||||
elseif val[0] is# '-'
|
||||
let result[2] = val[1:] + 0
|
||||
endif
|
||||
endfor
|
||||
return result
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_signify() abort
|
||||
let hunks = sy#repo#get_stats()
|
||||
if hunks[0] >= 0
|
||||
@@ -34,34 +61,9 @@ function! s:get_hunks_signify() abort
|
||||
return []
|
||||
endfunction
|
||||
|
||||
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() abort
|
||||
if !get(g:, 'gitgutter_enabled', 0) || s:is_branch_empty()
|
||||
return ''
|
||||
endif
|
||||
return GitGutterGetHunkSummary()
|
||||
let hunks = GitGutterGetHunkSummary()
|
||||
return hunks == [0, 0, 0] ? [] : hunks
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_changes() abort
|
||||
@@ -69,6 +71,16 @@ function! s:get_hunks_changes() abort
|
||||
return hunks == [0, 0, 0] ? [] : hunks
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_gitsigns() abort
|
||||
let hunks = get(b:, 'gitsigns_status_dict', {})
|
||||
return s:parse_hunk_status_dict(hunks)
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_coc() abort
|
||||
let hunks = get(b:, 'coc_git_status', '')
|
||||
return s:parse_hunk_status_decorated(hunks)
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_empty() abort
|
||||
return ''
|
||||
endfunction
|
||||
@@ -77,12 +89,14 @@ 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'
|
||||
elseif exists('*GitGutterGetHunkSummary')
|
||||
elseif exists('*GitGutterGetHunkSummary') && get(g:, 'gitgutter_enabled')
|
||||
let b:source_func = 's:get_hunks_gitgutter'
|
||||
elseif exists('*changes#GetStats')
|
||||
let b:source_func = 's:get_hunks_changes'
|
||||
elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary')
|
||||
let b:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary'
|
||||
elseif exists(':Gitsigns')
|
||||
let b:source_func = 's:get_hunks_gitsigns'
|
||||
elseif s:coc_git_enabled()
|
||||
let b:source_func = 's:get_hunks_coc'
|
||||
else
|
||||
@@ -104,6 +118,7 @@ function! airline#extensions#hunks#get_hunks() abort
|
||||
\ 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_gitsigns' &&
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_coc'
|
||||
return b:airline_hunks
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Doron Behar, C.Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Doron Behar, C.Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bjorn Neergaard, hallettj et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bjorn Neergaard, hallettj et al.
|
||||
" Plugin: https://github.com/autozimu/LanguageClient-neovim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -35,6 +35,10 @@ function! s:record_diagnostics(state)
|
||||
endfunction
|
||||
|
||||
function! s:get_diagnostics()
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
call LanguageClient#getState(function("s:record_diagnostics"))
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2018-2020 mox et al.
|
||||
" MIT License. Copyright (c) 2018-2021 mox et al.
|
||||
" Plugin: https://github.com/mox-mox/vim-localsearch
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 François-Xavier Carton et al.
|
||||
" MIT License. Copyright (c) 2013-2021 François-Xavier Carton et al.
|
||||
" Plugin: https://github.com/prabirshrestha/vim-lsp
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -61,7 +61,51 @@ function! airline#extensions#lsp#get_error() abort
|
||||
return airline#extensions#lsp#get('error')
|
||||
endfunction
|
||||
|
||||
let s:lsp_progress = []
|
||||
function! airline#extensions#lsp#progress() abort
|
||||
if get(w:, 'airline_active', 0)
|
||||
if exists('*lsp#get_progress')
|
||||
let s:lsp_progress = lsp#get_progress()
|
||||
|
||||
if len(s:lsp_progress) == 0 | return '' | endif
|
||||
|
||||
" show only most new progress
|
||||
let s:lsp_progress = s:lsp_progress[0]
|
||||
if s:lsp_progress['message'] !=# ''
|
||||
let percent = ''
|
||||
if has_key(s:lsp_progress, 'percentage') && s:lsp_progress['percentage'] >= 0
|
||||
let percent = ' ' . string(s:lsp_progress['percentage']) . '%'
|
||||
endif
|
||||
let s:title = s:lsp_progress['title']
|
||||
let message = airline#util#shorten(s:lsp_progress['message'] . percent, 91, 9)
|
||||
return s:lsp_progress['server'] . ': ' . s:title . ' ' . message
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
let s:timer = 0
|
||||
let s:ignore_time = 0
|
||||
function! airline#extensions#lsp#update() abort
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
if reltimefloat(reltime()) - s:ignore_time >=
|
||||
\ get(g:, 'airline#extensions#lsp#progress_skip_time', 0.3)
|
||||
\ || len(s:lsp_progress) == 0
|
||||
call airline#update_statusline()
|
||||
let s:ignore_time = reltimefloat(reltime())
|
||||
endif
|
||||
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')
|
||||
call airline#parts#define_function('lsp_progress', 'airline#extensions#lsp#progress')
|
||||
augroup airline_lsp_progress
|
||||
autocmd!
|
||||
autocmd User lsp_progress_updated call airline#extensions#lsp#update()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: http://www.drchip.org/astronaut/vim/#NETRW
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/chrisbra/NrrwRgn
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
" Apache 2.0 license. Copyright (c) 2019-2020 Copyright Neovim contributors.
|
||||
" Apache 2.0 license. Copyright (c) 2019-2021 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'))
|
||||
\ && has('nvim')
|
||||
\ && luaeval('vim.lsp ~= nil'))
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -14,24 +15,46 @@ function! s:airline_nvimlsp_count(cnt, symbol) abort
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#nvimlsp#get(type) abort
|
||||
if !exists(':LspInstallInfo')
|
||||
if has('nvim-0.11') && luaeval('vim.tbl_isempty(vim.lsp.get_clients({ bufnr = 0 }))')
|
||||
return ''
|
||||
elseif !has('nvim-0.11') && luaeval('vim.tbl_isempty(vim.lsp.buf_get_clients(0))')
|
||||
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 show_line_numbers = get(g:, 'airline#extensions#nvimlsp#show_line_numbers', 1)
|
||||
|
||||
let is_err = a:type ==# 'Error'
|
||||
|
||||
let symbol = is_err ? error_symbol : warning_symbol
|
||||
|
||||
if luaeval("pcall(require, 'vim.lsp.diagnostic')")
|
||||
if luaeval("pcall(require, 'vim.diagnostic')")
|
||||
let severity = a:type == 'Warning' ? 'Warn' : a:type
|
||||
let num = len(v:lua.vim.diagnostic.get(0, { 'severity': severity }))
|
||||
elseif 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)
|
||||
if show_line_numbers == 1 && luaeval("pcall(require, 'vim.diagnostic')") && num > 0
|
||||
return s:airline_nvimlsp_count(num, symbol) . <sid>airline_nvimlsp_get_line_number(num, a:type)
|
||||
else
|
||||
return s:airline_nvimlsp_count(num, symbol)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:airline_nvimlsp_get_line_number(cnt, type) abort
|
||||
let severity = a:type == 'Warning' ? 'Warn' : a:type
|
||||
let num = v:lua.vim.diagnostic.get(0, { 'severity': severity })[0].lnum
|
||||
|
||||
let l:open_lnum_symbol =
|
||||
\ get(g:, 'airline#extensions#nvimlsp#open_lnum_symbol', '(L')
|
||||
let l:close_lnum_symbol =
|
||||
\ get(g:, 'airline#extensions#nvimlsp#close_lnum_symbol', ')')
|
||||
|
||||
return open_lnum_symbol . num . close_lnum_symbol
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#nvimlsp#get_warning() abort
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/tpope/vim-obsession
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -43,6 +43,10 @@ function! airline#extensions#po#shorten()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#po#on_winenter()
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
" only reset cache, if the window size changed
|
||||
if get(b:, 'airline_winwidth', 0) != airline#util#winwidth()
|
||||
let b:airline_winwidth = airline#util#winwidth()
|
||||
@@ -51,11 +55,17 @@ function! airline#extensions#po#on_winenter()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:autocmd_handler()
|
||||
if exists('#airline')
|
||||
unlet! b:airline_po_stats
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#po#apply(...)
|
||||
if &ft ==# 'po'
|
||||
call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}')
|
||||
" Also reset the cache variable, if a window has been split, e.g. the winwidth changed
|
||||
autocmd airline BufWritePost * unlet! b:airline_po_stats
|
||||
autocmd airline BufWritePost * call s:autocmd_handler()
|
||||
autocmd airline WinEnter * call airline#extensions#po#on_winenter()
|
||||
endif
|
||||
endfunction
|
||||
@@ -65,8 +75,9 @@ function! airline#extensions#po#stats()
|
||||
return b:airline_po_stats
|
||||
endif
|
||||
|
||||
" Write stdout to null because we only want to see warnings.
|
||||
if g:airline#init#is_windows
|
||||
let cmd = 'msgfmt --statistics -o NUL '
|
||||
let cmd = 'msgfmt --statistics -o /NUL '
|
||||
else
|
||||
let cmd = 'msgfmt --statistics -o /dev/null -- '
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/petobens/poet_v
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
38
autoload/airline/extensions/rufo.vim
Normal file
38
autoload/airline/extensions/rufo.vim
Normal file
@@ -0,0 +1,38 @@
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('g:rufo_loaded')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
if !exists('g:airline#extensions#rufo#symbol')
|
||||
let g:airline#extensions#rufo#symbol = 'RuFo'
|
||||
endif
|
||||
|
||||
function! airline#extensions#rufo#init(ext)
|
||||
call airline#parts#define_raw('rufo', '%{airline#extensions#rufo#get_status}')
|
||||
call a:ext.add_statusline_func('airline#extensions#rufo#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#rufo#get_status()
|
||||
let out = ''
|
||||
if &ft == "ruby" && g:rufo_auto_formatting == 1
|
||||
let out .= s:spc.g:airline_left_alt_sep.s:spc.g:airline#extensions#rufo#symbol
|
||||
endif
|
||||
return out
|
||||
endfunction
|
||||
|
||||
" This function will be invoked just prior to the statusline getting modified.
|
||||
function! airline#extensions#rufo#apply(...)
|
||||
" First we check for the filetype.
|
||||
if &filetype == "ruby"
|
||||
" section_z.
|
||||
let w:airline_section_z = get(w:, 'airline_section_z', g:airline_section_z)
|
||||
|
||||
" Then we just append this extension to it, optionally using separators.
|
||||
let w:airline_section_z .= '%{airline#extensions#rufo#get_status()}'
|
||||
endif
|
||||
endfunction
|
||||
37
autoload/airline/extensions/scrollbar.vim
Normal file
37
autoload/airline/extensions/scrollbar.vim
Normal file
@@ -0,0 +1,37 @@
|
||||
" MIT License. Copyright (c) 2013-2021
|
||||
" vim: et ts=2 sts=2 sw=2 et
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#scrollbar#calculate() abort
|
||||
if winwidth(0) > get(g:, 'airline#extensions#scrollbar#minwidth', 200)
|
||||
\ && get(w:, 'airline_active', 0)
|
||||
let overwrite = 0
|
||||
if &encoding ==? 'utf-8' && !get(g:, 'airline_symbols_ascii', 0)
|
||||
let [left, right, middle] = [ '|', '|', '█']
|
||||
let overwrite = 1
|
||||
else
|
||||
let [left, right, middle] = [ '[', ']', '-']
|
||||
endif
|
||||
let spc = get(g:, 'airline_symbols.space', ' ')
|
||||
let width = 20 " max width, plus one border and indicator
|
||||
let perc = (line('.') + 0.0) / (line('$') + 0.0)
|
||||
let before = float2nr(round(perc * width))
|
||||
if before >= 0 && line('.') == 1
|
||||
let before = 0
|
||||
let left = (overwrite ? '' : left)
|
||||
endif
|
||||
let after = width - before
|
||||
if (after <= 1 && line('.') == line('$'))
|
||||
let after = 0
|
||||
let right = (overwrite ? '' : right)
|
||||
endif
|
||||
return left . repeat(spc, before) . middle . repeat(spc, after) . right
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#scrollbar#init(ext) abort
|
||||
call airline#parts#define_function('scrollbar', 'airline#extensions#scrollbar#calculate')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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
|
||||
|
||||
@@ -17,6 +17,19 @@ function! airline#extensions#searchcount#apply(...) abort
|
||||
\ '%{v:hlsearch ? airline#extensions#searchcount#status() : ""}')
|
||||
endfunction
|
||||
|
||||
function! s:search_term()
|
||||
let show_search_term = get(g:, 'airline#extensions#searchcount#show_search_term', 1)
|
||||
let search_term_limit = get(g:, 'airline#extensions#searchcount#search_term_limit', 8)
|
||||
|
||||
if show_search_term == 0
|
||||
return ''
|
||||
endif
|
||||
" shorten for all width smaller than 300 (this is just a guess)
|
||||
" this uses a non-breaking space, because it looks like
|
||||
" a leading space is stripped :/
|
||||
return "\ua0" . '/' . airline#util#shorten(getreg('/'), 300, search_term_limit)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#searchcount#status() abort
|
||||
try
|
||||
let result = searchcount(#{recompute: 1, maxcount: -1})
|
||||
@@ -24,18 +37,18 @@ function! airline#extensions#searchcount#status() abort
|
||||
return ''
|
||||
endif
|
||||
if result.incomplete ==# 1 " timed out
|
||||
return printf(' /%s [?/??]', @/)
|
||||
return printf('%s[?/??]', s:search_term())
|
||||
elseif result.incomplete ==# 2 " max count exceeded
|
||||
if result.total > result.maxcount &&
|
||||
\ result.current > result.maxcount
|
||||
return printf('%s[>%d/>%d]', @/,
|
||||
return printf('%s[>%d/>%d]', s:search_term(),
|
||||
\ result.current, result.total)
|
||||
elseif result.total > result.maxcount
|
||||
return printf('%s[%d/>%d]', @/,
|
||||
return printf('%s[%d/>%d]', s:search_term(),
|
||||
\ result.current, result.total)
|
||||
endif
|
||||
endif
|
||||
return printf('%s[%d/%d]', @/,
|
||||
return printf('%s[%d/%d]', s:search_term(),
|
||||
\ result.current, result.total)
|
||||
catch
|
||||
return ''
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et fdm=marker
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -12,6 +12,9 @@ let s:ctrlspace = get(g:, 'CtrlSpaceLoaded', 0)
|
||||
let s:tabws = get(g:, 'tabws_loaded', 0)
|
||||
let s:current_tabcnt = -1
|
||||
|
||||
" Dictionary functions are not possible in Vim9 Script,
|
||||
" so use the legacy Vim Script implementation
|
||||
|
||||
function! airline#extensions#tabline#init(ext)
|
||||
if has('gui_running') && match(&guioptions, 'e') > -1
|
||||
set guioptions-=e
|
||||
@@ -19,14 +22,14 @@ function! airline#extensions#tabline#init(ext)
|
||||
|
||||
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! airline#extensions#tabline#add_label(dict, type, right)
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
call a:dict.add_section_spaced('airline_tablabel'.
|
||||
\ (a:right ? '_right' : ''),
|
||||
call a:dict.add_section_spaced('airline_tablabel'. (a:right ? '_right' : ''),
|
||||
\ get(g:, 'airline#extensions#tabline#'.a:type.'_label', a:type))
|
||||
endif
|
||||
endfunction
|
||||
@@ -40,10 +43,12 @@ function! airline#extensions#tabline#add_tab_label(dict)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
|
||||
" Legacy VimScript implementation " {{{1
|
||||
function! s:toggle_off() " {{{2
|
||||
if !exists(":def") || !airline#util#has_vim9_script()
|
||||
|
||||
" Legacy Vim Script Implementation
|
||||
|
||||
function! s:toggle_off()
|
||||
call airline#extensions#tabline#autoshow#off()
|
||||
call airline#extensions#tabline#tabs#off()
|
||||
call airline#extensions#tabline#buffers#off()
|
||||
@@ -54,7 +59,8 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
call airline#extensions#tabline#tabws#off()
|
||||
endif
|
||||
endfunction
|
||||
function! s:toggle_on() " {{{2
|
||||
|
||||
function! s:toggle_on()
|
||||
if get(g:, 'airline_statusline_ontop', 0)
|
||||
call airline#extensions#tabline#enable()
|
||||
let &tabline='%!airline#statusline('.winnr().')'
|
||||
@@ -72,7 +78,53 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
|
||||
set tabline=%!airline#extensions#tabline#get()
|
||||
endfunction
|
||||
function! s:update_tabline(forceit) " {{{2
|
||||
|
||||
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.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)
|
||||
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 = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
|
||||
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', 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)
|
||||
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! s:update_tabline(forceit)
|
||||
if get(g:, 'airline#extensions#tabline#disable_refresh', 0)
|
||||
return
|
||||
endif
|
||||
@@ -93,7 +145,8 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
call airline#util#doautocmd('BufMRUChange')
|
||||
call airline#extensions#tabline#redraw()
|
||||
endfunction
|
||||
function! airline#extensions#tabline#redraw() " {{{2
|
||||
|
||||
function! airline#extensions#tabline#redraw()
|
||||
" sometimes, the tabline is not correctly updated see #1580
|
||||
" so force redraw here
|
||||
if exists(":redrawtabline") == 2
|
||||
@@ -105,60 +158,15 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
let &ro = &ro
|
||||
endif
|
||||
endfunction
|
||||
function! airline#extensions#tabline#enable() " {{{2
|
||||
|
||||
function! airline#extensions#tabline#enable()
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
@@ -187,7 +195,8 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
return airline#extensions#tabline#tabs#get()
|
||||
endif
|
||||
endfunction
|
||||
function! airline#extensions#tabline#title(n) " {{{2
|
||||
|
||||
function! airline#extensions#tabline#title(n)
|
||||
let title = ''
|
||||
if s:taboo
|
||||
let title = TabooTabTitle(a:n)
|
||||
@@ -208,18 +217,24 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
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])
|
||||
call add(curbuf, tabpagebuflist(a:n)[0])
|
||||
endif
|
||||
" a:n: -> buffer number
|
||||
" curbuf: list of buffers in current tabpage
|
||||
" we need the buffername in current tab page.
|
||||
return airline#extensions#tabline#get_buffer_name(curbuf[0], curbuf)
|
||||
endif
|
||||
|
||||
return title
|
||||
endfunction
|
||||
function! airline#extensions#tabline#get_buffer_name(nr, ...) " {{{2
|
||||
|
||||
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() " {{{2
|
||||
|
||||
function! airline#extensions#tabline#new_builder()
|
||||
let builder_context = {
|
||||
\ 'active' : 1,
|
||||
\ 'tabline' : 1,
|
||||
@@ -233,9 +248,11 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
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
|
||||
|
||||
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')
|
||||
@@ -254,30 +271,9 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
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
|
||||
finish
|
||||
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
|
||||
def s:toggle_off(): void
|
||||
airline#extensions#tabline#autoshow#off()
|
||||
airline#extensions#tabline#tabs#off()
|
||||
airline#extensions#tabline#buffers#off()
|
||||
@@ -288,7 +284,8 @@ else
|
||||
airline#extensions#tabline#tabws#off()
|
||||
endif
|
||||
enddef
|
||||
def s:toggle_on(): void # {{{2
|
||||
|
||||
def s:toggle_on(): void
|
||||
if get(g:, 'airline_statusline_ontop', 0)
|
||||
airline#extensions#tabline#enable()
|
||||
&tabline = '%!airline#statusline(' .. winnr() .. ')'
|
||||
@@ -305,37 +302,12 @@ else
|
||||
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>')
|
||||
|
||||
def airline#extensions#tabline#load_theme(palette: dict<any>): number
|
||||
# Needs to return a number, because it is implicitly used as extern_funcref
|
||||
# And funcrefs should return a value (see airline#util#exec_funcrefs())
|
||||
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
|
||||
return 0
|
||||
endif
|
||||
var colors = get(palette, 'tabline', {})
|
||||
var tablabel = get(colors, 'airline_tablabel', palette.normal.airline_b)
|
||||
@@ -376,8 +348,43 @@ else
|
||||
airline#highlighter#exec('airline_tabsel_right', tabsel_right)
|
||||
airline#highlighter#exec('airline_tabmod_right', tabmod_right)
|
||||
airline#highlighter#exec('airline_tabhid_right', tabhid_right)
|
||||
return 0
|
||||
enddef
|
||||
def airline#extensions#tabline#get(): string # {{{2
|
||||
|
||||
def s:update_tabline(forceit: number): void
|
||||
if get(g:, 'airline#extensions#tabline#disable_refresh', 0)
|
||||
return
|
||||
endif
|
||||
# loading a session file
|
||||
# On SessionLoadPost, g:SessionLoad variable is still set :/
|
||||
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
|
||||
# redrawtabline should always be available
|
||||
:redrawtabline
|
||||
enddef
|
||||
|
||||
def airline#extensions#tabline#enable(): void
|
||||
if &lines > 3
|
||||
&showtabline = 2
|
||||
endif
|
||||
enddef
|
||||
|
||||
def airline#extensions#tabline#get(): string
|
||||
var show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
var show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
||||
|
||||
@@ -406,7 +413,8 @@ else
|
||||
return airline#extensions#tabline#tabs#get()
|
||||
endif
|
||||
enddef
|
||||
def airline#extensions#tabline#title(n: number): string # {{{2
|
||||
|
||||
def airline#extensions#tabline#title(n: number): string
|
||||
var title = ''
|
||||
if get(g:, 'airline#extensions#taboo#enabled', 1) &&
|
||||
get(g:, 'loaded_taboo', 0) && exists("*TabooTabTitle")
|
||||
@@ -426,19 +434,21 @@ else
|
||||
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})
|
||||
var curbuf = filter(buflist, (_, v) => index(all_buffers, v) != -1)
|
||||
if len(curbuf) == 0
|
||||
add(curbuf, tabpagebuflist()[0])
|
||||
add(curbuf, tabpagebuflist(n)[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
|
||||
|
||||
def airline#extensions#tabline#get_buffer_name(nr: number, buffers = airline#extensions#tabline#buflist#list()): string
|
||||
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
|
||||
|
||||
def airline#extensions#tabline#new_builder(): dict<any>
|
||||
var builder_context = {
|
||||
'active': 1,
|
||||
'tabline': 1,
|
||||
@@ -449,7 +459,8 @@ else
|
||||
}
|
||||
return airline#extensions#tabline#builder#new(builder_context)
|
||||
enddef
|
||||
def airline#extensions#tabline#group_of_bufnr(tab_bufs: list<number>, bufnr: number): string # {{{2
|
||||
|
||||
def airline#extensions#tabline#group_of_bufnr(tab_bufs: list<number>, bufnr: number): string
|
||||
var cur = bufnr('%')
|
||||
var group = ''
|
||||
if cur == bufnr
|
||||
@@ -469,19 +480,4 @@ else
|
||||
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-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -30,7 +30,7 @@ function! airline#extensions#tabline#autoshow#on()
|
||||
autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()))
|
||||
autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()) - 1)
|
||||
else
|
||||
autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$'))
|
||||
autocmd TabNew,TabClosed * call <sid>show_tabline(s:tab_min_count, tabpagenr('$'))
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -161,13 +161,10 @@ function! s:get_number(index)
|
||||
return a:index
|
||||
endif
|
||||
let bidx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
|
||||
if bidx_mode > 1
|
||||
let l:count = bidx_mode == 2 ? a:index+11 : a:index+1
|
||||
return join(map(split(printf('%02d', l:count), '\zs'),
|
||||
\ 'get(s:number_map, v:val, "")'), '')
|
||||
else
|
||||
return get(s:number_map, a:index+1, '')
|
||||
endif
|
||||
let number_format = bidx_mode > 1 ? '%02d' : '%d'
|
||||
let l:count = bidx_mode == 2 ? a:index+11 : a:index+1
|
||||
return join(map(split(printf(number_format, l:count), '\zs'),
|
||||
\ 'get(s:number_map, v:val, "")'), '')
|
||||
endfunction
|
||||
|
||||
function! s:select_tab(buf_index)
|
||||
@@ -199,8 +196,8 @@ function! s:map_keys()
|
||||
let bidx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1)
|
||||
if bidx_mode > 0
|
||||
if bidx_mode == 1
|
||||
for i in range(1, 9)
|
||||
exe printf('noremap <silent> <Plug>AirlineSelectTab%d :call <SID>select_tab(%d)<CR>', i, i-1)
|
||||
for i in range(1, 10)
|
||||
exe printf('noremap <silent> <Plug>AirlineSelectTab%d :call <SID>select_tab(%d)<CR>', i%10, i-1)
|
||||
endfor
|
||||
else
|
||||
let start_idx = bidx_mode == 2 ? 11 : 1
|
||||
@@ -223,7 +220,11 @@ function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, mo
|
||||
if a:clicks == 1 && a:modifiers !~# '[^ ]'
|
||||
if a:button is# 'l'
|
||||
" left button - switch to buffer
|
||||
silent execute 'buffer' a:minwid
|
||||
try
|
||||
silent execute 'buffer' a:minwid
|
||||
catch
|
||||
call airline#util#warning("Cannot switch buffer, current buffer is modified! See :h 'hidden'")
|
||||
endtry
|
||||
elseif a:button is# 'm'
|
||||
" middle button - delete buffer
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -8,6 +8,10 @@ function! airline#extensions#tabline#buflist#invalidate()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buflist#clean()
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
call airline#extensions#tabline#buflist#invalidate()
|
||||
call airline#extensions#tabline#buffers#invalidate()
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -71,7 +71,7 @@ endfunction
|
||||
|
||||
" Compute the change in size of the tabline caused by separators
|
||||
"
|
||||
" This should be kept up-to-date with |s:get_transitioned_seperator| and
|
||||
" This should be kept up-to-date with |s:get_transitioned_separator| and
|
||||
" |s:get_separator| in autoload/airline/builder.vim
|
||||
function! s:get_separator_change_with_end(new_group, old_group, new_end_group, old_end_group, sep_size, alt_sep_size)
|
||||
let sep_change = 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016-2020 Kevin Sapper et al.
|
||||
" MIT License. Copyright (c) 2016-2021 Kevin Sapper et al.
|
||||
" Plugin: https://github.com/szw/vim-ctrlspace
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -24,13 +24,16 @@ function! airline#extensions#tabline#ctrlspace#on()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#invalidate()
|
||||
if !exists('#airline')
|
||||
return
|
||||
endif
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
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 = []
|
||||
for bufferindex in sort(keys(ctrlspace#api#Buffers(a:cur_tab)), 'N')
|
||||
for buffer in ctrlspace#api#BufferList(a:cur_tab)
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et fdm=marker
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
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
|
||||
if !exists(":def") || !airline#util#has_vim9_script()
|
||||
function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
|
||||
let fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
let _ = ''
|
||||
|
||||
let name = bufname(a:bufnr)
|
||||
if empty(name)
|
||||
let _ .= '[No Name]'
|
||||
let _ = '[No Name]'
|
||||
elseif name =~ 'term://'
|
||||
" Neovim Terminal
|
||||
let _ = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
|
||||
@@ -20,9 +19,9 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
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))
|
||||
let _ = pathshorten(fnamemodify(name, fmod))
|
||||
else
|
||||
let _ .= fnamemodify(name, fmod)
|
||||
let _ = fnamemodify(name, fmod)
|
||||
endif
|
||||
if a:bufnr != bufnr('%') && fnametruncate && strlen(_) > fnametruncate
|
||||
let _ = airline#util#strcharpart(_, 0, fnametruncate)
|
||||
@@ -32,7 +31,7 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name) " {{{2
|
||||
function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name)
|
||||
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)
|
||||
|
||||
@@ -44,16 +43,17 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
endif
|
||||
return _
|
||||
endfunction
|
||||
finish
|
||||
else
|
||||
" New Vim9 script implementation {{{1
|
||||
def airline#extensions#tabline#formatters#default#format(bufnr: number, buffers: list<number>): string # {{{2
|
||||
" Vim9 Script implementation
|
||||
def airline#extensions#tabline#formatters#default#format(bufnr: number, buffers: list<number>): string
|
||||
var fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
|
||||
var fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
var result = ''
|
||||
var fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
|
||||
|
||||
var name = bufname(bufnr)
|
||||
if empty(name)
|
||||
result = '[No Name]'
|
||||
result = '[No Name]'
|
||||
elseif name =~ 'term://'
|
||||
# Neovim Terminal
|
||||
result = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
|
||||
@@ -69,13 +69,16 @@ else
|
||||
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)
|
||||
|
||||
def airline#extensions#tabline#formatters#default#wrap_name(bufnr: number, buffer_name: string): string
|
||||
var buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
|
||||
var buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
|
||||
|
||||
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
|
||||
result ..= substitute(buffer_name, '\\', '/', 'g')
|
||||
|
||||
if getbufvar(bufnr, '&modified')
|
||||
result ..= g:airline_symbols.modified
|
||||
endif
|
||||
return result
|
||||
enddef
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -7,7 +7,7 @@ function! airline#extensions#tabline#formatters#jsformatter#format(bufnr, buffer
|
||||
let buf = bufname(a:bufnr)
|
||||
let filename = fnamemodify(buf, ':t')
|
||||
|
||||
if filename == 'index.js' || filename == 'index.jsx' || filename == 'index.ts' || filename == 'index.tsx'
|
||||
if filename ==# 'index.js' || filename ==# 'index.jsx' || filename ==# 'index.ts' || filename ==# 'index.tsx' || filename ==# 'index.vue'
|
||||
return fnamemodify(buf, ':p:h:t') . '/i'
|
||||
else
|
||||
return airline#extensions#tabline#formatters#unique_tail_improved#format(a:bufnr, a:buffers)
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
|
||||
|
||||
function! airline#extensions#tabline#formatters#short_path#format(bufnr, buffers)
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:h:t')
|
||||
let _ = ''
|
||||
|
||||
let name = bufname(a:bufnr)
|
||||
@@ -15,7 +14,7 @@ function! airline#extensions#tabline#formatters#short_path#format(bufnr, buffers
|
||||
" Neovim Terminal
|
||||
let _ = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
|
||||
else
|
||||
let _ .= fnamemodify(name, ':p:h:t') . '/' . fnamemodify(name, ':t')
|
||||
let _ .= fnamemodify(name, fmod) . '/' . fnamemodify(name, ':t')
|
||||
endif
|
||||
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#tabline#formatters#short_path_improved#format(bufnr, buffers) abort
|
||||
let name = bufname(a:bufnr)
|
||||
if empty(name)
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, '[No Name]')
|
||||
endif
|
||||
|
||||
let tail = s:tail(a:bufnr)
|
||||
let tails = s:tails(a:bufnr, a:buffers)
|
||||
|
||||
if has_key(tails, tail)
|
||||
" Use short path for duplicates
|
||||
return airline#extensions#tabline#formatters#short_path#format(a:bufnr, a:buffers)
|
||||
endif
|
||||
|
||||
" Use tail for unique filenames
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, tail)
|
||||
endfunction
|
||||
|
||||
function! s:tails(self, buffers) abort
|
||||
let tails = {}
|
||||
for nr in a:buffers
|
||||
if nr != a:self
|
||||
let tails[s:tail(nr)] = 1
|
||||
endif
|
||||
endfor
|
||||
return tails
|
||||
endfunction
|
||||
|
||||
function! s:tail(bufnr) abort
|
||||
return fnamemodify(bufname(a:bufnr), ':t')
|
||||
endfunction
|
||||
@@ -1,15 +1,18 @@
|
||||
" MIT License. Copyright (c) 2017-2020 Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2017-2021 Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#tabline#formatters#tabnr#format(tab_nr_type, nr)
|
||||
function! airline#extensions#tabline#formatters#tabnr#format(tab_nr, buflist)
|
||||
let spc=g:airline_symbols.space
|
||||
if a:tab_nr_type == 0 " nr of splits
|
||||
return spc. '%{len(tabpagebuflist('.a:nr.'))}'
|
||||
elseif a:tab_nr_type == 1 " tab number
|
||||
return spc. a:nr
|
||||
else "== 2 splits and tab number
|
||||
return spc. a:nr. '.%{len(tabpagebuflist('.a:nr.'))}'
|
||||
let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
|
||||
if tab_nr_type == 0 " nr of splits
|
||||
return spc. len(tabpagebuflist(a:tab_nr))
|
||||
elseif tab_nr_type == 1 " tab number
|
||||
" Return only the current tab number
|
||||
return spc. a:tab_nr
|
||||
else " tab_nr_type == 2 splits and tab number
|
||||
" return the tab number followed by the number of buffers (in the tab)
|
||||
return spc. a:tab_nr. spc. len(tabpagebuflist(a:tab_nr))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -22,7 +22,9 @@ function! airline#extensions#tabline#tabs#on()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#invalidate()
|
||||
let s:current_bufnr = -1
|
||||
if exists('#airline')
|
||||
let s:current_bufnr = -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#get()
|
||||
@@ -39,6 +41,8 @@ function! airline#extensions#tabline#tabs#get()
|
||||
endif
|
||||
endif
|
||||
|
||||
let s:filtered_buflist = airline#extensions#tabline#buflist#list()
|
||||
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
|
||||
call airline#extensions#tabline#add_label(b, 'tabs', 0)
|
||||
@@ -50,8 +54,10 @@ function! airline#extensions#tabline#tabs#get()
|
||||
let group = 'airline_tabsel'
|
||||
if g:airline_detect_modified
|
||||
for bi in tabpagebuflist(curtab)
|
||||
if getbufvar(bi, '&modified')
|
||||
let group = 'airline_tabmod'
|
||||
if index(s:filtered_buflist,bi) != -1
|
||||
if getbufvar(bi, '&modified')
|
||||
let group = 'airline_tabmod'
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
@@ -64,8 +70,7 @@ function! airline#extensions#tabline#tabs#get()
|
||||
let val = '%('
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||
let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
|
||||
let val .= airline#extensions#tabline#tabs#tabnr_formatter(tab_nr_type, a:i)
|
||||
let val .= airline#extensions#tabline#tabs#tabnr_formatter(a:i, tabpagebuflist(a:i))
|
||||
endif
|
||||
|
||||
return val.'%'.a:i.'T %{airline#extensions#tabline#title('.a:i.')} %)'
|
||||
@@ -79,14 +84,16 @@ function! airline#extensions#tabline#tabs#get()
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#show_close_button', 1)
|
||||
call b.add_section('airline_tab_right', ' %999X'.
|
||||
\ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ')
|
||||
\ get(g:, 'airline#extensions#tabline#close_symbol', 'X').'%X ')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1
|
||||
let buffers = tabpagebuflist(curtab)
|
||||
for nr in buffers
|
||||
let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right"
|
||||
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
|
||||
if index(s:filtered_buflist,nr) != -1
|
||||
let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right"
|
||||
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
|
||||
endif
|
||||
endfor
|
||||
if get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
call airline#extensions#tabline#add_label(b, 'buffers', 1)
|
||||
@@ -107,8 +114,8 @@ function! airline#extensions#tabline#tabs#map_keys()
|
||||
endif
|
||||
let bidx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1)
|
||||
if bidx_mode == 1
|
||||
for i in range(1, 9)
|
||||
exe printf('noremap <silent> <Plug>AirlineSelectTab%d :%dtabn<CR>', i, i)
|
||||
for i in range(1, 10)
|
||||
exe printf('noremap <silent> <Plug>AirlineSelectTab%d :%dtabn<CR>', i%10, i)
|
||||
endfor
|
||||
else
|
||||
for i in range(11, 99)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016-2020 Kevin Sapper et al.
|
||||
" MIT License. Copyright (c) 2016-2021 Kevin Sapper et al.
|
||||
" PLugin: https://github.com/s1341/vim-tabws
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -24,8 +24,10 @@ function! airline#extensions#tabline#tabws#on()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabws#invalidate()
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
if exists('#airline')
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabws#add_buffer_section(builder, cur_tab, cur_buf, pull_right)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" xTabline - Reduced version for vim-airline
|
||||
" Plugin: https://github.com/mg979/vim-xtabline
|
||||
" MIT License Copyright (C) 2018-2020 Gianmaria Bajo <mg1979.git@gmail.com>
|
||||
" MIT License Copyright (C) 2018-2021 Gianmaria Bajo <mg1979.git@gmail.com>
|
||||
" tabpagecd:
|
||||
" expanded version by mg979
|
||||
" MIT License Copyright (C) 2012-2013 Kana Natsuno <http://whileimautomaton.net/>
|
||||
" MIT License Copyright (C) 2018-2020 Gianmaria Bajo <mg1979.git@gmail.com>
|
||||
" MIT License Copyright (C) 2018-2021 Gianmaria Bajo <mg1979.git@gmail.com>
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ function! airline#extensions#tabline#xtabline#init()
|
||||
autocmd TabLeave * call s:Do('leave')
|
||||
autocmd TabClosed * call s:Do('close')
|
||||
|
||||
autocmd BufEnter * let g:xtabline_changing_buffer = 0
|
||||
autocmd BufEnter * if exists('#airline') | let g:xtabline_changing_buffer = 0 | endif
|
||||
autocmd BufAdd,BufDelete,BufWrite * call airline#extensions#tabline#xtabline#filter_buffers()
|
||||
augroup END
|
||||
|
||||
@@ -180,6 +180,10 @@ function! airline#extensions#tabline#xtabline#filter_buffers()
|
||||
" 'accepted' is a list of buffer numbers, for quick access.
|
||||
" 'excluded' is a list of buffer numbers, it will be used by Airline to hide buffers.
|
||||
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
if !s:xtabline_filtering | return | endif
|
||||
|
||||
let g:airline#extensions#tabline#exclude_buffers = []
|
||||
@@ -351,6 +355,10 @@ endfunction
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
function! s:Do(action)
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
let arg = a:action
|
||||
if !s:state | call s:InitCwds() | return | endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/majutsushi/tagbar
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -8,7 +8,6 @@ if !exists(':TagbarToggle')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:flags = get(g:, 'airline#extensions#tagbar#flags', '')
|
||||
let s:spc = g:airline_symbols.space
|
||||
let s:init=0
|
||||
|
||||
@@ -35,15 +34,21 @@ function! airline#extensions#tagbar#currenttag()
|
||||
try
|
||||
" try to load the plugin, if filetypes are disabled,
|
||||
" this will cause an error, so try only once
|
||||
let a=tagbar#currenttag('%', '', '')
|
||||
let a = tagbar#currenttag('%s', '', '')
|
||||
catch
|
||||
endtry
|
||||
unlet! a
|
||||
let s:init=1
|
||||
endif
|
||||
let cursize = getfsize(fnamemodify(bufname('%'), ':p'))
|
||||
if cursize > 0 && cursize > get(g:, 'airline#extensions#tagbar#max_filesize', 1024 * 1024)
|
||||
return ''
|
||||
endif
|
||||
let flags = get(g:, 'airline#extensions#tagbar#flags', '')
|
||||
" function tagbar#currenttag does not exist, if filetype is not enabled
|
||||
if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag")
|
||||
let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags)
|
||||
let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', flags,
|
||||
\ get(g:, 'airline#extensions#tagbar#searchmethod', 'nearest-stl'))
|
||||
let s:airline_tagbar_last_lookup_time = localtime()
|
||||
endif
|
||||
return s:airline_tagbar_last_lookup_val
|
||||
|
||||
37
autoload/airline/extensions/taglist.vim
Normal file
37
autoload/airline/extensions/taglist.vim
Normal file
@@ -0,0 +1,37 @@
|
||||
" MIT License. Copyright (c) 2021 DEMAREST Maxime (maxime@indelog.fr)
|
||||
" Plugin: https://github.com/yegappan/taglist/
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':TlistShowTag')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#taglist#currenttag()
|
||||
" Update tag list if taglist is not loaded (else we get an empty tag name)
|
||||
" Load yegappan/taglist and vim-scripts/taglist.vim only once.
|
||||
let tlist_updated = 0
|
||||
if !exists('*taglist#Tlist_Get_Tagname_By_Line()') && !exists('*Tlist_Get_Tagname_By_Line()')
|
||||
TlistUpdate
|
||||
let tlist_updated = 1
|
||||
endif
|
||||
if !tlist_updated && exists('*Tlist_Get_Filenames()')
|
||||
let tlist_filenames = Tlist_Get_Filenames()
|
||||
if stridx(type(tlist_filenames) == type([]) ? join(tlist_filenames, '\n') : tlist_filenames, expand('%:p')) < 0
|
||||
TlistUpdate
|
||||
endif
|
||||
endif
|
||||
" Is this function is not present it'means you use the old vertsion of
|
||||
" tag list : https://github.com/vim-scripts/taglist.vim.
|
||||
" Please use the new version : https://github.com/yegappan/taglist.
|
||||
if exists('*taglist#Tlist_Get_Tagname_By_Line()')
|
||||
return taglist#Tlist_Get_Tagname_By_Line()
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#taglist#init(ext)
|
||||
call airline#parts#define_function('taglist', 'airline#extensions#taglist#currenttag')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -6,31 +6,46 @@ 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! s:GetAirlineSection()
|
||||
if exists("g:airline_section_z_term")
|
||||
let section_z = g:airline_section_z_term
|
||||
else
|
||||
let section_z = airline#section#create(['linenr', 'maxlinenr'])
|
||||
endif
|
||||
|
||||
if exists("g:airline_section_a_term")
|
||||
let section_a = g:airline_section_a_term
|
||||
else
|
||||
let section_a = airline#section#create_left(['terminal', 'tmode'])
|
||||
endif
|
||||
return [section_a, section_z]
|
||||
endfunction
|
||||
|
||||
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)
|
||||
let sections = s:GetAirlineSection()
|
||||
let spc = g:airline_symbols.space
|
||||
call a:1.add_section_spaced('airline_a', sections[0])
|
||||
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.add_section('airline_term', 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)
|
||||
call a:1.add_section_spaced('airline_z', sections[1])
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#term#inactive_apply(...) abort
|
||||
if getbufvar(a:2.bufnr, '&buftype') ==? 'terminal'
|
||||
call a:1.add_section_spaced('airline_a', s:section_a)
|
||||
let sections = s:GetAirlineSection()
|
||||
let spc = g:airline_symbols.space
|
||||
call a:1.add_section_spaced('airline_a', sections[0])
|
||||
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.add_section('airline_term', 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)
|
||||
call a:1.add_section_spaced('airline_z', sections[1])
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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-2020 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/chrisbra/unicode.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -9,7 +9,7 @@ if !get(g:, 'loaded_unicodePlugin', 0)
|
||||
endif
|
||||
|
||||
function! airline#extensions#unicode#apply(...)
|
||||
if exists(":UnicodeTable") == 2 && bufname('') ==# 'UnicodeTable'
|
||||
if exists(':UnicodeTable') == 2 && bufname('') =~# '/UnicodeTable.txt'
|
||||
call airline#parts#define('unicode', {
|
||||
\ 'text': '[UnicodeTable]',
|
||||
\ 'accent': 'bold' })
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/Shougo/unite.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
27
autoload/airline/extensions/vim9lsp.vim
Normal file
27
autoload/airline/extensions/vim9lsp.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
" MIT License. Copyright (c) 2021 DEMAREST Maxime (maxime@indelog.fr)
|
||||
" Plugin: https://github.com/yegappan/lsp
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('*lsp#lsp#ErrorCount')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:error_symbol = get(g:, 'airline#extensions#vim9lsp#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#vim9lsp#warning_symbol', 'W:')
|
||||
|
||||
function! airline#extensions#vim9lsp#get_warnings() abort
|
||||
let res = get(lsp#lsp#ErrorCount(), 'Warn', 0)
|
||||
return res > 0 ? s:warning_symbol . res : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vim9lsp#get_errors() abort
|
||||
let res = get(lsp#lsp#ErrorCount(), 'Error', 0)
|
||||
return res > 0 ? s:error_symbol . res : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vim9lsp#init(ext) abort
|
||||
call airline#parts#define_function('vim9lsp_warning_count', 'airline#extensions#vim9lsp#get_warnings')
|
||||
call airline#parts#define_function('vim9lsp_error_count', 'airline#extensions#vim9lsp#get_errors')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016-2020 Jerome Reybert et al.
|
||||
" MIT License. Copyright (c) 2016-2021 Jerome Reybert et al.
|
||||
" Plugin: https://github.com/jreybert/vimagit
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/cdelledonne/vim-cmake
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
25
autoload/airline/extensions/vimodoro.vim
Normal file
25
autoload/airline/extensions/vimodoro.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/VimfanTPdvorak/vimodoro.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':RTM')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#vimodoro#apply(...) abort
|
||||
if exists('t:vimodoro')
|
||||
if &ft ==# 'vimodoro'
|
||||
if exists(':PomodoroStatus')
|
||||
call airline#extensions#apply_left_override('vimodoro', '%{PomodoroStatus(1)}')
|
||||
else
|
||||
call airline#extensions#apply_left_override('vimodoro', g:airline_section_y)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimodoro#init(ext) abort
|
||||
call a:ext.add_statusline_func('airline#extensions#vimodoro#apply')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" Plugin: https://github.com/jmcantrell/vim-virtualenv
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -11,7 +11,7 @@ function! airline#extensions#virtualenv#init(ext)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#virtualenv#apply(...)
|
||||
if &filetype =~# "python"
|
||||
if match(get(g:, 'airline#extensions#virtualenv#ft', ['python']), &filetype) > -1
|
||||
if get(g:, 'virtualenv_loaded', 0)
|
||||
let statusline = virtualenv#statusline()
|
||||
else
|
||||
@@ -25,7 +25,7 @@ function! airline#extensions#virtualenv#apply(...)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#virtualenv#update()
|
||||
if &filetype =~# "python"
|
||||
if match(get(g:, 'airline#extensions#virtualenv#ft', ['python']), &filetype) > -1
|
||||
call airline#extensions#virtualenv#apply()
|
||||
call airline#update_statusline()
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2020 s1341 (github@shmarya.net)
|
||||
" MIT License. Copyright (c) 2021 s1341 (github@shmarya.net)
|
||||
" Plugin: https://github.com/liuchengxu/vista.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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
|
||||
@@ -11,7 +11,8 @@ 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'],
|
||||
\ 'csv': ['indent', 'mixed-indent-file']}
|
||||
\ 'csv': ['indent', 'mixed-indent-file'],
|
||||
\ 'mail': ['trailing']}
|
||||
|
||||
function! s:check_mixed_indent()
|
||||
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
|
||||
@@ -51,7 +52,7 @@ endfunction
|
||||
function! s:conflict_marker()
|
||||
" Checks for git conflict markers
|
||||
let annotation = '\%([0-9A-Za-z_.:]\+\)\?'
|
||||
if &ft is# 'rst'
|
||||
if match(['rst', 'markdown', 'rmd'], &ft) >= 0
|
||||
" rst filetypes use '=======' as header
|
||||
let pattern = '^\%(\%(<\{7} '.annotation. '\)\|\%(>\{7\} '.annotation.'\)\)$'
|
||||
else
|
||||
@@ -77,7 +78,8 @@ function! airline#extensions#whitespace#check()
|
||||
let check = 'trailing'
|
||||
if index(checks, check) > -1 && index(get(skip_check_ft, &ft, []), check) < 0
|
||||
try
|
||||
let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$')
|
||||
let regexp = get(b:, 'airline_whitespace_trailing_regexp',
|
||||
\ get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$'))
|
||||
let trailing = search(regexp, 'nw')
|
||||
catch
|
||||
call airline#util#warning(printf('Whitespace: error occurred evaluating "%s"', regexp))
|
||||
@@ -182,6 +184,10 @@ function! airline#extensions#whitespace#init(...)
|
||||
endfunction
|
||||
|
||||
function! s:ws_refresh()
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
if get(b:, 'airline_ws_changedtick', 0) == b:changedtick
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2 fdm=marker
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -9,8 +9,18 @@ if exists('*wordcount')
|
||||
if get(g:, 'actual_curbuf', '') != bufnr('')
|
||||
return
|
||||
endif
|
||||
let query = a:visual_mode_active ? 'visual_words' : 'words'
|
||||
return get(wordcount(), query, 0)
|
||||
if &filetype ==# 'tex' && exists('b:vimtex') && get(g:, 'airline#extensions#vimtex#wordcount', 0)
|
||||
" We're in a TeX file and vimtex is a plugin, so use vimtex's wordcount...
|
||||
if a:visual_mode_active
|
||||
" not useful?
|
||||
return
|
||||
else
|
||||
return vimtex#misc#wordcount()
|
||||
endif
|
||||
else
|
||||
let query = a:visual_mode_active ? 'visual_words' : 'words'
|
||||
return get(wordcount(), query, 0)
|
||||
endif
|
||||
endfunction
|
||||
else " Pull wordcount from the g_ctrl-g stats
|
||||
function! s:get_wordcount(visual_mode_active)
|
||||
@@ -86,8 +96,8 @@ endfunction
|
||||
" airline functions {{{1
|
||||
" default filetypes:
|
||||
function! airline#extensions#wordcount#apply(...)
|
||||
let filetypes = get(g:, 'airline#extensions#wordcount#filetypes',
|
||||
\ ['asciidoc', 'help', 'mail', 'markdown', 'nroff', 'org', 'rst', 'plaintex', 'tex', 'text'])
|
||||
let filetypes = get(g:, 'airline#extensions#wordcount#filetypes',
|
||||
\ ['asciidoc', 'help', 'mail', 'markdown', 'rmd', 'nroff', 'org', 'rst', 'plaintex', 'tex', 'text'])
|
||||
" export current filetypes settings to global namespace
|
||||
let g:airline#extensions#wordcount#filetypes = filetypes
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,17 +1,37 @@
|
||||
" MIT License. Copyright (c) 2017-2020 YoungHoon Rhiu et al.
|
||||
" MIT License. Copyright (c) 2017-2021 YoungHoon Rhiu et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('g:XkbSwitchLib')
|
||||
if !exists('g:XkbSwitchLib') && !exists('*FcitxCurrentIM') && !has('nvim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#xkblayout#status()
|
||||
let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
|
||||
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 exists('g:XkbSwitchLib')
|
||||
let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
|
||||
let keyboard_layout = get(split(keyboard_layout, '\.'), -1, '')
|
||||
elseif exists('*FcitxCurrentIMwithRime')
|
||||
let keyboard_layout = FcitxCurrentIMwithRime()
|
||||
elseif exists('*FcitxCurrentIM')
|
||||
let keyboard_layout = FcitxCurrentIM()
|
||||
elseif has('nvim')
|
||||
try
|
||||
let keyboard_layout = luaeval('require"ime".current()')
|
||||
catch /.*/
|
||||
try
|
||||
let keyboard_layout = luaeval('require"fcitx5-ui".displayCurrentIM()')
|
||||
catch /.*/
|
||||
let keyboard_layout = ''
|
||||
endtry
|
||||
endtry
|
||||
else
|
||||
let keyboard_layout = ''
|
||||
endif
|
||||
" substitute keyboard-us to us
|
||||
let keyboard_layout = substitute(keyboard_layout, 'keyboard-', '', 'g')
|
||||
|
||||
let short_codes = get(g:, 'airline#extensions#xkblayout#short_codes', {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'})
|
||||
if has_key(short_codes, keyboard_layout)
|
||||
let keyboard_layout = short_codes[keyboard_layout]
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2015-2020 Evgeny Firsov et al.
|
||||
" MIT License. Copyright (c) 2015-2021 Evgeny Firsov et al.
|
||||
" Plugin: https://github.com/ycm-core/YouCompleteMe
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2020 Dmitry Geurkov (d.geurkov@gmail.com)
|
||||
" MIT License. Copyright (c) 2021 Dmitry Geurkov (d.geurkov@gmail.com)
|
||||
" Plugin: https://github.com/troydm/zoomwintab.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,30 +1,35 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2 fdm=marker et
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:is_win32term = (has('win32') || has('win64')) &&
|
||||
\ !has('gui_running') &&
|
||||
\ (empty($CONEMUBUILD) || &term !=? 'xterm') &&
|
||||
\ empty($WTSESSION) &&
|
||||
\ empty($WT_SESSION) &&
|
||||
\ !(exists("+termguicolors") && &termguicolors)
|
||||
|
||||
let s:separators = {}
|
||||
let s:accents = {}
|
||||
let s:hl_groups = {}
|
||||
|
||||
if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
" Legacy VimScript implementation {{{1
|
||||
function! s:gui2cui(rgb, fallback) abort " {{{2
|
||||
if !exists(":def") || !airline#util#has_vim9_script()
|
||||
|
||||
" Legacy Vimscript implementation
|
||||
function! s:gui2cui(rgb, fallback) abort
|
||||
if a:rgb == ''
|
||||
return a:fallback
|
||||
elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1
|
||||
return a:rgb
|
||||
elseif a:rgb[0] !~ '#'
|
||||
" a:rgb contains colorname
|
||||
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) abort " {{{2
|
||||
|
||||
function! s:group_not_done(list, name) abort
|
||||
if index(a:list, a:name) == -1
|
||||
call add(a:list, a:name)
|
||||
return 1
|
||||
@@ -35,7 +40,8 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
return 0
|
||||
endif
|
||||
endfu
|
||||
function! s:get_syn(group, what, mode) abort "{{{2
|
||||
|
||||
function! s:get_syn(group, what, mode) abort
|
||||
let color = ''
|
||||
if hlexists(a:group)
|
||||
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, a:mode)
|
||||
@@ -50,13 +56,16 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
endif
|
||||
return color
|
||||
endfunction
|
||||
function! s:get_array(guifg, guibg, ctermfg, ctermbg, opts) abort " {{{2
|
||||
|
||||
function! s:get_array(guifg, guibg, ctermfg, ctermbg, opts) abort
|
||||
return [ a:guifg, a:guibg, a:ctermfg, a:ctermbg, empty(a:opts) ? '' : join(a:opts, ',') ]
|
||||
endfunction
|
||||
function! airline#highlighter#reset_hlcache() abort " {{{2
|
||||
|
||||
function! airline#highlighter#reset_hlcache() abort
|
||||
let s:hl_groups = {}
|
||||
endfunction
|
||||
function! airline#highlighter#get_highlight(group, ...) abort " {{{2
|
||||
|
||||
function! airline#highlighter#get_highlight(group, ...) abort
|
||||
" 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')
|
||||
@@ -78,14 +87,16 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
let s:hl_groups[a:group] = res
|
||||
return res
|
||||
endfunction
|
||||
function! airline#highlighter#get_highlight2(fg, bg, ...) abort " {{{2
|
||||
|
||||
function! airline#highlighter#get_highlight2(fg, bg, ...) abort
|
||||
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
|
||||
|
||||
function! s:hl_group_exists(group) abort
|
||||
if !hlexists(a:group)
|
||||
return 0
|
||||
elseif empty(synIDattr(synIDtrans(hlID(a:group)), 'fg'))
|
||||
@@ -93,34 +104,8 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==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
|
||||
|
||||
function! s:CheckDefined(colors) abort
|
||||
" 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
|
||||
@@ -145,13 +130,14 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
" 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
|
||||
if empty(bg) || bg < 0
|
||||
" in case there is no background color defined for Normal
|
||||
let bg = a:colors[3]
|
||||
endif
|
||||
return a:colors[0:1] + [fg, bg] + [a:colors[4]]
|
||||
endfunction
|
||||
function! s:GetHiCmd(list) abort " {{{2
|
||||
|
||||
function! s:GetHiCmd(list) abort
|
||||
" a:list needs to have 5 items!
|
||||
let res = ''
|
||||
let i = -1
|
||||
@@ -175,22 +161,8 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
endwhile
|
||||
return res
|
||||
endfunction
|
||||
function! s:exec_separator(dict, from, to, inverse, suffix) abort " {{{2
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
let group = a:from.'_to_'.a:to.a:suffix
|
||||
let from = airline#themes#get_highlight(a:from.a:suffix)
|
||||
let to = airline#themes#get_highlight(a:to.a:suffix)
|
||||
if a:inverse
|
||||
let colors = [ from[1], to[1], from[3], to[3] ]
|
||||
else
|
||||
let colors = [ to[1], from[1], to[3], from[3] ]
|
||||
endif
|
||||
let a:dict[group] = colors
|
||||
call airline#highlighter#exec(group, colors)
|
||||
endfunction
|
||||
function! airline#highlighter#load_theme() abort " {{{2
|
||||
|
||||
function! airline#highlighter#load_theme() abort
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
@@ -198,20 +170,39 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
||||
endfor
|
||||
call airline#highlighter#highlight(['inactive'])
|
||||
if getbufvar( bufnr('%'), '&modified' )
|
||||
if getbufvar( bufnr('%'), '&modified' ) && &buftype != 'terminal'
|
||||
call airline#highlighter#highlight(['normal', 'modified'])
|
||||
else
|
||||
call airline#highlighter#highlight(['normal'])
|
||||
endif
|
||||
endfunction
|
||||
function! airline#highlighter#add_separator(from, to, inverse) abort " {{{2
|
||||
|
||||
function! airline#highlighter#add_accent(accent) abort
|
||||
let s:accents[a:accent] = 1
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#add_separator(from, to, inverse) abort
|
||||
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
|
||||
|
||||
function! s:exec_separator(dict, from, to, inverse, suffix) abort
|
||||
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#highlight_modified_inactive(bufnr) abort " {{{2
|
||||
|
||||
function! airline#highlighter#highlight_modified_inactive(bufnr) abort
|
||||
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 : []
|
||||
@@ -224,7 +215,44 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors)
|
||||
endif
|
||||
endfunction
|
||||
function! airline#highlighter#highlight(modes, ...) abort " {{{2
|
||||
|
||||
function! airline#highlighter#exec(group, colors) abort
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
let colors = a:colors
|
||||
if len(colors) == 4
|
||||
call add(colors, '')
|
||||
endif
|
||||
" colors should always be string values
|
||||
let colors = map(copy(colors), 'type(v:val) != type("") ? string(v:val) : v:val')
|
||||
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)
|
||||
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 /^Vim\%((\a\+)\)\=:E421:/ " color definition not found
|
||||
let group=matchstr(v:exception, '\w\+\ze=')
|
||||
let color=matchstr(v:exception, '=\zs\w\+')
|
||||
let cmd=substitute(cmd, color, 'grey', 'g')
|
||||
exe cmd
|
||||
call airline#util#warning('color definition for group ' . a:group . ' not found, using grey as fallback')
|
||||
catch
|
||||
call airline#util#warning('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! airline#highlighter#highlight(modes, ...) abort
|
||||
let bufnr = a:0 ? a:1 : ''
|
||||
let p = g:airline#themes#{g:airline_theme}#palette
|
||||
|
||||
@@ -308,31 +336,40 @@ if !exists(":def") || (exists(":def") && get(g:, "airline_experimental", 0)==0)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" End legacy VimScript
|
||||
finish
|
||||
|
||||
else
|
||||
" This is using Vim9 script " {{{1
|
||||
def s:gui2cui(rgb: string, fallback: string): string # {{{2
|
||||
|
||||
" This is using Vim9 script
|
||||
|
||||
def s:gui2cui(rgb: string, fallback: string): string
|
||||
if empty(rgb)
|
||||
return fallback
|
||||
elseif match(rgb, '^\%(NONE\|[fb]g\)$') > -1
|
||||
return rgb
|
||||
elseif rgb !~ '#'
|
||||
# rgb contains colorname
|
||||
return rgb
|
||||
endif
|
||||
var _rgb = []
|
||||
_rgb = map(split(rgb[1:], '..\zs'), {_, v -> ("0x" .. v)->str2nr(16)})
|
||||
_rgb = mapnew(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
|
||||
|
||||
def s:group_not_done(list: list<string>, name: string): bool
|
||||
if index(list, name) == -1
|
||||
add(list, name)
|
||||
return true
|
||||
else
|
||||
if &vbs
|
||||
:echomsg printf("airline: group: %s already done, skipping", name)
|
||||
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
|
||||
|
||||
def s:get_syn(group: string, what: string, mode: string): string
|
||||
var color = ''
|
||||
if hlexists(group)
|
||||
color = hlID(group)->synIDtrans()->synIDattr(what, mode)
|
||||
@@ -347,23 +384,28 @@ else
|
||||
endif
|
||||
return color
|
||||
enddef
|
||||
def s:get_array(guifg: string, guibg: string, ctermfg: string, ctermbg: string, opts: list<string>): list<string> # {{{2
|
||||
|
||||
def s:get_array(guifg: string, guibg: string, ctermfg: string, ctermbg: string, opts: list<string>): list<string>
|
||||
return [ guifg, guibg, ctermfg, ctermbg, empty(opts) ? '' : join(opts, ',') ]
|
||||
enddef
|
||||
def airline#highlighter#reset_hlcache(): void # {{{2
|
||||
|
||||
def airline#highlighter#reset_hlcache(): void
|
||||
s:hl_groups = {}
|
||||
enddef
|
||||
def airline#highlighter#get_highlight(group: string, rest: list<string> = ['']): list<string> # {{{2
|
||||
|
||||
def airline#highlighter#get_highlight(group: string, rest: list<string> = ['']): list<string>
|
||||
# only check for the cterm reverse attribute
|
||||
# TODO: do we need to check all modes (gui, term, as well)?
|
||||
var reverse = false
|
||||
var bold = false
|
||||
var property: string
|
||||
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()
|
||||
property = hlID(group)->synIDtrans()->synIDattr('reverse', 'cterm')
|
||||
if !empty(property) && property->str2nr()
|
||||
reverse = true
|
||||
endif
|
||||
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, group)
|
||||
@@ -374,7 +416,8 @@ else
|
||||
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()
|
||||
property = hlID(group)->synIDtrans()->synIDattr('bold')
|
||||
if !empty(property) && property->str2nr()
|
||||
bold = true
|
||||
endif
|
||||
if reverse
|
||||
@@ -386,15 +429,16 @@ else
|
||||
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
|
||||
|
||||
def airline#highlighter#get_highlight2(fg: list<string>, bg: list<string>, ...rest: list<string>): list<string>
|
||||
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)}))
|
||||
return s:get_array(guifg, guibg, ctermfg, ctermbg, filter(rest, (_, v) => !empty(v)))
|
||||
enddef
|
||||
def s:hl_group_exists(group: string): bool # {{{2
|
||||
|
||||
def s:hl_group_exists(group: string): bool
|
||||
if !hlexists(group)
|
||||
return false
|
||||
elseif hlID(group)->synIDtrans()->synIDattr('fg')->empty()
|
||||
@@ -402,7 +446,8 @@ else
|
||||
endif
|
||||
return true
|
||||
enddef
|
||||
def s:CheckDefined(colors: list<any>): list<any> # {{{2
|
||||
|
||||
def s:CheckDefined(colors: list<any>): list<any>
|
||||
# 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
|
||||
@@ -427,13 +472,14 @@ else
|
||||
# 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
|
||||
if empty(bg) || 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]]
|
||||
return colors[ 0 : 1 ] + [fg, bg] + [colors[4]]
|
||||
enddef
|
||||
def s:GetHiCmd(list: list<string>): string # {{{2
|
||||
|
||||
def s:GetHiCmd(list: list<string>): string
|
||||
# list needs to have 5 items!
|
||||
var res: string
|
||||
var i = -1
|
||||
@@ -445,56 +491,52 @@ else
|
||||
continue
|
||||
endif
|
||||
if i == 0
|
||||
res = res .. ' guifg=' .. item
|
||||
res ..= ' guifg=' .. item
|
||||
elseif i == 1
|
||||
res = res .. ' guibg=' .. item
|
||||
res ..= ' guibg=' .. item
|
||||
elseif i == 2
|
||||
res = res .. ' ctermfg=' .. item
|
||||
res ..= ' ctermfg=' .. item
|
||||
elseif i == 3
|
||||
res = res .. ' ctermbg=' .. item
|
||||
res ..= ' ctermbg=' .. item
|
||||
elseif i == 4
|
||||
res = res .. printf(' gui=%s cterm=%s term=%s', item, item, item)
|
||||
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
|
||||
|
||||
def airline#highlighter#load_theme(): void
|
||||
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
|
||||
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' ) && &buftype != 'terminal'
|
||||
airline#highlighter#highlight(['normal', 'modified'])
|
||||
else
|
||||
airline#highlighter#highlight(['normal'])
|
||||
endif
|
||||
enddef
|
||||
def s:exec_separator(dict: dict<any>, from_arg: string, to_arg: string, inverse: bool, suffix: string): void # {{{2
|
||||
|
||||
def airline#highlighter#add_accent(accent: string): void
|
||||
s:accents[accent] = 1
|
||||
enddef
|
||||
|
||||
def airline#highlighter#add_separator(from: string, to: string, inverse: bool): void
|
||||
s:separators[from .. to] = [from, to, inverse]
|
||||
s:exec_separator({}, from, to, inverse, '')
|
||||
enddef
|
||||
|
||||
def s:exec_separator(dict: dict<any>, from_arg: string, to_arg: string, inverse: bool, suffix: string): void
|
||||
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 from = mapnew(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})
|
||||
var to = mapnew(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
|
||||
@@ -503,28 +545,8 @@ else
|
||||
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
|
||||
|
||||
def airline#highlighter#highlight_modified_inactive(bufnr: number): void
|
||||
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', {})
|
||||
@@ -542,11 +564,45 @@ else
|
||||
airline#highlighter#exec('airline_c' .. bufnr .. '_inactive', colors)
|
||||
endif
|
||||
enddef
|
||||
def airline#highlighter#highlight(modes: list<string>, bufnr: string = ''): void # {{{2
|
||||
|
||||
def airline#highlighter#exec(group: string, clrs: list<any>): void
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
var colors: list<string> = mapnew(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
|
||||
if old_hi != new_hi || !s:hl_group_exists(group)
|
||||
var cmd = printf('hi %s%s', group, s:GetHiCmd(colors))
|
||||
try
|
||||
:exe cmd
|
||||
catch /^Vim\%((\a\+)\)\=:E421:/
|
||||
var grp = matchstr(v:exception, '\w\+\ze=')
|
||||
var clr = matchstr(v:exception, '=\zs\w\+')
|
||||
cmd = substitute(cmd, clr, 'grey', 'g')
|
||||
:exe cmd
|
||||
airline#util#warning('color ' .. clr .. ' definition for group ' .. grp .. ' not found, using grey as fallback')
|
||||
catch
|
||||
airline#util#warning('Error when running command: ' .. cmd)
|
||||
endtry
|
||||
if has_key(s:hl_groups, group)
|
||||
s:hl_groups[group] = colors
|
||||
endif
|
||||
endif
|
||||
enddef
|
||||
|
||||
def airline#highlighter#highlight(modes: list<string>, bufnr: string = ''): void
|
||||
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 mapped = map(modes, (_, v) => v == modes[0] ? v : modes[0] .. "_" .. v)
|
||||
var suffix = ''
|
||||
if modes[0] == 'inactive'
|
||||
suffix = '_inactive'
|
||||
@@ -571,11 +627,11 @@ else
|
||||
# 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\+'))
|
||||
bnr = matchstr(name, 'airline_c\zs\d\+')->str2nr()
|
||||
if bnr > 0 && index(buffers_in_tabpage, bnr) == -1
|
||||
continue
|
||||
endif
|
||||
elseif (name =~ '_to_') || (name[0:10] == 'airline_tab' && !empty(suffix))
|
||||
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)
|
||||
@@ -625,5 +681,5 @@ else
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
enddef
|
||||
endif " }}}1
|
||||
enddef
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -32,27 +32,63 @@ function! airline#init#bootstrap()
|
||||
call s:check_defined('g:airline_exclude_filetypes', [])
|
||||
call s:check_defined('g:airline_exclude_preview', 0)
|
||||
|
||||
" If g:airline_mode_map_codes is set to 1 in your .vimrc it will display
|
||||
" only the modes' codes in the status line. Refer :help mode() for codes.
|
||||
" That may be a preferred presentation because it is minimalistic.
|
||||
call s:check_defined('g:airline_mode_map_codes', 0)
|
||||
call s:check_defined('g:airline_mode_map', {})
|
||||
call extend(g:airline_mode_map, {
|
||||
|
||||
if g:airline_mode_map_codes != 1
|
||||
" If you prefer different mode names than those below they can be
|
||||
" customised by inclusion in your .vimrc - for example, including just:
|
||||
" let g:airline_mode_map = {
|
||||
" \ 'Rv' : 'VIRTUAL REPLACE',
|
||||
" \ 'niV' : 'VIRTUAL REPLACE (NORMAL)',
|
||||
" \ }
|
||||
" ...would override 'Rv' and 'niV' below respectively.
|
||||
call extend(g:airline_mode_map, {
|
||||
\ '__' : '------',
|
||||
\ 'c' : 'COMMAND',
|
||||
\ 'i' : 'INSERT',
|
||||
\ 'ic' : 'INSERT COMPL',
|
||||
\ 'ix' : 'INSERT COMPL',
|
||||
\ 'multi' : 'MULTI',
|
||||
\ 'n' : 'NORMAL',
|
||||
\ 'ni' : '(INSERT)',
|
||||
\ 'n' : 'NORMAL',
|
||||
\ 'no' : 'OP PENDING',
|
||||
\ 'R' : 'REPLACE',
|
||||
\ 'Rv' : 'V REPLACE',
|
||||
\ 's' : 'SELECT',
|
||||
\ 'S' : 'S-LINE',
|
||||
\ '' : 'S-BLOCK',
|
||||
\ 't' : 'TERMINAL',
|
||||
\ 'v' : 'VISUAL',
|
||||
\ 'V' : 'V-LINE',
|
||||
\ 'nov' : 'OP PENDING CHAR',
|
||||
\ 'noV' : 'OP PENDING LINE',
|
||||
\ 'no' : 'OP PENDING BLOCK',
|
||||
\ 'niI' : 'INSERT (NORMAL)',
|
||||
\ 'niR' : 'REPLACE (NORMAL)',
|
||||
\ 'niV' : 'V REPLACE (NORMAL)',
|
||||
\ 'v' : 'VISUAL',
|
||||
\ 'V' : 'V-LINE',
|
||||
\ '' : 'V-BLOCK',
|
||||
\ 's' : 'SELECT',
|
||||
\ 'S' : 'S-LINE',
|
||||
\ '' : 'S-BLOCK',
|
||||
\ 'i' : 'INSERT',
|
||||
\ 'ic' : 'INSERT COMPL GENERIC',
|
||||
\ 'ix' : 'INSERT COMPL',
|
||||
\ 'R' : 'REPLACE',
|
||||
\ 'Rc' : 'REPLACE COMP GENERIC',
|
||||
\ 'Rv' : 'V REPLACE',
|
||||
\ 'Rx' : 'REPLACE COMP',
|
||||
\ 'c' : 'COMMAND',
|
||||
\ 'cv' : 'VIM EX',
|
||||
\ 'ce' : 'EX',
|
||||
\ 'r' : 'PROMPT',
|
||||
\ 'rm' : 'MORE PROMPT',
|
||||
\ 'r?' : 'CONFIRM',
|
||||
\ '!' : 'SHELL',
|
||||
\ 't' : 'TERMINAL',
|
||||
\ 'multi' : 'MULTI',
|
||||
\ }, 'keep')
|
||||
" NB: no*, cv, ce, r? and ! do not actually display
|
||||
else
|
||||
" Exception: The control character in ^S and ^V modes' codes
|
||||
" break the status line if allowed to render 'naturally' so
|
||||
" they are overridden with ^ (when g:airline_mode_map_codes = 1)
|
||||
call extend(g:airline_mode_map, {
|
||||
\ '' : '^V',
|
||||
\ '' : '^S',
|
||||
\ }, 'keep')
|
||||
endif
|
||||
|
||||
call s:check_defined('g:airline_theme_map', {})
|
||||
call extend(g:airline_theme_map, {
|
||||
@@ -86,29 +122,35 @@ function! airline#init#bootstrap()
|
||||
call s:check_defined('g:airline_left_alt_sep', "\ue0b1") "
|
||||
call s:check_defined('g:airline_right_sep', "\ue0b2") "
|
||||
call s:check_defined('g:airline_right_alt_sep', "\ue0b3") "
|
||||
" ro=, ws=☲, lnr=☰, mlnr=, br=, nx=Ɇ, crypt=🔒, dirty=⚡
|
||||
" ro=, ws=☲, lnr=, mlnr=☰, colnr=℅, br=, nx=Ɇ, crypt=🔒, dirty=⚡
|
||||
" Note: For powerline, we add an extra space after maxlinenr symbol,
|
||||
" because it is usually setup as a ligature in most powerline patched
|
||||
" fonts. It can be over-ridden by configuring a custom maxlinenr
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': "\ue0a2",
|
||||
\ 'whitespace': "\u2632",
|
||||
\ 'linenr': "\u2630 ",
|
||||
\ 'maxlinenr': " \ue0a1",
|
||||
\ 'maxlinenr': "\u2261 ",
|
||||
\ 'linenr': " \ue0a1:",
|
||||
\ 'colnr': " \u2105:",
|
||||
\ 'branch': "\ue0a0",
|
||||
\ 'notexists': "\u0246",
|
||||
\ 'dirty': "\u26a1",
|
||||
\ 'crypt': nr2char(0x1F512),
|
||||
\ }, 'keep')
|
||||
" Note: If "\u2046" (Ɇ) does not show up, try to use "\u2204" (∄)
|
||||
elseif &encoding==?'utf-8' && !get(g:, "airline_symbols_ascii", 0)
|
||||
" Symbols for Unicode terminals
|
||||
call s:check_defined('g:airline_left_sep', "")
|
||||
call s:check_defined('g:airline_left_alt_sep', "")
|
||||
call s:check_defined('g:airline_right_sep', "")
|
||||
call s:check_defined('g:airline_right_alt_sep', "")
|
||||
" ro=⊝, ws=☲, lnr=☰, mlnr=㏑, br=ᚠ, nx=Ɇ, crypt=🔒
|
||||
" ro=⊝, ws=☲, lnr=㏑, mlnr=☰, colnr=℅, br=ᚠ, nx=Ɇ, crypt=🔒
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': "\u229D",
|
||||
\ 'whitespace': "\u2632",
|
||||
\ 'linenr': "\u2630 ",
|
||||
\ 'maxlinenr': " \u33D1",
|
||||
\ 'maxlinenr': "\u2261",
|
||||
\ 'linenr': " \u33d1:",
|
||||
\ 'colnr': " \u2105:",
|
||||
\ 'branch': "\u16A0",
|
||||
\ 'notexists': "\u0246",
|
||||
\ 'crypt': nr2char(0x1F512),
|
||||
@@ -123,8 +165,9 @@ function! airline#init#bootstrap()
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': 'RO',
|
||||
\ 'whitespace': '!',
|
||||
\ 'linenr': 'ln ',
|
||||
\ 'maxlinenr': ' :',
|
||||
\ 'linenr': ' ln:',
|
||||
\ 'maxlinenr': '',
|
||||
\ 'colnr': ' cn:',
|
||||
\ 'branch': '',
|
||||
\ 'notexists': '?',
|
||||
\ 'crypt': 'cr',
|
||||
@@ -145,7 +188,11 @@ function! airline#init#bootstrap()
|
||||
\ 'function': 'airline#parts#readonly',
|
||||
\ 'accent': 'red',
|
||||
\ })
|
||||
call airline#parts#define_raw('file', airline#formatter#short_path#format('%f%m'))
|
||||
if get(g:, 'airline_section_c_only_filename',0)
|
||||
call airline#parts#define_raw('file', '%t%m')
|
||||
else
|
||||
call airline#parts#define_raw('file', airline#formatter#short_path#format('%f%m'))
|
||||
endif
|
||||
call airline#parts#define_raw('path', '%F%m')
|
||||
call airline#parts#define('linenr', {
|
||||
\ 'raw': '%{g:airline_symbols.linenr}%l',
|
||||
@@ -153,6 +200,9 @@ function! airline#init#bootstrap()
|
||||
call airline#parts#define('maxlinenr', {
|
||||
\ 'raw': '/%L%{g:airline_symbols.maxlinenr}',
|
||||
\ 'accent': 'bold'})
|
||||
call airline#parts#define('colnr', {
|
||||
\ 'raw': '%{g:airline_symbols.colnr}%v',
|
||||
\ 'accent': 'bold'})
|
||||
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
|
||||
call airline#parts#define('hunks', {
|
||||
\ 'raw': '',
|
||||
@@ -164,16 +214,27 @@ function! airline#init#bootstrap()
|
||||
\ 'raw': '',
|
||||
\ 'accent': 'bold'
|
||||
\ })
|
||||
call airline#parts#define('coc_current_function', {
|
||||
\ 'raw': '',
|
||||
\ 'accent': 'bold'
|
||||
\ })
|
||||
call airline#parts#define('lsp_progress', {
|
||||
\ 'raw': '',
|
||||
\ 'accent': 'bold'
|
||||
\ })
|
||||
call airline#parts#define_empty(['obsession', 'tagbar', 'syntastic-warn',
|
||||
\ 'syntastic-err', 'eclim', 'whitespace','windowswap',
|
||||
\ 'syntastic-err', 'eclim', 'whitespace','windowswap', 'taglist',
|
||||
\ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count',
|
||||
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count',
|
||||
\ 'lsp_error_count', 'lsp_warning_count',
|
||||
\ 'lsp_error_count', 'lsp_warning_count', 'scrollbar',
|
||||
\ 'nvimlsp_error_count', 'nvimlsp_warning_count',
|
||||
\ 'vim9lsp_warning_count', 'vim9lsp_error_count',
|
||||
\ 'languageclient_error_count', 'languageclient_warning_count',
|
||||
\ 'coc_warning_count', 'coc_error_count', 'vista', 'battery'])
|
||||
|
||||
call airline#parts#define_text('bookmark', '')
|
||||
call airline#parts#define_text('capslock', '')
|
||||
call airline#parts#define_text('codeium', '')
|
||||
call airline#parts#define_text('gutentags', '')
|
||||
call airline#parts#define_text('gen_tags', '')
|
||||
call airline#parts#define_text('grepper', '')
|
||||
@@ -198,31 +259,31 @@ function! airline#init#sections()
|
||||
endif
|
||||
if !exists('g:airline_section_c')
|
||||
if exists("+autochdir") && &autochdir == 1
|
||||
let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly', 'coc_status'])
|
||||
let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly', 'coc_status', 'lsp_progress'])
|
||||
else
|
||||
let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly', 'coc_status'])
|
||||
let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly', 'coc_status', 'lsp_progress'])
|
||||
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', 'gen_tags', 'omnisharp', 'grepper', 'filetype'])
|
||||
let g:airline_section_x = airline#section#create_right(['coc_current_function', 'bookmark', 'scrollbar', 'tagbar', 'taglist', 'vista', 'gutentags', 'gen_tags', 'omnisharp', 'grepper', 'codeium', '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', '%p%%'.spc, 'linenr', 'maxlinenr', ':%v'])
|
||||
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%p%%', 'linenr', 'maxlinenr', 'colnr'])
|
||||
else
|
||||
let g:airline_section_z = airline#section#create(['%p%%'.spc, 'linenr', ':%v'])
|
||||
let g:airline_section_z = airline#section#create(['%p%%', 'linenr', 'colnr'])
|
||||
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', 'lsp_error_count', 'nvimlsp_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', 'vim9lsp_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', 'lsp_warning_count', 'nvimlsp_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', 'vim9lsp_warning_count'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2021 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
|
||||
|
||||
const s:basic16 = [
|
||||
let s:basic16 = [
|
||||
\ [ 0x00, 0x00, 0x00 ],
|
||||
\ [ 0x00, 0x00, 0x80 ],
|
||||
\ [ 0x00, 0x80, 0x00 ],
|
||||
@@ -41,7 +41,29 @@ const s:basic16 = [
|
||||
\ [ 0xFF, 0xFF, 0xFF ]
|
||||
\ ]
|
||||
|
||||
if exists(":def")
|
||||
if !exists(":def") || !airline#util#has_vim9_script()
|
||||
|
||||
function! airline#msdos#round_msdos_colors(rgblist)
|
||||
" Check for values from MSDOS 16 color terminal
|
||||
let best = []
|
||||
let min = 100000
|
||||
let list = s:basic16
|
||||
for value in list
|
||||
let t = abs(value[0] - a:rgblist[0]) +
|
||||
\ abs(value[1] - a:rgblist[1]) +
|
||||
\ abs(value[2] - a:rgblist[2])
|
||||
if min > t
|
||||
let min = t
|
||||
let best = value
|
||||
endif
|
||||
endfor
|
||||
return index(s:basic16, best)
|
||||
endfunction
|
||||
|
||||
finish
|
||||
|
||||
else
|
||||
|
||||
def airline#msdos#round_msdos_colors(rgblist: list<number>): string
|
||||
# Check for values from MSDOS 16 color terminal
|
||||
var best = []
|
||||
@@ -58,22 +80,4 @@ if exists(":def")
|
||||
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 = []
|
||||
let min = 100000
|
||||
let list = s:basic16
|
||||
for value in list
|
||||
let t = abs(value[0] - a:rgblist[0]) +
|
||||
\ abs(value[1] - a:rgblist[1]) +
|
||||
\ abs(value[2] - a:rgblist[2])
|
||||
if min > t
|
||||
let min = t
|
||||
let best = value
|
||||
endif
|
||||
endfor
|
||||
return index(s:basic16, best)
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -53,7 +53,9 @@ endfunction
|
||||
" }}}
|
||||
|
||||
function! airline#parts#mode()
|
||||
return airline#util#shorten(get(w:, 'airline_current_mode', ''), 79, 1)
|
||||
let part = airline#parts#get('mode')
|
||||
let minwidth = get(part, 'minwidth', 79)
|
||||
return airline#util#shorten(get(w:, 'airline_current_mode', ''), minwidth, 1)
|
||||
endfunction
|
||||
|
||||
function! airline#parts#crypt()
|
||||
@@ -64,15 +66,103 @@ function! airline#parts#paste()
|
||||
return g:airline_detect_paste && &paste ? g:airline_symbols.paste : ''
|
||||
endfunction
|
||||
|
||||
" Sources:
|
||||
" https://ftp.nluug.nl/pub/vim/runtime/spell/
|
||||
" https://en.wikipedia.org/wiki/Regional_indicator_symbol
|
||||
let s:flags = {
|
||||
\ 'af_za': '🇿🇦[af]',
|
||||
\ 'am_et': '🇭🇺[am]',
|
||||
\ 'bg_bg': '🇧🇬',
|
||||
\ 'br_fr': '🇫🇷[br]',
|
||||
\ 'ca_es': '🇪🇸[ca]',
|
||||
\ 'cs_cz': '🇨🇿',
|
||||
\ 'cy_gb': '🇬🇧[cy]',
|
||||
\ 'da_dk': '🇩🇰',
|
||||
\ 'de' : '🇩🇪',
|
||||
\ 'de_19': '🇩🇪[19]',
|
||||
\ 'de_20': '🇩🇪[20]',
|
||||
\ 'de_at': '🇩🇪[at]',
|
||||
\ 'de_ch': '🇩🇪[ch]',
|
||||
\ 'de_de': '🇩🇪',
|
||||
\ 'el_gr': '🇬🇷',
|
||||
\ 'en': '🇬🇧',
|
||||
\ 'en_au': '🇦🇺',
|
||||
\ 'en_ca': '🇨🇦',
|
||||
\ 'en_gb': '🇬🇧',
|
||||
\ 'en_nz': '🇳🇿',
|
||||
\ 'en_us': '🇺🇸',
|
||||
\ 'es': '🇪🇸',
|
||||
\ 'es_es': '🇪🇸',
|
||||
\ 'es_mx': '🇲🇽',
|
||||
\ 'fo_fo': '🇫🇴',
|
||||
\ 'fr_fr': '🇫🇷',
|
||||
\ 'ga_ie': '🇮🇪',
|
||||
\ 'gd_gb': '🇬🇧[gd]',
|
||||
\ 'gl_es': '🇪🇸[gl]',
|
||||
\ 'he_il': '🇮🇱',
|
||||
\ 'hr_hr': '🇭🇷',
|
||||
\ 'hu_hu': '🇭🇺',
|
||||
\ 'id_id': '🇮🇩',
|
||||
\ 'it_it': '🇮🇹',
|
||||
\ 'ku_tr': '🇹🇷[ku]',
|
||||
\ 'la' : '🇮🇹[la]',
|
||||
\ 'lt_lt': '🇱🇹',
|
||||
\ 'lv_lv': '🇱🇻',
|
||||
\ 'mg_mg': '🇲🇬',
|
||||
\ 'mi_nz': '🇳🇿[mi]',
|
||||
\ 'ms_my': '🇲🇾',
|
||||
\ 'nb_no': '🇳🇴',
|
||||
\ 'nl_nl': '🇳🇱',
|
||||
\ 'nn_no': '🇳🇴[ny]',
|
||||
\ 'ny_mw': '🇲🇼',
|
||||
\ 'pl_pl': '🇵🇱',
|
||||
\ 'pt': '🇵🇹',
|
||||
\ 'pt_br': '🇧🇷',
|
||||
\ 'pt_pt': '🇵🇹',
|
||||
\ 'ro_ro': '🇷🇴',
|
||||
\ 'ru' : '🇷🇺',
|
||||
\ 'ru_ru': '🇷🇺',
|
||||
\ 'ru_yo': '🇷🇺[yo]',
|
||||
\ 'rw_rw': '🇷🇼',
|
||||
\ 'sk_sk': '🇸🇰',
|
||||
\ 'sl_si': '🇸🇮',
|
||||
\ 'sr_rs': '🇷🇸',
|
||||
\ 'sv_se': '🇸🇪',
|
||||
\ 'sw_ke': '🇰🇪',
|
||||
\ 'tet_id': '🇮🇩[tet]',
|
||||
\ 'th' : '🇹🇭',
|
||||
\ 'tl_ph': '🇵🇭',
|
||||
\ 'tn_za': '🇿🇦[tn]',
|
||||
\ 'uk_ua': '🇺🇦',
|
||||
\ 'yi' : '🇻🇮',
|
||||
\ 'yi_tr': '🇹🇷',
|
||||
\ 'zu_za': '🇿🇦[zu]',
|
||||
\ }
|
||||
" Also support spelllang without region codes
|
||||
let s:flags_noregion = {}
|
||||
for s:key in keys(s:flags)
|
||||
let s:flags_noregion[split(s:key, '_')[0]] = s:flags[s:key]
|
||||
endfor
|
||||
|
||||
function! airline#parts#spell()
|
||||
let spelllang = g:airline_detect_spelllang ? printf(" [%s]", toupper(substitute(&spelllang, ',', '/', 'g'))) : ''
|
||||
if g:airline_detect_spell && &spell
|
||||
if g:airline_detect_spell && (&spell || (exists('g:airline_spell_check_command') && eval(g:airline_spell_check_command)))
|
||||
|
||||
if g:airline_detect_spelllang !=? '0' && g:airline_detect_spelllang ==? 'flag'
|
||||
let spelllang = tolower(&spelllang)
|
||||
if has_key(s:flags, spelllang)
|
||||
return s:flags[spelllang]
|
||||
elseif has_key(s:flags_noregion, spelllang)
|
||||
return s:flags_noregion[spelllang]
|
||||
endif
|
||||
endif
|
||||
|
||||
let winwidth = airline#util#winwidth()
|
||||
if winwidth >= 90
|
||||
return g:airline_symbols.spell . spelllang
|
||||
elseif winwidth >= 70
|
||||
return g:airline_symbols.spell
|
||||
else
|
||||
elseif !empty(g:airline_symbols.spell)
|
||||
return split(g:airline_symbols.spell, '\zs')[0]
|
||||
endif
|
||||
endif
|
||||
@@ -101,17 +191,18 @@ endfunction
|
||||
|
||||
function! airline#parts#filetype()
|
||||
return (airline#util#winwidth() < 90 && strlen(&filetype) > 3)
|
||||
\ ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? '…' : '>')
|
||||
\ ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? "\u2026" : '>')
|
||||
\ : &filetype
|
||||
endfunction
|
||||
|
||||
function! airline#parts#ffenc()
|
||||
let expected = get(g:, 'airline#parts#ffenc#skip_expected_string', '')
|
||||
let bomb = &l:bomb ? '[BOM]' : ''
|
||||
let bomb = &bomb ? '[BOM]' : ''
|
||||
let noeolf = &eol ? '' : '[!EOL]'
|
||||
let ff = strlen(&ff) ? '['.&ff.']' : ''
|
||||
if expected is# &fenc.bomb.ff
|
||||
if expected is# &fenc.bomb.noeolf.ff
|
||||
return ''
|
||||
else
|
||||
return &fenc.bomb.ff
|
||||
return &fenc.bomb.noeolf.ff
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user