292 changed files with 18239 additions and 5785 deletions
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
doc/tags |
||||
*.lock |
||||
.vim-flavor |
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
language: ruby |
||||
rvm: |
||||
- 1.9.3 |
||||
script: rake ci |
@ -0,0 +1,249 @@
@@ -0,0 +1,249 @@
|
||||
# Change Log |
||||
|
||||
This is the Changelog for the vim-airline project. |
||||
|
||||
## [0.12] - Unreleased |
||||
- New features |
||||
- Extensions: |
||||
- [poetv](https://github.com/petobens/poet-v) support |
||||
- [vim-lsp](https://github.com/prabirshrestha/vim-lsp) support |
||||
- [zoomwintab](https://github.com/troydm/zoomwintab.vim) support |
||||
- [Vaffle](https://github.com/cocopon/vaffle.vim) support |
||||
- [vim-dirvish](https://github.com/justinmk/vim-dirvish) support |
||||
- [fzf.vim](https://github.com/junegunn/fzf.vim) support |
||||
- [OmniSharp](https://github.com/OmniSharp/omnisharp-vim) support |
||||
- [searchcount](https://vim-jp.org/vimdoc-en/eval.html#searchcount()) support |
||||
- [fern.vim](https://github.com/lambdalisue/fern.vim) support |
||||
- [Vim-CMake](https://github.com/cdelledonne/vim-cmake) support |
||||
- [battery.vim](https://github.com/lambdalisue/battery.vim) support |
||||
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) support |
||||
- [gen_tags.vim](https://github.com/jsfaint/gen_tags.vim) support |
||||
- Improvements |
||||
- git branch can also be displayed using [gina.vim](https://github.com/lambdalisue/gina.vim) |
||||
- coc extensions can also show additional status messages |
||||
- [coc-git](https://github.com/neoclide/coc-git) extension integrated into hunks extension |
||||
- Other |
||||
- 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 |
||||
|
||||
## [0.11] - 2019-11-10 |
||||
- New features |
||||
- Extensions: |
||||
- [Coc](https://github.com/neoclide/coc.nvim) support |
||||
- [Defx](https://github.com/Shougo/defx.nvim) support |
||||
- [gina](https://github.com/lambdalisue/gina.vim) support |
||||
- [vim-bookmark](https://github.com/MattesGroeger/vim-bookmarks) support |
||||
- [vista.vim](https://github.com/liuchengxu/vista.vim) support |
||||
- [tabws](https://github.com/s1341/vim-tabws) support for the tabline |
||||
- Improvements |
||||
- The statusline can be configured to be shown on top (in the tabline) |
||||
Set the `g:airline_statusline_ontop` to enable this experimental feature. |
||||
- If `buffer_idx_mode=2`, up to 89 mappings will be exposed to access more |
||||
buffers directly (issue [#1823](https://github.com/vim-airline/vim-airline/issues/1823)) |
||||
- Allow to use `random` as special theme name, which will switch to a random |
||||
airline theme (at least if a random number can be generated :() |
||||
- The branch extensions now also displays whether the repository is in a clean state |
||||
(will append a ! or ⚡if the repository is considered dirty). |
||||
- The whitespace extensions will also check for conflict markers |
||||
- `:AirlineRefresh` command now takes an additional `!` attribute, that **skips** |
||||
recreating the highlighting groups (which might have a serious performance |
||||
impact if done very often, as might be the case when the configuration variable |
||||
`airline_skip_empty_sections` is active). |
||||
- airline can now also detect multiple cursor mode (issue [#1933](https://github.com/vim-airline/vim-airline/issues/1933)) |
||||
- expose hunks output using the function `airline#extensions#hunks#get_raw_hunks()` to the outside [#1877](https://github.com/vim-airline/vim-airline/pull/1877) |
||||
- expose wordcount affected filetype list to the public using the `airline#extensions#wordcount#filetypes` variable [#1887](https://github.com/vim-airline/vim-airline/pull/1887) |
||||
- for the `:AirlineExtension` command, indicate whether the extension has been loaded from an external source [#1890](https://github.com/vim-airline/vim-airline/issues/1890) |
||||
- correctly load custom wordcount formatters [#1896](https://github.com/vim-airline/vim-airline/issues/1896) |
||||
- add a new short_path formatter for the tabline [#1898](https://github.com/vim-airline/vim-airline/pull/1898) |
||||
- several improvements to the branch, denite and tabline extension, as well as the async code for Vim and Neovim |
||||
- the term extension supports [neoterm](https://github.com/kassio/neoterm) vim plugin |
||||
|
||||
## [0.10] - 2018-12-15 |
||||
- New features |
||||
- Extensions: |
||||
- [LanguageClient](https://github.com/autozimu/LanguageClient-neovim) |
||||
- [vim-gutentags](https://github.com/ludovicchabant/vim-gutentags) |
||||
- [vim-localsearch](https://github.com/mox-mox/vim-localsearch) |
||||
- [xtabline](https://github.com/mg979/vim-xtabline) |
||||
- [vim-grepper](https://github.com/mhinz/vim-grepper) |
||||
- Add custom AirlineModeChanged autocommand, allowing to call user defined commands |
||||
whenever airline displays a different mode |
||||
- New :AirlineExtensions command, to show which extensions have been loaded |
||||
- Detect several new modes (e.g. completion, virtual replace, etc) |
||||
- Improvements |
||||
- Various performance improvements, should Vim keep responsive, even when |
||||
many highlighting groups need to be re-created |
||||
- Rework tabline extension |
||||
- Refactor [vim-ctrlspace](https://github.com/szw/vim-ctrlspace) extension |
||||
- Refactor the wordcount extension |
||||
- Reworked the po extension |
||||
- Allow to disable line numbers for the [Ale Extension](https://github.com/w0rp/ale) |
||||
- [fugitive](https://github.com/tpope/vim-fugitive) plugin has been refactored |
||||
causing adjustments for vim-airline, also uses Fugitives new API calls |
||||
- some improvements to Vims terminal mode |
||||
- Allow to use alternative seperators for inactive windows ([#1236](https://github.com/vim-airline/vim-airline/issues/1236)) |
||||
- Statusline can be set to inactive, whenever Vim loses focus (using FocusLost autocommand) |
||||
|
||||
## [0.9] - 2018-01-15 |
||||
- Changes |
||||
- Look of default Airline Symbols has been improved [#1397](https://github.com/vim-airline/vim-airline/issues/1397) |
||||
- Airline does now set `laststatus=2` if needed |
||||
- Syntastic extension now displays warnings and errors separately |
||||
- Updates on Resize and SessionLoad events |
||||
- Add `maxlinenr` symbol to `airline_section_z` |
||||
- Add quickfix title to inactive windows |
||||
- Improvements |
||||
- Many performance improvements (using caching and async feature when possible) |
||||
- Cache changes to highlighting groups if `g:airline_highlighting_cache = 1` is set |
||||
- Allow to skip empty sections by setting `g:airline_skip_empty_sections` variable |
||||
- Make use of improved Vim Script API, if available (e.g. getwininfo()) |
||||
- Support for Vims terminal feature (very experimental since it hasn't been stabilized yet) |
||||
- More configuration for the tabline extension (with clickable buffers for Neovim) |
||||
- Works better on smaller window sizes |
||||
- Make airline aware of git worktrees |
||||
- Improvements to the fugitive extension [#1603](https://github.com/vim-airline/vim-airline/issues/1603) |
||||
- Allows for configurable fileformat output if `g:airline#parts#ffenc#skip_expected_string` is set |
||||
- Improvements to the documentation |
||||
- New features |
||||
- Full async support for Vim 8 and Neovim |
||||
- Extensions: |
||||
- [vim-bufmru](https://github.com/mildred/vim-bufmru) |
||||
- [xkb-switch](https://github.com/ierton/xkb-switch) |
||||
- [input-source-switcher](https://github.com/vovkasm/input-source-switcher) |
||||
- [vimagit](https://github.com/jreybert/vimagit) |
||||
- [denite](https://github.com/Shougo/denite.nvim) |
||||
- [dein](https://github.com/Shougo/dein.vim) |
||||
- [vimtex](https://github.com/lervag/vimtex) |
||||
- [minpac](https://github.com/k-takata/minpac/) |
||||
- [vim-cursormode](https://github.com/vheon/vim-cursormode) |
||||
- [Neomake](https://github.com/neomake/neomake) |
||||
- [Ale](https://github.com/w0rp/ale) |
||||
- [vim-obsession](https://github.com/tpope/vim-obsession) |
||||
- spell (can also display Spell language) |
||||
- keymap |
||||
- Formatters: |
||||
- Formatters for JavaScript [#1617](https://github.com/vim-airline/vim-airline/issues/1617) |
||||
- Tabline: Allow for custom formatter for `tab_nr_type` [#1418](https://github.com/vim-airline/vim-airline/issues/1418) |
||||
- Customizable wordcount formatter [#1584](https://github.com/vim-airline/vim-airline/issues/1584) |
||||
- Add User autocommand for Theme changing [#1226](https://github.com/vim-airline/vim-airline/issues/1226) |
||||
- Shows mercurial mq status if hg mq extension is enabled |
||||
|
||||
## [0.8] - 2016-03-09 |
||||
- Changes |
||||
- Airline converted to an organization and moved to new [repository](https://github.com/vim-airline/vim-airline) |
||||
- Themes have been split into an separate repository [vim-airline-themes](https://github.com/vim-airline/vim-airline-themes) |
||||
- Improvements |
||||
- Extensions |
||||
- branch: support Git and Mercurial simultaneously, untracked files |
||||
- whitespace: new mixed-indent rule |
||||
- Windows support |
||||
- Many bug fixes |
||||
- Support for Neovim |
||||
- New features |
||||
- Many new themes |
||||
- Extensions/integration |
||||
- [taboo](https://github.com/gcmt/taboo.vim) |
||||
- [vim-ctrlspace](https://github.com/szw/vim-ctrlspace) |
||||
- [quickfixsigns](https://github.com/tomtom/quickfixsigns_vim) |
||||
- [YouCompleteMe](https://github.com/ycm-core/YouCompleteMe) |
||||
- [po.vim](http://www.vim.org/scripts/script.php?script_id=695) |
||||
- [unicode.vim](https://github.com/chrisbra/unicode.vim) |
||||
- wordcount |
||||
- crypt indicator |
||||
- byte order mark indicator |
||||
- Tabline's tab mode can display splits simultaneously |
||||
|
||||
## [0.7] - 2014-12-10 |
||||
- New features |
||||
- accents support; allowing multiple colors/styles in the same section |
||||
- extensions: eclim |
||||
- themes: understated, monochrome, murmur, sol, lucius |
||||
- Improvements |
||||
- solarized theme; support for 8 color terminals |
||||
- tabline resizes dynamically based on number of open buffers |
||||
- miscellaneous bug fixes |
||||
|
||||
## [0.6] - 2013-10-08 |
||||
|
||||
- New features |
||||
- accents support; allowing multiple colors/styles in the same section |
||||
- extensions: eclim |
||||
- themes: understated, monochrome, murmur, sol, lucius |
||||
- Improvements |
||||
- solarized theme; support for 8 color terminals |
||||
- tabline resizes dynamically based on number of open buffers |
||||
- miscellaneous bug fixes |
||||
|
||||
## [0.5] - 2013-09-13 |
||||
|
||||
- New features |
||||
- smart tabline extension which displays all buffers when only one tab is visible |
||||
- automatic section truncation when the window resizes |
||||
- support for a declarative style of configuration, allowing parts to contain metadata such as minimum window width or conditional visibility |
||||
- themes: zenburn, serene |
||||
- Other |
||||
- a sizable chunk of vim-airline is now running through a unit testing suite, automated via Travis CI |
||||
|
||||
## [0.4] - 2013-08-26 |
||||
|
||||
- New features |
||||
- integration with csv.vim and vim-virtualenv |
||||
- hunks extension for vim-gitgutter and vim-signify |
||||
- automatic theme switching with matching colorschemes |
||||
- commands: AirlineToggle |
||||
- themes: base16 (all variants) |
||||
- Improvements |
||||
- integration with undotree, tagbar, and unite |
||||
- Other |
||||
- refactored core and exposed statusline builder and pipeline |
||||
- all extension related g:airline_variables have been deprecated in favor of g:airline#extensions# variables |
||||
- extensions found in the runtimepath outside of the default distribution will be automatically loaded |
||||
|
||||
## [0.3] - 2013-08-12 |
||||
|
||||
- New features |
||||
- first-class integration with tagbar |
||||
- white space detection for trailing spaces and mixed indentation |
||||
- introduced warning section for syntastic and white space detection |
||||
- improved ctrlp integration: colors are automatically selected based on the current airline theme |
||||
- new themes: molokai, bubblegum, jellybeans, tomorrow |
||||
- Bug fixes |
||||
- improved handling of eventignore used by other plugins |
||||
- Other |
||||
- code cleaned up for clearer separation between core functionality and extensions |
||||
- introduced color extraction from highlight groups, allowing themes to be generated off of the active colorscheme (e.g. jellybeans and tomorrow) |
||||
- License changed to MIT |
||||
|
||||
## [0.2] - 2013-07-28 |
||||
|
||||
- New features |
||||
- iminsert detection |
||||
- integration with vimshell, vimfiler, commandt, lawrencium |
||||
- enhanced bufferline theming |
||||
- support for ctrlp theming |
||||
- support for custom window excludes |
||||
- New themes |
||||
- luna and wombat |
||||
- Bug fixes |
||||
- refresh branch name after switching with a shell command |
||||
|
||||
## [0.1] - 2013-07-17 |
||||
|
||||
- Initial release |
||||
- integration with other plugins: netrw, unite, nerdtree, undotree, gundo, tagbar, minibufexplr, ctrlp |
||||
- support for themes: 8 included |
||||
|
||||
[0.12]: https://github.com/vim-airline/vim-airline/compare/v0.11...HEAD |
||||
[0.11]: https://github.com/vim-airline/vim-airline/compare/v0.10...v0.11 |
||||
[0.10]: https://github.com/vim-airline/vim-airline/compare/v0.9...v0.10 |
||||
[0.9]: https://github.com/vim-airline/vim-airline/compare/v0.8...v0.9 |
||||
[0.8]: https://github.com/vim-airline/vim-airline/compare/v0.7...v0.8 |
||||
[0.7]: https://github.com/vim-airline/vim-airline/compare/v0.6...v0.7 |
||||
[0.6]: https://github.com/vim-airline/vim-airline/compare/v0.5...v0.6 |
||||
[0.5]: https://github.com/vim-airline/vim-airline/compare/v0.4...v0.5 |
||||
[0.4]: https://github.com/vim-airline/vim-airline/compare/v0.3...v0.4 |
||||
[0.3]: https://github.com/vim-airline/vim-airline/compare/v0.2...v0.3 |
||||
[0.2]: https://github.com/vim-airline/vim-airline/compare/v0.1...v0.2 |
||||
[0.1]: https://github.com/vim-airline/vim-airline/releases/tag/v0.1 |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
# Contributions |
||||
|
||||
Contributions and pull requests are welcome. Please take note of the following guidelines: |
||||
|
||||
* Adhere to the existing style as much as possible; notably, 2 space indents and long-form keywords. |
||||
* Keep the history clean! Squash your branches before you submit a pull request. `pull --rebase` is your friend. |
||||
* Any changes to the core should be tested against Vim 7.4. |
||||
|
||||
# Bugs |
||||
|
||||
Tracking down bugs can take a very long time due to different configurations, versions, and operating systems. To ensure a timely response, please help me out by doing the following: |
||||
|
||||
* the `:version` of vim |
||||
* the commit of vim-airline you're using |
||||
* the OS that you're using, including terminal emulator, GUI vs non-GUI |
||||
|
||||
# Themes |
||||
|
||||
* If you submit a theme, please create a screenshot so it can be added to the [Wiki][14]. |
||||
* In the majority of cases, modifications to colors of existing themes will likely be rejected. Themes are a subjective thing, so while you may prefer that a particular color be darker, another user will prefer it to be lighter, or something entirely different. The more popular the theme, the more unlikely the change will be accepted. However, it's pretty simple to create your own theme; copy the theme to `~/.vim/autoload/airline/themes` under a new name with your modifications, and it can be used. |
||||
|
||||
# Maintenance |
||||
|
||||
If you would like to take a more active role in improving vim-airline, please consider [becoming a maintainer][43]. |
||||
|
||||
|
||||
[14]: https://github.com/vim-airline/vim-airline/wiki/Screenshots |
||||
[43]: https://github.com/vim-airline/vim-airline/wiki/Becoming-a-Maintainer |
@ -1,2 +1,2 @@
@@ -1,2 +1,2 @@
|
||||
source 'https://rubygems.org' |
||||
gem 'vim-flavor', '~> 1.1' |
||||
gem 'vim-flavor', '~> 2.2.2' |
||||
|
@ -0,0 +1,382 @@
@@ -0,0 +1,382 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Christian Brabandt et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:untracked_jobs = {} |
||||
let s:mq_jobs = {} |
||||
let s:po_jobs = {} |
||||
let s:clean_jobs = {} |
||||
|
||||
" Generic functions handling on exit event of the various async functions |
||||
function! s:untracked_output(dict, buf) |
||||
if a:buf =~? ('^'. a:dict.cfg['untracked_mark']) |
||||
let a:dict.cfg.untracked[a:dict.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) |
||||
else |
||||
let a:dict.cfg.untracked[a:dict.file] = '' |
||||
endif |
||||
endfunction |
||||
|
||||
" also called from branch extension (for non-async vims) |
||||
function! airline#async#mq_output(buf, file) |
||||
let buf=a:buf |
||||
if !empty(a:buf) |
||||
if a:buf =~# 'no patches applied' || |
||||
\ a:buf =~# "unknown command 'qtop'" || |
||||
\ a:buf =~# "abort" |
||||
let buf = '' |
||||
elseif exists("b:mq") && b:mq isnot# buf |
||||
" make sure, statusline is updated |
||||
unlet! b:airline_head |
||||
endif |
||||
let b:mq = buf |
||||
endif |
||||
if has_key(s:mq_jobs, a:file) |
||||
call remove(s:mq_jobs, a:file) |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:po_output(buf, file) |
||||
if !empty(a:buf) |
||||
let b:airline_po_stats = printf("%s", a:buf) |
||||
else |
||||
let b:airline_po_stats = '' |
||||
endif |
||||
if has_key(s:po_jobs, a:file) |
||||
call remove(s:po_jobs, a:file) |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:valid_dir(dir) |
||||
if empty(a:dir) || !isdirectory(a:dir) |
||||
return getcwd() |
||||
endif |
||||
return a:dir |
||||
endfunction |
||||
|
||||
function! airline#async#vcs_untracked(config, file, vcs) |
||||
if g:airline#init#vim_async |
||||
" Vim 8 with async support |
||||
noa call airline#async#vim_vcs_untracked(a:config, a:file) |
||||
else |
||||
" nvim async or vim without job-feature |
||||
noa call airline#async#nvim_vcs_untracked(a:config, a:file, a:vcs) |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:set_clean_variables(file, vcs, val) |
||||
let var=getbufvar(fnameescape(a:file), 'buffer_vcs_config', {}) |
||||
if has_key(var, a:vcs) && has_key(var[a:vcs], 'dirty') && |
||||
\ type(getbufvar(fnameescape(a:file), 'buffer_vcs_config')) == type({}) |
||||
let var[a:vcs].dirty=a:val |
||||
try |
||||
call setbufvar(fnameescape(a:file), 'buffer_vcs_config', var) |
||||
unlet! b:airline_head |
||||
catch |
||||
endtry |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:set_clean_jobs_variable(vcs, file, id) |
||||
if !has_key(s:clean_jobs, a:vcs) |
||||
let s:clean_jobs[a:vcs] = {} |
||||
endif |
||||
let s:clean_jobs[a:vcs][a:file]=a:id |
||||
endfunction |
||||
|
||||
function! s:on_exit_clean(...) dict abort |
||||
let buf=self.buf |
||||
call s:set_clean_variables(self.file, self.vcs, !empty(buf)) |
||||
if has_key(get(s:clean_jobs, self.vcs, {}), self.file) |
||||
call remove(s:clean_jobs[self.vcs], self.file) |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#async#vcs_clean(cmd, file, vcs) |
||||
if g:airline#init#vim_async |
||||
" Vim 8 with async support |
||||
noa call airline#async#vim_vcs_clean(a:cmd, a:file, a:vcs) |
||||
elseif has("nvim") |
||||
" nvim async |
||||
noa call airline#async#nvim_vcs_clean(a:cmd, a:file, a:vcs) |
||||
else |
||||
" Vim pre 8 using system() |
||||
call airline#async#vim7_vcs_clean(a:cmd, a:file, a:vcs) |
||||
endif |
||||
endfunction |
||||
|
||||
if v:version >= 800 && has("job") |
||||
" Vim 8.0 with Job feature |
||||
" TODO: Check if we need the cwd option for the job_start() functions |
||||
" (only works starting with Vim 8.0.0902) |
||||
|
||||
function! s:on_stdout(channel, msg) dict abort |
||||
let self.buf .= a:msg |
||||
endfunction |
||||
|
||||
function! s:on_exit_mq(channel) dict abort |
||||
call airline#async#mq_output(self.buf, self.file) |
||||
endfunction |
||||
|
||||
function! s:on_exit_untracked(channel) dict abort |
||||
call s:untracked_output(self, self.buf) |
||||
if has_key(s:untracked_jobs, self.file) |
||||
call remove(s:untracked_jobs, self.file) |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:on_exit_po(channel) dict abort |
||||
call s:po_output(self.buf, self.file) |
||||
call airline#extensions#po#shorten() |
||||
endfunction |
||||
|
||||
function! airline#async#get_mq_async(cmd, file) |
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell' |
||||
let cmd = a:cmd |
||||
else |
||||
let cmd = [&shell, &shellcmdflag, a:cmd] |
||||
endif |
||||
|
||||
let options = {'cmd': a:cmd, 'buf': '', 'file': a:file} |
||||
if has_key(s:mq_jobs, a:file) |
||||
if job_status(get(s:mq_jobs, a:file)) == 'run' |
||||
return |
||||
elseif has_key(s:mq_jobs, a:file) |
||||
call remove(s:mq_jobs, a:file) |
||||
endif |
||||
endif |
||||
let id = job_start(cmd, { |
||||
\ 'err_io': 'out', |
||||
\ 'out_cb': function('s:on_stdout', options), |
||||
\ 'close_cb': function('s:on_exit_mq', options)}) |
||||
let s:mq_jobs[a:file] = id |
||||
endfunction |
||||
|
||||
function! airline#async#get_msgfmt_stat(cmd, file) |
||||
if !executable('msgfmt') |
||||
" no msgfmt |
||||
return |
||||
endif |
||||
if g:airline#init#is_windows |
||||
let cmd = 'cmd /C ' . a:cmd. shellescape(a:file) |
||||
else |
||||
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)] |
||||
endif |
||||
|
||||
let options = {'buf': '', 'file': a:file} |
||||
if has_key(s:po_jobs, a:file) |
||||
if job_status(get(s:po_jobs, a:file)) == 'run' |
||||
return |
||||
elseif has_key(s:po_jobs, a:file) |
||||
call remove(s:po_jobs, a:file) |
||||
endif |
||||
endif |
||||
let id = job_start(cmd, { |
||||
\ 'err_io': 'out', |
||||
\ 'out_cb': function('s:on_stdout', options), |
||||
\ 'close_cb': function('s:on_exit_po', options)}) |
||||
let s:po_jobs[a:file] = id |
||||
endfunction |
||||
|
||||
function! airline#async#vim_vcs_clean(cmd, file, vcs) |
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell' |
||||
let cmd = a:cmd |
||||
else |
||||
let cmd = [&shell, &shellcmdflag, a:cmd] |
||||
endif |
||||
|
||||
let options = {'buf': '', 'vcs': a:vcs, 'file': a:file} |
||||
let jobs = get(s:clean_jobs, a:vcs, {}) |
||||
if has_key(jobs, a:file) |
||||
if job_status(get(jobs, a:file)) == 'run' |
||||
return |
||||
elseif has_key(jobs, a:file) |
||||
" still running |
||||
return |
||||
" jobs dict should be cleaned on exit, so not needed here |
||||
" call remove(jobs, a:file) |
||||
endif |
||||
endif |
||||
let id = job_start(cmd, { |
||||
\ 'err_io': 'null', |
||||
\ 'out_cb': function('s:on_stdout', options), |
||||
\ 'close_cb': function('s:on_exit_clean', options)}) |
||||
call s:set_clean_jobs_variable(a:vcs, a:file, id) |
||||
endfunction |
||||
|
||||
function! airline#async#vim_vcs_untracked(config, file) |
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell' |
||||
let cmd = a:config['cmd'] . shellescape(a:file) |
||||
else |
||||
let cmd = [&shell, &shellcmdflag, a:config['cmd'] . shellescape(a:file)] |
||||
endif |
||||
|
||||
let options = {'cfg': a:config, 'buf': '', 'file': a:file} |
||||
if has_key(s:untracked_jobs, a:file) |
||||
if job_status(get(s:untracked_jobs, a:file)) == 'run' |
||||
return |
||||
elseif has_key(s:untracked_jobs, a:file) |
||||
call remove(s:untracked_jobs, a:file) |
||||
endif |
||||
endif |
||||
let id = job_start(cmd, { |
||||
\ 'err_io': 'out', |
||||
\ 'out_cb': function('s:on_stdout', options), |
||||
\ 'close_cb': function('s:on_exit_untracked', options)}) |
||||
let s:untracked_jobs[a:file] = id |
||||
endfunction |
||||
|
||||
elseif has("nvim") |
||||
" NVim specific functions |
||||
|
||||
function! s:nvim_output_handler(job_id, data, event) dict |
||||
if a:event == 'stdout' || a:event == 'stderr' |
||||
let self.buf .= join(a:data) |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:nvim_untracked_job_handler(job_id, data, event) dict |
||||
if a:event == 'exit' |
||||
call s:untracked_output(self, self.buf) |
||||
if has_key(s:untracked_jobs, self.file) |
||||
call remove(s:untracked_jobs, self.file) |
||||
endif |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:nvim_mq_job_handler(job_id, data, event) dict |
||||
if a:event == 'exit' |
||||
call airline#async#mq_output(self.buf, self.file) |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:nvim_po_job_handler(job_id, data, event) dict |
||||
if a:event == 'exit' |
||||
call s:po_output(self.buf, self.file) |
||||
call airline#extensions#po#shorten() |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#async#nvim_get_mq_async(cmd, file) |
||||
let config = { |
||||
\ 'buf': '', |
||||
\ 'file': a:file, |
||||
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')), |
||||
\ 'on_stdout': function('s:nvim_output_handler'), |
||||
\ 'on_stderr': function('s:nvim_output_handler'), |
||||
\ 'on_exit': function('s:nvim_mq_job_handler') |
||||
\ } |
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell' |
||||
let cmd = a:cmd |
||||
else |
||||
let cmd = [&shell, &shellcmdflag, a:cmd] |
||||
endif |
||||
|
||||
if has_key(s:mq_jobs, a:file) |
||||
call remove(s:mq_jobs, a:file) |
||||
endif |
||||
let id = jobstart(cmd, config) |
||||
let s:mq_jobs[a:file] = id |
||||
endfunction |
||||
|
||||
function! airline#async#nvim_get_msgfmt_stat(cmd, file) |
||||
let config = { |
||||
\ 'buf': '', |
||||
\ 'file': a:file, |
||||
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')), |
||||
\ 'on_stdout': function('s:nvim_output_handler'), |
||||
\ 'on_stderr': function('s:nvim_output_handler'), |
||||
\ 'on_exit': function('s:nvim_po_job_handler') |
||||
\ } |
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell' |
||||
" no msgfmt on windows? |
||||
return |
||||
else |
||||
let cmd = [&shell, &shellcmdflag, a:cmd. shellescape(a:file)] |
||||
endif |
||||
|
||||
if has_key(s:po_jobs, a:file) |
||||
call remove(s:po_jobs, a:file) |
||||
endif |
||||
let id = jobstart(cmd, config) |
||||
let s:po_jobs[a:file] = id |
||||
endfunction |
||||
|
||||
function! airline#async#nvim_vcs_clean(cmd, file, vcs) |
||||
let config = { |
||||
\ 'buf': '', |
||||
\ 'vcs': a:vcs, |
||||
\ 'file': a:file, |
||||
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')), |
||||
\ 'on_stdout': function('s:nvim_output_handler'), |
||||
\ 'on_stderr': function('s:nvim_output_handler'), |
||||
\ 'on_exit': function('s:on_exit_clean')} |
||||
if g:airline#init#is_windows && &shell =~ 'cmd\|powershell' |
||||
let cmd = a:cmd |
||||
else |
||||
let cmd = [&shell, &shellcmdflag, a:cmd] |
||||
endif |
||||
|
||||
if !has_key(s:clean_jobs, a:vcs) |
||||
let s:clean_jobs[a:vcs] = {} |
||||
endif |
||||
if has_key(s:clean_jobs[a:vcs], a:file) |
||||
" still running |
||||
return |
||||
" jobs dict should be cleaned on exit, so not needed here |
||||
" call remove(s:clean_jobs[a:vcs], a:file) |
||||
endif |
||||
let id = jobstart(cmd, config) |
||||
call s:set_clean_jobs_variable(a:vcs, a:file, id) |
||||
endfunction |
||||
|
||||
endif |
||||
|
||||
" Should work in either Vim pre 8 or Nvim |
||||
function! airline#async#nvim_vcs_untracked(cfg, file, vcs) |
||||
let cmd = a:cfg.cmd . shellescape(a:file) |
||||
let id = -1 |
||||
let config = { |
||||
\ 'buf': '', |
||||
\ 'vcs': a:vcs, |
||||
\ 'cfg': a:cfg, |
||||
\ 'file': a:file, |
||||
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')) |
||||
\ } |
||||
if has("nvim") |
||||
call extend(config, { |
||||
\ 'on_stdout': function('s:nvim_output_handler'), |
||||
\ 'on_exit': function('s:nvim_untracked_job_handler')}) |
||||
if has_key(s:untracked_jobs, config.file) |
||||
" still running |
||||
return |
||||
endif |
||||
try |
||||
let id = jobstart(cmd, config) |
||||
catch |
||||
" catch-all, jobstart() failed, fall back to system() |
||||
let id=-1 |
||||
endtry |
||||
let s:untracked_jobs[a:file] = id |
||||
endif |
||||
" vim without job feature or nvim jobstart failed |
||||
if id < 1 |
||||
let output=system(cmd) |
||||
call s:untracked_output(config, output) |
||||
call airline#extensions#branch#update_untracked_config(a:file, a:vcs) |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#async#vim7_vcs_clean(cmd, file, vcs) |
||||
" Vim pre 8, fallback using system() |
||||
" don't want to to see error messages |
||||
if g:airline#init#is_windows && &shell =~ 'cmd' |
||||
let cmd = a:cmd .' 2>nul' |
||||
elseif g:airline#init#is_windows && &shell =~ 'powerline' |
||||
let cmd = a:cmd .' 2> $null' |
||||
else |
||||
let cmd = a:cmd .' 2>/dev/null' |
||||
endif |
||||
let output=system(cmd) |
||||
call s:set_clean_variables(a:file, a:vcs, !empty(output)) |
||||
endfunction |
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
function! airline#deprecation#check() |
||||
if exists('g:airline_enable_fugitive') || exists('g:airline_fugitive_prefix') |
||||
echom 'The g:airline_enable_fugitive and g:airline_fugitive_prefix variables are obsolete. Please read the documentation about the branch extension.' |
||||
endif |
||||
|
||||
let tests = [ |
||||
\ [ 'g:airline_paste_symbol', 'g:airline_symbols.paste' ], |
||||
\ [ 'g:airline_readonly_symbol', 'g:airline_symbols.readonly' ], |
||||
\ [ 'g:airline_linecolumn_prefix', 'g:airline_symbols.linenr' ], |
||||
\ [ 'g:airline_branch_prefix', 'g:airline_symbols.branch' ], |
||||
\ [ 'g:airline_branch_empty_message', 'g:airline#extensions#branch#empty_message' ], |
||||
\ [ 'g:airline_detect_whitespace', 'g:airline#extensions#whitespace#enabled|show_message' ], |
||||
\ [ 'g:airline_enable_hunks', 'g:airline#extensions#hunks#enabled' ], |
||||
\ [ 'g:airline_enable_tagbar', 'g:airline#extensions#tagbar#enabled' ], |
||||
\ [ 'g:airline_enable_csv', 'g:airline#extensions#csv#enabled' ], |
||||
\ [ 'g:airline_enable_branch', 'g:airline#extensions#branch#enabled' ], |
||||
\ [ 'g:airline_enable_bufferline', 'g:airline#extensions#bufferline#enabled' ], |
||||
\ [ 'g:airline_enable_syntastic', 'g:airline#extensions#syntastic#enabled' ], |
||||
\ [ 'g:airline_enable_eclim', 'g:airline#extensions#eclim#enabled' ], |
||||
\ ] |
||||
for test in tests |
||||
if exists(test[0]) |
||||
let max = winwidth(0) - 16 |
||||
let msg = printf('The variable %s is deprecated and may not work in the future. It has been replaced with %s. Please read the documentation.', test[0], test[1]) |
||||
echom msg[:max].'...' |
||||
endif |
||||
endfor |
||||
endfunction |
||||
|
@ -0,0 +1,134 @@
@@ -0,0 +1,134 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !get(g:, 'loaded_ale_dont_use_this_in_other_plugins_please', 0) |
||||
finish |
||||
endif |
||||
|
||||
function! s:airline_ale_count(cnt, symbol) |
||||
return a:cnt ? a:symbol. a:cnt : '' |
||||
endfunction |
||||
|
||||
function! s:legacy_airline_ale_get_line_number(cnt, type) abort |
||||
" Before ALE introduced the FirstProblem API function, this is how |
||||
" airline would get the line numbers: |
||||
" 1. Get the whole loclist; 2. Filter it for the desired problem type. |
||||
" 3. Return the line number of the first element in the filtered list. |
||||
if a:cnt == 0 |
||||
return '' |
||||
endif |
||||
|
||||
let buffer = bufnr('') |
||||
let problem_type = (a:type ==# 'error') ? 'E' : 'W' |
||||
let problems = copy(ale#engine#GetLoclist(buffer)) |
||||
|
||||
call filter(problems, 'v:val.bufnr is buffer && v:val.type is# problem_type') |
||||
|
||||
if empty(problems) |
||||
return '' |
||||
endif |
||||
|
||||
let open_lnum_symbol = get(g:, 'airline#extensions#ale#open_lnum_symbol', '(L') |
||||
let close_lnum_symbol = get(g:, 'airline#extensions#ale#close_lnum_symbol', ')') |
||||
|
||||
return open_lnum_symbol . problems[0].lnum . close_lnum_symbol |
||||
endfunction |
||||
|
||||
function! s:new_airline_ale_get_line_number(cnt, type) abort |
||||
" The FirstProblem call in ALE is a far more efficient way |
||||
" of obtaining line number data. If the installed ALE supports |
||||
" it, we should use this method of getting line data. |
||||
if a:cnt == 0 |
||||
return '' |
||||
endif |
||||
let l:buffer = bufnr('') |
||||
|
||||
" Try to get the first error from ALE. |
||||
let l:result = ale#statusline#FirstProblem(l:buffer, a:type) |
||||
if empty(l:result) |
||||
" If there are no errors then try and check for style errors. |
||||
let l:result = ale#statusline#FirstProblem(l:buffer, 'style_' . a:type) |
||||
endif |
||||
|
||||
if empty(l:result) |
||||
return '' |
||||
endif |
||||
|
||||
let l:open_lnum_symbol = |
||||
\ get(g:, 'airline#extensions#ale#open_lnum_symbol', '(L') |
||||
let l:close_lnum_symbol = |
||||
\ get(g:, 'airline#extensions#ale#close_lnum_symbol', ')') |
||||
|
||||
return open_lnum_symbol . l:result.lnum . close_lnum_symbol |
||||
endfunction |
||||
|
||||
function! s:airline_ale_get_line_number(cnt, type) abort |
||||
" Use the new ALE statusline API function if it is available. |
||||
if exists("*ale#statusline#FirstProblem") |
||||
return s:new_airline_ale_get_line_number(a:cnt, a:type) |
||||
endif |
||||
|
||||
return s:legacy_airline_ale_get_line_number(a:cnt, a:type) |
||||
endfunction |
||||
|
||||
function! airline#extensions#ale#get(type) |
||||
if !exists(':ALELint') |
||||
return '' |
||||
endif |
||||
|
||||
let error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:') |
||||
let warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:') |
||||
let checking_symbol = get(g:, 'airline#extensions#ale#checking_symbol', '...') |
||||
let show_line_numbers = get(g:, 'airline#extensions#ale#show_line_numbers', 1) |
||||
|
||||
let is_err = a:type ==# 'error' |
||||
|
||||
if ale#engine#IsCheckingBuffer(bufnr('')) == 1 |
||||
return is_err ? '' : checking_symbol |
||||
endif |
||||
|
||||
let symbol = is_err ? error_symbol : warning_symbol |
||||
|
||||
let counts = ale#statusline#Count(bufnr('')) |
||||
if type(counts) == type({}) && has_key(counts, 'error') |
||||
" Use the current Dictionary format. |
||||
let errors = counts.error + counts.style_error |
||||
let num = is_err ? errors : counts.total - errors |
||||
else |
||||
" Use the old List format. |
||||
let num = is_err ? counts[0] : counts[1] |
||||
endif |
||||
|
||||
if show_line_numbers == 1 |
||||
return s:airline_ale_count(num, symbol) . <sid>airline_ale_get_line_number(num, a:type) |
||||
else |
||||
return s:airline_ale_count(num, symbol) |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#ale#get_warning() |
||||
return airline#extensions#ale#get('warning') |
||||
endfunction |
||||
|
||||
function! airline#extensions#ale#get_error() |
||||
return airline#extensions#ale#get('error') |
||||
endfunction |
||||
|
||||
function! airline#extensions#ale#init(ext) |
||||
call airline#parts#define_function('ale_error_count', 'airline#extensions#ale#get_error') |
||||
call airline#parts#define_function('ale_warning_count', 'airline#extensions#ale#get_warning') |
||||
augroup airline_ale |
||||
autocmd! |
||||
autocmd CursorHold,BufWritePost * call <sid>ale_refresh() |
||||
autocmd User ALEJobStarted,ALELintPost call <sid>ale_refresh() |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! s:ale_refresh() |
||||
if get(g:, 'airline_skip_empty_sections', 0) |
||||
exe ':AirlineRefresh!' |
||||
endif |
||||
endfunction |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !exists('g:loaded_battery') |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#battery#status(...) abort |
||||
if !exists('g:battery#update_statusline') |
||||
let g:battery#update_statusline = 1 |
||||
call battery#update() |
||||
endif |
||||
|
||||
let bat = battery#component() |
||||
return bat |
||||
endfunction |
||||
|
||||
function! airline#extensions#battery#init(ext) abort |
||||
call airline#parts#define_function('battery', 'airline#extensions#battery#status') |
||||
endfunction |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !exists(':BookmarkToggle') |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#bookmark#currentbookmark() abort |
||||
if get(w:, 'airline_active', 0) |
||||
let file = expand('%:p') |
||||
if file ==# '' |
||||
return |
||||
endif |
||||
|
||||
let current_line = line('.') |
||||
let has_bm = bm#has_bookmark_at_line(file, current_line) |
||||
let bm = has_bm ? bm#get_bookmark_by_line(file, current_line) : 0 |
||||
let annotation = has_bm ? bm['annotation'] : '' |
||||
|
||||
return annotation |
||||
endif |
||||
return '' |
||||
endfunction |
||||
|
||||
function! airline#extensions#bookmark#init(ext) abort |
||||
call airline#parts#define_function('bookmark', 'airline#extensions#bookmark#currentbookmark') |
||||
endfunction |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !exists('*CapsLockStatusline') |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#capslock#status() |
||||
return tolower(CapsLockStatusline()) ==# '[caps]' ? get(g:, 'airline#extensions#capslock#symbol', 'CAPS') : '' |
||||
endfunction |
||||
|
||||
function! airline#extensions#capslock#init(ext) |
||||
call airline#parts#define_function('capslock', 'airline#extensions#capslock#status') |
||||
endfunction |
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
" 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:') |
||||
|
||||
function! airline#extensions#coc#get_warning() abort |
||||
return airline#extensions#coc#get('warning') |
||||
endfunction |
||||
|
||||
function! airline#extensions#coc#get_error() abort |
||||
return airline#extensions#coc#get('error') |
||||
endfunction |
||||
|
||||
function! airline#extensions#coc#get(type) abort |
||||
if !exists(':CocCommand') |
||||
return '' |
||||
endif |
||||
let _backup = get(g:, 'coc_stl_format', '') |
||||
let is_err = (a:type is# 'error') |
||||
if is_err |
||||
let g:coc_stl_format = get(g:, 'airline#extensions#coc#stl_format_err', '%E{[%e(#%fe)]}') |
||||
else |
||||
let g:coc_stl_format = get(g:, 'airline#extensions#coc#stl_format_warn', '%W{[%w(#%fw)]}') |
||||
endif |
||||
let info = get(b:, 'coc_diagnostic_info', {}) |
||||
if empty(info) | return '' | endif |
||||
|
||||
|
||||
let cnt = get(info, a:type, 0) |
||||
if !empty(_backup) |
||||
let g:coc_stl_format = _backup |
||||
endif |
||||
|
||||
if empty(cnt) |
||||
return '' |
||||
else |
||||
return (is_err ? s:error_symbol : s:warning_symbol).cnt |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#coc#get_status() abort |
||||
" Shorten text for windows < 91 characters |
||||
return airline#util#shorten(get(g:, 'coc_status', ''), 91, 9) |
||||
endfunction |
||||
|
||||
function! airline#extensions#coc#init(ext) abort |
||||
call airline#parts#define_function('coc_error_count', 'airline#extensions#coc#get_error') |
||||
call airline#parts#define_function('coc_warning_count', 'airline#extensions#coc#get_warning') |
||||
call airline#parts#define_function('coc_status', 'airline#extensions#coc#get_status') |
||||
endfunction |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
function! airline#extensions#ctrlspace#statusline(...) abort |
||||
let spc = g:airline_symbols.space |
||||
let l:padding = spc . spc . spc |
||||
let cs = ctrlspace#context#Configuration().Symbols.CS |
||||
|
||||
let b = airline#builder#new({ 'active': 1 }) |
||||
call b.add_section('airline_b', cs . l:padding . ctrlspace#api#StatuslineModeSegment(l:padding)) |
||||
call b.split() |
||||
call b.add_section('airline_x', spc . ctrlspace#api#StatuslineTabSegment() . spc) |
||||
return b.build() |
||||
endfunction |
||||
|
||||
function! airline#extensions#ctrlspace#init(ext) abort |
||||
let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()" |
||||
endfunction |
@ -0,0 +1,122 @@
@@ -0,0 +1,122 @@
|
||||
" MIT Licsense. |
||||
" Plugin: https://github.com/vheon/vim-cursormode |
||||
" Copyright (C) 2014 Andrea Cedraro <a.cedraro@gmail.com>, |
||||
" Copyright (C) 2017 Eduardo Suarez-Santana <e.suarezsantana@gmail.com> |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if exists('g:loaded_cursormode') |
||||
finish |
||||
endif |
||||
|
||||
let g:loaded_cursormode = 1 |
||||
|
||||
let s:is_win = has('win32') || has('win64') |
||||
let s:is_iTerm = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'iTerm.app' |
||||
let s:is_AppleTerminal = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'Apple_Terminal' |
||||
|
||||
let s:is_good = !has('gui_running') && !s:is_win && !s:is_AppleTerminal |
||||
|
||||
let s:last_mode = '' |
||||
|
||||
if !exists('g:cursormode_exit_mode') |
||||
let g:cursormode_exit_mode='n' |
||||
endif |
||||
|
||||
function! airline#extensions#cursormode#tmux_escape(escape) |
||||
return '\033Ptmux;'.substitute(a:escape, '\\033', '\\033\\033', 'g').'\033\\' |
||||
endfunction |
||||
|
||||
let s:iTerm_escape_template = '\033]Pl%s\033\\' |
||||
let s:xterm_escape_template = '\033]12;%s\007' |
||||
|
||||
function! s:get_mode() |
||||
return call(get(g:, 'cursormode_mode_func', 'mode'), []) |
||||
endfunction |
||||
|
||||
function! airline#extensions#cursormode#set(...) |
||||
let mode = s:get_mode() |
||||
if mode !=# s:last_mode |
||||
let s:last_mode = mode |
||||
call s:set_cursor_color_for(mode) |
||||
endif |
||||
return '' |
||||
endfunction |
||||
|
||||
function! s:set_cursor_color_for(mode) |
||||
let mode = a:mode |
||||
for mode in [a:mode, a:mode.&background] |
||||
if has_key(s:color_map, mode) |
||||
try |
||||
let save_eventignore = &eventignore |
||||
set eventignore=all |
||||
let save_shelltemp = &shelltemp |
||||
set noshelltemp |
||||
|
||||
silent call system(s:build_command(s:color_map[mode])) |
||||
return |
||||
finally |
||||
let &shelltemp = save_shelltemp |
||||
let &eventignore = save_eventignore |
||||
endtry |
||||
endif |
||||
endfor |
||||
endfunction |
||||
|
||||
function! s:build_command(color) |
||||
if s:is_iTerm |
||||
let color = substitute(a:color, '^#', '', '') |
||||
let escape_template = s:iTerm_escape_template |
||||
else |
||||
let color = a:color |
||||
let escape_template = s:xterm_escape_template |
||||
endif |
||||
|
||||
let escape = printf(escape_template, color) |
||||
if exists('$TMUX') |
||||
let escape = airline#extensions#cursormode#tmux_escape(escape) |
||||
endif |
||||
return "printf '".escape."' > /dev/tty" |
||||
endfunction |
||||
|
||||
function! s:get_color_map() |
||||
if exists('g:cursormode_color_map') |
||||
return g:cursormode_color_map |
||||
endif |
||||
|
||||
try |
||||
let map = g:cursormode#{g:colors_name}#color_map |
||||
return map |
||||
catch |
||||
return { |
||||
\ "nlight": "#000000", |
||||
\ "ndark": "#BBBBBB", |
||||
\ "i": "#0000BB", |
||||
\ "v": "#FF5555", |
||||
\ "V": "#BBBB00", |
||||
\ "\<C-V>": "#BB00BB", |
||||
\ } |
||||
endtry |
||||
endfunction |
||||
|
||||
augroup airline#extensions#cursormode |
||||
autocmd! |
||||
autocmd VimLeave * nested call s:set_cursor_color_for(g:cursormode_exit_mode) |
||||
" autocmd VimEnter * call airline#extensions#cursormode#activate() |
||||
autocmd Colorscheme * call airline#extensions#cursormode#activate() |
||||
augroup END |
||||
|
||||
function! airline#extensions#cursormode#activate() |
||||
let s:color_map = s:get_color_map() |
||||
call airline#extensions#cursormode#set() |
||||
endfunction |
||||
|
||||
function! airline#extensions#cursormode#apply(...) |
||||
let w:airline_section_a = get(w:, 'airline_section_a', g:airline_section_a) |
||||
let w:airline_section_a .= '%{airline#extensions#cursormode#set()}' |
||||
endfunction |
||||
|
||||
function! airline#extensions#cursormode#init(ext) |
||||
let s:color_map = s:get_color_map() |
||||
call a:ext.add_statusline_func('airline#extensions#cursormode#apply') |
||||
endfunction |
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !get(g:, 'loaded_denite', 0) |
||||
finish |
||||
endif |
||||
|
||||
let s:denite_ver = (exists('*denite#get_status_mode') ? 2 : 3) |
||||
" Denite does not use vim's built-in modal editing but has a custom prompt |
||||
" that implements its own insert/normal mode so we have to handle changing the |
||||
" highlight |
||||
function! airline#extensions#denite#check_denite_mode(bufnr) abort |
||||
if &filetype !=# 'denite' && &filetype !=# 'denite-filter' |
||||
return '' |
||||
endif |
||||
|
||||
if s:denite_ver == 3 |
||||
let mode = split(denite#get_status("mode"), ' ') |
||||
else |
||||
let mode = split(denite#get_status_mode(), ' ') |
||||
endif |
||||
let mode = tolower(get(mode, 1, '')) |
||||
if !exists('b:denite_mode_cache') || mode != b:denite_mode_cache |
||||
call airline#highlighter#highlight([mode], a:bufnr) |
||||
let b:denite_mode_cache = mode |
||||
endif |
||||
return '' |
||||
endfunction |
||||
|
||||
function! airline#extensions#denite#apply(...) abort |
||||
if &filetype ==# 'denite' || &filetype ==# 'denite-filter' |
||||
let w:airline_skip_empty_sections = 0 |
||||
call a:1.add_section('airline_a', ' Denite %{airline#extensions#denite#check_denite_mode('.a:2['bufnr'].')}') |
||||
if s:denite_ver == 3 |
||||
call a:1.add_section('airline_c', ' %{denite#get_status("sources")}') |
||||
call a:1.split() |
||||
call a:1.add_section('airline_y', ' %{denite#get_status("path")} ') |
||||
call a:1.add_section('airline_z', ' %{denite#get_status("linenr")} ') |
||||
else |
||||
call a:1.add_section('airline_c', ' %{denite#get_status_sources()}') |
||||
call a:1.split() |
||||
call a:1.add_section('airline_y', ' %{denite#get_status_path()} ') |
||||
call a:1.add_section('airline_z', ' %{denite#get_status_linenr()} ') |
||||
endif |
||||
return 1 |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#denite#init(ext) abort |
||||
call denite#custom#option('_', 'statusline', 0) |
||||
call a:ext.add_statusline_func('airline#extensions#denite#apply') |
||||
endfunction |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
" MIT Licsense |
||||
" Plugin: https://github.com/justinmk/vim-dirvish |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !get(g:, 'loaded_dirvish', 0) |
||||
finish |
||||
endif |
||||
|
||||
let s:spc = g:airline_symbols.space |
||||
|
||||
function! airline#extensions#dirvish#init(ext) abort |
||||
call a:ext.add_statusline_func('airline#extensions#dirvish#apply') |
||||
endfunction |
||||
|
||||
function! airline#extensions#dirvish#apply(...) abort |
||||
if &filetype ==# 'dirvish' && exists('b:dirvish') |
||||
let w:airline_section_a = 'Dirvish' |
||||
|
||||
let w:airline_section_b = exists('*airline#extensions#branch#get_head') |
||||
\ ? '%{airline#extensions#branch#get_head()}' |
||||
\ : '' |
||||
|
||||
let w:airline_section_c = '%{b:dirvish._dir}' |
||||
|
||||
let w:airline_section_x = '' |
||||
let w:airline_section_y = '' |
||||
|
||||
let current_column_regex = ':%\dv' |
||||
let w:airline_section_z = join(filter( |
||||
\ split(get(w:, 'airline_section_z', g:airline_section_z)), |
||||
\ 'v:val !~ current_column_regex' |
||||
\ )) |
||||
endif |
||||
endfunction |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
" 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) |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#fern#apply(...) abort |
||||
if (&ft =~# 'fern') |
||||
let spc = g:airline_symbols.space |
||||
let fri = fern#fri#parse(expand('%f')) |
||||
|
||||
call a:1.add_section('airline_a', spc.'fern'.spc) |
||||
if exists('*airline#extensions#branch#get_head') |
||||
call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) |
||||
else |
||||
call a:1.add_section('airline_b', '') |
||||
endif |
||||
if !(fri.authority =~# '^drawer') |
||||
let abspath = substitute(fri.path, 'file://', '', '') |
||||
call a:1.add_section('airline_c', spc.fnamemodify(abspath, ':~')) |
||||
call a:1.split() |
||||
if len(get(g:, 'fern#comparators', {})) |
||||
call a:1.add_section('airline_y', spc.'%{fern#comparator}'.spc) |
||||
endif |
||||
endif |
||||
return 1 |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#fern#init(ext) abort |
||||
let g:fern_force_overwrite_statusline = 0 |
||||
call a:ext.add_statusline_func('airline#extensions#fern#apply') |
||||
endfunction |
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
" MIT License. Copyright (c) 2017-2021 Cimbali et al |
||||
" Plugin: https://github.com/tpope/vim-fugitive |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !airline#util#has_fugitive() |
||||
finish |
||||
endif |
||||
|
||||
function! s:ModifierFlags() |
||||
return (exists("+autochdir") && &autochdir) ? ':p' : ':.' |
||||
endfunction |
||||
|
||||
function! airline#extensions#fugitiveline#bufname() |
||||
if !exists('b:fugitive_name') |
||||
let b:fugitive_name = '' |
||||
try |
||||
if bufname('%') =~? '^fugitive:' && exists('*FugitiveReal') |
||||
let b:fugitive_name = FugitiveReal(bufname('%')) |
||||
elseif exists('b:git_dir') && exists('*fugitive#repo') |
||||
if get(b:, 'fugitive_type', '') is# 'blob' |
||||
let b:fugitive_name = fugitive#repo().translate(FugitivePath(@%, '')) |
||||
endif |
||||
elseif exists('b:git_dir') && !exists('*fugitive#repo') |
||||
let buffer = fugitive#buffer() |
||||
if buffer.type('blob') |
||||
let b:fugitive_name = buffer.repo().translate(buffer.path('/')) |
||||
endif |
||||
endif |
||||
catch |
||||
endtry |
||||
endif |
||||
|
||||
let fmod = s:ModifierFlags() |
||||
if empty(b:fugitive_name) |
||||
return fnamemodify(bufname('%'), fmod) |
||||
else |
||||
return fnamemodify(b:fugitive_name, fmod). " [git]" |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#fugitiveline#init(ext) |
||||
if exists("+autochdir") && &autochdir |
||||
" if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well |
||||
call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m') |
||||
else |
||||
call airline#parts#define_raw('file', '%<%{airline#extensions#fugitiveline#bufname()}%m') |
||||
endif |
||||
autocmd ShellCmdPost,CmdwinLeave * unlet! b:fugitive_name |
||||
autocmd User AirlineBeforeRefresh unlet! b:fugitive_name |
||||
endfunction |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
function! airline#extensions#fzf#init(ext) abort |
||||
" Remove the custom statusline that fzf.vim sets by removing its `FileType |
||||
" fzf` autocmd. Ideally we'd use `let g:fzf_statusline = 0`, but this |
||||
" variable is checked *before* airline#extensions#init() is called. |
||||
augroup _fzf_statusline |
||||
autocmd! |
||||
augroup END |
||||
|
||||
call a:ext.add_statusline_func('airline#extensions#fzf#apply') |
||||
call a:ext.add_inactive_statusline_func('airline#extensions#fzf#inactive_apply') |
||||
endfunction |
||||
|
||||
function! airline#extensions#fzf#statusline(...) abort |
||||
let spc = g:airline_symbols.space |
||||
|
||||
let builder = airline#builder#new({ 'active': 1 }) |
||||
call builder.add_section('airline_a', spc.'FZF'.spc) |
||||
call builder.add_section('airline_c', '') |
||||
return builder.build() |
||||
endfunction |
||||
|
||||
function! airline#extensions#fzf#apply(...) abort |
||||
if &filetype ==# 'fzf' |
||||
let spc = g:airline_symbols.space |
||||
call a:1.add_section('airline_a', spc.'FZF'.spc) |
||||
call a:1.add_section('airline_c', '') |
||||
return 1 |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#fzf#inactive_apply(...) abort |
||||
if getbufvar(a:2.bufnr, '&filetype') ==# 'fzf' |
||||
let spc = g:airline_symbols.space |
||||
call a:1.add_section('airline_a', spc.'FZF'.spc) |
||||
call a:1.add_section('airline_c', '') |
||||
return 1 |
||||
endif |
||||
endfunction |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !(get(g:, 'loaded_gentags#gtags', 0) || get(g:, 'loaded_gentags#ctags', 0)) |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#gen_tags#status(...) abort |
||||
return gen_tags#job#is_running() != 0 ? 'Gen. gen_tags' : '' |
||||
endfunction |
||||
|
||||
function! airline#extensions#gen_tags#init(ext) abort |
||||
call airline#parts#define_function('gen_tags', 'airline#extensions#gen_tags#status') |
||||
endfunction |
||||
|
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
" MIT License. Copyright (c) 2013-2021 |
||||
" Plugin: https://github.com/lambdalisue/gina.vim |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
if !get(g:, 'loaded_gina', 0) |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#gina#apply(...) abort |
||||
if (&ft =~# 'gina' && &ft !~# 'blame') || &ft ==# 'diff' |
||||
call a:1.add_section('airline_a', ' gina ') |
||||
call a:1.add_section('airline_b', ' %{gina#component#repo#branch()} ') |
||||
call a:1.split() |
||||
call a:1.add_section('airline_y', ' staged %{gina#component#status#staged()} ') |
||||
call a:1.add_section('airline_z', ' unstaged %{gina#component#status#unstaged()} ') |
||||
return 1 |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#gina#init(ext) abort |
||||
let g:gina_force_overwrite_statusline = 0 |
||||
call a:ext.add_statusline_func('airline#extensions#gina#apply') |
||||
endfunction |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !get(g:, 'loaded_grepper', 0) |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#grepper#status() |
||||
let msg = grepper#statusline() |
||||
return empty(msg) ? '' : 'grepper' |
||||
endfunction |
||||
|
||||
function! airline#extensions#grepper#init(ext) |
||||
call airline#parts#define_function('grepper', 'airline#extensions#grepper#status') |
||||
endfunction |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !get(g:, 'loaded_gutentags', 0) |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#gutentags#status() |
||||
let msg = gutentags#statusline() |
||||
return empty(msg) ? '' : 'Gen. ' . msg |
||||
endfunction |
||||
|
||||
function! airline#extensions#gutentags#init(ext) |
||||
call airline#parts#define_function('gutentags', 'airline#extensions#gutentags#status') |
||||
endfunction |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Doron Behar, C.Brabandt et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !has('keymap') |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#keymap#status() |
||||
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap')) |
||||
let short_codes = get(g:, 'airline#extensions#keymap#short_codes', {}) |
||||
let label = get(g:, 'airline#extensions#keymap#label', g:airline_symbols.keymap) |
||||
let default = get(g:, 'airline#extensions#keymap#default', '') |
||||
if (label !=# '') |
||||
let label .= ' ' |
||||
endif |
||||
let keymap = &keymap |
||||
if has_key(short_codes, keymap) |
||||
let keymap = short_codes[keymap] |
||||
endif |
||||
return printf('%s', (!empty(keymap) && &iminsert ? (label . keymap) : |
||||
\ (!empty(default) ? label . default : default))) |
||||
else |
||||
return '' |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#keymap#init(ext) |
||||
call airline#parts#define_function('keymap', 'airline#extensions#keymap#status') |
||||
endfunction |
@ -0,0 +1,109 @@
@@ -0,0 +1,109 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:error_symbol = get(g:, 'airline#extensions#languageclient#error_symbol', 'E:') |
||||
let s:warning_symbol = get(g:, 'airline#extensions#languageclient#warning_symbol', 'W:') |
||||
let s:show_line_numbers = get(g:, 'airline#extensions#languageclient#show_line_numbers', 1) |
||||
|
||||
" Severity codes from the LSP spec |
||||
let s:severity_error = 1 |
||||
let s:severity_warning = 2 |
||||
let s:severity_info = 3 |
||||
let s:severity_hint = 4 |
||||
|
||||
" After each LanguageClient state change `s:diagnostics` will be populated with |
||||
" a map from file names to lists of errors, warnings, informational messages, |
||||
" and hints. |
||||
let s:diagnostics = {} |
||||
|
||||
function! s:languageclient_refresh() |
||||
if get(g:, 'airline_skip_empty_sections', 0) |
||||
exe ':AirlineRefresh!' |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:record_diagnostics(state) |
||||
" The returned message might not have the 'result' key |
||||
if has_key(a:state, 'result') |
||||
let result = json_decode(a:state.result) |
||||
let s:diagnostics = result.diagnostics |
||||
endif |
||||
call s:languageclient_refresh() |
||||
endfunction |
||||
|
||||
function! s:get_diagnostics() |
||||
call LanguageClient#getState(function("s:record_diagnostics")) |
||||
endfunction |
||||
|
||||
function! s:diagnostics_for_buffer() |
||||
return get(s:diagnostics, expand('%:p'), []) |
||||
endfunction |
||||
|
||||
function! s:airline_languageclient_count(cnt, symbol) |
||||
return a:cnt ? a:symbol. a:cnt : '' |
||||
endfunction |
||||
|
||||
function! s:airline_languageclient_get_line_number(type) abort |
||||
let linenumber_of_first_problem = 0 |
||||
for d in s:diagnostics_for_buffer() |
||||
if has_key(d, 'severity') && d.severity == a:type |
||||
let linenumber_of_first_problem = d.range.start.line |
||||
break |
||||
endif |
||||
endfor |
||||
|
||||
if linenumber_of_first_problem == 0 |
||||
return '' |
||||
endif |
||||
|
||||
let open_lnum_symbol = get(g:, 'airline#extensions#languageclient#open_lnum_symbol', '(L') |
||||
let close_lnum_symbol = get(g:, 'airline#extensions#languageclient#close_lnum_symbol', ')') |
||||
|
||||
return open_lnum_symbol . linenumber_of_first_problem . close_lnum_symbol |
||||
endfunction |
||||
|
||||
function! airline#extensions#languageclient#get(type) |
||||
if get(b:, 'LanguageClient_isServerRunning', 0) ==# 0 |
||||
return '' |
||||
endif |
||||
|
||||
let is_err = a:type == s:severity_error |
||||
let symbol = is_err ? s:error_symbol : s:warning_symbol |
||||
|
||||
let cnt = 0 |
||||
for d in s:diagnostics_for_buffer() |
||||
if has_key(d, 'severity') && d.severity == a:type |
||||
let cnt += 1 |
||||
endif |
||||
endfor |
||||
|
||||
if cnt == 0 |
||||
return '' |
||||
endif |
||||
|
||||
if s:show_line_numbers == 1 |
||||
return s:airline_languageclient_count(cnt, symbol) . <sid>airline_languageclient_get_line_number(a:type) |
||||
else |
||||
return s:airline_languageclient_count(cnt, symbol) |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#languageclient#get_warning() |
||||
return airline#extensions#languageclient#get(s:severity_warning) |
||||
endfunction |
||||
|
||||
function! airline#extensions#languageclient#get_error() |
||||
return airline#extensions#languageclient#get(s:severity_error) |
||||
endfunction |
||||
|
||||
function! airline#extensions#languageclient#init(ext) |
||||
call airline#parts#define_function('languageclient_error_count', 'airline#extensions#languageclient#get_error') |
||||
call airline#parts#define_function('languageclient_warning_count', 'airline#extensions#languageclient#get_warning') |
||||
augroup airline_languageclient |
||||
autocmd! |
||||
autocmd User LanguageClientDiagnosticsChanged call <sid>get_diagnostics() |
||||
augroup END |
||||
endfunction |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:enabled = get(g:, 'airline#extensions#localsearch#enabled', 1) |
||||
if !get(g:, 'loaded_localsearch', 0) || !s:enabled || get(g:, 'airline#extensions#localsearch#loaded', 0) |
||||
finish |
||||
endif |
||||
let g:airline#extensions#localsearch#loaded = 001 |
||||
|
||||
let s:spc = g:airline_symbols.space |
||||
|
||||
let g:airline#extensions#localsearch#inverted = get(g:, 'airline#extensions#localsearch#inverted', 0) |
||||
|
||||
function! airline#extensions#localsearch#load_theme(palette) abort |
||||
call airline#highlighter#exec('localsearch_dark', [ '#ffffff' , '#000000' , 15 , 1 , '']) |
||||
endfunction |
||||
|
||||
|
||||
function! airline#extensions#localsearch#init(ext) abort |
||||
call a:ext.add_theme_func('airline#extensions#localsearch#load_theme') |
||||
call a:ext.add_statusline_func('airline#extensions#localsearch#apply') |
||||
endfunction |
||||
|
||||
|
||||
function! airline#extensions#localsearch#apply(...) abort |
||||
" first variable is the statusline builder |
||||
let builder = a:1 |
||||
|
||||
""""" WARNING: the API for the builder is not finalized and may change |
||||
if exists('#localsearch#WinEnter') && !g:airline#extensions#localsearch#inverted " If localsearch mode is enabled and 'invert' option is false |
||||
call builder.add_section('localsearch_dark', s:spc.airline#section#create('LS').s:spc) |
||||
endif |
||||
if !exists('#localsearch#WinEnter') && g:airline#extensions#localsearch#inverted " If localsearch mode is disabled and 'invert' option is true |
||||
call builder.add_section('localsearch_dark', s:spc.airline#section#create('GS').s:spc) |
||||
endif |
||||
return 0 |
||||
endfunction |
||||
|
@ -0,0 +1,107 @@
@@ -0,0 +1,107 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !get(g:, 'lsp_loaded', 0) |
||||
finish |
||||
endif |
||||
|
||||
function! s:airline_lsp_count(cnt, symbol) abort |
||||
return a:cnt ? a:symbol. a:cnt : '' |
||||
endfunction |
||||
|
||||
function! s:airline_lsp_get_line_number(cnt, type) abort |
||||
let result = '' |
||||
|
||||
if a:type ==# 'error' |
||||
let result = lsp#get_buffer_first_error_line() |
||||
endif |
||||
|
||||
if empty(result) |
||||
return '' |
||||
endif |
||||
|
||||
let open_lnum_symbol = |
||||
\ get(g:, 'airline#extensions#lsp#open_lnum_symbol', '(L') |
||||
let close_lnum_symbol = |
||||
\ get(g:, 'airline#extensions#lsp#close_lnum_symbol', ')') |
||||
|
||||
return open_lnum_symbol . result . close_lnum_symbol |
||||
endfunction |
||||
|
||||
function! airline#extensions#lsp#get(type) abort |
||||
if !exists(':LspDeclaration') |
||||
return '' |
||||
endif |
||||
|
||||
let error_symbol = get(g:, 'airline#extensions#lsp#error_symbol', 'E:') |
||||
let warning_symbol = get(g:, 'airline#extensions#lsp#warning_symbol', 'W:') |
||||
let show_line_numbers = get(g:, 'airline#extensions#lsp#show_line_numbers', 1) |
||||
|
||||
let is_err = a:type ==# 'error' |
||||
|
||||
let symbol = is_err ? error_symbol : warning_symbol |
||||
|
||||
let num = lsp#get_buffer_diagnostics_counts()[a:type] |
||||
|
||||
if show_line_numbers == 1 |
||||
return s:airline_lsp_count(num, symbol) . <sid>airline_lsp_get_line_number(num, a:type) |
||||
else |
||||
return s:airline_lsp_count(num, symbol) |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#lsp#get_warning() abort |
||||
return airline#extensions#lsp#get('warning') |
||||
endfunction |
||||
|
||||
function! airline#extensions#lsp#get_error() abort |
||||
return airline#extensions#lsp#get('error') |
||||
endfunction |
||||
|
||||
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'] !=# '' && s:lsp_progress['percentage'] !=# 100 |
||||
let percent = '' |
||||
if 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 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 |
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" Plugin: https://github.com/neomake/neomake |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
if !exists(':Neomake') |
||||
finish |
||||
endif |
||||
|
||||
let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:') |
||||
let s:warning_symbol = get(g:, 'airline#extensions#neomake#warning_symbol', 'W:') |
||||
|
||||
function! s:get_counts() |
||||
let l:counts = neomake#statusline#LoclistCounts() |
||||
|
||||
if empty(l:counts) |
||||
return neomake#statusline#QflistCounts() |
||||
else |
||||
return l:counts |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#neomake#get_warnings() |
||||
let counts = s:get_counts() |
||||
let warnings = get(counts, 'W', 0) |
||||
return warnings ? s:warning_symbol.warnings : '' |
||||
endfunction |
||||
|
||||
function! airline#extensions#neomake#get_errors() |
||||
let counts = s:get_counts() |
||||
let errors = get(counts, 'E', 0) |
||||
return errors ? s:error_symbol.errors : '' |
||||
endfunction |
||||
|
||||
function! airline#extensions#neomake#init(ext) |
||||
call airline#parts#define_function('neomake_warning_count', 'airline#extensions#neomake#get_warnings') |
||||
call airline#parts#define_function('neomake_error_count', 'airline#extensions#neomake#get_errors') |
||||
endfunction |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !exists(':NetrwSettings') |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#netrw#apply(...) |
||||
if &ft == 'netrw' |
||||
let spc = g:airline_symbols.space |
||||
|
||||
call a:1.add_section('airline_a', spc.'netrw'.spc) |
||||
if exists('*airline#extensions#branch#get_head') |
||||
call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) |
||||
endif |
||||
call a:1.add_section('airline_c', spc.'%f'.spc) |
||||
call a:1.split() |
||||
call a:1.add_section('airline_y', spc.'%{airline#extensions#netrw#sortstring()}'.spc) |
||||
return 1 |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#netrw#init(ext) |
||||
let g:netrw_force_overwrite_statusline = 0 |
||||
call a:ext.add_statusline_func('airline#extensions#netrw#apply') |
||||
endfunction |
||||
|
||||
|
||||
function! airline#extensions#netrw#sortstring() |
||||
let order = (get(g:, 'netrw_sort_direction', 'n') =~ 'n') ? '+' : '-' |
||||
return get(g:, 'netrw_sort_by', '') . (g:airline_symbols.space) . '[' . order . ']' |
||||
endfunction |
@ -0,0 +1,48 @@
@@ -0,0 +1,48 @@
|
||||
" 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')) |
||||
finish |
||||
endif |
||||
|
||||
function! s:airline_nvimlsp_count(cnt, symbol) abort |
||||
return a:cnt ? a:symbol. a:cnt : '' |
||||
endfunction |
||||
|
||||
function! airline#extensions#nvimlsp#get(type) abort |
||||
if !exists(':LspInstallInfo') |
||||
return '' |
||||
endif |
||||
|
||||
let error_symbol = get(g:, 'airline#extensions#nvimlsp#error_symbol', 'E:') |
||||
let warning_symbol = get(g:, 'airline#extensions#nvimlsp#warning_symbol', 'W:') |
||||
|
||||
let is_err = a:type ==# 'Error' |
||||
|
||||
let symbol = is_err ? error_symbol : warning_symbol |
||||
|
||||
if luaeval("pcall(require, 'vim.lsp.diagnostic')") |
||||
let num = v:lua.vim.lsp.diagnostic.get_count(0, a:type) |
||||
else |
||||
let num = v:lua.vim.lsp.util.buf_diagnostics_count(a:type) |
||||
endif |
||||
|
||||
return s:airline_nvimlsp_count(num, symbol) |
||||
endfunction |
||||
|
||||
function! airline#extensions#nvimlsp#get_warning() abort |
||||
return airline#extensions#nvimlsp#get('Warning') |
||||
endfunction |
||||
|
||||
function! airline#extensions#nvimlsp#get_error() abort |
||||
return airline#extensions#nvimlsp#get('Error') |
||||
endfunction |
||||
|
||||
function! airline#extensions#nvimlsp#init(ext) abort |
||||
call airline#parts#define_function('nvimlsp_error_count', 'airline#extensions#nvimlsp#get_error') |
||||
call airline#parts#define_function('nvimlsp_warning_count', 'airline#extensions#nvimlsp#get_warning') |
||||
endfunction |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !exists('*ObsessionStatus') |
||||
finish |
||||
endif |
||||
|
||||
let s:spc = g:airline_symbols.space |
||||
|
||||
if !exists('g:airline#extensions#obsession#indicator_text') |
||||
let g:airline#extensions#obsession#indicator_text = '$' |
||||
endif |
||||
|
||||
function! airline#extensions#obsession#init(ext) |
||||
call airline#parts#define_function('obsession', 'airline#extensions#obsession#get_status') |
||||
endfunction |
||||
|
||||
function! airline#extensions#obsession#get_status() |
||||
return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '') |
||||
endfunction |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
" MIT License |
||||
" Plugin: https://github.com/OmniSharp/omnisharp-vim |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !get(g:, 'OmniSharp_loaded', 0) |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#omnisharp#server_status(...) abort |
||||
if !exists(':OmniSharpGotoDefinition') || !get(g:, 'OmniSharp_server_stdio', 0) |
||||
return '' |
||||
endif |
||||
|
||||
let host = OmniSharp#GetHost(bufnr('%')) |
||||
if type(host.job) != v:t_dict || get(host.job, 'stopped') |
||||
return '' |
||||
endif |
||||
|
||||
let sln = fnamemodify(host.sln_or_dir, ':t') |
||||
|
||||
if get(host.job, 'loaded', 0) |
||||
return sln |
||||
endif |
||||
|
||||
try |
||||
let projectsloaded = OmniSharp#project#CountLoaded() |
||||
let projectstotal = OmniSharp#project#CountTotal() |
||||
catch |
||||
" The CountLoaded and CountTotal functions are very new - catch the error |
||||
" when they don't exist |
||||
let projectsloaded = 0 |
||||
let projectstotal = 0 |
||||
endtry |
||||
return printf('%s(%d/%d)', sln, projectsloaded, projectstotal) |
||||
endfunction |
||||
|
||||
function! airline#extensions#omnisharp#init(ext) abort |
||||
call airline#parts#define_function('omnisharp', 'airline#extensions#omnisharp#server_status') |
||||
augroup airline_omnisharp |
||||
autocmd! |
||||
autocmd User OmniSharpStarted,OmniSharpReady,OmniSharpStopped AirlineRefresh! |
||||
augroup END |
||||
endfunction |
@ -0,0 +1,94 @@
@@ -0,0 +1,94 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling, Christian Brabandt et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
function! airline#extensions#po#shorten() |
||||
" Format and shorte the output of msgfmt |
||||
let b:airline_po_stats = substitute(get(b:, 'airline_po_stats', ''), ' \(message\|translation\)s*\.*', '', 'g') |
||||
let b:airline_po_stats = substitute(b:airline_po_stats, ', ', '/', 'g') |
||||
if exists("g:airline#extensions#po#displayed_limit") |
||||
let w:displayed_po_limit = g:airline#extensions#po#displayed_limit |
||||
if len(b:airline_po_stats) > w:displayed_po_limit - 1 |
||||
let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 2)].(&encoding==?'utf-8' ? '…' : '.') |
||||
endif |
||||
endif |
||||
if strlen(get(b:, 'airline_po_stats', '')) >= 30 && airline#util#winwidth() < 150 |
||||
let fuzzy = '' |
||||
let untranslated = '' |
||||
let messages = '' |
||||
" Shorten [120 translated, 50 fuzzy, 4 untranslated] to [120T/50F/4U] |
||||
if b:airline_po_stats =~ 'fuzzy' |
||||
let fuzzy = substitute(b:airline_po_stats, '.\{-}\(\d\+\) fuzzy.*', '\1F', '') |
||||
if fuzzy == '0F' |
||||
let fuzzy = '' |
||||
endif |
||||
endif |
||||
if b:airline_po_stats =~ 'untranslated' |
||||
let untranslated = substitute(b:airline_po_stats, '.\{-}\(\d\+\) untranslated.*', '\1U', '') |
||||
if untranslated == '0U' |
||||
let untranslated = '' |
||||
endif |
||||
endif |
||||
let messages = substitute(b:airline_po_stats, '\(\d\+\) translated.*', '\1T', '') |
||||
if messages ==# '0T' |
||||
let messages = '' |
||||
endif |
||||
let b:airline_po_stats = printf('%s%s%s', fuzzy, (empty(fuzzy) || empty(untranslated) ? '' : '/'), untranslated) |
||||
if strlen(b:airline_po_stats) < 10 |
||||
let b:airline_po_stats = messages. (!empty(b:airline_po_stats) && !empty(messages) ? '/':''). b:airline_po_stats |
||||
endif |
||||
endif |
||||
let b:airline_po_stats = '['.b:airline_po_stats. '] ' |
||||
endfunction |
||||
|
||||
function! airline#extensions#po#on_winenter() |
||||
" only reset cache, if the window size changed |
||||
if get(b:, 'airline_winwidth', 0) != airline#util#winwidth() |
||||
let b:airline_winwidth = airline#util#winwidth() |
||||
" needs re-formatting |
||||
unlet! b:airline_po_stats |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#po#apply(...) |
||||
if &ft ==# 'po' |
||||
call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}') |
||||
" Also reset the cache variable, if a window has been split, e.g. the winwidth changed |
||||
autocmd airline BufWritePost * unlet! b:airline_po_stats |
||||
autocmd airline WinEnter * call airline#extensions#po#on_winenter() |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#po#stats() |
||||
if exists('b:airline_po_stats') && !empty(b:airline_po_stats) |
||||
return b:airline_po_stats |
||||
endif |
||||
|
||||
if g:airline#init#is_windows |
||||
let cmd = 'msgfmt --statistics -o NUL ' |
||||
else |
||||
let cmd = 'msgfmt --statistics -o /dev/null -- ' |
||||
endif |
||||
if g:airline#init#vim_async |
||||
call airline#async#get_msgfmt_stat(cmd, expand('%:p')) |
||||
elseif has("nvim") |
||||
call airline#async#nvim_get_msgfmt_stat(cmd, expand('%:p')) |
||||
else |
||||
let airline_po_stats = system(cmd. shellescape(expand('%:p'))) |
||||
if v:shell_error |
||||
return '' |
||||
endif |
||||
try |
||||
let b:airline_po_stats = split(airline_po_stats, '\n')[0] |
||||
catch |
||||
let b:airline_po_stats = '' |
||||
endtry |
||||
call airline#extensions#po#shorten() |
||||
endif |
||||
return get(b:, 'airline_po_stats', '') |
||||
endfunction |
||||
|
||||
function! airline#extensions#po#init(ext) |
||||
call a:ext.add_statusline_func('airline#extensions#po#apply') |
||||
endfunction |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:spc = g:airline_symbols.space |
||||
|
||||
function! airline#extensions#poetv#init(ext) |
||||
call a:ext.add_statusline_func('airline#extensions#poetv#apply') |
||||
endfunction |
||||
|
||||
function! airline#extensions#poetv#apply(...) |
||||
if &filetype =~# 'python' |
||||
if get(g:, 'poetv_loaded', 0) |
||||
let statusline = poetv#statusline() |
||||
else |
||||
let statusline = fnamemodify($VIRTUAL_ENV, ':t') |
||||
endif |
||||
if !empty(statusline) |
||||
call airline#extensions#append_to_section('x', |
||||
\ s:spc.g:airline_right_alt_sep.s:spc.statusline) |
||||
endif |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#poetv#update() |
||||
if &filetype =~# 'python' |
||||
call airline#extensions#poetv#apply() |
||||
call airline#update_statusline() |
||||
endif |
||||
endfunction |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !exists(':PromptlineSnapshot') |
||||
finish |
||||
endif |
||||
|
||||
if !exists('airline#extensions#promptline#snapshot_file') || !len('airline#extensions#promptline#snapshot_file') |
||||
finish |
||||
endif |
||||
|
||||
let s:prompt_snapshot_file = get(g:, 'airline#extensions#promptline#snapshot_file', '') |
||||
let s:color_template = get(g:, 'airline#extensions#promptline#color_template', 'normal') |
||||
|
||||
function! airline#extensions#promptline#init(ext) |
||||
call a:ext.add_theme_func('airline#extensions#promptline#set_prompt_colors') |
||||
endfunction |
||||
|
||||
function! airline#extensions#promptline#set_prompt_colors(palette) |
||||
let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' |
||||
let mode_palette = a:palette[color_template] |
||||
|
||||
if !has_key(g:, 'promptline_symbols') |
||||
let g:promptline_symbols = { |
||||
\ 'left' : g:airline_left_sep, |
||||
\ 'right' : g:airline_right_sep, |
||||
\ 'left_alt' : g:airline_left_alt_sep, |
||||
\ 'right_alt' : g:airline_right_alt_sep} |
||||
endif |
||||
|
||||
let promptline_theme = promptline#api#create_theme_from_airline(mode_palette) |
||||
call promptline#api#create_snapshot_with_theme(s:prompt_snapshot_file, promptline_theme) |
||||
endfunction |
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !exists('g:airline#extensions#quickfix#quickfix_text') |
||||
let g:airline#extensions#quickfix#quickfix_text = 'Quickfix' |
||||
endif |
||||
|
||||
if !exists('g:airline#extensions#quickfix#location_text') |
||||
let g:airline#extensions#quickfix#location_text = 'Location' |
||||
endif |
||||
|
||||
function! airline#extensions#quickfix#apply(...) |
||||
if &buftype == 'quickfix' |
||||
let w:airline_section_a = airline#extensions#quickfix#get_type() |
||||
let w:airline_section_b = '%{get(w:, "quickfix_title", "")}' |
||||
let w:airline_section_c = '' |
||||
let w:airline_section_x = '' |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#quickfix#init(ext) |
||||
call a:ext.add_statusline_func('airline#extensions#quickfix#apply') |
||||
call a:ext.add_inactive_statusline_func('airline#extensions#quickfix#inactive_qf_window') |
||||
endfunction |
||||
|
||||
function! airline#extensions#quickfix#inactive_qf_window(...) |
||||
if getbufvar(a:2.bufnr, '&filetype') is# 'qf' && !empty(airline#util#getwinvar(a:2.winnr, 'quickfix_title', '')) |
||||
call setwinvar(a:2.winnr, 'airline_section_c', '[%{get(w:, "quickfix_title", "")}] %f %m') |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#quickfix#get_type() |
||||
if exists("*win_getid") && exists("*getwininfo") |
||||
let dict = getwininfo(win_getid()) |
||||
if len(dict) > 0 && get(dict[0], 'quickfix', 0) && !get(dict[0], 'loclist', 0) |
||||
return g:airline#extensions#quickfix#quickfix_text |
||||
elseif len(dict) > 0 && get(dict[0], 'quickfix', 0) && get(dict[0], 'loclist', 0) |
||||
return g:airline#extensions#quickfix#location_text |
||||
endif |
||||
endif |
||||
redir => buffers |
||||
silent ls |
||||
redir END |
||||
|
||||
let nr = bufnr('%') |
||||
for buf in split(buffers, '\n') |
||||
if match(buf, '\v^\s*'.nr) > -1 |
||||
if match(buf, '\cQuickfix') > -1 |
||||
return g:airline#extensions#quickfix#quickfix_text |
||||
else |
||||
return g:airline#extensions#quickfix#location_text |
||||
endif |
||||
endif |
||||
endfor |
||||
return '' |
||||
endfunction |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !exists('*searchcount') |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#searchcount#init(ext) abort |
||||
call a:ext.add_statusline_func('airline#extensions#searchcount#apply') |
||||
endfunction |
||||
|
||||
function! airline#extensions#searchcount#apply(...) abort |
||||
call airline#extensions#append_to_section('y', |
||||
\ '%{v:hlsearch ? airline#extensions#searchcount#status() : ""}') |
||||
endfunction |
||||
|
||||
function! s:search_term() |
||||
" 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, 8) |
||||
endfunction |
||||
|
||||
function! airline#extensions#searchcount#status() abort |
||||
try |
||||
let result = searchcount(#{recompute: 1, maxcount: -1}) |
||||
if empty(result) || result.total ==# 0 |
||||
return '' |
||||
endif |
||||
if result.incomplete ==# 1 " timed out |
||||
return printf('%s [?/??]', s:search_term()) |
||||
elseif result.incomplete ==# 2 " max count exceeded |
||||
if result.total > result.maxcount && |
||||
\ result.current > result.maxcount |
||||
return printf('%s[>%d/>%d]', s:search_term(), |
||||
\ result.current, result.total) |
||||
elseif result.total > result.maxcount |
||||
return printf('%s[%d/>%d]', s:search_term(), |
||||
\ result.current, result.total) |
||||
endif |
||||
endif |
||||
return printf('%s[%d/%d]', s:search_term(), |
||||
\ result.current, result.total) |
||||
catch |
||||
return '' |
||||
endtry |
||||
endfunction |
@ -1,225 +1,267 @@
@@ -1,225 +1,267 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') |
||||
let s:excludes = get(g:, 'airline#extensions#tabline#excludes', []) |
||||
let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) |
||||
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) |
||||
|
||||
let s:builder_context = { |
||||
\ 'active' : 1, |
||||
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep), |
||||
\ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep), |
||||
\ } |
||||
if get(g:, 'airline_powerline_fonts', 0) |
||||
let s:builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , "\ue0b0") |
||||
let s:builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , "\ue0b1") |
||||
else |
||||
let s:builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ') |
||||
let s:builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|') |
||||
scriptencoding utf-8 |
||||
|
||||
let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0) |
||||
if s:taboo |
||||
let g:taboo_tabline = 0 |
||||
endif |
||||
|
||||
let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0) |
||||
let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0) |
||||
let s:ctrlspace = get(g:, 'CtrlSpaceLoaded', 0) |
||||
let s:tabws = get(g:, 'tabws_loaded', 0) |
||||
|
||||
function! airline#extensions#tabline#init(ext) |
||||
if has('gui_running') |
||||
set guioptions-=e |
||||
endif |
||||
|
||||
autocmd User AirlineToggledOn call s:toggle_on() |
||||
autocmd User AirlineToggledOff call s:toggle_off() |
||||
|
||||
call s:toggle_on() |
||||
call a:ext.add_theme_func('airline#extensions#tabline#load_theme') |
||||
endfunction |
||||
|
||||
function! s:toggle_off() |
||||
call airline#extensions#tabline#autoshow#off() |
||||
call airline#extensions#tabline#tabs#off() |
||||
call airline#extensions#tabline#buffers#off() |
||||
if s:ctrlspace |
||||
call airline#extensions#tabline#ctrlspace#off() |
||||
endif |
||||
if s:tabws |
||||
call airline#extensions#tabline#tabws#off() |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:toggle_on() |
||||
if get(g:, 'airline_statusline_ontop', 0) |
||||
call airline#extensions#tabline#enable() |
||||
let &tabline='%!airline#statusline('.winnr().')' |
||||
return |
||||
endif |
||||
call airline#extensions#tabline#autoshow#on() |
||||
call airline#extensions#tabline#tabs#on() |
||||
call airline#extensions#tabline#buffers#on() |
||||
if s:ctrlspace |
||||
call airline#extensions#tabline#ctrlspace#on() |
||||
endif |
||||
if s:tabws |
||||
call airline#extensions#tabline#tabws#on() |
||||
endif |
||||
|
||||
set tabline=%!airline#extensions#tabline#get() |
||||
endfunction |
||||
|
||||
if s:buf_min_count <= 0 && s:tab_min_count <= 1 |
||||
set showtabline=2 |
||||
function! s:update_tabline(forceit) |
||||
if get(g:, 'airline#extensions#tabline#disable_refresh', 0) |
||||
return |
||||
endif |
||||
" loading a session file |
||||
" On SessionLoadPost, g:SessionLoad variable is still set :/ |
||||
if !a:forceit && get(g:, 'SessionLoad', 0) |
||||
return |
||||
endif |
||||
let match = expand('<afile>') |
||||
if pumvisible() |
||||
return |
||||
elseif !get(g:, 'airline#extensions#tabline#enabled', 0) |
||||
return |
||||
" return, if buffer matches ignore pattern or is directory (netrw) |
||||
elseif empty(match) || airline#util#ignore_buf(match) || isdirectory(match) |
||||
return |
||||
endif |
||||
call airline#util#doautocmd('BufMRUChange') |
||||
call airline#extensions#tabline#redraw() |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#redraw() |
||||
" sometimes, the tabline is not correctly updated see #1580 |
||||
" so force redraw here |
||||
if exists(":redrawtabline") == 2 |
||||
redrawtabline |
||||
else |
||||
if s:show_buffers == 1 |
||||
autocmd CursorMoved * call <sid>on_cursormove(s:buf_min_count, len(s:get_buffer_list())) |
||||
else |
||||
autocmd TabEnter * call <sid>on_cursormove(s:tab_min_count, tabpagenr('$')) |
||||
endif |
||||
" Have to set a property equal to itself to get airline to re-eval. |
||||
" Setting `let &tabline=&tabline` destroys the cursor position so we |
||||
" need something less invasive. |
||||
let &ro = &ro |
||||
endif |
||||
endfunction |
||||
|
||||
call a:ext.add_theme_func('airline#extensions#tabline#load_theme') |
||||
function! airline#extensions#tabline#enable() |
||||
if &lines > 3 |
||||
set showtabline=2 |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#load_theme(palette) |
||||
if pumvisible() |
||||
return |
||||
endif |
||||
let colors = get(a:palette, 'tabline', {}) |
||||
let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b) |
||||
let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a) |
||||
let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a) |
||||
let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c) |
||||
let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a) |
||||
let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c) |
||||
call airline#highlighter#exec('airline_tab', l:tab) |
||||
call airline#highlighter#exec('airline_tabsel', l:tabsel) |
||||
call airline#highlighter#exec('airline_tabtype', l:tabtype) |
||||
call airline#highlighter#exec('airline_tabfill', l:tabfill) |
||||
call airline#highlighter#exec('airline_tabmod', l:tabmod) |
||||
call airline#highlighter#exec('airline_tabhid', l:tabhid) |
||||
endfunction |
||||
|
||||
function! s:on_cursormove(min_count, total_count) |
||||
if a:total_count >= a:min_count |
||||
if &showtabline != 2 |
||||
set showtabline=2 |
||||
endif |
||||
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 |
||||
if &showtabline != 0 |
||||
set showtabline=0 |
||||
endif |
||||
"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 |
||||
endfunction |
||||
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) |
||||
|
||||
function! airline#extensions#tabline#get() |
||||
if s:show_buffers && tabpagenr('$') == 1 |
||||
return s:get_buffers() |
||||
" 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 |
||||
return s:get_tabs() |
||||
"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#title(n) |
||||
let buflist = tabpagebuflist(a:n) |
||||
let winnr = tabpagewinnr(a:n) |
||||
return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1]) |
||||
endfunction |
||||
let s:current_tabcnt = -1 |
||||
|
||||
function! airline#extensions#tabline#get_buffer_name(nr) |
||||
return airline#extensions#tabline#formatters#{s:formatter}(a:nr, get(s:, 'current_buffer_list', [])) |
||||
endfunction |
||||
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) |
||||
|
||||
function! s:get_buffer_list() |
||||
let buffers = [] |
||||
let cur = bufnr('%') |
||||
for nr in range(1, bufnr('$')) |
||||
if buflisted(nr) && bufexists(nr) |
||||
for ex in s:excludes |
||||
if match(bufname(nr), ex) |
||||
continue |
||||
endif |
||||
endfor |
||||
if getbufvar(nr, 'current_syntax') == 'qf' |
||||
continue |
||||
endif |
||||
call add(buffers, nr) |
||||
endif |
||||
endfor |
||||
let curtabcnt = tabpagenr('$') |
||||
if curtabcnt != s:current_tabcnt |
||||
let s:current_tabcnt = curtabcnt |
||||
call airline#extensions#tabline#tabs#invalidate() |
||||
call airline#extensions#tabline#buffers#invalidate() |
||||
call airline#extensions#tabline#ctrlspace#invalidate() |
||||
call airline#extensions#tabline#tabws#invalidate() |
||||
endif |
||||
|
||||
let s:current_buffer_list = buffers |
||||
return buffers |
||||
if !exists('#airline#BufAdd#*') |
||||
autocmd airline BufAdd * call <sid>update_tabline(0) |
||||
endif |
||||
if !exists('#airline#SessionLoadPost') |
||||
autocmd airline SessionLoadPost * call <sid>update_tabline(1) |
||||
endif |
||||
if s:ctrlspace |
||||
return airline#extensions#tabline#ctrlspace#get() |
||||
elseif s:tabws |
||||
return airline#extensions#tabline#tabws#get() |
||||
elseif show_buffers && curtabcnt == 1 || !show_tabs |
||||
return airline#extensions#tabline#buffers#get() |
||||
else |
||||
return airline#extensions#tabline#tabs#get() |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:get_visible_buffers() |
||||
let buffers = s:get_buffer_list() |
||||
let cur = bufnr('%') |
||||
function! airline#extensions#tabline#title(n) |
||||
let title = '' |
||||
if s:taboo |
||||
let title = TabooTabTitle(a:n) |
||||
endif |
||||
|
||||
let total_width = 0 |
||||
let max_width = 0 |
||||
|
||||
for nr in buffers |
||||
let width = len(airline#extensions#tabline#get_buffer_name(nr)) + 4 |
||||
let total_width += width |
||||
let max_width = max([max_width, width]) |
||||
endfor |
||||
|
||||
" only show current and surrounding buffers if there are too many buffers |
||||
let position = index(buffers, cur) |
||||
let vimwidth = &columns |
||||
if total_width > vimwidth && position > -1 |
||||
let buf_count = len(buffers) |
||||
|
||||
" determine how many buffers to show based on the longest buffer width, |
||||
" use one on the right side and put the rest on the left |
||||
let buf_max = vimwidth / max_width |
||||
let buf_right = 1 |
||||
let buf_left = max([0, buf_max - buf_right]) |
||||
|
||||
let start = max([0, position - buf_left]) |
||||
let end = min([buf_count, position + buf_right]) |
||||
|
||||
" fill up available space on the right |
||||
if position < buf_left |
||||
let end += (buf_left - position) |
||||
endif |
||||
if empty(title) && exists('*gettabvar') |
||||
let title = gettabvar(a:n, 'title') |
||||
endif |
||||
|
||||
" fill up available space on the left |
||||
if end > buf_count - 1 - buf_right |
||||
let start -= max([0, buf_right - (buf_count - 1 - position)]) |
||||
let formatter = get(g:, 'airline#extensions#tabline#tabtitle_formatter') |
||||
if empty(title) && formatter !=# '' && exists("*".formatter) |
||||
let title = call(formatter, [a:n]) |
||||
endif |
||||
|
||||
if empty(title) |
||||
let buflist = tabpagebuflist(a:n) |
||||
let winnr = tabpagewinnr(a:n) |
||||
let all_buffers = airline#extensions#tabline#buflist#list() |
||||
let curbuf = filter(buflist, 'index(all_buffers, v:val) != -1') |
||||
if len(curbuf) == 0 |
||||
call add(curbuf, tabpagebuflist()[0]) |
||||
endif |
||||
return airline#extensions#tabline#get_buffer_name(curbuf[0], curbuf) |
||||
endif |
||||
|
||||
let buffers = eval('buffers[' . start . ':' . end . ']') |
||||
return title |
||||
endfunction |
||||
|
||||
if start > 0 |
||||
call insert(buffers, -1, 0) |
||||
endif |
||||
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 |
||||
|
||||
if end < buf_count - 1 |
||||
call add(buffers, -1) |
||||
endif |
||||
function! airline#extensions#tabline#new_builder() |
||||
let builder_context = { |
||||
\ 'active' : 1, |
||||
\ 'tabline' : 1, |
||||
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep), |
||||
\ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep), |
||||
\ } |
||||
if get(g:, 'airline_powerline_fonts', 0) |
||||
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep) |
||||
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep) |
||||
else |
||||
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ') |
||||
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|') |
||||
endif |
||||
|
||||
return buffers |
||||
return airline#extensions#tabline#builder#new(builder_context) |
||||
endfunction |
||||
|
||||
function! s:get_buffers() |
||||
let b = airline#builder#new(s:builder_context) |
||||
function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr) |
||||
let cur = bufnr('%') |
||||
let tab_bufs = tabpagebuflist(tabpagenr()) |
||||
for nr in s:get_visible_buffers() |
||||
if nr < 0 |
||||
call b.add_raw('%#airline_tabhid#...') |
||||
continue |
||||
endif |
||||
if cur == nr |
||||
if g:airline_detect_modified && getbufvar(nr, '&modified') |
||||
let group = 'airline_tabmod' |
||||
else |
||||
let group = 'airline_tabsel' |
||||
endif |
||||
if cur == a:bufnr |
||||
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') |
||||
let group = 'airline_tabmod' |
||||
else |
||||
if index(tab_bufs, nr) > -1 |
||||
let group = 'airline_tab' |
||||
else |
||||
let group = 'airline_tabhid' |
||||
endif |
||||
endif |
||||
call b.add_section(group, '%( %{airline#extensions#tabline#get_buffer_name('.nr.')} %)') |
||||
endfor |
||||
|
||||
call b.add_section('airline_tabfill', '') |
||||
call b.split() |
||||
call b.add_section('airline_tabtype', ' buffers ') |
||||
return b.build() |
||||
endfunction |
||||
|
||||
function! s:get_tabs() |
||||
let b = airline#builder#new(s:builder_context) |
||||
for i in range(1, tabpagenr('$')) |
||||
if i == tabpagenr() |
||||
let group = 'airline_tabsel' |
||||
if g:airline_detect_modified |
||||
for bi in tabpagebuflist(i) |
||||
if getbufvar(bi, '&modified') |
||||
let group = 'airline_tabmod' |
||||
endif |
||||
endfor |
||||
endif |
||||
else |
||||
let group = 'airline_tab' |
||||
endif |
||||
let val = '%(' |
||||
if s:tab_nr_type == 0 |
||||
let val .= ' %{len(tabpagebuflist('.i.'))}' |
||||
else |
||||
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') |
||||
let group = 'airline_tabmod_unsel' |
||||
elseif index(a:tab_bufs, a:bufnr) > -1 |
||||
let group = 'airline_tab' |
||||
else |
||||
let val .= (g:airline_symbols.space).i |
||||
let group = 'airline_tabhid' |
||||
endif |
||||
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)') |
||||
endfor |
||||
call b.add_raw('%T') |
||||
call b.add_section('airline_tabfill', '') |
||||
call b.split() |
||||
call b.add_section('airline_tab', ' %999XX ') |
||||
call b.add_section('airline_tabtype', ' tabs ') |
||||
return b.build() |
||||
endif |
||||
return group |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#add_label(dict, type, right) |
||||
if get(g:, 'airline#extensions#tabline#show_tab_type', 1) |
||||
call a:dict.add_section_spaced('airline_tablabel'. |
||||
\ (a:right ? '_right' : ''), |
||||
\ get(g:, 'airline#extensions#tabline#'.a:type.'_label', a:type)) |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#add_tab_label(dict) |
||||
let show_tab_count = get(g:, 'airline#extensions#tabline#show_tab_count', 1) |
||||
if show_tab_count == 2 |
||||
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$'))) |
||||
elseif show_tab_count == 1 && tabpagenr('$') > 1 |
||||
call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$'))) |
||||
endif |
||||
endfunction |
||||
|
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) |
||||
let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0) |
||||
let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0) |
||||
|
||||
function! airline#extensions#tabline#autoshow#off() |
||||
if exists('s:original_tabline') |
||||
let &tabline = s:original_tabline |
||||
let &showtabline = s:original_showtabline |
||||
endif |
||||
|
||||
augroup airline_tabline_autoshow |
||||
autocmd! |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#autoshow#on() |
||||
let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ] |
||||
|
||||
augroup airline_tabline_autoshow |
||||
autocmd! |
||||
if s:buf_min_count <= 0 && s:tab_min_count <= 1 |
||||
call airline#extensions#tabline#enable() |
||||
else |
||||
if s:show_buffers == 1 |
||||
autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list())) |
||||
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('$')) |
||||
endif |
||||
endif |
||||
|
||||
" Invalidate cache. This has to come after the BufUnload for |
||||
" s:show_buffers, to invalidate the cache for BufEnter. |
||||
autocmd BufLeave,BufAdd,BufUnload * call airline#extensions#tabline#buflist#invalidate() |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! s:show_tabline(min_count, total_count) |
||||
if a:total_count >= a:min_count |
||||
if &showtabline != 2 && &lines > 3 |
||||
set showtabline=2 |
||||
endif |
||||
else |
||||
if &showtabline != 0 |
||||
set showtabline=0 |
||||
endif |
||||
endif |
||||
endfunction |
@ -0,0 +1,263 @@
@@ -0,0 +1,263 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:spc = g:airline_symbols.space |
||||
|
||||
let s:current_bufnr = -1 |
||||
let s:current_modified = 0 |
||||
let s:current_tabline = '' |
||||
let s:current_visible_buffers = [] |
||||
|
||||
let s:number_map = { |
||||
\ '0': '⁰', |
||||
\ '1': '¹', |
||||
\ '2': '²', |
||||
\ '3': '³', |
||||
\ '4': '⁴', |
||||
\ '5': '⁵', |
||||
\ '6': '⁶', |
||||
\ '7': '⁷', |
||||
\ '8': '⁸', |
||||
\ '9': '⁹' |
||||
\ } |
||||
let s:number_map = &encoding == 'utf-8' |
||||
\ ? get(g:, 'airline#extensions#tabline#buffer_idx_format', s:number_map) |
||||
\ : {} |
||||
|
||||
function! airline#extensions#tabline#buffers#off() |
||||
augroup airline_tabline_buffers |
||||
autocmd! |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#buffers#on() |
||||
let terminal_event = has("nvim") ? 'TermOpen' : 'TerminalOpen' |
||||
augroup airline_tabline_buffers |
||||
autocmd! |
||||
autocmd BufDelete * call airline#extensions#tabline#buflist#clean() |
||||
if exists("##".terminal_event) |
||||
exe 'autocmd '. terminal_event. ' * call airline#extensions#tabline#buflist#clean()' |
||||
endif |
||||
autocmd User BufMRUChange call airline#extensions#tabline#buflist#clean() |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#buffers#invalidate() |
||||
let s:current_bufnr = -1 |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#buffers#get() |
||||
try |
||||
call <sid>map_keys() |
||||
catch |
||||
" no-op |
||||
endtry |
||||
let cur = bufnr('%') |
||||
if cur == s:current_bufnr && &columns == s:column_width |
||||
if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified |
||||
return s:current_tabline |
||||
endif |
||||
endif |
||||
|
||||
let b = airline#extensions#tabline#new_builder() |
||||
let tab_bufs = tabpagebuflist(tabpagenr()) |
||||
let show_buf_label_first = 0 |
||||
|
||||
if get(g:, 'airline#extensions#tabline#buf_label_first', 0) |
||||
let show_buf_label_first = 1 |
||||
endif |
||||
if show_buf_label_first |
||||
call airline#extensions#tabline#add_label(b, 'buffers', 0) |
||||
endif |
||||
|
||||
let b.tab_bufs = tabpagebuflist(tabpagenr()) |
||||
|
||||
let b.overflow_group = 'airline_tabhid' |
||||
let b.buffers = airline#extensions#tabline#buflist#list() |
||||
if get(g:, 'airline#extensions#tabline#current_first', 0) |
||||
if index(b.buffers, cur) > -1 |
||||
call remove(b.buffers, index(b.buffers, cur)) |
||||
endif |
||||
let b.buffers = [cur] + b.buffers |
||||
endif |
||||
|
||||
function! b.get_group(i) dict |
||||
let bufnum = get(self.buffers, a:i, -1) |
||||
if bufnum == -1 |
||||
return '' |
||||
endif |
||||
let group = airline#extensions#tabline#group_of_bufnr(self.tab_bufs, bufnum) |
||||
if bufnum == bufnr('%') |
||||
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 |
||||
endif |
||||
return group |
||||
endfunction |
||||
|
||||
if has("tablineat") |
||||
function! b.get_pretitle(i) dict |
||||
let bufnum = get(self.buffers, a:i, -1) |
||||
return '%'.bufnum.'@airline#extensions#tabline#buffers#clickbuf@' |
||||
endfunction |
||||
|
||||
function! b.get_posttitle(i) dict |
||||
return '%X' |
||||
endfunction |
||||
endif |
||||
|
||||
function! b.get_title(i) dict |
||||
let bufnum = get(self.buffers, a:i, -1) |
||||
let group = self.get_group(a:i) |
||||
let pgroup = self.get_group(a:i - 1) |
||||
" always add a space when powerline_fonts are used |
||||
" or for the very first item |
||||
if get(g:, 'airline_powerline_fonts', 0) || a:i == 0 |
||||
let space = s:spc |
||||
else |
||||
let space= (pgroup == group ? s:spc : '') |
||||
endif |
||||
|
||||
if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) |
||||
if len(s:number_map) > 0 |
||||
return space. s:get_number(a:i) . '%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)' . s:spc |
||||
else |
||||
return '['.(a:i+1).s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)'.']' |
||||
endif |
||||
else |
||||
return space.'%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)'.s:spc |
||||
endif |
||||
endfunction |
||||
|
||||
let current_buffer = max([index(b.buffers, cur), 0]) |
||||
let last_buffer = len(b.buffers) - 1 |
||||
call b.insert_titles(current_buffer, 0, last_buffer) |
||||
|
||||
call b.add_section('airline_tabfill', '') |
||||
call b.split() |
||||
call b.add_section('airline_tabfill', '') |
||||
if !show_buf_label_first |
||||
call airline#extensions#tabline#add_label(b, 'buffers', 1) |
||||
endif |
||||
|
||||
call airline#extensions#tabline#add_tab_label(b) |
||||
|
||||
let s:current_bufnr = cur |
||||
let s:column_width = &columns |
||||
let s:current_tabline = b.build() |
||||
let s:current_visible_buffers = copy(b.buffers) |
||||
" Do not remove from s:current_visible_buffers, this breaks s:select_tab() |
||||
"if b._right_title <= last_buffer |
||||
" call remove(s:current_visible_buffers, b._right_title, last_buffer) |
||||
"endif |
||||
"if b._left_title > 0 |
||||
" call remove(s:current_visible_buffers, 0, b._left_title) |
||||
"endif |
||||
return s:current_tabline |
||||
endfunction |
||||
|
||||
function! s:get_number(index) |
||||
if len(s:number_map) == 0 |
||||
return a:index |
||||
endif |
||||
let bidx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) |
||||
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) |
||||
" no-op when called in 'keymap_ignored_filetypes' |
||||
if count(get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes', |
||||
\ ['vimfiler', 'nerdtree']), &ft) |
||||
return |
||||
endif |
||||
let idx = a:buf_index |
||||
if s:current_visible_buffers[0] == -1 |
||||
let idx = idx + 1 |
||||
endif |
||||
|
||||
let buf = get(s:current_visible_buffers, idx, 0) |
||||
if buf != 0 |
||||
exec 'b!' . buf |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:jump_to_tab(offset) |
||||
let l = airline#extensions#tabline#buflist#list() |
||||
let i = index(l, bufnr('%')) |
||||
if i > -1 |
||||
exec 'b!' . l[(i + a:offset) % len(l)] |
||||
endif |
||||
endfunction |
||||
|
||||
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, 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 |
||||
for i in range(start_idx, 99) |
||||
exe printf('noremap <silent> <Plug>AirlineSelectTab%02d :call <SID>select_tab(%d)<CR>', i, i-start_idx) |
||||
endfor |
||||
endif |
||||
noremap <silent> <Plug>AirlineSelectPrevTab :<C-u>call <SID>jump_to_tab(-v:count1)<CR> |
||||
noremap <silent> <Plug>AirlineSelectNextTab :<C-u>call <SID>jump_to_tab(v:count1)<CR> |
||||
" Enable this for debugging |
||||
" com! AirlineBufferList :echo map(copy(s:current_visible_buffers), {i,k -> k.": ".bufname(k)}) |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, modifiers) abort |
||||
" Clickable buffers |
||||
" works only in recent NeoVim with has('tablineat') |
||||
|
||||
" single mouse button click without modifiers pressed |
||||
if a:clicks == 1 && a:modifiers !~# '[^ ]' |
||||
if a:button is# 'l' |
||||
" left button - switch to buffer |
||||
silent execute 'buffer' a:minwid |
||||
elseif a:button is# 'm' |
||||
" middle button - delete buffer |
||||
|
||||
if get(g:, 'airline#extensions#tabline#middle_click_preserves_windows', 0) == 0 || winnr('$') == 1 |
||||
" just simply delete the clicked buffer. This will cause windows |
||||
" associated with the clicked buffer to be closed. |
||||
silent execute 'bdelete' a:minwid |
||||
else |
||||
" find windows displaying the clicked buffer and open an new |
||||
" buffer in them. |
||||
let current_window = bufwinnr("%") |
||||
let window_number = bufwinnr(a:minwid) |
||||
let last_window_visited = -1 |
||||
|
||||
" Set to 1 if the clicked buffer was open in any windows. |
||||
let buffer_in_window = 0 |
||||
|
||||
" Find the next window with the clicked buffer open. If bufwinnr() |
||||
" returns the same window number, this is because we clicked a new |
||||
" buffer, and then tried editing a new buffer. Vim won't create a |
||||
" new empty buffer for the same window, so we get the same window |
||||
" number from bufwinnr(). In this case we just give up and don't |
||||
" delete the buffer. |
||||
" This could be made cleaner if we could check if the clicked buffer |
||||
" is a new buffer, but I don't know if there is a way to do that. |
||||
while window_number != -1 && window_number != last_window_visited |
||||
let buffer_in_window = 1 |
||||
silent execute window_number . 'wincmd w' |
||||
silent execute 'enew' |
||||
let last_window_visited = window_number |
||||
let window_number = bufwinnr(a:minwid) |
||||
endwhile |
||||
silent execute current_window . 'wincmd w' |
||||
if window_number != last_window_visited || buffer_in_window == 0 |
||||
silent execute 'bdelete' a:minwid |
||||
endif |
||||
endif |
||||
endif |
||||
endif |
||||
endfunction |
@ -0,0 +1,81 @@
@@ -0,0 +1,81 @@
|
||||
" 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#buflist#invalidate() |
||||
unlet! s:current_buffer_list |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#buflist#clean() |
||||
call airline#extensions#tabline#buflist#invalidate() |
||||
call airline#extensions#tabline#buffers#invalidate() |
||||
endfunction |
||||
|
||||
" paths in excludes list |
||||
function! s:ExcludePaths(nr, exclude_paths) |
||||
let bname = bufname(a:nr) |
||||
if empty(bname) |
||||
return 0 |
||||
endif |
||||
let bpath = fnamemodify(bname, ":p") |
||||
for f in a:exclude_paths |
||||
if bpath =~# f | return 1 | endif |
||||
endfor |
||||
endfunction |
||||
|
||||
" other types to exclude |
||||
function! s:ExcludeOther(nr, exclude_preview) |
||||
if (getbufvar(a:nr, 'current_syntax') == 'qf') || |
||||
\ (a:exclude_preview && getbufvar(a:nr, '&bufhidden') == 'wipe' |
||||
\ && getbufvar(a:nr, '&buftype') == 'nofile') |
||||
return 1 | endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#buflist#list() |
||||
if exists('s:current_buffer_list') |
||||
return s:current_buffer_list |
||||
endif |
||||
|
||||
let exclude_buffers = get(g:, 'airline#extensions#tabline#exclude_buffers', []) |
||||
let exclude_paths = get(g:, 'airline#extensions#tabline#excludes', []) |
||||
let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1) |
||||
|
||||
let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$")) |
||||
|
||||
let buffers = [] |
||||
" If this is too slow, we can switch to a different algorithm. |
||||
" Basically branch 535 already does it, but since it relies on |
||||
" BufAdd autocommand, I'd like to avoid this if possible. |
||||
for nr in list |
||||
if buflisted(nr) |
||||
" Do not add to the bufferlist, if either |
||||
" 1) bufnr is exclude_buffers list |
||||
" 2) buffername matches one of exclude_paths patterns |
||||
" 3) buffer is a quickfix buffer |
||||
" 4) when excluding preview windows: |
||||
" 'bufhidden' == wipe |
||||
" 'buftype' == nofile |
||||
" 5) ignore buffers matching airline#extensions#tabline#ignore_bufadd_pat |
||||
|
||||
" check buffer numbers first |
||||
if index(exclude_buffers, nr) >= 0 |
||||
continue |
||||
" check paths second |
||||
elseif !empty(exclude_paths) && s:ExcludePaths(nr, exclude_paths) |
||||
continue |
||||
" ignore buffers matching airline#extensions#tabline#ignore_bufadd_pat |
||||
elseif airline#util#ignore_buf(bufname(nr)) |
||||
continue |
||||
" check other types last |
||||
elseif s:ExcludeOther(nr, exclude_preview) |
||||
continue |
||||
endif |
||||
|
||||
call add(buffers, nr) |
||||
endif |
||||
endfor |
||||
|
||||
let s:current_buffer_list = buffers |
||||
return buffers |
||||
endfunction |
@ -0,0 +1,232 @@
@@ -0,0 +1,232 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:prototype = {} |
||||
|
||||
" Set the point in the tabline where the builder should insert the titles. |
||||
" |
||||
" Subsequent calls will overwrite the previous ones, so only the last call |
||||
" determines to location to insert titles. |
||||
" |
||||
" NOTE: The titles are not inserted until |build| is called, so that the |
||||
" remaining contents of the tabline can be taken into account. |
||||
" |
||||
" Callers should define at least |get_title| and |get_group| on the host |
||||
" object before calling |build|. |
||||
function! s:prototype.insert_titles(current, first, last) dict |
||||
let self._first_title = a:first " lowest index |
||||
let self._last_title = a:last " highest index |
||||
let self._left_title = a:current " next index to add on the left |
||||
let self._right_title = a:current + 1 " next index to add on the right |
||||
let self._left_position = self.get_position() " left end of titles |
||||
let self._right_position = self._left_position " right end of the titles |
||||
endfunction |
||||
|
||||
" Insert a title for entry number |index|, of group |group| at position |pos|, |
||||
" if there is space for it. Returns 1 if it is inserted, 0 otherwise |
||||
" |
||||
" |force| inserts the title even if there isn't enough space left for it. |
||||
" |sep_size| adjusts the size change that the title is considered to take up, |
||||
" to account for changes to the separators |
||||
" |
||||
" The title is defined by |get_title| on the hosting object, called with |
||||
" |index| as its only argument. |
||||
" |get_pretitle| and |get_posttitle| may be defined on the host object to |
||||
" insert some formatting before or after the title. These should be 0-width. |
||||
" |
||||
" This method updates |_right_position| and |_remaining_space| on the host |
||||
" object, if the title is inserted. |
||||
function! s:prototype.try_insert_title(index, group, pos, sep_size, force) dict |
||||
let title = self.get_title(a:index) |
||||
let title_size = s:tabline_evaluated_length(title) + a:sep_size |
||||
if a:force || self._remaining_space >= title_size |
||||
let pos = a:pos |
||||
if has_key(self, "get_pretitle") |
||||
call self.insert_raw(self.get_pretitle(a:index), pos) |
||||
let self._right_position += 1 |
||||
let pos += 1 |
||||
endif |
||||
|
||||
call self.insert_section(a:group, title, pos) |
||||
let self._right_position += 1 |
||||
let pos += 1 |
||||
|
||||
if has_key(self, "get_posttitle") |
||||
call self.insert_raw(self.get_posttitle(a:index), pos) |
||||
let self._right_position += 1 |
||||
let pos += 1 |
||||
endif |
||||
|
||||
let self._remaining_space -= title_size |
||||
return 1 |
||||
endif |
||||
return 0 |
||||
endfunction |
||||
|
||||
function! s:get_separator_change(new_group, old_group, end_group, sep_size, alt_sep_size) |
||||
return s:get_separator_change_with_end(a:new_group, a:old_group, a:end_group, a:end_group, a:sep_size, a:alt_sep_size) |
||||
endfunction |
||||
|
||||
" Compute the change in size of the tabline caused by separators |
||||
" |
||||
" This should be kept up-to-date with |s:get_transitioned_seperator| and |
||||
" |s:get_separator| in autoload/airline/builder.vim |
||||
function! s:get_separator_change_with_end(new_group, old_group, new_end_group, old_end_group, sep_size, alt_sep_size) |
||||
let sep_change = 0 |
||||
if !empty(a:new_end_group) " Separator between title and the end |
||||
let sep_change += airline#builder#should_change_group(a:new_group, a:new_end_group) ? a:sep_size : a:alt_sep_size |
||||
endif |
||||
if !empty(a:old_group) " Separator between the title and the one adjacent |
||||
let sep_change += airline#builder#should_change_group(a:new_group, a:old_group) ? a:sep_size : a:alt_sep_size |
||||
if !empty(a:old_end_group) " Remove mis-predicted separator |
||||
let sep_change -= airline#builder#should_change_group(a:old_group, a:old_end_group) ? a:sep_size : a:alt_sep_size |
||||
endif |
||||
endif |
||||
return sep_change |
||||
endfunction |
||||
|
||||
" This replaces the build function of the |airline#builder#new| object, to |
||||
" insert titles as specified by the last call to |insert_titles| before |
||||
" passing to the original build function. |
||||
" |
||||
" Callers should define at least |get_title| and |get_group| on the host |
||||
" object if |insert_titles| has been called on it. |
||||
function! s:prototype.build() dict |
||||
if has_key(self, '_left_position') && self._first_title <= self._last_title |
||||
let self._remaining_space = &columns - s:tabline_evaluated_length(self._build()) |
||||
|
||||
let center_active = get(g:, 'airline#extensions#tabline#center_active', 0) |
||||
|
||||
let sep_size = s:tabline_evaluated_length(self._context.left_sep) |
||||
let alt_sep_size = s:tabline_evaluated_length(self._context.left_alt_sep) |
||||
|
||||
let outer_left_group = airline#builder#get_prev_group(self._sections, self._left_position) |
||||
let outer_right_group = airline#builder#get_next_group(self._sections, self._right_position) |
||||
|
||||
let overflow_marker = get(g:, 'airline#extensions#tabline#overflow_marker', g:airline_symbols.ellipsis) |
||||
let overflow_marker_size = s:tabline_evaluated_length(overflow_marker) |
||||
" Allow space for the markers before we begin filling in titles. |
||||
if self._left_title > self._first_title |
||||
let self._remaining_space -= overflow_marker_size + |
||||
\ s:get_separator_change(self.overflow_group, "", outer_left_group, sep_size, alt_sep_size) |
||||
endif |
||||
if self._left_title < self._last_title |
||||
let self._remaining_space -= overflow_marker_size + |
||||
\ s:get_separator_change(self.overflow_group, "", outer_right_group, sep_size, alt_sep_size) |
||||
endif |
||||
|
||||
" Add the current title |
||||
let group = self.get_group(self._left_title) |
||||
if self._left_title == self._first_title |
||||
let sep_change = s:get_separator_change(group, "", outer_left_group, sep_size, alt_sep_size) |
||||
else |
||||
let sep_change = s:get_separator_change(group, "", self.overflow_group, sep_size, alt_sep_size) |
||||
endif |
||||
if self._left_title == self._last_title |
||||
let sep_change += s:get_separator_change(group, "", outer_right_group, sep_size, alt_sep_size) |
||||
else |
||||
let sep_change += s:get_separator_change(group, "", self.overflow_group, sep_size, alt_sep_size) |
||||
endif |
||||
let left_group = group |
||||
let right_group = group |
||||
let self._left_title -= |
||||
\ self.try_insert_title(self._left_title, group, self._left_position, sep_change, 1) |
||||
|
||||
if get(g:, 'airline#extensions#tabline#current_first', 0) |
||||
" always have current title first |
||||
let self._left_position += 1 |
||||
endif |
||||
|
||||
if !center_active && self._right_title <= self._last_title |
||||
" Add the title to the right |
||||
let group = self.get_group(self._right_title) |
||||
if self._right_title == self._last_title |
||||
let sep_change = s:get_separator_change_with_end(group, right_group, outer_right_group, self.overflow_group, sep_size, alt_sep_size) - overflow_marker_size |
||||
else |
||||
let sep_change = s:get_separator_change(group, right_group, self.overflow_group, sep_size, alt_sep_size) |
||||
endif |
||||
let right_group = group |
||||
let self._right_title += |
||||
\ self.try_insert_title(self._right_title, group, self._right_position, sep_change, 1) |
||||
endif |
||||
|
||||
while self._remaining_space > 0 |
||||
let done = 0 |
||||
if self._left_title >= self._first_title |
||||
" Insert next title to the left |
||||
let group = self.get_group(self._left_title) |
||||
if self._left_title == self._first_title |
||||
let sep_change = s:get_separator_change_with_end(group, left_group, outer_left_group, self.overflow_group, sep_size, alt_sep_size) - overflow_marker_size |
||||
else |
||||
let sep_change = s:get_separator_change(group, left_group, self.overflow_group, sep_size, alt_sep_size) |
||||
endif |
||||
let left_group = group |
||||
let done = self.try_insert_title(self._left_title, group, self._left_position, sep_change, 0) |
||||
let self._left_title -= done |
||||
endif |
||||
" If center_active is set, this |if| operates as an independent |if|, |
||||
" otherwise as an |elif|. |
||||
if self._right_title <= self._last_title && (center_active || !done) |
||||
" Insert next title to the right |
||||
let group = self.get_group(self._right_title) |
||||
if self._right_title == self._last_title |
||||
let sep_change = s:get_separator_change_with_end(group, right_group, outer_right_group, self.overflow_group, sep_size, alt_sep_size) - overflow_marker_size |
||||
else |
||||
let sep_change = s:get_separator_change(group, right_group, self.overflow_group, sep_size, alt_sep_size) |
||||
endif |
||||
let right_group = group |
||||
let done = self.try_insert_title(self._right_title, group, self._right_position, sep_change, 0) |
||||
let self._right_title += done |
||||
endif |
||||
if !done |
||||
break |
||||
endif |
||||
endwhile |
||||
|
||||
if self._left_title >= self._first_title |
||||
if get(g:, 'airline#extensions#tabline#current_first', 0) |
||||
let self._left_position -= 1 |
||||
endif |
||||
call self.insert_section(self.overflow_group, overflow_marker, self._left_position) |
||||
let self._right_position += 1 |
||||
endif |
||||
|
||||
if self._right_title <= self._last_title |
||||
call self.insert_section(self.overflow_group, overflow_marker, self._right_position) |
||||
endif |
||||
endif |
||||
|
||||
return self._build() |
||||
endfunction |
||||
|
||||
let s:prototype.overflow_group = 'airline_tab' |
||||
|
||||
" Extract the text content a tabline will render. (Incomplete). |
||||
" |
||||
" See :help 'statusline' for the list of fields. |
||||
function! s:evaluate_tabline(tabline) |
||||
let tabline = a:tabline |
||||
let tabline = substitute(tabline, '%{\([^}]\+\)}', '\=eval(submatch(1))', 'g') |
||||
let tabline = substitute(tabline, '%#[^#]\+#', '', 'g') |
||||
let tabline = substitute(tabline, '%(\([^)]\+\)%)', '\1', 'g') |
||||
let tabline = substitute(tabline, '%\d\+[TX]', '', 'g') |
||||
let tabline = substitute(tabline, '%=', '', 'g') |
||||
let tabline = substitute(tabline, '%\d*\*', '', 'g') |
||||
if has('tablineat') |
||||
let tabline = substitute(tabline, '%@[^@]\+@', '', 'g') |
||||
endif |
||||
return tabline |
||||
endfunction |
||||
|
||||
function! s:tabline_evaluated_length(tabline) |
||||
return airline#util#strchars(s:evaluate_tabline(a:tabline)) |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#builder#new(context) |
||||
let builder = airline#builder#new(a:context) |
||||
let builder._build = builder.build |
||||
call extend(builder, s:prototype, 'force') |
||||
return builder |
||||
endfunction |
@ -0,0 +1,166 @@
@@ -0,0 +1,166 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:current_bufnr = -1 |
||||
let s:current_modified = 0 |
||||
let s:current_tabnr = -1 |
||||
let s:current_tabline = '' |
||||
let s:highlight_groups = ['hid', 0, '', 'sel', 'mod_unsel', 0, 'mod_unsel', 'mod'] |
||||
|
||||
function! airline#extensions#tabline#ctrlspace#off() |
||||
augroup airline_tabline_ctrlspace |
||||
autocmd! |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#ctrlspace#on() |
||||
augroup airline_tabline_ctrlspace |
||||
autocmd! |
||||
autocmd BufDelete * call airline#extensions#tabline#ctrlspace#invalidate() |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#ctrlspace#invalidate() |
||||
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) |
||||
if buffer['index'] == bufferindex |
||||
call add(buffer_list, buffer) |
||||
endif |
||||
endfor |
||||
endfor |
||||
|
||||
" add by tenfy(tenfyzhong@qq.com) |
||||
" if the current buffer no in the buffer list |
||||
" return false and no redraw tabline. |
||||
" Fixes #1515. if there a BufEnter autocmd execute redraw. The tabline may no update. |
||||
let bufnr_list = map(copy(buffer_list), 'v:val["index"]') |
||||
if index(bufnr_list, a:cur_buf) == -1 && a:cur_tab == s:current_tabnr |
||||
return 0 |
||||
endif |
||||
|
||||
let s:current_modified = getbufvar(a:cur_buf, '&modified') |
||||
|
||||
for buffer in buffer_list |
||||
let group = 'airline_tab' |
||||
\ .s:highlight_groups[(4 * buffer.modified) + (2 * buffer.visible) + (a:cur_buf == buffer.index)] |
||||
\ .pos_extension |
||||
|
||||
let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)' |
||||
|
||||
if has("tablineat") |
||||
let buf_name = '%'.buffer.index.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X' |
||||
endif |
||||
|
||||
call a:builder.add_section_spaced(group, buf_name) |
||||
endfor |
||||
|
||||
" add by tenfy(tenfyzhong@qq.com) |
||||
" if the selected buffer was updated |
||||
" return true |
||||
return 1 |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pull_right) |
||||
let pos_extension = (a:pull_right ? '_right' : '') |
||||
let tab_list = ctrlspace#api#TabList() |
||||
|
||||
for tab in tab_list |
||||
let group = 'airline_tab' |
||||
\ .s:highlight_groups[(4 * tab.modified) + (3 * tab.current)] |
||||
\ .pos_extension |
||||
|
||||
if get(g:, 'airline#extensions#tabline#ctrlspace_show_tab_nr', 0) == 0 |
||||
call a:builder.add_section_spaced(group, '%'.tab.index.'T'.tab.title.ctrlspace#api#TabBuffersNumber(tab.index).'%T') |
||||
else |
||||
call a:builder.add_section_spaced(group, '%'.(tab.index).'T'.(tab.index).(g:airline_symbols.space).(tab.title).ctrlspace#api#TabBuffersNumber(tab.index).'%T') |
||||
endif |
||||
endfor |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#ctrlspace#get() |
||||
let cur_buf = bufnr('%') |
||||
let buffer_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') |
||||
let tab_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') |
||||
let switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0) |
||||
|
||||
try |
||||
call airline#extensions#tabline#tabs#map_keys() |
||||
endtry |
||||
|
||||
let cur_tab = tabpagenr() |
||||
|
||||
if cur_buf == s:current_bufnr && cur_tab == s:current_tabnr |
||||
if !g:airline_detect_modified || getbufvar(cur_buf, '&modified') == s:current_modified |
||||
return s:current_tabline |
||||
endif |
||||
endif |
||||
|
||||
let builder = airline#extensions#tabline#new_builder() |
||||
|
||||
let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) |
||||
let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1) |
||||
|
||||
let AppendBuffers = function('airline#extensions#tabline#ctrlspace#add_buffer_section', [builder, cur_tab, cur_buf]) |
||||
let AppendTabs = function('airline#extensions#tabline#ctrlspace#add_tab_section', [builder]) |
||||
let AppendLabel = function(builder.add_section_spaced, ['airline_tabtype'], builder) |
||||
|
||||
" <= 1: |{Tabs} <tab| |
||||
" == 2: |{Buffers} <buffers| |
||||
" == 3: |buffers> {Buffers} {Tabs} <tabs| |
||||
let showing_mode = (2 * show_buffers) + (show_tabs) |
||||
let ignore_update = 0 |
||||
|
||||
" Add left tabline content |
||||
if showing_mode <= 1 " Tabs only mode |
||||
call AppendTabs(0) |
||||
elseif showing_mode == 2 " Buffers only mode |
||||
let ignore_update = !AppendBuffers(0) |
||||
else |
||||
if !switch_buffers_and_tabs |
||||
call AppendLabel(buffer_label) |
||||
let ignore_update = !AppendBuffers(0) |
||||
else |
||||
call AppendLabel(tab_label) |
||||
call AppendTabs(0) |
||||
endif |
||||
endif |
||||
|
||||
if ignore_update | return s:current_tabline | endif |
||||
|
||||
call builder.add_section('airline_tabfill', '') |
||||
call builder.split() |
||||
call builder.add_section('airline_tabfill', '') |
||||
|
||||
" Add right tabline content |
||||
if showing_mode <= 1 " Tabs only mode |
||||
call AppendLabel(tab_label) |
||||
elseif showing_mode == 2 " Buffers only mode |
||||
call AppendLabel(buffer_label) |
||||
else |
||||
if !switch_buffers_and_tabs |
||||
call AppendTabs(1) |
||||
call AppendLabel(tab_label) |
||||
else |
||||
let ignore_update = AppendBuffers(1) |
||||
call AppendLabel(buffer_label) |
||||
endif |
||||
endif |
||||
|
||||
if ignore_update | return s:current_tabline | endif |
||||
|
||||
let s:current_bufnr = cur_buf |
||||
let s:current_tabnr = cur_tab |
||||
let s:current_tabline = builder.build() |
||||
return s:current_tabline |
||||
endfunction |
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.') |
||||
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) |
||||
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ') |
||||
let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0) |
||||
let s:buf_modified_symbol = g:airline_symbols.modified |
||||
|
||||
function! airline#extensions#tabline#formatters#default(bufnr, buffers) |
||||
let _ = '' |
||||
|
||||
if s:buf_nr_show |
||||
let _ .= printf(s:buf_nr_format, a:bufnr) |
||||
endif |
||||
|
||||
let name = bufname(a:bufnr) |
||||
if empty(name) |
||||
let _ .= '[No Name]' |
||||
else |
||||
if s:fnamecollapse |
||||
let _ .= substitute(fnamemodify(name, s:fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g') |
||||
else |
||||
let _ .= fnamemodify(name, s:fmod) |
||||
endif |
||||
endif |
||||
|
||||
if getbufvar(a:bufnr, '&modified') == 1 |
||||
let _ .= s:buf_modified_symbol |
||||
endif |
||||
|
||||
return _ |
||||
endfunction |
||||
|
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
" 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#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]' |
||||
elseif name =~ 'term://' |
||||
" Neovim Terminal |
||||
let _ = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '') |
||||
else |
||||
if get(g:, 'airline#extensions#tabline#fnamecollapse', 1) |
||||
" Does not handle non-ascii characters like Cyrillic: 'D/Учёба/t.c' |
||||
"let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g') |
||||
let _ .= pathshorten(fnamemodify(name, fmod)) |
||||
else |
||||
let _ .= fnamemodify(name, fmod) |
||||
endif |
||||
if a:bufnr != bufnr('%') && fnametruncate && strlen(_) > fnametruncate |
||||
let _ = airline#util#strcharpart(_, 0, fnametruncate) |
||||
endif |
||||
endif |
||||
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _) |
||||
endfunction |
||||
|
||||
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) |
||||
let buf_modified_symbol = g:airline_symbols.modified |
||||
|
||||
let _ = buf_nr_show ? printf(buf_nr_format, a:bufnr) : '' |
||||
let _ .= substitute(a:buffer_name, '\\', '/', 'g') |
||||
|
||||
if getbufvar(a:bufnr, '&modified') == 1 |
||||
let _ .= buf_modified_symbol |
||||
endif |
||||
return _ |
||||
endfunction |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
" 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#jsformatter#format(bufnr, buffers) |
||||
let buf = bufname(a:bufnr) |
||||
let filename = fnamemodify(buf, ':t') |
||||
|
||||
if filename ==# 'index.js' || filename ==# 'index.jsx' || filename ==# 'index.ts' || filename ==# 'index.tsx' || filename ==# 'index.vue' |
||||
return fnamemodify(buf, ':p:h:t') . '/i' |
||||
else |
||||
return airline#extensions#tabline#formatters#unique_tail_improved#format(a:bufnr, a:buffers) |
||||
endif |
||||
endfunction |
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
" 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 _ = '' |
||||
|
||||
let name = bufname(a:bufnr) |
||||
if empty(name) |
||||
let _ .= '[No Name]' |
||||
elseif name =~ 'term://' |
||||
" Neovim Terminal |
||||
let _ = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '') |
||||
else |
||||
let _ .= fnamemodify(name, ':p:h:t') . '/' . fnamemodify(name, ':t') |
||||
endif |
||||
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _) |
||||
endfunction |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
" 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) |
||||
let spc=g:airline_symbols.space |
||||
if a:tab_nr_type == 0 " nr of splits |
||||
return spc. '%{len(tabpagebuflist('.a:nr.'))}' |
||||
elseif a:tab_nr_type == 1 " tab number |
||||
return spc. a:nr |
||||
else "== 2 splits and tab number |
||||
return spc. a:nr. '.%{len(tabpagebuflist('.a:nr.'))}' |
||||
endif |
||||
endfunction |
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
" 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#unique_tail#format(bufnr, buffers) |
||||
let duplicates = {} |
||||
let tails = {} |
||||
let map = {} |
||||
for nr in a:buffers |
||||
let name = bufname(nr) |
||||
if empty(name) |
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, '[No Name]') |
||||
else |
||||
if name =~ 'term://' |
||||
" Neovim Terminal |
||||
let tail = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '') |
||||
else |
||||
let tail = fnamemodify(name, ':s?/\+$??:t') |
||||
endif |
||||
if has_key(tails, tail) |
||||
let duplicates[nr] = nr |
||||
endif |
||||
let tails[tail] = 1 |
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, tail) |
||||
endif |
||||
endfor |
||||
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.') |
||||
for nr in values(duplicates) |
||||
let name = bufname(nr) |
||||
let fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) |
||||
if fnamecollapse |
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')) |
||||
else |
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(name, fmod)) |
||||
endif |
||||
endfor |
||||
|
||||
if has_key(map, a:bufnr) |
||||
return map[a:bufnr] |
||||
endif |
||||
|
||||
" if we get here, the buffer list isn't in sync with the selected buffer yet, fall back to the default |
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) |
||||
endfunction |
@ -0,0 +1,91 @@
@@ -0,0 +1,91 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:skip_symbol = '…' |
||||
|
||||
function! airline#extensions#tabline#formatters#unique_tail_improved#format(bufnr, buffers) |
||||
if len(a:buffers) <= 1 " don't need to compare bufnames if has less than one buffer opened |
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) |
||||
endif |
||||
|
||||
let curbuf_tail = fnamemodify(bufname(a:bufnr), ':t') |
||||
let do_deduplicate = 0 |
||||
let path_tokens = {} |
||||
|
||||
for nr in a:buffers |
||||
let name = bufname(nr) |
||||
if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail " only perform actions if curbuf_tail isn't unique |
||||
let do_deduplicate = 1 |
||||
let tokens = reverse(split(substitute(fnamemodify(name, ':p:h'), '\\', '/', 'g'), '/')) |
||||
let token_index = 0 |
||||
for token in tokens |
||||
if token == '' | continue | endif |
||||
if token == '.' | break | endif |
||||
if !has_key(path_tokens, token_index) |
||||
let path_tokens[token_index] = {} |
||||
endif |
||||
let path_tokens[token_index][token] = 1 |
||||
let token_index += 1 |
||||
endfor |
||||
endif |
||||
endfor |
||||
|
||||
if do_deduplicate == 1 |
||||
let path = [] |
||||
let token_index = 0 |
||||
for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:h'), '\\', '/', 'g'), '/')) |
||||
if token == '.' | break | endif |
||||
let duplicated = 0 |
||||
let uniq = 1 |
||||
let single = 1 |
||||
if has_key(path_tokens, token_index) |
||||
let duplicated = 1 |
||||
if len(keys(path_tokens[token_index])) > 1 | let single = 0 | endif |
||||
if has_key(path_tokens[token_index], token) | let uniq = 0 | endif |
||||
endif |
||||
call insert(path, {'token': token, 'duplicated': duplicated, 'uniq': uniq, 'single': single}) |
||||
let token_index += 1 |
||||
endfor |
||||
|
||||
let buf_name = [curbuf_tail] |
||||
let has_uniq = 0 |
||||
let has_skipped = 0 |
||||
for token1 in reverse(path) |
||||
if !token1['duplicated'] && len(buf_name) > 1 |
||||
call insert(buf_name, s:skip_symbol) |
||||
let has_skipped = 0 |
||||
break |
||||
endif |
||||
|
||||
if has_uniq == 1 |
||||
call insert(buf_name, s:skip_symbol) |
||||
let has_skipped = 0 |
||||
break |
||||
endif |
||||
|
||||
if token1['uniq'] == 0 && token1['single'] == 1 |
||||
let has_skipped = 1 |
||||
else |
||||
if has_skipped == 1 |
||||
call insert(buf_name, s:skip_symbol) |
||||
let has_skipped = 0 |
||||
endif |
||||
call insert(buf_name, token1['token']) |
||||
endif |
||||
|
||||
if token1['uniq'] == 1 |
||||
let has_uniq = 1 |
||||
endif |
||||
endfor |
||||
|
||||
if has_skipped == 1 |
||||
call insert(buf_name, s:skip_symbol) |
||||
endif |
||||
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, join(buf_name, '/')) |
||||
else |
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) |
||||
endif |
||||
endfunction |
@ -0,0 +1,134 @@
@@ -0,0 +1,134 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:spc = g:airline_symbols.space |
||||
let s:current_bufnr = -1 |
||||
let s:current_tabnr = -1 |
||||
let s:current_modified = 0 |
||||
|
||||
function! airline#extensions#tabline#tabs#off() |
||||
augroup airline_tabline_tabs |
||||
autocmd! |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#tabs#on() |
||||
augroup airline_tabline_tabs |
||||
autocmd! |
||||
autocmd BufDelete * call airline#extensions#tabline#tabs#invalidate() |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#tabs#invalidate() |
||||
let s:current_bufnr = -1 |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#tabs#get() |
||||
let curbuf = bufnr('%') |
||||
let curtab = tabpagenr() |
||||
try |
||||
call airline#extensions#tabline#tabs#map_keys() |
||||
catch |
||||
" no-op |
||||
endtry |
||||
if curbuf == s:current_bufnr && curtab == s:current_tabnr && &columns == s:column_width |
||||
if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified |
||||
return s:current_tabline |
||||
endif |
||||
endif |
||||
|
||||
let b = airline#extensions#tabline#new_builder() |
||||
|
||||
call airline#extensions#tabline#add_label(b, 'tabs', 0) |
||||
|
||||
function! b.get_group(i) dict |
||||
let curtab = tabpagenr() |
||||
let group = 'airline_tab' |
||||
if a:i == curtab |
||||
let group = 'airline_tabsel' |
||||
if g:airline_detect_modified |
||||
for bi in tabpagebuflist(curtab) |
||||
if getbufvar(bi, '&modified') |
||||
let group = 'airline_tabmod' |
||||
endif |
||||
endfor |
||||
endif |
||||
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 |
||||
endif |
||||
return group |
||||
endfunction |
||||
|
||||
function! b.get_title(i) dict |
||||
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) |
||||
endif |
||||
|
||||
return val.'%'.a:i.'T %{airline#extensions#tabline#title('.a:i.')} %)' |
||||
endfunction |
||||
|
||||
call b.insert_titles(curtab, 1, tabpagenr('$')) |
||||
|
||||
call b.add_section('airline_tabfill', '') |
||||
call b.split() |
||||
call b.add_section('airline_tabfill', '') |
||||
|
||||
if get(g:, 'airline#extensions#tabline#show_close_button', 1) |
||||
call b.add_section('airline_tab_right', ' %999X'. |
||||
\ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ') |
||||
endif |
||||
|
||||
if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1 |
||||
let buffers = tabpagebuflist(curtab) |
||||
for nr in buffers |
||||
let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right" |
||||
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)') |
||||
endfor |
||||
if get(g:, 'airline#extensions#tabline#show_buffers', 1) |
||||
call airline#extensions#tabline#add_label(b, 'buffers', 1) |
||||
endif |
||||
endif |
||||
call airline#extensions#tabline#add_tab_label(b) |
||||
|
||||
let s:current_bufnr = curbuf |
||||
let s:current_tabnr = curtab |
||||
let s:column_width = &columns |
||||
let s:current_tabline = b.build() |
||||
return s:current_tabline |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#tabs#map_keys() |
||||
if maparg('<Plug>AirlineSelectTab1', 'n') is# ':1tabn<CR>' |
||||
return |
||||
endif |
||||
let bidx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1) |
||||
if bidx_mode == 1 |
||||
for i in range(1, 10) |
||||
exe printf('noremap <silent> <Plug>AirlineSelectTab%d :%dtabn<CR>', i%10, i) |
||||
endfor |
||||
else |
||||
for i in range(11, 99) |
||||
exe printf('noremap <silent> <Plug>AirlineSelectTab%d :%dtabn<CR>', i, i-10) |
||||
endfor |
||||
endif |
||||
noremap <silent> <Plug>AirlineSelectPrevTab gT |
||||
" tabn {count} goes to count tab does not go {count} tab pages forward! |
||||
noremap <silent> <Plug>AirlineSelectNextTab :<C-U>exe repeat(':tabn\|', v:count1)<cr> |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i) abort |
||||
let formatter = get(g:, 'airline#extensions#tabline#tabnr_formatter', 'tabnr') |
||||
try |
||||
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, a:i) |
||||
catch /^Vim\%((\a\+)\)\=:E117/ " catch E117, unknown function |
||||
" Function not found |
||||
return call(formatter, [a:nr, a:i]) |
||||
catch |
||||
" something went wrong, return an empty string |
||||
return "" |
||||
endtry |
||||
endfunction |
@ -0,0 +1,154 @@
@@ -0,0 +1,154 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:current_bufnr = -1 |
||||
let s:current_modified = 0 |
||||
let s:current_tabnr = -1 |
||||
let s:current_tabline = '' |
||||
let s:highlight_groups = ['hid', 0, '', 'sel', 'mod_unsel', 0, 'mod_unsel', 'mod'] |
||||
|
||||
function! airline#extensions#tabline#tabws#off() |
||||
augroup airline_tabline_tabws |
||||
autocmd! |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#tabws#on() |
||||
augroup airline_tabline_tabws |
||||
autocmd! |
||||
autocmd BufDelete * call airline#extensions#tabline#tabws#invalidate() |
||||
augroup END |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#tabws#invalidate() |
||||
let s:current_bufnr = -1 |
||||
let s:current_tabnr = -1 |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#tabws#add_buffer_section(builder, cur_tab, cur_buf, pull_right) |
||||
let pos_extension = (a:pull_right ? '_right' : '') |
||||
let bufnr_list = tabws#getbuffersfortab(a:cur_tab) |
||||
|
||||
if index(bufnr_list, a:cur_buf) == -1 && a:cur_tab == s:current_tabnr |
||||
return 0 |
||||
endif |
||||
|
||||
let s:current_modified = getbufvar(a:cur_buf, '&modified') |
||||
let visible_list = tabpagebuflist(a:cur_tab) |
||||
|
||||
for buffer in bufnr_list |
||||
let group = 'airline_tab' |
||||
\ .s:highlight_groups[(4 * getbufvar(buffer, '&modified')) + (2 * (index(visible_list, buffer) != -1)) + (a:cur_buf == buffer)] |
||||
\ .pos_extension |
||||
|
||||
let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.')}%)' |
||||
|
||||
if has("tablineat") |
||||
let buf_name = '%'.buffer.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X' |
||||
endif |
||||
|
||||
call a:builder.add_section_spaced(group, buf_name) |
||||
endfor |
||||
|
||||
" add by tenfy(tenfyzhong@qq.com) |
||||
" if the selected buffer was updated |
||||
" return true |
||||
return 1 |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#tabws#add_tab_section(builder, pull_right) |
||||
let pos_extension = (a:pull_right ? '_right' : '') |
||||
|
||||
for tab in range(1, tabpagenr('$')) |
||||
let current = tab == tabpagenr() |
||||
let group = 'airline_tab' |
||||
\ .s:highlight_groups[(3 * current)] |
||||
\ .pos_extension |
||||
|
||||
if get(g:, 'airline#extensions#tabline#tabws_show_tab_nr', 0) == 0 |
||||
call a:builder.add_section_spaced(group, '%'.tab.'T'.tabws#gettabname(tab).'%T') |
||||
else |
||||
call a:builder.add_section_spaced(group, '%'.tab.'T'.tab.(g:airline_symbols.space).tabws#gettabname(tab).'%T') |
||||
endif |
||||
endfor |
||||
endfunction |
||||
|
||||
function! airline#extensions#tabline#tabws#get() |
||||
let cur_buf = bufnr('%') |
||||
let buffer_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') |
||||
let tab_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') |
||||
let switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0) |
||||
|
||||
try |
||||
call airline#extensions#tabline#tabs#map_keys() |
||||
endtry |
||||
|
||||
let cur_tab = tabpagenr() |
||||
|
||||
if cur_buf == s:current_bufnr && cur_tab == s:current_tabnr |
||||
if !g:airline_detect_modified || getbufvar(cur_buf, '&modified') == s:current_modified |
||||
return s:current_tabline |
||||
endif |
||||
endif |
||||
|
||||
let builder = airline#extensions#tabline#new_builder() |
||||
|
||||
let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) |
||||
let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1) |
||||
|
||||
let AppendBuffers = function('airline#extensions#tabline#tabws#add_buffer_section', [builder, cur_tab, cur_buf]) |
||||
let AppendTabs = function('airline#extensions#tabline#tabws#add_tab_section', [builder]) |
||||
let AppendLabel = function(builder.add_section_spaced, ['airline_tabtype'], builder) |
||||
|
||||
" <= 1: |{Tabs} <tab| |
||||
" == 2: |{Buffers} <buffers| |
||||
" == 3: |buffers> {Buffers} {Tabs} <tabs| |
||||
let showing_mode = (2 * show_buffers) + (show_tabs) |
||||
let ignore_update = 0 |
||||
|
||||
" Add left tabline content |
||||
if showing_mode <= 1 " Tabs only mode |
||||
call AppendTabs(0) |
||||
elseif showing_mode == 2 " Buffers only mode |
||||
let ignore_update = !AppendBuffers(0) |
||||
else |
||||
if !switch_buffers_and_tabs |
||||
call AppendLabel(buffer_label) |
||||
let ignore_update = !AppendBuffers(0) |
||||
else |
||||
call AppendLabel(tab_label) |
||||
call AppendTabs(0) |
||||
endif |
||||
endif |
||||
|
||||
if ignore_update | return s:current_tabline | endif |
||||
|
||||
call builder.add_section('airline_tabfill', '') |
||||
call builder.split() |
||||
call builder.add_section('airline_tabfill', '') |
||||
|
||||
" Add right tabline content |
||||
if showing_mode <= 1 " Tabs only mode |
||||
call AppendLabel(tab_label) |
||||
elseif showing_mode == 2 " Buffers only mode |
||||
call AppendLabel(buffer_label) |
||||
else |
||||
if !switch_buffers_and_tabs |
||||
call AppendTabs(1) |
||||
call AppendLabel(tab_label) |
||||
else |
||||
let ignore_update = AppendBuffers(1) |
||||
call AppendLabel(buffer_label) |
||||
endif |
||||
endif |
||||
|
||||
if ignore_update | return s:current_tabline | endif |
||||
|
||||
let s:current_bufnr = cur_buf |
||||
let s:current_tabnr = cur_tab |
||||
let s:current_tabline = builder.build() |
||||
return s:current_tabline |
||||
endfunction |
@ -0,0 +1,396 @@
@@ -0,0 +1,396 @@
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
" xTabline - Reduced version for vim-airline |
||||
" Plugin: https://github.com/mg979/vim-xtabline |
||||
" 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-2021 Gianmaria Bajo <mg1979.git@gmail.com> |
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
|
||||
function! airline#extensions#tabline#xtabline#init() |
||||
|
||||
let s:state = 0 |
||||
|
||||
" initialize mappings |
||||
call airline#extensions#tabline#xtabline#maps() |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
" Variables |
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
let g:loaded_xtabline = 1 |
||||
let s:most_recent = -1 |
||||
let s:xtabline_filtering = 1 |
||||
|
||||
let t:xtl_excluded = get(g:, 'airline#extensions#tabline#exclude_buffers', []) |
||||
let t:xtl_accepted = [] |
||||
|
||||
let g:xtabline_include_previews = get(g:, 'xtabline_include_previews', 1) |
||||
|
||||
let g:xtabline_alt_action = get(g:, 'xtabline_alt_action', "buffer #") |
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
" Autocommands |
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
augroup plugin-xtabline |
||||
autocmd! |
||||
|
||||
autocmd TabNew * call s:Do('new') |
||||
autocmd TabEnter * call s:Do('enter') |
||||
autocmd TabLeave * call s:Do('leave') |
||||
autocmd TabClosed * call s:Do('close') |
||||
|
||||
autocmd BufEnter * let g:xtabline_changing_buffer = 0 |
||||
autocmd BufAdd,BufDelete,BufWrite * call airline#extensions#tabline#xtabline#filter_buffers() |
||||
augroup END |
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
" Commands |
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
com! XTabReopen call airline#extensions#tabline#xtabline#reopen_last_tab() |
||||
|
||||
endfunction |
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
" Mappings |
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! airline#extensions#tabline#xtabline#maps() |
||||
|
||||
if !exists('g:xtabline_disable_keybindings') |
||||
|
||||
fun! s:mapkeys(keys, plug) |
||||
if empty(mapcheck(a:keys)) && !hasmapto(a:plug) |
||||
silent! execute 'nmap <unique> '.a:keys.' '.a:plug |
||||
endif |
||||
endfun |
||||
|
||||
call s:mapkeys('<F5>','<Plug>XTablineToggleTabs') |
||||
call s:mapkeys('<leader><F5>','<Plug>XTablineToggleFiltering') |
||||
call s:mapkeys('<BS>','<Plug>XTablineSelectBuffer') |
||||
call s:mapkeys(']l','<Plug>XTablineNextBuffer') |
||||
call s:mapkeys('[l','<Plug>XTablinePrevBuffer') |
||||
call s:mapkeys('<leader>tr','<Plug>XTablineReopen') |
||||
endif |
||||
|
||||
nnoremap <unique> <script> <Plug>XTablineToggleTabs <SID>ToggleTabs |
||||
nnoremap <silent> <SID>ToggleTabs :call airline#extensions#tabline#xtabline#toggle_tabs()<cr> |
||||
|
||||
nnoremap <unique> <script> <Plug>XTablineToggleFiltering <SID>ToggleFiltering |
||||
nnoremap <silent> <SID>ToggleFiltering :call airline#extensions#tabline#xtabline#toggle_buffers()<cr> |
||||
|
||||
nnoremap <unique> <script> <Plug>XTablineSelectBuffer <SID>SelectBuffer |
||||
nnoremap <silent> <expr> <SID>SelectBuffer g:xtabline_changing_buffer ? "\<C-c>" : ":<C-u>call airline#extensions#tabline#xtabline#select_buffer(v:count)\<cr>" |
||||
|
||||
nnoremap <unique> <script> <Plug>XTablineNextBuffer <SID>NextBuffer |
||||
nnoremap <silent> <expr> <SID>NextBuffer airline#extensions#tabline#xtabline#next_buffer(v:count1) |
||||
|
||||
nnoremap <unique> <script> <Plug>XTablinePrevBuffer <SID>PrevBuffer |
||||
nnoremap <silent> <expr> <SID>PrevBuffer airline#extensions#tabline#xtabline#prev_buffer(v:count1) |
||||
|
||||
nnoremap <unique> <script> <Plug>XTablineReopen <SID>ReopenLastTab |
||||
nnoremap <silent> <SID>ReopenLastTab :XTabReopen<cr> |
||||
|
||||
if get(g:, 'xtabline_cd_commands', 0) |
||||
map <unique> <leader>cdc <Plug>XTablineCdCurrent |
||||
map <unique> <leader>cdd <Plug>XTablineCdDown1 |
||||
map <unique> <leader>cd2 <Plug>XTablineCdDown2 |
||||
map <unique> <leader>cd3 <Plug>XTablineCdDown3 |
||||
map <unique> <leader>cdh <Plug>XTablineCdHome |
||||
nnoremap <unique> <script> <Plug>XTablineCdCurrent :cd %:p:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr> |
||||
nnoremap <unique> <script> <Plug>XTablineCdDown1 :cd %:p:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr> |
||||
nnoremap <unique> <script> <Plug>XTablineCdDown2 :cd %:p:h:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr> |
||||
nnoremap <unique> <script> <Plug>XTablineCdDown3 :cd %:p:h:h:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr> |
||||
nnoremap <unique> <script> <Plug>XTablineCdHome :cd ~<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr> |
||||
endif |
||||
endfunction |
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
" Commands functions |
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! airline#extensions#tabline#xtabline#toggle_tabs() |
||||
"""Toggle between tabs/buffers tabline.""" |
||||
|
||||
if tabpagenr("$") == 1 | call airline#util#warning("There is only one tab.") | return | endif |
||||
|
||||
if g:airline#extensions#tabline#show_tabs |
||||
let g:airline#extensions#tabline#show_tabs = 0 |
||||
call airline#util#warning("Showing buffers") |
||||
else |
||||
let g:airline#extensions#tabline#show_tabs = 1 |
||||
call airline#util#warning("Showing tabs") |
||||
endif |
||||
|
||||
doautocmd BufAdd |
||||
endfunction |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! airline#extensions#tabline#xtabline#toggle_buffers() |
||||
"""Toggle buffer filtering in the tabline.""" |
||||
|
||||
if s:xtabline_filtering |
||||
let s:xtabline_filtering = 0 |
||||
let g:airline#extensions#tabline#exclude_buffers = [] |
||||
call airline#util#warning("Buffer filtering turned off") |
||||
doautocmd BufAdd |
||||
else |
||||
let s:xtabline_filtering = 1 |
||||
call airline#extensions#tabline#xtabline#filter_buffers() |
||||
call airline#util#warning("Buffer filtering turned on") |
||||
doautocmd BufAdd |
||||
endif |
||||
endfunction |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! airline#extensions#tabline#xtabline#reopen_last_tab() |
||||
"""Reopen the last closed tab.""" |
||||
|
||||
if !exists('s:most_recently_closed_tab') |
||||
call airline#util#warning("No recent tabs.") |
||||
return |
||||
endif |
||||
|
||||
let tab = s:most_recently_closed_tab |
||||
tabnew |
||||
let empty = bufnr("%") |
||||
let t:cwd = tab['cwd'] |
||||
cd `=t:cwd` |
||||
let t:name = tab['name'] |
||||
for buf in tab['buffers'] | execute "badd ".buf | endfor |
||||
execute "edit ".tab['buffers'][0] |
||||
execute "bdelete ".empty |
||||
endfunction |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! airline#extensions#tabline#xtabline#filter_buffers() |
||||
"""Filter buffers so that only the ones within the tab's cwd will show up. |
||||
|
||||
" 'accepted' is a list of buffer numbers, for quick access. |
||||
" 'excluded' is a list of buffer numbers, it will be used by Airline to hide buffers. |
||||
|
||||
if !s:xtabline_filtering | return | endif |
||||
|
||||
let g:airline#extensions#tabline#exclude_buffers = [] |
||||
let t:xtl_excluded = g:airline#extensions#tabline#exclude_buffers |
||||
let t:xtl_accepted = [] | let accepted = t:xtl_accepted |
||||
let previews = g:xtabline_include_previews |
||||
|
||||
" bufnr(0) is the alternate buffer |
||||
for buf in range(1, bufnr("$")) |
||||
|
||||
if !buflisted(buf) | continue | endif |
||||
|
||||
" get the path |
||||
let path = expand("#".buf.":p") |
||||
|
||||
" confront with the cwd |
||||
if !previews && path =~ "^".getcwd() |
||||
call add(accepted, buf) |
||||
elseif previews && path =~ getcwd() |
||||
call add(accepted, buf) |
||||
else |
||||
call add(t:xtl_excluded, buf) |
||||
endif |
||||
endfor |
||||
|
||||
call s:RefreshTabline() |
||||
endfunction |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! airline#extensions#tabline#xtabline#next_buffer(nr) |
||||
"""Switch to next visible buffer.""" |
||||
|
||||
if ( s:NotEnoughBuffers() || !s:xtabline_filtering ) | return | endif |
||||
let accepted = t:xtl_accepted |
||||
|
||||
let ix = index(accepted, bufnr("%")) |
||||
let target = ix + a:nr |
||||
let total = len(accepted) |
||||
|
||||
if ix == -1 |
||||
" not in index, go back to most recent or back to first |
||||
if s:most_recent == -1 || s:most_recent >= total |
||||
let s:most_recent = 0 |
||||
endif |
||||
|
||||
elseif target >= total |
||||
" over last buffer |
||||
while target >= total | let target -= total | endwhile |
||||
let s:most_recent = target |
||||
|
||||
else |
||||
let s:most_recent = target |
||||
endif |
||||
|
||||
return ":buffer " . accepted[s:most_recent] . "\<cr>" |
||||
endfunction |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! airline#extensions#tabline#xtabline#prev_buffer(nr) |
||||
"""Switch to previous visible buffer.""" |
||||
|
||||
if ( s:NotEnoughBuffers() || !s:xtabline_filtering ) | return | endif |
||||
let accepted = t:xtl_accepted |
||||
|
||||
let ix = index(accepted, bufnr("%")) |
||||
let target = ix - a:nr |
||||
let total = len(accepted) |
||||
|
||||
if ix == -1 |
||||
" not in index, go back to most recent or back to first |
||||
if s:most_recent == -1 || s:most_recent >= total |
||||
let s:most_recent = 0 |
||||
endif |
||||
|
||||
elseif target < 0 |
||||
" before first buffer |
||||
while target < 0 | let target += total | endwhile |
||||
let s:most_recent = target |
||||
|
||||
else |
||||
let s:most_recent = target |
||||
endif |
||||
|
||||
return ":buffer " . accepted[s:most_recent] . "\<cr>" |
||||
endfunction |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! airline#extensions#tabline#xtabline#select_buffer(nr) |
||||
"""Switch to visible buffer in the tabline with [count].""" |
||||
|
||||
if ( a:nr == 0 || !s:xtabline_filtering ) | execute g:xtabline_alt_action | return | endif |
||||
let accepted = t:xtl_accepted |
||||
|
||||
if (a:nr > len(accepted)) || s:NotEnoughBuffers() || accepted[a:nr - 1] == bufnr("%") |
||||
return |
||||
else |
||||
let g:xtabline_changing_buffer = 1 |
||||
execute "buffer ".accepted[a:nr - 1] |
||||
endif |
||||
endfunction |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! s:TabBuffers() |
||||
"""Return a list of buffers names for this tab.""" |
||||
|
||||
return map(copy(t:xtl_accepted), 'bufname(v:val)') |
||||
endfunction |
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
" Helper functions |
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! s:NotEnoughBuffers() |
||||
"""Just return if there aren't enough buffers.""" |
||||
|
||||
if len(t:xtl_accepted) < 2 |
||||
if index(t:xtl_accepted, bufnr("%")) == -1 |
||||
return |
||||
elseif !len(t:xtl_accepted) |
||||
call airline#util#warning("No available buffers for this tab.") |
||||
else |
||||
call airline#util#warning("No other available buffers for this tab.") |
||||
endif |
||||
return 1 |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:RefreshTabline() |
||||
call airline#extensions#tabline#buflist#invalidate() |
||||
endfunction |
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
" TabPageCd |
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
" tabpagecd - Turn :cd into :tabpagecd, to use one tab page per project |
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! s:InitCwds() |
||||
if !exists('g:xtab_cwds') | let g:xtab_cwds = [] | endif |
||||
|
||||
while len(g:xtab_cwds) < tabpagenr("$") |
||||
call add(g:xtab_cwds, getcwd()) |
||||
endwhile |
||||
let s:state = 1 |
||||
let t:cwd = getcwd() |
||||
let s:last_tab = 0 |
||||
call airline#extensions#tabline#xtabline#filter_buffers() |
||||
endfunction |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! airline#extensions#tabline#xtabline#update_obsession() |
||||
let string = 'let g:xtab_cwds = '.string(g:xtab_cwds).' | call airline#extensions#tabline#xtabline#update_obsession()' |
||||
if !exists('g:obsession_append') |
||||
let g:obsession_append = [string] |
||||
else |
||||
call filter(g:obsession_append, 'v:val !~# "^let g:xtab_cwds"') |
||||
call add(g:obsession_append, string) |
||||
endif |
||||
endfunction |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
function! s:Do(action) |
||||
let arg = a:action |
||||
if !s:state | call s:InitCwds() | return | endif |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
if arg == 'new' |
||||
|
||||
call insert(g:xtab_cwds, getcwd(), tabpagenr()-1) |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
elseif arg == 'enter' |
||||
|
||||
let t:cwd =g:xtab_cwds[tabpagenr()-1] |
||||
|
||||
cd `=t:cwd` |
||||
call airline#extensions#tabline#xtabline#filter_buffers() |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
elseif arg == 'leave' |
||||
|
||||
let t:cwd = getcwd() |
||||
let g:xtab_cwds[tabpagenr()-1] = t:cwd |
||||
let s:last_tab = tabpagenr() - 1 |
||||
|
||||
if !exists('t:name') | let t:name = t:cwd | endif |
||||
let s:most_recent_tab = {'cwd': t:cwd, 'name': t:name, 'buffers': s:TabBuffers()} |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
elseif arg == 'close' |
||||
|
||||
let s:most_recently_closed_tab = copy(s:most_recent_tab) |
||||
call remove(g:xtab_cwds, s:last_tab) |
||||
endif |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
||||
|
||||
call airline#extensions#tabline#xtabline#update_obsession() |
||||
endfunction |
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
call airline#parts#define_function('tmode', 'airline#extensions#term#termmode') |
||||
call airline#parts#define('terminal', {'text': get(g:airline_mode_map, 't', 't'), 'accent': 'bold'}) |
||||
|
||||
let s:spc = g:airline_symbols.space |
||||
|
||||
let s:section_a = airline#section#create_left(['terminal', 'tmode']) |
||||
let s:section_z = airline#section#create(['linenr', 'maxlinenr']) |
||||
|
||||
function! airline#extensions#term#apply(...) abort |
||||
if &buftype ==? 'terminal' || bufname(a:2.bufnr)[0] ==? '!' |
||||
call a:1.add_section_spaced('airline_a', s:section_a) |
||||
call a:1.add_section_spaced('airline_b', s:neoterm_id(a:2.bufnr)) |
||||
call a:1.add_section('airline_term', s:spc.s:termname(a:2.bufnr)) |
||||
call a:1.split() |
||||
call a:1.add_section('airline_y', '') |
||||
call a:1.add_section_spaced('airline_z', s:section_z) |
||||
return 1 |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#term#inactive_apply(...) abort |
||||
if getbufvar(a:2.bufnr, '&buftype') ==? 'terminal' |
||||
call a:1.add_section_spaced('airline_a', s:section_a) |
||||
call a:1.add_section_spaced('airline_b', s:neoterm_id(a:2.bufnr)) |
||||
call a:1.add_section('airline_term', s:spc.s:termname(a:2.bufnr)) |
||||
call a:1.split() |
||||
call a:1.add_section('airline_y', '') |
||||
call a:1.add_section_spaced('airline_z', s:section_z) |
||||
return 1 |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#term#termmode() abort |
||||
let mode = airline#parts#mode()[0] |
||||
if mode ==? 'T' || mode ==? '-' |
||||
" We don't need to output T, the statusline already says "TERMINAL". |
||||
" Also we don't want to output "-" on an inactive statusline. |
||||
let mode = '' |
||||
endif |
||||
return mode |
||||
endfunction |
||||
|
||||
function! s:termname(bufnr) abort |
||||
let bufname = bufname(a:bufnr) |
||||
if has('nvim') |
||||
" Get rid of the leading "term", working dir and process ID. |
||||
" Afterwards, remove the possibly added neoterm ID. |
||||
return substitute(matchstr(bufname, 'term.*:\zs.*'), |
||||
\ ';#neoterm-\d\+', '', '') |
||||
else |
||||
if bufname =~? 'neoterm-\d\+' |
||||
" Do not return a redundant buffer name, when this is a neoterm terminal. |
||||
return '' |
||||
endif |
||||
" Get rid of the leading "!". |
||||
if bufname[0] ==? '!' |
||||
return bufname[1:] |
||||
else |
||||
return bufname |
||||
endif |
||||
endif |
||||
endfunction |
||||
|
||||
function! s:neoterm_id(bufnr) abort |
||||
let id = getbufvar(a:bufnr, 'neoterm_id') |
||||
if id !=? '' |
||||
let id = 'neoterm-'.id |
||||
endif |
||||
return id |
||||
endfunction |
||||
|
||||
function! airline#extensions#term#init(ext) abort |
||||
call a:ext.add_statusline_func('airline#extensions#term#apply') |
||||
call a:ext.add_inactive_statusline_func('airline#extensions#term#inactive_apply') |
||||
endfunction |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !exists(':Tmuxline') |
||||
finish |
||||
endif |
||||
|
||||
let s:tmuxline_snapshot_file = get(g:, 'airline#extensions#tmuxline#snapshot_file', '') |
||||
let s:color_template = get(g:, 'airline#extensions#tmuxline#color_template', 'normal') |
||||
|
||||
function! airline#extensions#tmuxline#init(ext) |
||||
call a:ext.add_theme_func('airline#extensions#tmuxline#set_tmux_colors') |
||||
endfunction |
||||
|
||||
function! airline#extensions#tmuxline#set_tmux_colors(palette) |
||||
let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' |
||||
let mode_palette = a:palette[color_template] |
||||
|
||||
let tmuxline_theme = tmuxline#api#create_theme_from_airline(mode_palette) |
||||
call tmuxline#api#set_theme(tmuxline_theme) |
||||
|
||||
if strlen(s:tmuxline_snapshot_file) |
||||
call tmuxline#api#snapshot(s:tmuxline_snapshot_file) |
||||
endif |
||||
endfunction |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !get(g:, 'loaded_unicodePlugin', 0) |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#unicode#apply(...) |
||||
if exists(":UnicodeTable") == 2 && bufname('') ==# 'UnicodeTable' |
||||
call airline#parts#define('unicode', { |
||||
\ 'text': '[UnicodeTable]', |
||||
\ 'accent': 'bold' }) |
||||
let w:airline_section_a = airline#section#create(['unicode']) |
||||
let w:airline_section_b = '' |
||||
let w:airline_section_c = ' ' |
||||
let w:airline_section_y = '' |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#unicode#init(ext) |
||||
call a:ext.add_statusline_func('airline#extensions#unicode#apply') |
||||
endfunction |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
" MIT License. Copyright (c) 2016-2021 Jerome Reybert et al. |
||||
" Plugin: https://github.com/jreybert/vimagit |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
" This plugin replaces the whole section_a when in vimagit buffer |
||||
scriptencoding utf-8 |
||||
|
||||
if !get(g:, 'loaded_magit', 0) |
||||
finish |
||||
endif |
||||
|
||||
let s:commit_mode = {'ST': 'STAGING', 'CC': 'COMMIT', 'CA': 'AMEND'} |
||||
|
||||
function! airline#extensions#vimagit#init(ext) abort |
||||
call a:ext.add_statusline_func('airline#extensions#vimagit#apply') |
||||
endfunction |
||||
|
||||
function! airline#extensions#vimagit#get_mode() abort |
||||
if ( exists("*magit#get_current_mode") ) |
||||
return magit#get_current_mode() |
||||
else |
||||
return get(s:commit_mode, b:magit_current_commit_mode, '???') |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#vimagit#apply(...) abort |
||||
if ( &filetype == 'magit' ) |
||||
let w:airline_section_a = '%{airline#extensions#vimagit#get_mode()}' |
||||
endif |
||||
endfunction |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
function! airline#extensions#vimcmake#init(ext) abort |
||||
call a:ext.add_statusline_func('airline#extensions#vimcmake#apply') |
||||
call a:ext.add_inactive_statusline_func('airline#extensions#vimcmake#inactive_apply') |
||||
endfunction |
||||
|
||||
function! airline#extensions#vimcmake#apply(...) abort |
||||
if &filetype ==# 'vimcmake' |
||||
let spc = g:airline_symbols.space |
||||
call a:1.add_section('airline_a', spc.'CMake'.spc) |
||||
call a:1.add_section('airline_b', spc.'%{cmake#statusline#GetBuildInfo(1)}'.spc) |
||||
call a:1.add_section('airline_c', spc.'%{cmake#statusline#GetCmdInfo()}'.spc) |
||||
return 1 |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#vimcmake#inactive_apply(...) abort |
||||
if getbufvar(a:2.bufnr, '&filetype') ==# 'vimcmake' |
||||
let spc = g:airline_symbols.space |
||||
call a:1.add_section('airline_a', spc.'[CMake]') |
||||
call a:1.add_section('airline_b', spc.'%{cmake#statusline#GetBuildInfo(0)}') |
||||
call a:1.add_section('airline_c', spc.'%{cmake#statusline#GetCmdInfo()}') |
||||
return 1 |
||||
endif |
||||
endfunction |
@ -0,0 +1,84 @@
@@ -0,0 +1,84 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" Plugin: https://github.com/lervag/vimtex |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
let s:spc = g:airline_symbols.space |
||||
|
||||
function! s:SetDefault(var, val) |
||||
if !exists(a:var) |
||||
execute 'let ' . a:var . '=' . string(a:val) |
||||
endif |
||||
endfunction |
||||
|
||||
" Left and right delimiters (added only when status string is not empty) |
||||
call s:SetDefault( 'g:airline#extensions#vimtex#left', "{") |
||||
call s:SetDefault( 'g:airline#extensions#vimtex#right', "}") |
||||
|
||||
" The current tex file is the main project file |
||||
call s:SetDefault( 'g:airline#extensions#vimtex#main', "" ) |
||||
" |
||||
" The current tex file is a subfile of the project |
||||
" and the compilation is set for the main file |
||||
call s:SetDefault( 'g:airline#extensions#vimtex#sub_main', "m") |
||||
" |
||||
" The current tex file is a subfile of the project |
||||
" and the compilation is set for this subfile |
||||
call s:SetDefault( 'g:airline#extensions#vimtex#sub_local', "l") |
||||
" |
||||
" Compilation is running and continuous compilation is off |
||||
call s:SetDefault( 'g:airline#extensions#vimtex#compiled', "c₁") |
||||
|
||||
" Compilation is running and continuous compilation is on |
||||
call s:SetDefault( 'g:airline#extensions#vimtex#continuous', "c") |
||||
|
||||
" Viewer is opened |
||||
call s:SetDefault( 'g:airline#extensions#vimtex#viewer', "v") |
||||
|
||||
function! airline#extensions#vimtex#init(ext) |
||||
call airline#parts#define_raw('vimtex', '%{airline#extensions#vimtex#get_scope()}') |
||||
call a:ext.add_statusline_func('airline#extensions#vimtex#apply') |
||||
endfunction |
||||
|
||||
function! airline#extensions#vimtex#apply(...) |
||||
if exists("b:vimtex") |
||||
let w:airline_section_x = get(w:, 'airline_section_x', g:airline_section_x) |
||||
let w:airline_section_x.=s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#vimtex#get_scope()}' |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#vimtex#get_scope() |
||||
let l:status = '' |
||||
|
||||
let vt_local = get(b:, 'vimtex_local', {}) |
||||
if empty(vt_local) |
||||
let l:status .= g:airline#extensions#vimtex#main |
||||
else |
||||
if get(vt_local, 'active') |
||||
let l:status .= g:airline#extensions#vimtex#sub_local |
||||
else |
||||
let l:status .= g:airline#extensions#vimtex#sub_main |
||||
endif |
||||
endif |
||||
|
||||
if get(get(get(b:, 'vimtex', {}), 'viewer', {}), 'xwin_id') |
||||
let l:status .= g:airline#extensions#vimtex#viewer |
||||
endif |
||||
|
||||
let l:compiler = get(get(b:, 'vimtex', {}), 'compiler', {}) |
||||
if !empty(l:compiler) |
||||
if has_key(l:compiler, 'is_running') && b:vimtex.compiler.is_running() |
||||
if get(l:compiler, 'continuous') |
||||
let l:status .= g:airline#extensions#vimtex#continuous |
||||
else |
||||
let l:status .= g:airline#extensions#vimtex#compiled |
||||
endif |
||||
endif |
||||
endif |
||||
|
||||
if !empty(l:status) |
||||
let l:status = g:airline#extensions#vimtex#left . l:status . g:airline#extensions#vimtex#right |
||||
endif |
||||
return l:status |
||||
endfunction |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
" MIT License. Copyright (c) 2021 s1341 (github@shmarya.net) |
||||
" Plugin: https://github.com/liuchengxu/vista.vim |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
if !get(g:, 'loaded_vista', 0) |
||||
finish |
||||
endif |
||||
|
||||
function! airline#extensions#vista#currenttag() abort |
||||
if get(w:, 'airline_active', 0) |
||||
return airline#util#shorten(get(b:, 'vista_nearest_method_or_function', ''), 91, 9) |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#vista#init(ext) abort |
||||
call airline#parts#define_function('vista', 'airline#extensions#vista#currenttag') |
||||
endfunction |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !exists('g:loaded_windowswap') |
||||
finish |
||||
endif |
||||
|
||||
let s:spc = g:airline_symbols.space |
||||
|
||||
if !exists('g:airline#extensions#windowswap#indicator_text') |
||||
let g:airline#extensions#windowswap#indicator_text = 'WS' |
||||
endif |
||||
|
||||
function! airline#extensions#windowswap#init(ext) |
||||
call airline#parts#define_function('windowswap', 'airline#extensions#windowswap#get_status') |
||||
endfunction |
||||
|
||||
function! airline#extensions#windowswap#get_status() |
||||
" use new tab-aware api if WS is up to date |
||||
let s:mark = exists('*WindowSwap#IsCurrentWindowMarked') ? |
||||
\WindowSwap#IsCurrentWindowMarked() : |
||||
\(WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr()) |
||||
if s:mark |
||||
return g:airline#extensions#windowswap#indicator_text.s:spc |
||||
endif |
||||
return '' |
||||
endfunction |
@ -0,0 +1,118 @@
@@ -0,0 +1,118 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 fdm=marker |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
" get wordcount {{{1 |
||||
if exists('*wordcount') |
||||
function! s:get_wordcount(visual_mode_active) |
||||
if get(g:, 'actual_curbuf', '') != bufnr('') |
||||
return |
||||
endif |
||||
let query = a:visual_mode_active ? 'visual_words' : 'words' |
||||
return get(wordcount(), query, 0) |
||||
endfunction |
||||
else " Pull wordcount from the g_ctrl-g stats |
||||
function! s:get_wordcount(visual_mode_active) |
||||
let pattern = a:visual_mode_active |
||||
\ ? '^.\D*\d\+\D\+\d\+\D\+\zs\d\+' |
||||
\ : '^.\D*\%(\d\+\D\+\)\{5}\zs\d\+' |
||||
|
||||
let save_status = v:statusmsg |
||||
if !a:visual_mode_active && col('.') == col('$') |
||||
let save_pos = getpos('.') |
||||
execute "silent normal! g\<c-g>" |
||||
call setpos('.', save_pos) |
||||
else |
||||
execute "silent normal! g\<c-g>" |
||||
endif |
||||
let stats = v:statusmsg |
||||
let v:statusmsg = save_status |
||||
|
||||
return str2nr(matchstr(stats, pattern)) |
||||
endfunction |
||||
endif |
||||
|
||||
" format {{{1 |
||||
let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default') |
||||
|
||||
" wrapper function for compatibility; redefined below for old-style formatters |
||||
function! s:format_wordcount(wordcount) |
||||
return airline#extensions#wordcount#formatters#{s:formatter}#to_string(a:wordcount) |
||||
endfunction |
||||
|
||||
" check user-defined formatter exists with appropriate functions, otherwise |
||||
" fall back to default |
||||
if s:formatter !=# 'default' |
||||
execute 'runtime! autoload/airline/extensions/wordcount/formatters/'.s:formatter.'.vim' |
||||
if !exists('*airline#extensions#wordcount#formatters#{s:formatter}#to_string') |
||||
if !exists('*airline#extensions#wordcount#formatters#{s:formatter}#format') |
||||
let s:formatter = 'default' |
||||
else |
||||
" redefine for backwords compatibility |
||||
function! s:format_wordcount(_) |
||||
if mode() ==? 'v' |
||||
return b:airline_wordcount |
||||
else |
||||
return airline#extensions#wordcount#formatters#{s:formatter}#format() |
||||
endif |
||||
endfunction |
||||
endif |
||||
endif |
||||
endif |
||||
|
||||
" update {{{1 |
||||
let s:wordcount_cache = 0 " cache wordcount for performance when force_update=0 |
||||
function! s:update_wordcount(force_update) |
||||
let wordcount = s:get_wordcount(0) |
||||
if wordcount != s:wordcount_cache || a:force_update |
||||
let s:wordcount_cache = wordcount |
||||
let b:airline_wordcount = s:format_wordcount(wordcount) |
||||
endif |
||||
endfunction |
||||
|
||||
function airline#extensions#wordcount#get() |
||||
if get(g:, 'airline#visual_active', 0) |
||||
return s:format_wordcount(s:get_wordcount(1)) |
||||
else |
||||
if get(b:, 'airline_changedtick', 0) != b:changedtick |
||||
call s:update_wordcount(0) |
||||
let b:airline_changedtick = b:changedtick |
||||
endif |
||||
return get(b:, 'airline_wordcount', '') |
||||
endif |
||||
endfunction |
||||
|
||||
" airline functions {{{1 |
||||
" default filetypes: |
||||
function! airline#extensions#wordcount#apply(...) |
||||
let filetypes = get(g:, 'airline#extensions#wordcount#filetypes', |
||||
\ ['asciidoc', 'help', 'mail', 'markdown', 'nroff', 'org', 'rst', 'plaintex', 'tex', 'text']) |
||||
" export current filetypes settings to global namespace |
||||
let g:airline#extensions#wordcount#filetypes = filetypes |
||||
|
||||
" Check if filetype needs testing |
||||
if did_filetype() |
||||
" correctly test for compound filetypes (e.g. markdown.pandoc) |
||||
let ft = substitute(&filetype, '\.', '\\|', 'g') |
||||
|
||||
" Select test based on type of "filetypes": new=list, old=string |
||||
if type(filetypes) == get(v:, 't_list', type([])) |
||||
\ ? match(filetypes, '\<'. ft. '\>') > -1 || index(filetypes, 'all') > -1 |
||||
\ : match(&filetype, filetypes) > -1 |
||||
let b:airline_changedtick = -1 |
||||
call s:update_wordcount(1) " force update: ensures initial worcount exists |
||||
elseif exists('b:airline_wordcount') " cleanup when filetype is removed |
||||
unlet b:airline_wordcount |
||||
endif |
||||
endif |
||||
|
||||
if exists('b:airline_wordcount') |
||||
call airline#extensions#prepend_to_section( |
||||
\ 'z', '%{airline#extensions#wordcount#get()}') |
||||
endif |
||||
endfunction |
||||
|
||||
function! airline#extensions#wordcount#init(ext) |
||||
call a:ext.add_statusline_func('airline#extensions#wordcount#apply') |
||||
endfunction |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
function! airline#extensions#wordcount#formatters#default#update_fmt(...) |
||||
let s:fmt = get(g:, 'airline#extensions#wordcount#formatter#default#fmt', '%s words') |
||||
let s:fmt_short = get(g:, 'airline#extensions#wordcount#formatter#default#fmt_short', s:fmt == '%s words' ? '%sW' : s:fmt) |
||||
endfunction |
||||
|
||||
" Reload format when statusline is rebuilt |
||||
call airline#extensions#wordcount#formatters#default#update_fmt() |
||||
|
||||
if index(g:airline_statusline_funcrefs, function('airline#extensions#wordcount#formatters#default#update_fmt')) == -1 |
||||
" only add it, if not already done |
||||
call airline#add_statusline_funcref(function('airline#extensions#wordcount#formatters#default#update_fmt')) |
||||
endif |
||||
|
||||
if match(get(v:, 'lang', ''), '\v\cC|en') > -1 |
||||
let s:decimal_group = ',' |
||||
elseif match(get(v:, 'lang', ''), '\v\cde|dk|fr|pt') > -1 |
||||
let s:decimal_group = '.' |
||||
else |
||||
let s:decimal_group = '' |
||||
endif |
||||
|
||||
function! airline#extensions#wordcount#formatters#default#to_string(wordcount) |
||||
if airline#util#winwidth() > 85 |
||||
if a:wordcount > 999 |
||||
" Format number according to locale, e.g. German: 1.245 or English: 1,245 |
||||
let wordcount = substitute(a:wordcount, '\d\@<=\(\(\d\{3\}\)\+\)$', s:decimal_group.'&', 'g') |
||||
else |
||||
let wordcount = a:wordcount |
||||
endif |
||||
let str = printf(s:fmt, wordcount) |
||||
else |
||||
let str = printf(s:fmt_short, a:wordcount) |
||||
endif |
||||
|
||||
let str .= g:airline_symbols.space |
||||
|
||||
if !empty(g:airline_right_alt_sep) |
||||
let str .= g:airline_right_alt_sep . g:airline_symbols.space |
||||
endif |
||||
|
||||
return str |
||||
endfunction |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
function! airline#extensions#wordcount#formatters#readingtime#update_fmt(...) abort |
||||
let s:fmt = get(g:, 'airline#extensions#wordcount#formatter#readingtime#fmt', 'About %s minutes') |
||||
let s:fmt_short = get(g:, 'airline#extensions#wordcount#formatter#readingtime#fmt_short', s:fmt ==# 'About %s minutes' ? '%sW' : s:fmt) |
||||
endfunction |
||||
|
||||
" Reload format when statusline is rebuilt |
||||
call airline#extensions#wordcount#formatters#readingtime#update_fmt() |
||||
|
||||
if index(g:airline_statusline_funcrefs, function('airline#extensions#wordcount#formatters#readingtime#update_fmt')) == -1 |
||||
" only add it, if not already done |
||||
call airline#add_statusline_funcref(function('airline#extensions#wordcount#formatters#readingtime#update_fmt')) |
||||
endif |
||||
|
||||
if match(get(v:, 'lang', ''), '\v\cC|en') > -1 |
||||
let s:decimal_group = ',' |
||||
elseif match(get(v:, 'lang', ''), '\v\cde|dk|fr|pt') > -1 |
||||
let s:decimal_group = '.' |
||||
else |
||||
let s:decimal_group = '' |
||||
endif |
||||
|
||||
function! airline#extensions#wordcount#formatters#readingtime#to_string(wordcount) abort |
||||
if airline#util#winwidth() > 85 |
||||
if a:wordcount > 999 |
||||
" Format number according to locale, e.g. German: 1.245 or English: 1,245 |
||||
let wordcount = substitute(a:wordcount, '\d\@<=\(\(\d\{3\}\)\+\)$', s:decimal_group.'&', 'g') |
||||
else |
||||
let wordcount = a:wordcount |
||||
endif |
||||
let str = printf(s:fmt, ceil(wordcount / 200.0)) |
||||
else |
||||
let str = printf(s:fmt_short, ceil(a:wordcount / 200.0)) |
||||
endif |
||||
|
||||
let str .= g:airline_symbols.space |
||||
|
||||
if !empty(g:airline_right_alt_sep) |
||||
let str .= g:airline_right_alt_sep . g:airline_symbols.space |
||||
endif |
||||
|
||||
return str |
||||
endfunction |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
" 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') |
||||
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 has_key(short_codes, keyboard_layout) |
||||
let keyboard_layout = short_codes[keyboard_layout] |
||||
endif |
||||
|
||||
return keyboard_layout |
||||
endfunction |
||||
|
||||
function! airline#extensions#xkblayout#init(ext) |
||||
call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status') |
||||
endfunction |
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
if !get(g:, 'loaded_youcompleteme', 0) |
||||
finish |
||||
endif |
||||
|
||||
let s:spc = g:airline_symbols.space |
||||
let s:error_symbol = get(g:, 'airline#extensions#ycm#error_symbol', 'E:') |
||||
let s:warning_symbol = get(g:, 'airline#extensions#ycm#warning_symbol', 'W:') |
||||
|
||||
function! airline#extensions#ycm#init(ext) |
||||
call airline#parts#define_function('ycm_error_count', 'airline#extensions#ycm#get_error_count') |
||||
call airline#parts#define_function('ycm_warning_count', 'airline#extensions#ycm#get_warning_count') |
||||
endfunction |
||||
|
||||
function! airline#extensions#ycm#get_error_count() abort |
||||
if exists("*youcompleteme#GetErrorCount") |
||||
let cnt = youcompleteme#GetErrorCount() |
||||
|
||||
if cnt != 0 |
||||
return s:error_symbol.cnt |
||||
endif |
||||
endif |
||||
|
||||
return '' |
||||
endfunction |
||||
|
||||
function! airline#extensions#ycm#get_warning_count() |
||||
if exists("*youcompleteme#GetWarningCount") |
||||
let cnt = youcompleteme#GetWarningCount() |
||||
|
||||
if cnt != 0 |
||||
return s:warning_symbol.cnt.s:spc |
||||
endif |
||||
endif |
||||
|
||||
return '' |
||||
endfunction |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
" 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 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
|
||||
" Avoid installing twice |
||||
if exists('g:loaded_vim_airline_zoomwintab') |
||||
finish |
||||
endif |
||||
|
||||
let g:loaded_vim_airline_zoomwintab = 1 |
||||
|
||||
let s:zoomwintab_status_zoomed_in = |
||||
\ get(g:, 'airline#extensions#zoomwintab#status_zoomed_in', g:airline_left_alt_sep.' Zoomed') |
||||
let s:zoomwintab_status_zoomed_out = |
||||
\ get(g:, 'airline#extensions#zoomwintab#status_zoomed_out', '') |
||||
|
||||
function! airline#extensions#zoomwintab#apply(...) abort |
||||
call airline#extensions#prepend_to_section('gutter', |
||||
\ exists('t:zoomwintab') ? s:zoomwintab_status_zoomed_in : s:zoomwintab_status_zoomed_out) |
||||
endfunction |
||||
|
||||
function! airline#extensions#zoomwintab#init(ext) abort |
||||
call a:ext.add_statusline_func('airline#extensions#zoomwintab#apply') |
||||
endfunction |
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
scriptencoding utf-8 |
||||
|
||||
function! airline#formatter#short_path#format(val) abort |
||||
if get(g:, 'airline_stl_path_style', 'default') ==# 'short' |
||||
return '%{pathshorten(expand("'.a:val.'"))}' |
||||
endif |
||||
return a:val |
||||
endfunction |
@ -0,0 +1,59 @@
@@ -0,0 +1,59 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling Christian Brabandt et al. |
||||
" vim: et ts=2 sts=2 sw=2 |
||||
|
||||
scriptencoding utf-8 |
||||
|
||||
" basic 16 msdos from MSDOS |
||||
" see output of color, should be |
||||
" 0 Black |
||||
" 1 DarkBlue |
||||
" 2 DarkGreen |
||||
" 3 DarkCyan |
||||
" 4 DarkRed |
||||
" 5 DarkMagenta |
||||
" 6 Brown |
||||
" 7 LightGray |
||||
" 8 DarkGray |
||||
" 9 Blue |
||||
" 10 Green |
||||
" 11 Cyan |
||||
" 12 Red |
||||
" 13 Magenta |
||||
" 14 Yellow |
||||
" 15 White |
||||
|
||||
let s:basic16 = [ |
||||
\ [ 0x00, 0x00, 0x00 ], |
||||
\ [ 0x00, 0x00, 0x80 ], |
||||
\ [ 0x00, 0x80, 0x00 ], |
||||
\ [ 0x00, 0x80, 0x80 ], |
||||
\ [ 0x80, 0x00, 0x00 ], |
||||
\ [ 0x80, 0x00, 0x80 ], |
||||
\ [ 0x80, 0x80, 0x00 ], |
||||
\ [ 0xC0, 0xC0, 0xC0 ], |
||||
\ [ 0x80, 0x80, 0x80 ], |
||||
\ [ 0x00, 0x00, 0xFF ], |
||||
\ [ 0x00, 0xFF, 0x00 ], |
||||
\ [ 0x00, 0xFF, 0xFF ], |
||||
\ [ 0xFF, 0x00, 0x00 ], |
||||
\ [ 0xFF, 0x00, 0xFF ], |
||||
\ [ 0xFF, 0xFF, 0x00 ], |
||||
\ [ 0xFF, 0xFF, 0xFF ] |
||||
\ ] |
||||
|
||||
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,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
" Normal mode |
||||
let s:N1 = [ '#ffffff' , '#5f00af' , 231 , 55 ] |
||||
let s:N2 = [ '#ffffff' , '#875fd7' , 231 , 98 ] |
||||
let s:N3 = [ '#333333' , '#efefef' , 59 , 255 ] |
||||
|
||||
" Insert mode |
||||
let s:I1 = [ '#ffffff' , '#005fff' , 231 , 27 ] |
||||
let s:I2 = [ '#ffffff' , '#00afff' , 231 , 39 ] |
||||
let s:I3 = [ '#333333' , '#efefef' , 59 , 255 ] |
||||
|
||||
" Visual mode |
||||
let s:V1 = [ '#121212' , '#ff5f00' , 233 , 202 ] |
||||
let s:V2 = [ '#121212' , '#ffaf00' , 233 , 214 ] |
||||
let s:V3 = [ '#333333' , '#efefef' , 59 , 255 ] |
||||
|
||||
" Replace mode |
||||
let s:R1 = [ '#ffffff' , '#ff0000' , 231 , 196 ] |
||||
let s:R2 = [ '#ffffff' , '#ff5f5f' , 231 , 203 ] |
||||
let s:R3 = [ '#333333' , '#efefef' , 59 , 255 ] |
||||
|
||||
let g:airline#themes#aurora#palette = {} |
||||
let g:airline#themes#aurora#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||
let g:airline#themes#aurora#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||
let g:airline#themes#aurora#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||
let g:airline#themes#aurora#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) |
||||
|
||||
" Inactive mode |
||||
let s:IN1 = [ '#9e9e9e' , '#9e9e9e' , 247 , 247 ] |
||||
let s:IN2 = [ '#efefef' , '#efefef' , 255 , 255 ] |
||||
|
||||
let s:IA = [ s:IN1[1] , s:IN2[1] , s:IN1[3] , s:IN2[3] , '' ] |
||||
let g:airline#themes#aurora#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
||||
|
||||
" CtrlP |
||||
if !get(g:, 'loaded_ctrlp', 0) |
||||
finish |
||||
endif |
||||
|
||||
let s:CP1 = [ '#ffffff' , '#5f00af' , 231 , 55 ] |
||||
let s:CP2 = [ '#ffffff' , '#875fd7' , 231 , 98 ] |
||||
let s:CP3 = [ '#5f00af' , '#ffffff' , 55 , 231 ] |
||||
|
||||
let g:airline#themes#aurora#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(s:CP1, s:CP2, s:CP3) |
||||
|
||||
" Tabline |
||||
let g:airline#themes#aurora#palette.tabline = { |
||||
\ 'airline_tab': [ '#ffffff' , '#5f00af' , 231 , 55 , '' ], |
||||
\ 'airline_tabsel': [ '#ffffff' , '#875fd7' , 231 , 98 , '' ], |
||||
\ 'airline_tabtype': [ '#ffffff' , '#875fd7' , 231 , 98 , '' ], |
||||
\ 'airline_tabfill': [ '#ffffff' , '#121212' , 231 , 16 , '' ], |
||||
\ 'airline_tabmod': [ '#ffffff' , '#ff5f5f' , 231 , 203 , '' ] |
||||
\ } |
@ -1,82 +0,0 @@
@@ -1,82 +0,0 @@
|
||||
" Vim Airline theme. |
||||
" |
||||
" Repository: https://github.com/idlua/badcat |
||||
" Author: Luan Vicente <hi[at]idlua.me> |
||||
|
||||
|
||||
" COLOR PALETTE -------------------------------------------------------------{{{ |
||||
let g:airline#themes#badcat#palette = {} |
||||
|
||||
let s:guiBlack = "#080808" |
||||
let s:guiGray = "#262626" |
||||
let s:guiLightgray = "#6c6c6c" |
||||
let s:guiWhite = "#e4e4e4" |
||||
let s:guiRed = "#ff5f5f" |
||||
let s:guiGreen = "#afd787" |
||||
let s:guiBlue = "#5fafd7" |
||||
let s:guiOrange = "#ffaf5f" |
||||
|
||||
let s:ctermBlack = "232" |
||||
let s:ctermGray = "235" |
||||
let s:ctermLightgray = "242" |
||||
let s:ctermWhite = "254" |
||||
let s:ctermRed = "203" |
||||
let s:ctermGreen = "150" |
||||
let s:ctermBlue = "074" |
||||
let s:ctermOrange = "215" |
||||
" }}} |
||||
" BASICS --------------------------------------------------------------------{{{ |
||||
let s:modified = { 'airline_c': [ '#ffb964', '', s:ctermRed, '', '' ] } |
||||
" }}} |
||||
|
||||
|
||||
" MODES SUPPORT |
||||
" NORMAL MODE ---------------------------------------------------------------{{{ |
||||
let s:N1 = [ s:guiWhite , s:guiBlack , s:ctermWhite , s:ctermGray ] |
||||
let s:N2 = [ s:guiLightgray , s:guiGray , s:ctermLightgray , s:ctermGray ] |
||||
let s:N3 = [ s:guiWhite , s:guiBlack , s:ctermWhite , s:ctermBlack ] |
||||
let g:airline#themes#badcat#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||
let g:airline#themes#badcat#palette.normal_modified = s:modified |
||||
" }}} |
||||
" INSERT MODE ---------------------------------------------------------------{{{ |
||||
let s:I1 = [ s:guiGreen , s:guiBlack , s:ctermGreen , s:ctermBlack ] |
||||
let s:I2 = [ s:guiBlack , s:guiGreen , s:ctermBlack , s:ctermGreen ] |
||||
let s:I3 = [ s:guiGreen , s:guiBlack , s:ctermGreen , s:ctermBlack ] |
||||
let g:airline#themes#badcat#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||
let g:airline#themes#badcat#palette.insert_modified = s:modified |
||||
" }}} |
||||
" VISUAL MODE ---------------------------------------------------------------{{{ |
||||
let s:V1 = [ s:guiBlue , s:guiBlack , s:ctermBlue , s:ctermBlack ] |
||||
let s:V2 = [ s:guiBlack , s:guiBlue , s:ctermBlack , s:ctermBlue ] |
||||
let s:V3 = [ s:guiBlue , s:guiBlack , s:ctermBlue , s:ctermBlack ] |
||||
let g:airline#themes#badcat#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||
let g:airline#themes#badcat#palette.visual_modified = s:modified |
||||
" }}} |
||||
" REPLACE MODE --------------------------------------------------------------{{{ |
||||
let s:R1 = [ s:guiOrange , s:guiBlack , s:ctermOrange , s:ctermBlack ] |
||||
let s:R2 = [ s:guiBlack , s:guiOrange , s:ctermBlack , s:ctermOrange ] |
||||
let s:R3 = [ s:guiOrange , s:guiBlack , s:ctermOrange , s:ctermBlack ] |
||||
let g:airline#themes#badcat#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) |
||||
let g:airline#themes#badcat#palette.replace_modified = s:modified |
||||
" }}} |
||||
" INACTIVE MODE -------------------------------------------------------------{{{ |
||||
let s:IN1 = [ s:guiBlack , s:guiGray , s:ctermBlack , s:ctermGray ] |
||||
let s:IN2 = [ s:guiLightgray , s:guiBlack , s:ctermLightgray , s:ctermBlack ] |
||||
let s:IN3 = [ s:guiLightgray , s:guiBlack , s:ctermLightgray , s:ctermBlack ] |
||||
let g:airline#themes#badcat#palette.inactive = airline#themes#generate_color_map(s:IN1, s:IN2, s:IN3) |
||||
let g:airline#themes#badcat#palette.inactive_modified = s:modified |
||||
" }}} |
||||
|
||||
|
||||
" SPECIFIC PLUGIN SUPPORT |
||||
" CtrlP ---------------------------------------------------------------------{{{ |
||||
if !get(g:, 'loaded_ctrlp', 0) |
||||
finish |
||||
endif |
||||
|
||||
let s:CP1 = [ s:guiWhite , s:guiGray , s:ctermWhite , s:ctermGray ] |
||||
let s:CP2 = [ s:guiWhite , s:guiGray , s:ctermWhite , s:ctermGray ] |
||||
let s:CP3 = [ s:guiWhite , s:guiBlack , s:ctermWhite , s:ctermBlack ] |
||||
|
||||
let g:airline#themes#badcat#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(s:CP1, s:CP2, s:CP3) |
||||
" }}} |
@ -1,107 +0,0 @@
@@ -1,107 +0,0 @@
|
||||
if get(g:, 'airline#themes#base16#constant', 0) |
||||
let g:airline#themes#base16#palette = {} |
||||
|
||||
" Color palette |
||||
let s:gui_dark_gray = '#202020' |
||||
let s:cterm_dark_gray = 234 |
||||
let s:gui_med_gray_hi = '#303030' |
||||
let s:cterm_med_gray_hi = 236 |
||||
let s:gui_med_gray_lo = '#3a3a3a' |
||||
let s:cterm_med_gray_lo = 237 |
||||
let s:gui_light_gray = '#505050' |
||||
let s:cterm_light_gray = 239 |
||||
let s:gui_green = '#99cc99' |
||||
let s:cterm_green = 151 |
||||
let s:gui_blue = '#6a9fb5' |
||||
let s:cterm_blue = 67 |
||||
let s:gui_purple = '#aa759f' |
||||
let s:cterm_purple = 139 |
||||
let s:gui_orange = '#d28445' |
||||
let s:cterm_orange = 173 |
||||
let s:gui_red = '#ac4142' |
||||
let s:cterm_red = 131 |
||||
let s:gui_pink = '#d7afd7' |
||||
let s:cterm_pink = 182 |
||||
|
||||
" Normal mode |
||||
let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green] |
||||
let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo] |
||||
let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi] |
||||
let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||
let g:airline#themes#base16#palette.normal_modified = { |
||||
\ 'airline_c': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''], |
||||
\ } |
||||
|
||||
" Insert mode |
||||
let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue] |
||||
let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi] |
||||
let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3) |
||||
let g:airline#themes#base16#palette.insert_modified = copy(g:airline#themes#base16#palette.normal_modified) |
||||
let g:airline#themes#base16#palette.insert_paste = { |
||||
\ 'airline_a': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''], |
||||
\ } |
||||
|
||||
" Replace mode |
||||
let g:airline#themes#base16#palette.replace = { |
||||
\ 'airline_a': [s:gui_dark_gray, s:gui_red, s:cterm_dark_gray, s:cterm_red, ''], |
||||
\ 'airline_c': [s:gui_red, s:gui_med_gray_hi, s:cterm_red, s:cterm_med_gray_hi, ''], |
||||
\ } |
||||
let g:airline#themes#base16#palette.replace_modified = copy(g:airline#themes#base16#palette.insert_modified) |
||||
|
||||
" Visual mode |
||||
let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink] |
||||
let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi] |
||||
let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3) |
||||
let g:airline#themes#base16#palette.visual_modified = copy(g:airline#themes#base16#palette.insert_modified) |
||||
|
||||
" Inactive window |
||||
let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, ''] |
||||
let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
||||
let g:airline#themes#base16#palette.inactive_modified = { |
||||
\ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''], |
||||
\ } |
||||
else |
||||
function! airline#themes#base16#refresh() |
||||
let g:airline#themes#base16#palette = {} |
||||
|
||||
let g:airline#themes#base16#palette.accents = { |
||||
\ 'red': airline#themes#get_highlight('Constant'), |
||||
\ } |
||||
|
||||
let s:N1 = airline#themes#get_highlight2(['DiffText', 'bg'], ['DiffText', 'fg'], 'bold') |
||||
let s:N2 = airline#themes#get_highlight('Visual') |
||||
let s:N3 = airline#themes#get_highlight('CursorLine') |
||||
let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||
|
||||
let group = airline#themes#get_highlight('vimCommand') |
||||
let g:airline#themes#base16#palette.normal_modified = { |
||||
\ 'statusline': [ group[0], '', group[2], '', '' ] |
||||
\ } |
||||
|
||||
let s:I1 = airline#themes#get_highlight2(['DiffAdded', 'bg'], ['DiffAdded', 'fg'], 'bold') |
||||
let s:I2 = airline#themes#get_highlight2(['DiffAdded', 'fg'], ['Normal', 'bg']) |
||||
let s:I3 = s:N3 |
||||
let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||
let g:airline#themes#base16#palette.insert_modified = g:airline#themes#base16#palette.normal_modified |
||||
|
||||
let s:R1 = airline#themes#get_highlight2(['WarningMsg', 'bg'], ['WarningMsg', 'fg'], 'bold') |
||||
let s:R2 = s:N2 |
||||
let s:R3 = s:N3 |
||||
let g:airline#themes#base16#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) |
||||
let g:airline#themes#base16#palette.replace_modified = g:airline#themes#base16#palette.normal_modified |
||||
|
||||
let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold') |
||||
let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg']) |
||||
let s:V3 = s:N3 |
||||
let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||
let g:airline#themes#base16#palette.visual_modified = g:airline#themes#base16#palette.normal_modified |
||||
|
||||
let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg']) |
||||
let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
||||
let g:airline#themes#base16#palette.inactive_modified = { |
||||
\ 'airline_c': [ group[0], '', group[2], '', '' ] |
||||
\ } |
||||
endfunction |
||||
call airline#themes#base16#refresh() |
||||
endif |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue