mirror of
https://github.com/vim-airline/vim-airline.git
synced 2026-09-21 02:33:14 +08:00
Compare commits
54
Commits
d25c049e61
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae24f4aca0 | ||
|
|
192c2c7e8e | ||
|
|
a2fefe5993 | ||
|
|
e12b203f11 | ||
|
|
9e0beefd6e | ||
|
|
f02ddb6338 | ||
|
|
d842cfb9dd | ||
|
|
c05ddf470d | ||
|
|
1586662296 | ||
|
|
9bf0c3de43 | ||
|
|
6e09d725c2 | ||
|
|
f6d9cc6b4a | ||
|
|
46d64f94d4 | ||
|
|
a29ae5be6f | ||
|
|
da47577aa8 | ||
|
|
5fb91eb8d7 | ||
|
|
609e5c0ee1 | ||
|
|
bd888a05db | ||
|
|
493a5b4895 | ||
|
|
7d019cd8f5 | ||
|
|
0f3db77abe | ||
|
|
ee44d57525 | ||
|
|
7fe264257e | ||
|
|
723def3fa8 | ||
|
|
081f8ac918 | ||
|
|
c52bb3dd32 | ||
|
|
512456e425 | ||
|
|
d9f7979cef | ||
|
|
4ab7c731fe | ||
|
|
b03fdc542f | ||
|
|
72acbef146 | ||
|
|
499ae85357 | ||
|
|
e06b45a870 | ||
|
|
6b51799f26 | ||
|
|
159573187e | ||
|
|
e40a696db0 | ||
|
|
5ca7f0b7fe | ||
|
|
41c5f54507 | ||
|
|
7fc376a4d5 | ||
|
|
2e2afc1056 | ||
|
|
45003f9451 | ||
|
|
0694335daa | ||
|
|
7ad8c717c6 | ||
|
|
c7704c6bc7 | ||
|
|
7c7391a1fc | ||
|
|
9884c07966 | ||
|
|
7a552f415c | ||
|
|
25635ab504 | ||
|
|
6c704f4b78 | ||
|
|
3ddcab16c2 | ||
|
|
81eca99486 | ||
|
|
f706e7c486 | ||
|
|
d7edaf8fd0 | ||
|
|
3cb60641e7 |
@@ -11,10 +11,11 @@ on:
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
vim:
|
||||
- v9.1.0000
|
||||
- v9.0.0000
|
||||
- v8.2.1000
|
||||
- v8.2.0000
|
||||
|
||||
+27
-5
@@ -2,7 +2,9 @@
|
||||
|
||||
This is the Changelog for the vim-airline project.
|
||||
|
||||
## [0.12] - Unreleased
|
||||
## [0.13] - Unreleased
|
||||
|
||||
## [0.12] - 2026-05-02
|
||||
- New features
|
||||
- Extensions:
|
||||
- [poetv](https://github.com/petobens/poet-v) support
|
||||
@@ -12,22 +14,42 @@ This is the Changelog for the vim-airline project.
|
||||
- [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
|
||||
- [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
|
||||
- [vim-rufu](https://github.com/ruby-formatter/rufo-vim) support
|
||||
- [vim-flog](https://github.com/rbong/vim-flog) support
|
||||
- [nvim-lsp](https://github.com/neovim/nvim-lsp) support
|
||||
- [vim9lsp.vim](https://github.com/yegappan/lsp) support
|
||||
- [fcitx.vim](https://github.com/fcitx/fcitx5) support
|
||||
- [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim) support
|
||||
- [codeium](https://github.com/Exafunction/codeium.vim) support
|
||||
- [vimodoro](https://github.com/VimfanTPdvorak/vimodoro) support
|
||||
- [nerdfont](https://github.com/lambdalisue/nerdfont.vim) support
|
||||
- [zhihu](https://github.com/pxwg/zhihu.nvim) Neovim support
|
||||
- Ascii Scrollbar support
|
||||
- Improvements
|
||||
- git branch can also be displayed using [gina.vim](https://github.com/lambdalisue/gina.vim)
|
||||
- coc extensions can also show additional status messages as well as the current function
|
||||
- [coc-git](https://github.com/neoclide/coc-git) extension integrated into hunks extension
|
||||
- rewrote parts using Vim9 Script for performance improvements
|
||||
- [vim-obsession](https://github.com/tpope/vim-obsession) allow to set paused indicator
|
||||
- Display executable symbol for executable script
|
||||
- Support for Neovims global statusline
|
||||
- whitespace extensions: add git conflict marker support
|
||||
- Support tabpanel, including mouse and scroll support (Vim only)
|
||||
- Support multi-line statusline (Vim only)
|
||||
- Support clickable buffers in Vim
|
||||
- Support for showing `repo:/path/file` path like style using the `gitrepo` style
|
||||
- tabline: Expose `<Plug>AirlineSelectFirstTab` and `<Plug>AirlineSelectLastTab`
|
||||
- tabline: Add a new `buffer_idx_mode` that adds a lot more mappings.
|
||||
- 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 multiple Vim versions to unit tests
|
||||
- Added option to show short paths in the status line
|
||||
|
||||
## [0.11] - 2019-11-10
|
||||
@@ -85,7 +107,7 @@ This is the Changelog for the vim-airline project.
|
||||
- [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))
|
||||
- Allow to use alternative separators 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
|
||||
@@ -135,7 +157,7 @@ This is the Changelog for the vim-airline project.
|
||||
## [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)
|
||||
- Themes have been split into a separate repository [vim-airline-themes](https://github.com/vim-airline/vim-airline-themes)
|
||||
- Improvements
|
||||
- Extensions
|
||||
- branch: support Git and Mercurial simultaneously, untracked files
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2013-2021 Bailey Ling, Christian Brabandt, et al.
|
||||
Copyright (C) 2013-2026 Bailey Ling, Christian Brabandt, et al.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
|
||||
@@ -32,6 +32,8 @@ information. By default (without configuration) this line will look like this:
|
||||
+-----------------------------------------------------------------------------+
|
||||
| A | B | C X | Y | Z | [...] |
|
||||
+-----------------------------------------------------------------------------+
|
||||
| [...] |
|
||||
+-----------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
The statusline is the colored line at the bottom, which contains the sections
|
||||
@@ -45,7 +47,7 @@ section|meaning (example)
|
||||
X | filetype (vim)
|
||||
Y | file encoding[fileformat] (utf-8[unix])
|
||||
Z | current position in the file
|
||||
[...] | additional sections (warning/errors/statistics) from external plugins (e.g. YCM, syntastic, ...)
|
||||
[...] | additional sections (warning/errors/statistics) from external plugins (e.g. YCM, syntastic, ...)<br>can be shown on a second line optionally (Vim only)
|
||||
|
||||
The information in Section Z looks like this:
|
||||
|
||||
@@ -239,6 +241,7 @@ to call custom functions. Use `:let g:airline_statusline_ontop=1` to enable it.
|
||||
Every section is composed of parts, and you can reorder and reconfigure them at will.
|
||||
|
||||

|
||||
Note: nowadays you should use the `AirlineAfterInit` autocommand
|
||||
|
||||
Sections can contain accents, which allows for very granular control of visuals (see configuration [here](https://github.com/vim-airline/vim-airline/issues/299#issuecomment-25772886)).
|
||||
|
||||
@@ -306,7 +309,7 @@ If you are interested in becoming a maintainer (we always welcome more maintaine
|
||||
|
||||
# License
|
||||
|
||||
[MIT License][58]. Copyright (c) 2013-2021 Bailey Ling & Contributors.
|
||||
[MIT License][58]. Copyright (c) 2013-2026 Bailey Ling & Contributors.
|
||||
|
||||
[1]: https://github.com/Lokaltog/vim-powerline
|
||||
[2]: https://github.com/powerline/powerline
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -6,7 +6,7 @@ scriptencoding utf-8
|
||||
let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', [])
|
||||
let g:airline_inactive_funcrefs = get(g:, 'airline_inactive_statusline_funcrefs', [])
|
||||
|
||||
let s:sections = ['a','b','c','gutter','x','y','z', 'error', 'warning']
|
||||
let s:sections = ['a','b','c','gutter','x','y','z', 'error', 'warning', 'warning2']
|
||||
let s:contexts = {}
|
||||
let s:core_funcrefs = [
|
||||
\ function('airline#extensions#apply'),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -190,12 +190,8 @@ function! s:section_is_empty(self, content)
|
||||
endif
|
||||
|
||||
" only check, if airline#skip_empty_sections == 1
|
||||
if get(g:, 'airline_skip_empty_sections', 0) == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" only check, if airline#skip_empty_sections == 1
|
||||
if get(w:, 'airline_skip_empty_sections', -1) == 0
|
||||
if get(g:, 'airline_skip_empty_sections', 0) == 0 ||
|
||||
\ get(w:, 'airline_skip_empty_sections', -1) == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -177,6 +177,11 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'netrw')
|
||||
endif
|
||||
|
||||
if get(g:, 'loaded_nerdfont', 0) && get(g:, 'airline#extensions#nerdfont#enabled', 1)
|
||||
call airline#extensions#nerdfont#init(s:ext)
|
||||
call add(s:loaded_ext, 'nerdfont')
|
||||
endif
|
||||
|
||||
" fzf buffers are also terminal buffers, so this must be above term.
|
||||
if exists(':FZF') && get(g:, 'airline#extensions#fzf#enabled', 1)
|
||||
call airline#extensions#fzf#init(s:ext)
|
||||
@@ -348,7 +353,7 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'ale')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#lsp#enabled', 1) && exists(':LspDeclaration'))
|
||||
if (get(g:, 'airline#extensions#lsp#enabled', 1) && get(g:, 'lsp_loaded', 0))
|
||||
call airline#extensions#lsp#init(s:ext)
|
||||
call add(s:loaded_ext, 'lsp')
|
||||
endif
|
||||
@@ -395,6 +400,11 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'tabline')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tabpanel#enabled', 0)
|
||||
call airline#extensions#tabpanel#Init(s:ext)
|
||||
call add(s:loaded_ext, 'tabpanel')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tmuxline#enabled', 1) && exists(':Tmuxline')
|
||||
call airline#extensions#tmuxline#init(s:ext)
|
||||
call add(s:loaded_ext, 'tmuxline')
|
||||
@@ -526,6 +536,16 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'rufo')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#zhihu#enabled', 1) && airline#util#has_zhihu())
|
||||
call airline#extensions#zhihu#init(s:ext)
|
||||
call add(s:loaded_ext, 'zhihu')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#linediff#enabled', 1) && exists('g:loaded_linediff'))
|
||||
call airline#extensions#linediff#init(s:ext)
|
||||
call add(s:loaded_ext, 'linediff')
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#get_loaded_extensions()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bjorn Neergaard, w0rp et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bjorn Neergaard, w0rp et al.
|
||||
" Plugin: https://github.com/dense-analysis/ale
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2021 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2026 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/lambdalisue/battery.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2021 Bjoern Petri <bjoern.petri@sundevil.de>
|
||||
" MIT License. Copyright (c) 2026 Bjoern Petri <bjoern.petri@sundevil.de>
|
||||
" Plugin: https://github.com/MattesGroeger/vim-bookmarks
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: fugitive, gina, lawrencium and vcscommand
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling et al.
|
||||
" Plugin: https://github.com/bling/vim-bufferline
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2021 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2026 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/tpope/vim-capslock
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2019-2021 Peng Guanwen et al.
|
||||
" MIT License. Copyright (c) 2019-2026 Peng Guanwen et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
" Plugin: https://github.com/neoclide/coc
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2021 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2026 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/Exafunction/codeium.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling et al.
|
||||
" Plugin: https://github.com/wincent/command-t
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/chrisbra/csv.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/ctrlpvim/ctrlp.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/szw/vim-ctrlspace
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
" 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>
|
||||
" Copyright (C) 2014-2026 Andrea Cedraro <a.cedraro@gmail.com>, Eduardo Suarez-Santana <e.suarezsantana@gmail.com>
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -11,10 +11,11 @@ let s:section_truncate_width = get(g:, 'airline#extensions#default#section_trunc
|
||||
\ 'z': 45,
|
||||
\ 'warning': 80,
|
||||
\ 'error': 80,
|
||||
\ 'warning2': 80,
|
||||
\ })
|
||||
let s:layout = get(g:, 'airline#extensions#default#layout', [
|
||||
\ [ 'a', 'b', 'c' ],
|
||||
\ [ 'x', 'y', 'z', 'warning', 'error' ]
|
||||
\ [ 'x', 'y', 'z', 'warning', 'error', 'warning2' ]
|
||||
\ ])
|
||||
|
||||
function! s:get_section(winnr, key, ...)
|
||||
@@ -32,9 +33,24 @@ function! s:get_section(winnr, key, ...)
|
||||
return empty(text) ? '' : prefix.text.suffix
|
||||
endfunction
|
||||
|
||||
function! s:eval_section_empty(content)
|
||||
let exprlist = []
|
||||
call substitute(a:content, '%{\([^}]*\)}', '\=add(exprlist, submatch(1))', 'g')
|
||||
for expr in exprlist
|
||||
try
|
||||
if !empty(eval(expr))
|
||||
return 0
|
||||
endif
|
||||
catch
|
||||
return 0
|
||||
endtry
|
||||
endfor
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! s:build_sections(builder, context, keys)
|
||||
for key in a:keys
|
||||
if (key == 'warning' || key == 'error') && !a:context.active
|
||||
if (key == 'warning' || key == 'error' || key == 'warning2') && !a:context.active
|
||||
continue
|
||||
endif
|
||||
call s:add_section(a:builder, a:context, key)
|
||||
@@ -49,21 +65,30 @@ if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch8
|
||||
\ (v:version == 704 && !has("patch1511"))
|
||||
" i have no idea why the warning section needs special treatment, but it's
|
||||
" needed to prevent separators from showing up
|
||||
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
||||
if ((a:key == 'error' || a:key == 'warning' || a:key == 'warning2')
|
||||
\ && empty(s:get_section(a:context.winnr, a:key)))
|
||||
return
|
||||
endif
|
||||
if condition
|
||||
call a:builder.add_raw('%(')
|
||||
endif
|
||||
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key))
|
||||
if condition
|
||||
call a:builder.add_raw('%)')
|
||||
if a:key == 'warning2' && airline#util#has_multiline()
|
||||
let section = s:get_section(a:context.winnr, a:key)
|
||||
if !s:eval_section_empty(section)
|
||||
call a:builder.add_raw('%@%#airline_warning#'.section)
|
||||
endif
|
||||
else
|
||||
if condition
|
||||
call a:builder.add_raw('%(')
|
||||
endif
|
||||
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key))
|
||||
if condition
|
||||
call a:builder.add_raw('%)')
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
else
|
||||
" older version don't like the use of %(%)
|
||||
function! s:add_section(builder, context, key)
|
||||
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
||||
if ((a:key == 'error' || a:key == 'warning')
|
||||
\ && empty(s:get_section(a:context.winnr, a:key)))
|
||||
return
|
||||
endif
|
||||
if a:key == 'warning'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2021 Thomas Dy et al.
|
||||
" MIT License. Copyright (c) 2017-2026 Thomas Dy et al.
|
||||
" Plugin: https://github.com/Shougo/denite.nvim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" PLugin: https://eclim.org
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021
|
||||
" MIT License. Copyright (c) 2013-2026
|
||||
" Plugin: https://github.com/lambdalisue/fern.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -7,30 +7,57 @@ if !get(g:, 'loaded_fern', 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
|
||||
function! airline#extensions#fern#apply_active(...) abort
|
||||
" check if current buffer is both fern and active
|
||||
if (&ft =~# 'fern') && a:2.active ==# '1'
|
||||
call airline#extensions#fern#configure_sections(a:1, a:2)
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! airline#extensions#fern#apply_inactive(...) abort
|
||||
" check if referenced buffer is both fern and inactive
|
||||
if getbufvar(a:2.bufnr, '&filetype') ==# 'fern' && a:2.active ==# '0'
|
||||
call airline#extensions#fern#configure_sections(a:1, a:2)
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#fern#configure_sections(win, context) abort
|
||||
let spc = g:airline_symbols.space
|
||||
let fri = fern#fri#parse(bufname(a:context.bufnr))
|
||||
let abspath = ''
|
||||
" Replace uses fern-replacer filetype, do not try to parse in that case
|
||||
if &ft ==# 'fern' && fri.scheme ==# 'fern'
|
||||
let abspath = fern#fri#to#filepath(fern#fri#parse(fri.path))
|
||||
endif
|
||||
call a:win.add_section('airline_a', spc.'fern'.spc)
|
||||
if exists('*airline#extensions#branch#get_head')
|
||||
" because fern navigation changes an internal _fri_ and not the working directory
|
||||
" we need to give it some help so the branch name gets updated
|
||||
try
|
||||
if &ft ==# 'fern'
|
||||
execute 'lcd' fnameescape(abspath)
|
||||
endif
|
||||
catch /^Vim\%((\a\+)\)\=:E344:/
|
||||
call a:win.add_section('airline_b', '')
|
||||
endtry
|
||||
call a:win.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc)
|
||||
else
|
||||
call a:win.add_section('airline_b', '')
|
||||
endif
|
||||
if !(fri.authority =~# '^drawer')
|
||||
call a:win.add_section('airline_c', spc.fnamemodify(abspath, ':~'))
|
||||
call a:win.split()
|
||||
if len(get(g:, 'fern#comparators', {}))
|
||||
call a:win.add_section('airline_y', spc.'%{fern#comparator}'.spc)
|
||||
endif
|
||||
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')
|
||||
call a:ext.add_statusline_func('airline#extensions#fern#apply_active')
|
||||
call a:ext.add_inactive_statusline_func('airline#extensions#fern#apply_inactive')
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2021 Cimbali et al
|
||||
" MIT License. Copyright (c) 2017-2026 Cimbali et al
|
||||
" Plugin: https://github.com/tpope/vim-fugitive
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/junegunn/fzf, https://github.com/junegunn/fzf.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2021 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2026 Mathias Andersson et al.
|
||||
" Written by Kamil Cukrowski 2020
|
||||
" Plugin: https://github.com/jsfaint/gen_tags.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021
|
||||
" MIT License. Copyright (c) 2013-2026
|
||||
" Plugin: https://github.com/lambdalisue/gina.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2021 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2026 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/mhinz/vim-grepper
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2014-2021 Mathias Andersson et al.
|
||||
" MIT License. Copyright (c) 2014-2026 Mathias Andersson et al.
|
||||
" Plugin: https://github.com/ludovicchabant/vim-gutentags
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: vim-gitgutter, vim-signify, changesPlugin, quickfixsigns, coc-git,
|
||||
" gitsigns.nvim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
@@ -28,6 +28,18 @@ function! s:coc_git_enabled() abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! s:git2_enabled() abort
|
||||
if !has('nvim')
|
||||
return 0
|
||||
endif
|
||||
try
|
||||
lua require("git2.diff")
|
||||
return 1
|
||||
catch /.*/
|
||||
endtry
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:parse_hunk_status_dict(hunks) abort
|
||||
let result = [0, 0, 0]
|
||||
let result[0] = get(a:hunks, 'added', 0)
|
||||
@@ -81,6 +93,10 @@ function! s:get_hunks_coc() abort
|
||||
return s:parse_hunk_status_decorated(hunks)
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_git2() abort
|
||||
return v:lua.require('git2.diff').get_raw_hunks()
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_empty() abort
|
||||
return ''
|
||||
endfunction
|
||||
@@ -97,6 +113,8 @@ function! airline#extensions#hunks#get_raw_hunks() abort
|
||||
let b:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary'
|
||||
elseif exists(':Gitsigns')
|
||||
let b:source_func = 's:get_hunks_gitsigns'
|
||||
elseif s:git2_enabled()
|
||||
let b:source_func = 's:get_hunks_git2'
|
||||
elseif s:coc_git_enabled()
|
||||
let b:source_func = 's:get_hunks_coc'
|
||||
else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Doron Behar, C.Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Doron Behar, C.Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bjorn Neergaard, hallettj et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bjorn Neergaard, hallettj et al.
|
||||
" Plugin: https://github.com/autozimu/LanguageClient-neovim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
" MIT License. Copyright (c) 2026 Shad
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#linediff#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#linediff#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#linediff#apply(...)
|
||||
if exists('b:differ.description')
|
||||
let w:airline_section_c = b:differ.description
|
||||
endif
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2018-2021 mox et al.
|
||||
" MIT License. Copyright (c) 2018-2026 mox et al.
|
||||
" Plugin: https://github.com/mox-mox/vim-localsearch
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 François-Xavier Carton et al.
|
||||
" MIT License. Copyright (c) 2013-2026 François-Xavier Carton et al.
|
||||
" Plugin: https://github.com/prabirshrestha/vim-lsp
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/neomake/neomake
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
" MIT License. Copyright (c) 2026-2026 Wu Zhenyu et al
|
||||
" Plugin: https://github.com/lambdalisue/nerdfont.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_nerdfont', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#nerdfont#fileformat() abort
|
||||
if &fileformat ==# 'dos'
|
||||
return nerdfont#platform#find('windows')
|
||||
endif
|
||||
if &fileformat ==# 'mac'
|
||||
return nerdfont#platform#find('macos')
|
||||
endif
|
||||
if &fileformat ==# 'unix'
|
||||
if has('unix')
|
||||
return nerdfont#platform#find()
|
||||
else
|
||||
return nerdfont#platform#find('linux')
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#nerdfont#ffenc() abort
|
||||
let expected = get(g:, 'airline#parts#ffenc#skip_expected_string', '')
|
||||
let bomb = &bomb ? '[BOM]' : ''
|
||||
let noeolf = &eol ? '' : '[!EOL]'
|
||||
let ff = strlen(&ff) ? '['.&ff.']' : ''
|
||||
if expected is# &fenc.bomb.noeolf.ff
|
||||
return ''
|
||||
else
|
||||
return &fenc.bomb.noeolf.' '.airline#extensions#nerdfont#fileformat()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#nerdfont#init(ext) abort
|
||||
call airline#parts#define_function('ffenc', 'airline#extensions#nerdfont#ffenc')
|
||||
call a:ext.add_statusline_func('airline#extensions#nerdfont#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#nerdfont#apply(...) abort
|
||||
call airline#extensions#append_to_section('x', ' %{nerdfont#find()}')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: http://www.drchip.org/astronaut/vim/#NETRW
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/chrisbra/NrrwRgn
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" Apache 2.0 license. Copyright (c) 2019-2021 Copyright Neovim contributors.
|
||||
" Apache 2.0 license. Copyright (c) 2019-2026 Copyright Neovim contributors.
|
||||
" Plugin: https://github.com/neovim/nvim-lsp
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -47,7 +47,7 @@ endfunction
|
||||
|
||||
function! s:airline_nvimlsp_get_line_number(cnt, type) abort
|
||||
let severity = a:type == 'Warning' ? 'Warn' : a:type
|
||||
let num = v:lua.vim.diagnostic.get(0, { 'severity': severity })[0].lnum
|
||||
let num = v:lua.vim.diagnostic.get(0, { 'severity': severity })[0].lnum + 1
|
||||
|
||||
let l:open_lnum_symbol =
|
||||
\ get(g:, 'airline#extensions#nvimlsp#open_lnum_symbol', '(L')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/tpope/vim-obsession
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
@@ -14,10 +14,14 @@ if !exists('g:airline#extensions#obsession#indicator_text')
|
||||
let g:airline#extensions#obsession#indicator_text = '$'
|
||||
endif
|
||||
|
||||
if !exists('g:airline#extensions#obsession#indicator_text_paused')
|
||||
let g:airline#extensions#obsession#indicator_text_paused = '' " vim-obsession defaults to 'S'
|
||||
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), '')
|
||||
return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), (g:airline#extensions#obsession#indicator_text_paused . s:spc))
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/petobens/poet_v
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/edkolev/promptline.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" This extension is inspired by vim-anzu <https://github.com/osyo-manga/vim-anzu>.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/vim-syntastic/syntastic
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt 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
|
||||
let s:current_tabline = ''
|
||||
let s:current_visible_buffers = []
|
||||
@@ -49,14 +49,15 @@ function! airline#extensions#tabline#buffers#invalidate()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buffers#get()
|
||||
let curbuf = bufnr('%')
|
||||
let curtab = tabpagenr()
|
||||
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
|
||||
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
|
||||
@@ -77,10 +78,10 @@ function! airline#extensions#tabline#buffers#get()
|
||||
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))
|
||||
if index(b.buffers, curbuf) > -1
|
||||
call remove(b.buffers, index(b.buffers, curbuf))
|
||||
endif
|
||||
let b.buffers = [cur] + b.buffers
|
||||
let b.buffers = [curbuf] + b.buffers
|
||||
endif
|
||||
|
||||
function! b.get_group(i) dict
|
||||
@@ -96,6 +97,7 @@ function! airline#extensions#tabline#buffers#get()
|
||||
endfunction
|
||||
|
||||
if has("tablineat")
|
||||
" Neovim version
|
||||
function! b.get_pretitle(i) dict
|
||||
let bufnum = get(self.buffers, a:i, -1)
|
||||
return '%'.bufnum.'@airline#extensions#tabline#buffers#clickbuf@'
|
||||
@@ -106,6 +108,17 @@ function! airline#extensions#tabline#buffers#get()
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if has("statusline_click")
|
||||
" Vim version
|
||||
function! b.get_pretitle(i) dict
|
||||
return '%'.get(self.buffers, a:i, -1).'[airline#extensions#tabline#buffers#clickbufVim]'
|
||||
endfunction
|
||||
|
||||
function! b.get_posttitle(i) dict
|
||||
return '%[]'
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! b.get_title(i) dict
|
||||
let bufnum = get(self.buffers, a:i, -1)
|
||||
let group = self.get_group(a:i)
|
||||
@@ -129,7 +142,7 @@ function! airline#extensions#tabline#buffers#get()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let current_buffer = max([index(b.buffers, cur), 0])
|
||||
let current_buffer = max([index(b.buffers, curbuf), 0])
|
||||
let last_buffer = len(b.buffers) - 1
|
||||
call b.insert_titles(current_buffer, 0, last_buffer)
|
||||
|
||||
@@ -142,7 +155,8 @@ function! airline#extensions#tabline#buffers#get()
|
||||
|
||||
call airline#extensions#tabline#add_tab_label(b)
|
||||
|
||||
let s:current_bufnr = cur
|
||||
let s:current_bufnr = curbuf
|
||||
let s:current_tabnr = curtab
|
||||
let s:column_width = &columns
|
||||
let s:current_tabline = b.build()
|
||||
let s:current_visible_buffers = copy(b.buffers)
|
||||
@@ -207,11 +221,68 @@ function! s:map_keys()
|
||||
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>
|
||||
noremap <silent> <Plug>AirlineSelectFirstTab :<C-u>call <SID>select_tab(0)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectLastTab :<C-u>call <SID>select_tab(len(airline#extensions#tabline#buflist#list()) - 1)<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#clickbufVim(dict) abort
|
||||
" Clickable buffers in Vim, requires v9.2.0338
|
||||
|
||||
" single mouse button click without modifiers pressed
|
||||
if a:dict.nclicks == 1 && empty(a:dict.mods)
|
||||
if a:dict.button is# 'l'
|
||||
" left button - switch to buffer
|
||||
try
|
||||
silent execute 'buffer' a:dict.minwid
|
||||
catch
|
||||
call airline#util#warning("Cannot switch buffer, current buffer is modified! See :h 'hidden'")
|
||||
endtry
|
||||
elseif a:dict.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:dict.minwid
|
||||
else
|
||||
" find windows displaying the clicked buffer and open an new
|
||||
" buffer in them.
|
||||
let current_window = bufwinnr("%")
|
||||
let window_number = bufwinnr(a:dict.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:dict.minwid
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
" force a redraw
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, modifiers) abort
|
||||
" Clickable buffers
|
||||
" works only in recent NeoVim with has('tablineat')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -44,6 +44,7 @@ function! airline#extensions#tabline#buflist#list()
|
||||
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 l:CustomFilter = get(g:, 'airline#extensions#tabline#filter_function')
|
||||
|
||||
let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$"))
|
||||
|
||||
@@ -61,6 +62,8 @@ function! airline#extensions#tabline#buflist#list()
|
||||
" 'bufhidden' == wipe
|
||||
" 'buftype' == nofile
|
||||
" 5) ignore buffers matching airline#extensions#tabline#ignore_bufadd_pat
|
||||
" 6) airline#extensions#tabline#filter_function is defined and returns
|
||||
" empty value
|
||||
|
||||
" check buffer numbers first
|
||||
if index(exclude_buffers, nr) >= 0
|
||||
@@ -74,6 +77,8 @@ function! airline#extensions#tabline#buflist#list()
|
||||
" check other types last
|
||||
elseif s:ExcludeOther(nr, exclude_preview)
|
||||
continue
|
||||
elseif !empty(l:CustomFilter) && !call(l:CustomFilter, [nr])
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(buffers, nr)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016-2021 Kevin Sapper et al.
|
||||
" MIT License. Copyright (c) 2016-2026 Kevin Sapper et al.
|
||||
" Plugin: https://github.com/szw/vim-ctrlspace
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -47,7 +47,7 @@ if !exists(":def") || !airline#util#has_vim9_script()
|
||||
else
|
||||
" Vim9 Script implementation
|
||||
def airline#extensions#tabline#formatters#default#format(bufnr: number, buffers: list<number>): string
|
||||
var fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
|
||||
var fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
|
||||
var fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
var result = ''
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
let g:airline#extensions#tabline#formatters#nerdfont#formatter = get(g:, 'airline#extensions#tabline#formatters#nerdfont#formatter', 'default')
|
||||
|
||||
function! airline#extensions#tabline#formatters#nerdfont#format(bufnr, buffers) abort
|
||||
" Call original formatter.
|
||||
let originalFormatter = airline#extensions#tabline#formatters#{g:airline#extensions#tabline#formatters#nerdfont#formatter}#format(a:bufnr, a:buffers)
|
||||
return originalFormatter . printf(' %s', nerdfont#find(bufname(a:bufnr)))
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2021 Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2017-2026 Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
let g:airline#extensions#tabline#formatters#zhihu#formatter = get(g:, 'airline#extensions#tabline#formatters#zhihu#formatter', 'default')
|
||||
|
||||
function! airline#extensions#tabline#formatters#zhihu#format(bufnr, buffers)
|
||||
let l:name = bufname(a:bufnr)
|
||||
if match(l:name, 'zhihu://') == -1
|
||||
return airline#extensions#tabline#formatters#{g:airline#extensions#tabline#formatters#zhihu#formatter}#format(a:bufnr, a:buffers)
|
||||
endif
|
||||
let l:prefix = matchstr(fnamemodify(l:name, ':h'), '\d\+')
|
||||
if l:prefix !=# ''
|
||||
let l:prefix .= '/'
|
||||
endif
|
||||
return l:prefix . fnamemodify(l:name, ':t')
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -125,6 +125,8 @@ function! airline#extensions#tabline#tabs#map_keys()
|
||||
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>
|
||||
noremap <silent> <Plug>AirlineSelectFirstTab :<C-u>:tabfirst<CR>
|
||||
noremap <silent> <Plug>AirlineSelectLastTab :<C-u>:tablast<CR>
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i) abort
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016-2021 Kevin Sapper et al.
|
||||
" MIT License. Copyright (c) 2016-2026 Kevin Sapper et al.
|
||||
" PLugin: https://github.com/s1341/vim-tabws
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
vim9script
|
||||
|
||||
# MIT License. Copyright (c) 2013-2026 Christian Brabandt et al.
|
||||
# vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
var spc = g:airline_symbols.space
|
||||
var mouse_support = has('patch-9.2.0386')
|
||||
|
||||
def IsTabModified(tabnr: number): bool
|
||||
if !g:airline_detect_modified
|
||||
return false
|
||||
endif
|
||||
for bi in tabpagebuflist(tabnr)
|
||||
if getbufvar(bi, '&modified')
|
||||
return true
|
||||
endif
|
||||
endfor
|
||||
return false
|
||||
enddef
|
||||
|
||||
export def Get(): string
|
||||
var tabnr = get(g:, 'actual_curtabpage', tabpagenr())
|
||||
var curtab = tabpagenr()
|
||||
var label = ''
|
||||
|
||||
if tabnr == 1
|
||||
label ..= '%#airline_tabfill#'
|
||||
label ..= get(g:, 'airline#extensions#tabpanel#label', '[tabs]') .. "\n"
|
||||
endif
|
||||
|
||||
var buflist = tabpagebuflist(tabnr)
|
||||
var winnr = tabpagewinnr(tabnr)
|
||||
var bufnr = buflist[winnr - 1]
|
||||
var title = fnamemodify(bufname(bufnr), ':t')
|
||||
if empty(title)
|
||||
title = '[No Name]'
|
||||
endif
|
||||
|
||||
if tabnr == curtab
|
||||
if IsTabModified(tabnr)
|
||||
label ..= '%#airline_tabmod#'
|
||||
else
|
||||
label ..= '%#airline_tabsel#'
|
||||
endif
|
||||
else
|
||||
if IsTabModified(tabnr)
|
||||
label ..= '%#airline_tabmod_unsel#'
|
||||
else
|
||||
label ..= '%#airline_tab#'
|
||||
endif
|
||||
endif
|
||||
|
||||
if mouse_support
|
||||
label ..= '%' .. tabnr .. '[airline#extensions#tabpanel#ClickTab]'
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||
label ..= spc .. tabnr
|
||||
label ..= spc
|
||||
endif
|
||||
|
||||
label ..= title .. spc
|
||||
|
||||
if mouse_support
|
||||
label ..= '%[]'
|
||||
endif
|
||||
return label
|
||||
enddef
|
||||
|
||||
export def ClickTab(info: dict<any>): number
|
||||
if info.nclicks != 1 || !empty(info.mods)
|
||||
return 0
|
||||
endif
|
||||
if info.button ==# 'l'
|
||||
try
|
||||
silent execute 'tabnext' info.minwid
|
||||
catch
|
||||
airline#util#warning('Cannot switch tab')
|
||||
endtry
|
||||
elseif info.button ==# 'm'
|
||||
try
|
||||
silent execute 'tabclose' info.minwid
|
||||
catch
|
||||
airline#util#warning('Cannot close tab')
|
||||
endtry
|
||||
endif
|
||||
return 0
|
||||
enddef
|
||||
|
||||
def LinkHighlights(): void
|
||||
highlight! link TabPanelFill airline_tabfill
|
||||
highlight! link TabPanelSel airline_tabsel
|
||||
highlight! link TabPanel airline_tab
|
||||
enddef
|
||||
|
||||
export def LoadTheme(palette: dict<any>): number
|
||||
airline#extensions#tabline#load_theme(palette)
|
||||
LinkHighlights()
|
||||
return 0
|
||||
enddef
|
||||
|
||||
def Enable(): void
|
||||
LinkHighlights()
|
||||
&tabpanel = '%!airline#extensions#tabpanel#Get()'
|
||||
var cols = get(g:, 'airline#extensions#tabpanel#columns', 20)
|
||||
var align = get(g:, 'airline#extensions#tabpanel#align', '')
|
||||
var scrollbar = get(g:, 'airline#extensions#tabpanel#scrollbar', 1)
|
||||
var opts = 'columns:' .. cols
|
||||
if !empty(align)
|
||||
opts ..= ',align:' .. align
|
||||
endif
|
||||
if mouse_support
|
||||
if scrollbar
|
||||
opts ..= ',scrollbar'
|
||||
endif
|
||||
endif
|
||||
&tabpanelopt = opts
|
||||
&showtabpanel = 2
|
||||
enddef
|
||||
|
||||
def Disable(): void
|
||||
highlight! link TabPanelFill NONE
|
||||
highlight! link TabPanelSel NONE
|
||||
highlight! link TabPanel NONE
|
||||
&tabpanel = ''
|
||||
&tabpanelopt = ''
|
||||
&showtabpanel = 0
|
||||
enddef
|
||||
|
||||
export def Init(ext: dict<any>): void
|
||||
if !exists('+tabpanel')
|
||||
return
|
||||
endif
|
||||
|
||||
autocmd_add([{
|
||||
group: 'airline_tabpanel',
|
||||
event: 'User',
|
||||
pattern: 'AirlineToggledOn',
|
||||
cmd: 'Enable()',
|
||||
replace: true,
|
||||
}])
|
||||
autocmd_add([{
|
||||
group: 'airline_tabpanel',
|
||||
event: 'User',
|
||||
pattern: 'AirlineToggledOff',
|
||||
cmd: 'Disable()',
|
||||
replace: true,
|
||||
}])
|
||||
|
||||
ext.add_theme_func('airline#extensions#tabpanel#LoadTheme')
|
||||
Enable()
|
||||
enddef
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/majutsushi/tagbar
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2021 DEMAREST Maxime (maxime@indelog.fr)
|
||||
" MIT License. Copyright (c) 2021 DEMAREST Maxime (maxime@indelog.fr)
|
||||
" Plugin: https://github.com/yegappan/taglist/
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/edkolev/tmuxline.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/mbbill/undotree
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling, Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/chrisbra/unicode.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/Shougo/unite.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2016-2021 Jerome Reybert et al.
|
||||
" MIT License. Copyright (c) 2016-2026 Jerome Reybert et al.
|
||||
" Plugin: https://github.com/jreybert/vimagit
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/cdelledonne/vim-cmake
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/VimfanTPdvorak/vimodoro.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/lervag/vimtex
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/jmcantrell/vim-virtualenv
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
|
||||
@@ -8,11 +8,14 @@ scriptencoding utf-8
|
||||
let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1)
|
||||
let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace)
|
||||
let s:default_checks = ['indent', 'trailing', 'mixed-indent-file', 'conflicts']
|
||||
let s:searchcount = exists('*searchcount')
|
||||
|
||||
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
|
||||
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'],
|
||||
\ 'csv': ['indent', 'mixed-indent-file'],
|
||||
\ 'mail': ['trailing']}
|
||||
\ 'mail': ['trailing'],
|
||||
\ 'diff': ['trailing'],
|
||||
\ 'gitcommit': ['trailing']}
|
||||
|
||||
function! s:check_mixed_indent()
|
||||
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
|
||||
@@ -51,7 +54,8 @@ endfunction
|
||||
|
||||
function! s:conflict_marker()
|
||||
" Checks for git conflict markers
|
||||
let annotation = '\%([0-9A-Za-z_.:]\+\)\?'
|
||||
" space required for jj conflict marker: #2727
|
||||
let annotation = '\%([0-9A-Za-z_.: ]\+\)\?'
|
||||
if match(['rst', 'markdown', 'rmd'], &ft) >= 0
|
||||
" rst filetypes use '=======' as header
|
||||
let pattern = '^\%(\%(<\{7} '.annotation. '\)\|\%(>\{7\} '.annotation.'\)\)$'
|
||||
@@ -61,6 +65,19 @@ function! s:conflict_marker()
|
||||
return search(pattern, 'nw')
|
||||
endfunction
|
||||
|
||||
function! s:conflict_marker_count()
|
||||
if !s:searchcount
|
||||
return 0
|
||||
endif
|
||||
" Checks for git conflict markers
|
||||
" space required for jj conflict marker: #2727
|
||||
let annotation = '\%([0-9A-Za-z_.: ]\+\)\?'
|
||||
let pattern = '^<\{7} '.annotation. '$'
|
||||
let cnt = searchcount(#{pattern: pattern, recompute: 1, timeout: 10})
|
||||
return has_key(cnt, 'total') ? cnt.total : 0
|
||||
endfunction
|
||||
|
||||
|
||||
function! airline#extensions#whitespace#check()
|
||||
let max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
|
||||
if &readonly || !&modifiable || !s:enabled || line('$') > max_lines
|
||||
@@ -108,6 +125,7 @@ function! airline#extensions#whitespace#check()
|
||||
let conflicts = 0
|
||||
if index(checks, 'conflicts') > -1
|
||||
let conflicts = s:conflict_marker()
|
||||
let conflicts_count = s:conflict_marker_count()
|
||||
endif
|
||||
|
||||
if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file) || conflicts != 0
|
||||
@@ -138,10 +156,16 @@ function! airline#extensions#whitespace#check()
|
||||
if conflicts != 0
|
||||
let conflicts_fmt = get(g:, 'airline#extensions#whitespace#conflicts_format', '[%s]conflicts')
|
||||
let b:airline_whitespace_check .= space.printf(conflicts_fmt, conflicts)
|
||||
if conflicts_count > 1
|
||||
let b:airline_whitespace_check .= printf('*%d', conflicts_count)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if airline#util#has_multiline()
|
||||
return b:airline_whitespace_check
|
||||
endif
|
||||
return airline#util#shorten(b:airline_whitespace_check, 120, 9)
|
||||
endfunction
|
||||
|
||||
@@ -159,8 +183,16 @@ function! airline#extensions#whitespace#toggle()
|
||||
|
||||
if exists("g:airline#extensions#whitespace#enabled")
|
||||
let g:airline#extensions#whitespace#enabled = s:enabled
|
||||
if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0
|
||||
let g:airline_section_warning .= airline#section#create(['whitespace'])
|
||||
if s:enabled
|
||||
if airline#util#has_multiline() && exists('g:airline_section_warning2')
|
||||
if match(g:airline_section_warning2, '#whitespace#check') < 0
|
||||
let g:airline_section_warning2 .= airline#section#create(['whitespace'])
|
||||
endif
|
||||
else
|
||||
if match(g:airline_section_warning, '#whitespace#check') < 0
|
||||
let g:airline_section_warning .= airline#section#create(['whitespace'])
|
||||
endif
|
||||
endif
|
||||
call airline#update_statusline()
|
||||
endif
|
||||
endif
|
||||
@@ -192,7 +224,7 @@ function! s:ws_refresh()
|
||||
return
|
||||
endif
|
||||
unlet! b:airline_whitespace_check
|
||||
if get(g:, 'airline_skip_empty_sections', 0)
|
||||
if get(g:, 'airline_skip_empty_sections', 0) || airline#util#has_multiline()
|
||||
exe ':AirlineRefresh!'
|
||||
endif
|
||||
let b:airline_ws_changedtick = b:changedtick
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" Plugin: https://github.com/wesQ3/vim-windowswap
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2 fdm=marker
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -12,7 +12,7 @@ if exists('*wordcount')
|
||||
if &filetype ==# 'tex' && exists('b:vimtex') && get(g:, 'airline#extensions#vimtex#wordcount', 0)
|
||||
" We're in a TeX file and vimtex is a plugin, so use vimtex's wordcount...
|
||||
if a:visual_mode_active
|
||||
" not useful?
|
||||
" not useful?
|
||||
return
|
||||
else
|
||||
return vimtex#misc#wordcount()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2017-2021 YoungHoon Rhiu et al.
|
||||
" MIT License. Copyright (c) 2017-2026 YoungHoon Rhiu et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2015-2021 Evgeny Firsov et al.
|
||||
" MIT License. Copyright (c) 2015-2026 Evgeny Firsov et al.
|
||||
" Plugin: https://github.com/ycm-core/YouCompleteMe
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
" MIT License. Copyright (c) 2026-2026 Wu Zhenyu et al
|
||||
" Plugin: https://github.com/pxwg/zhihu.nvim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !airline#util#has_zhihu()
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:has_percent_eval = v:version > 802 || (v:version == 802 && has("patch2854"))
|
||||
|
||||
function! airline#extensions#zhihu#bufname() abort
|
||||
let fmod = (exists("+autochdir") && &autochdir) ? ':p' : ':.'
|
||||
let name = fnamemodify(bufname('%'), fmod)
|
||||
|
||||
if empty(name)
|
||||
return ''
|
||||
endif
|
||||
|
||||
if match(name, 'zhihu://') == -1
|
||||
return s:has_percent_eval ? '%f' : name
|
||||
endif
|
||||
|
||||
return get(get(b:, 'article', {}), 'title', name)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#zhihu#init(ext) abort
|
||||
let prct = s:has_percent_eval ? '%' : ''
|
||||
|
||||
if exists("+autochdir") && &autochdir
|
||||
" if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well
|
||||
if get(g:, 'airline_stl_path_style', 'default') ==# 'short'
|
||||
call airline#parts#define_raw('path', '%<%{'. prct. 'pathshorten(airline#extensions#zhihu#bufname())' . prct . '}%m')
|
||||
else
|
||||
call airline#parts#define_raw('path', '%<%{' . prct . 'airline#extensions#zhihu#bufname()' . prct . '}%m')
|
||||
endif
|
||||
else
|
||||
if get(g:, 'airline_stl_path_style', 'default') ==# 'short'
|
||||
call airline#parts#define_raw('file', '%<%{' . prct . 'pathshorten(airline#extensions#zhihu#bufname())' . prct . '}%m')
|
||||
else
|
||||
call airline#parts#define_raw('file', '%<%{' . prct . 'airline#extensions#zhihu#bufname()' . prct . '}%m')
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2021 Dmitry Geurkov (d.geurkov@gmail.com)
|
||||
" MIT License. Copyright (c) 2021-2026 Dmitry Geurkov (d.geurkov@gmail.com)
|
||||
" Plugin: https://github.com/troydm/zoomwintab.vim
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -186,6 +186,13 @@ if !exists(":def") || !airline#util#has_vim9_script()
|
||||
call <sid>exec_separator({}, a:from, a:to, a:inverse, '')
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#remove_separators_for_bufnr(bufnr) abort
|
||||
" remove all separators, that have the buffer number in their name,
|
||||
" but do not be too greedy!
|
||||
let pat = 'c' . a:bufnr . '\(\D\|$\)'
|
||||
call filter(s:separators, 'v:key !~# pat')
|
||||
endfunction
|
||||
|
||||
function! s:exec_separator(dict, from, to, inverse, suffix) abort
|
||||
if pumvisible()
|
||||
return
|
||||
@@ -529,6 +536,13 @@ else
|
||||
s:exec_separator({}, from, to, inverse, '')
|
||||
enddef
|
||||
|
||||
def airline#highlighter#remove_separators_for_bufnr(bufnr: string): void
|
||||
# remove all separators, that have the bufnr in its name, make sure we
|
||||
# have a full match here
|
||||
const pat = $'c{bufnr}\(\D\|$\)'
|
||||
filter(s:separators, (k, v) => k !~# pat)
|
||||
enddef
|
||||
|
||||
def s:exec_separator(dict: dict<any>, from_arg: string, to_arg: string, inverse: bool, suffix: string): void
|
||||
if pumvisible()
|
||||
return
|
||||
@@ -681,5 +695,5 @@ else
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
enddef
|
||||
enddef
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -129,15 +129,21 @@ function! airline#init#bootstrap()
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': "\ue0a2",
|
||||
\ 'whitespace': "\u2632",
|
||||
\ 'maxlinenr': "\u2630 ",
|
||||
\ 'maxlinenr': "\u2261 ",
|
||||
\ 'linenr': " \ue0a1:",
|
||||
\ 'colnr': " \u2105:",
|
||||
\ 'branch': "\ue0a0",
|
||||
\ 'notexists': "\u0246",
|
||||
\ 'dirty': "\u26a1",
|
||||
\ 'crypt': nr2char(0x1F512),
|
||||
\ 'executable': "\u2699",
|
||||
\ }, 'keep')
|
||||
" Note: If "\u2046" (Ɇ) does not show up, try to use "\u2204" (∄)
|
||||
if exists("*setcellwidths")
|
||||
" whitespace char 0x2632 changed to double-width in Unicode 16,
|
||||
" mark it single width again
|
||||
call setcellwidths([[0x2632, 0x2632, 1]])
|
||||
endif
|
||||
elseif &encoding==?'utf-8' && !get(g:, "airline_symbols_ascii", 0)
|
||||
" Symbols for Unicode terminals
|
||||
call s:check_defined('g:airline_left_sep', "")
|
||||
@@ -148,13 +154,14 @@ function! airline#init#bootstrap()
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': "\u229D",
|
||||
\ 'whitespace': "\u2632",
|
||||
\ 'maxlinenr': "\u2630",
|
||||
\ 'maxlinenr': "\u2261",
|
||||
\ 'linenr': " \u33d1:",
|
||||
\ 'colnr': " \u2105:",
|
||||
\ 'branch': "\u16A0",
|
||||
\ 'notexists': "\u0246",
|
||||
\ 'crypt': nr2char(0x1F512),
|
||||
\ 'dirty': '!',
|
||||
\ 'executable': "\u2699",
|
||||
\ }, 'keep')
|
||||
else
|
||||
" Symbols for ASCII terminals
|
||||
@@ -172,6 +179,7 @@ function! airline#init#bootstrap()
|
||||
\ 'notexists': '?',
|
||||
\ 'crypt': 'cr',
|
||||
\ 'dirty': '!',
|
||||
\ 'executable': 'x',
|
||||
\ }, 'keep')
|
||||
endif
|
||||
|
||||
@@ -184,18 +192,21 @@ function! airline#init#bootstrap()
|
||||
call airline#parts#define_function('crypt', 'airline#parts#crypt')
|
||||
call airline#parts#define_function('spell', 'airline#parts#spell')
|
||||
call airline#parts#define_function('filetype', 'airline#parts#filetype')
|
||||
call airline#parts#define_function('executable', 'airline#parts#executable')
|
||||
call airline#parts#define('readonly', {
|
||||
\ 'function': 'airline#parts#readonly',
|
||||
\ 'accent': 'red',
|
||||
\ })
|
||||
if get(g:, 'airline_section_c_only_filename',0)
|
||||
call airline#parts#define_raw('file', '%t%m')
|
||||
elseif get(g:, 'airline_stl_path_style', 'default') ==# 'gitrepo'
|
||||
call airline#parts#define_function('file', 'airline#parts#gitrepo')
|
||||
else
|
||||
call airline#parts#define_raw('file', airline#formatter#short_path#format('%f%m'))
|
||||
endif
|
||||
call airline#parts#define_raw('path', '%F%m')
|
||||
call airline#parts#define('linenr', {
|
||||
\ 'raw': '%{g:airline_symbols.linenr}%l',
|
||||
\ 'raw': '%{g:airline_symbols.linenr}%2l',
|
||||
\ 'accent': 'bold'})
|
||||
call airline#parts#define('maxlinenr', {
|
||||
\ 'raw': '/%L%{g:airline_symbols.maxlinenr}',
|
||||
@@ -248,7 +259,7 @@ endfunction
|
||||
function! airline#init#sections()
|
||||
let spc = g:airline_symbols.space
|
||||
if !exists('g:airline_section_a')
|
||||
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'keymap', 'spell', 'capslock', 'xkblayout', 'iminsert'])
|
||||
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'keymap', 'spell', 'capslock', 'xkblayout', 'iminsert', 'executable'])
|
||||
endif
|
||||
if !exists('g:airline_section_b')
|
||||
if airline#util#winwidth() > 99
|
||||
@@ -283,7 +294,16 @@ function! airline#init#sections()
|
||||
if !exists('g:airline_section_error')
|
||||
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count', 'lsp_error_count', 'nvimlsp_error_count', 'languageclient_error_count', 'coc_error_count', 'vim9lsp_error_count'])
|
||||
endif
|
||||
if !exists('g:airline_section_warning')
|
||||
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'lsp_warning_count', 'nvimlsp_warning_count', 'languageclient_warning_count', 'whitespace', 'coc_warning_count', 'vim9lsp_warning_count'])
|
||||
if airline#util#has_multiline()
|
||||
if !exists('g:airline_section_warning')
|
||||
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'lsp_warning_count', 'nvimlsp_warning_count', 'languageclient_warning_count', 'coc_warning_count', 'vim9lsp_warning_count'])
|
||||
endif
|
||||
if !exists('g:airline_section_warning2')
|
||||
let g:airline_section_warning2 = airline#section#create(['whitespace'])
|
||||
endif
|
||||
else
|
||||
if !exists('g:airline_section_warning')
|
||||
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'lsp_warning_count', 'nvimlsp_warning_count', 'languageclient_warning_count', 'whitespace', 'coc_warning_count', 'vim9lsp_warning_count'])
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
+18
-18
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling Christian Brabandt et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -43,24 +43,24 @@ let s:basic16 = [
|
||||
|
||||
if !exists(":def") || !airline#util#has_vim9_script()
|
||||
|
||||
function! airline#msdos#round_msdos_colors(rgblist)
|
||||
" Check for values from MSDOS 16 color terminal
|
||||
let best = []
|
||||
let min = 100000
|
||||
let list = s:basic16
|
||||
for value in list
|
||||
let t = abs(value[0] - a:rgblist[0]) +
|
||||
\ abs(value[1] - a:rgblist[1]) +
|
||||
\ abs(value[2] - a:rgblist[2])
|
||||
if min > t
|
||||
let min = t
|
||||
let best = value
|
||||
endif
|
||||
endfor
|
||||
return index(s:basic16, best)
|
||||
endfunction
|
||||
function! airline#msdos#round_msdos_colors(rgblist)
|
||||
" Check for values from MSDOS 16 color terminal
|
||||
let best = []
|
||||
let min = 100000
|
||||
let list = s:basic16
|
||||
for value in list
|
||||
let t = abs(value[0] - a:rgblist[0]) +
|
||||
\ abs(value[1] - a:rgblist[1]) +
|
||||
\ abs(value[2] - a:rgblist[2])
|
||||
if min > t
|
||||
let min = t
|
||||
let best = value
|
||||
endif
|
||||
endfor
|
||||
return index(s:basic16, best)
|
||||
endfunction
|
||||
|
||||
finish
|
||||
finish
|
||||
|
||||
else
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
@@ -206,3 +206,32 @@ function! airline#parts#ffenc()
|
||||
return &fenc.bomb.noeolf.ff
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#parts#executable()
|
||||
if exists("*getfperm") && getfperm(bufname('%')) =~ 'x'
|
||||
return g:airline_symbols.executable
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#parts#gitrepo() abort
|
||||
if !exists('*FugitiveFind')
|
||||
return expand('%:p')
|
||||
endif
|
||||
let toplevel = FugitiveFind(':/', bufnr(''))
|
||||
if empty(toplevel)
|
||||
return expand('%:p')
|
||||
endif
|
||||
" Remove trailing separator
|
||||
let toplevel = substitute(toplevel, '[/\\]$', '', '')
|
||||
let reponame = fnamemodify(toplevel, ':t')
|
||||
let fullpath = resolve(expand('%:p'))
|
||||
" Get file path relative to repo root
|
||||
if fullpath[:len(toplevel)-1] ==# toplevel
|
||||
let relpath = fullpath[len(toplevel)+1:]
|
||||
else
|
||||
let relpath = expand('%:t')
|
||||
endif
|
||||
return reponame .. ':' .. relpath .. (&modified ? '[+]' : '')
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2 et
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
|
||||
" MIT License. Copyright (c) 2013-2026 Bailey Ling, Christian Brabandt et al.
|
||||
" vim: et ts=2 sts=2 sw=2 tw=80
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
+390
-181
@@ -13,84 +13,14 @@ let s:has_strchars = exists('*strchars')
|
||||
let s:has_strcharpart = exists('*strcharpart')
|
||||
let s:focusgained_ignore_time = 0
|
||||
|
||||
" TODO: Try to cache winwidth(0) function
|
||||
" e.g. store winwidth per window and access that, only update it, if the size
|
||||
" actually changed.
|
||||
function! airline#util#winwidth(...) abort
|
||||
let nr = get(a:000, 0, 0)
|
||||
" When statusline is on top, or using global statusline for Neovim
|
||||
" always return the number of columns
|
||||
if get(g:, 'airline_statusline_ontop', 0) || &laststatus > 2
|
||||
return &columns
|
||||
else
|
||||
return winwidth(nr)
|
||||
endif
|
||||
function! airline#util#has_vim9_script()
|
||||
" Returns true, if Vim is new enough to understand vim9 script
|
||||
return (exists(":def") &&
|
||||
\ exists("v:versionlong") &&
|
||||
\ v:versionlong >= 8022844 &&
|
||||
\ get(g:, "airline_experimental", 0))
|
||||
endfunction
|
||||
|
||||
function! airline#util#shorten(text, winwidth, minwidth, ...)
|
||||
if airline#util#winwidth() < a:winwidth && len(split(a:text, '\zs')) > a:minwidth
|
||||
if get(a:000, 0, 0)
|
||||
" shorten from tail
|
||||
return '…'.matchstr(a:text, '.\{'.a:minwidth.'}$')
|
||||
else
|
||||
" shorten from beginning of string
|
||||
return matchstr(a:text, '^.\{'.a:minwidth.'}').'…'
|
||||
endif
|
||||
else
|
||||
return a:text
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#wrap(text, minwidth)
|
||||
if a:minwidth > 0 && airline#util#winwidth() < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
return a:text
|
||||
endfunction
|
||||
|
||||
function! airline#util#append(text, minwidth)
|
||||
if a:minwidth > 0 && airline#util#winwidth() < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc
|
||||
return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text
|
||||
endfunction
|
||||
|
||||
function! airline#util#warning(msg)
|
||||
echohl WarningMsg
|
||||
echomsg "airline: ".a:msg
|
||||
echohl Normal
|
||||
endfunction
|
||||
|
||||
function! airline#util#prepend(text, minwidth)
|
||||
if a:minwidth > 0 && airline#util#winwidth() < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc
|
||||
endfunction
|
||||
|
||||
if v:version >= 704
|
||||
function! airline#util#getbufvar(bufnr, key, def)
|
||||
return getbufvar(a:bufnr, a:key, a:def)
|
||||
endfunction
|
||||
else
|
||||
function! airline#util#getbufvar(bufnr, key, def)
|
||||
let bufvals = getbufvar(a:bufnr, '')
|
||||
return get(bufvals, a:key, a:def)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if v:version >= 704
|
||||
function! airline#util#getwinvar(winnr, key, def)
|
||||
return getwinvar(a:winnr, a:key, a:def)
|
||||
endfunction
|
||||
else
|
||||
function! airline#util#getwinvar(winnr, key, def)
|
||||
let winvals = getwinvar(a:winnr, '')
|
||||
return get(winvals, a:key, a:def)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if v:version >= 704
|
||||
function! airline#util#exec_funcrefs(list, ...)
|
||||
for Fn in a:list
|
||||
@@ -116,125 +46,404 @@ else
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" Compatibility wrapper for strchars, in case this vim version does not
|
||||
" have it natively
|
||||
function! airline#util#strchars(str)
|
||||
if s:has_strchars
|
||||
return strchars(a:str)
|
||||
if !exists(":def") || !airline#util#has_vim9_script()
|
||||
" TODO: Try to cache winwidth(0) function
|
||||
" e.g. store winwidth per window and access that, only update it, if the size
|
||||
" actually changed.
|
||||
function! airline#util#winwidth(...) abort
|
||||
let nr = get(a:000, 0, 0)
|
||||
" When statusline is on top, or using global statusline for Neovim
|
||||
" always return the number of columns
|
||||
if get(g:, 'airline_statusline_ontop', 0) || &laststatus > 2
|
||||
return &columns
|
||||
else
|
||||
return winwidth(nr)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#shorten(text, winwidth, minwidth, ...)
|
||||
if airline#util#winwidth() < a:winwidth && len(split(a:text, '\zs')) > a:minwidth
|
||||
if get(a:000, 0, 0)
|
||||
" shorten from tail
|
||||
return '…'.matchstr(a:text, '.\{'.a:minwidth.'}$')
|
||||
else
|
||||
" shorten from beginning of string
|
||||
return matchstr(a:text, '^.\{'.a:minwidth.'}').'…'
|
||||
endif
|
||||
else
|
||||
return a:text
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#wrap(text, minwidth)
|
||||
if a:minwidth > 0 && airline#util#winwidth() < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
return a:text
|
||||
endfunction
|
||||
|
||||
function! airline#util#append(text, minwidth)
|
||||
if a:minwidth > 0 && airline#util#winwidth() < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc
|
||||
return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text
|
||||
endfunction
|
||||
|
||||
function! airline#util#warning(msg)
|
||||
echohl WarningMsg
|
||||
echomsg "airline: ".a:msg
|
||||
echohl Normal
|
||||
endfunction
|
||||
|
||||
function! airline#util#prepend(text, minwidth)
|
||||
if a:minwidth > 0 && airline#util#winwidth() < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc
|
||||
endfunction
|
||||
|
||||
if v:version >= 704
|
||||
function! airline#util#getbufvar(bufnr, key, def)
|
||||
return getbufvar(a:bufnr, a:key, a:def)
|
||||
endfunction
|
||||
else
|
||||
return strlen(substitute(a:str, '.', 'a', 'g'))
|
||||
function! airline#util#getbufvar(bufnr, key, def)
|
||||
let bufvals = getbufvar(a:bufnr, '')
|
||||
return get(bufvals, a:key, a:def)
|
||||
endfunction
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#strcharpart(...)
|
||||
if s:has_strcharpart
|
||||
return call('strcharpart', a:000)
|
||||
if v:version >= 704
|
||||
function! airline#util#getwinvar(winnr, key, def)
|
||||
return getwinvar(a:winnr, a:key, a:def)
|
||||
endfunction
|
||||
else
|
||||
" does not handle multibyte chars :(
|
||||
return a:1[(a:2):(a:3)]
|
||||
function! airline#util#getwinvar(winnr, key, def)
|
||||
let winvals = getwinvar(a:winnr, '')
|
||||
return get(winvals, a:key, a:def)
|
||||
endfunction
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#ignore_buf(name)
|
||||
let pat = '\c\v'. get(g:, 'airline#ignore_bufadd_pat', '').
|
||||
\ get(g:, 'airline#extensions#tabline#ignore_bufadd_pat',
|
||||
\ '!|defx|gundo|nerd_tree|startify|tagbar|term://|undotree|vimfiler')
|
||||
return match(a:name, pat) > -1
|
||||
endfunction
|
||||
|
||||
function! airline#util#has_fugitive()
|
||||
if !exists("s:has_fugitive")
|
||||
let s:has_fugitive = exists('*FugitiveHead')
|
||||
endif
|
||||
return s:has_fugitive
|
||||
endfunction
|
||||
|
||||
function! airline#util#has_gina()
|
||||
if !exists("s:has_gina")
|
||||
let s:has_gina = (exists(':Gina') && v:version >= 800)
|
||||
endif
|
||||
return s:has_gina
|
||||
endfunction
|
||||
|
||||
|
||||
function! airline#util#has_lawrencium()
|
||||
if !exists("s:has_lawrencium")
|
||||
let s:has_lawrencium = exists('*lawrencium#statusline')
|
||||
endif
|
||||
return s:has_lawrencium
|
||||
endfunction
|
||||
" Compatibility wrapper for strchars, in case this vim version does not
|
||||
" have it natively
|
||||
function! airline#util#strchars(str)
|
||||
if s:has_strchars
|
||||
return strchars(a:str)
|
||||
else
|
||||
return strlen(substitute(a:str, '.', 'a', 'g'))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#has_vcscommand()
|
||||
if !exists("s:has_vcscommand")
|
||||
let s:has_vcscommand = exists('*VCSCommandGetStatusLine')
|
||||
endif
|
||||
return get(g:, 'airline#extensions#branch#use_vcscommand', 0) && s:has_vcscommand
|
||||
endfunction
|
||||
function! airline#util#strcharpart(...)
|
||||
if s:has_strcharpart
|
||||
return call('strcharpart', a:000)
|
||||
else
|
||||
" does not handle multibyte chars :(
|
||||
return a:1[(a:2):(a:3)]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#has_custom_scm()
|
||||
return !empty(get(g:, 'airline#extensions#branch#custom_head', ''))
|
||||
endfunction
|
||||
function! airline#util#ignore_buf(name)
|
||||
let pat = '\c\v'. get(g:, 'airline#ignore_bufadd_pat', '').
|
||||
\ get(g:, 'airline#extensions#tabline#ignore_bufadd_pat',
|
||||
\ '!|defx|gundo|nerd_tree|startify|tagbar|term://|undotree|vimfiler')
|
||||
return match(a:name, pat) > -1
|
||||
endfunction
|
||||
|
||||
function! airline#util#doautocmd(event)
|
||||
if !exists('#airline') && a:event !=? 'AirlineToggledOff'
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
try
|
||||
exe printf("silent doautocmd %s User %s", s:nomodeline, a:event)
|
||||
catch /^Vim\%((\a\+)\)\=:E48:/
|
||||
" Catch: Sandbox mode
|
||||
" no-op
|
||||
endtry
|
||||
endfunction
|
||||
function! airline#util#has_fugitive()
|
||||
if !exists("s:has_fugitive")
|
||||
let s:has_fugitive = exists('*FugitiveHead')
|
||||
endif
|
||||
return s:has_fugitive
|
||||
endfunction
|
||||
|
||||
function! airline#util#themes(match)
|
||||
let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:match.'*.vim', 1), "\n")
|
||||
return sort(map(files, 'fnamemodify(v:val, ":t:r")') + ('random' =~ a:match ? ['random'] : []))
|
||||
endfunction
|
||||
function! airline#util#has_zhihu()
|
||||
if !has('nvim')
|
||||
return 0
|
||||
endif
|
||||
try
|
||||
call v:lua.require'zhihu'.setup()
|
||||
catch
|
||||
return 0
|
||||
endtry
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! airline#util#stl_disabled(winnr)
|
||||
" setting the statusline is disabled,
|
||||
" either globally, per window, or per buffer
|
||||
" w:airline_disabled is deprecated!
|
||||
return get(g:, 'airline_disable_statusline', 0) ||
|
||||
\ airline#util#getwinvar(a:winnr, 'airline_disable_statusline', 0) ||
|
||||
\ airline#util#getwinvar(a:winnr, 'airline_disabled', 0) ||
|
||||
\ airline#util#getbufvar(winbufnr(a:winnr), 'airline_disable_statusline', 0)
|
||||
endfunction
|
||||
function! airline#util#has_gina()
|
||||
if !exists("s:has_gina")
|
||||
let s:has_gina = (exists(':Gina') && v:version >= 800)
|
||||
endif
|
||||
return s:has_gina
|
||||
endfunction
|
||||
|
||||
function! airline#util#ignore_next_focusgain()
|
||||
if has('win32')
|
||||
" Setup an ignore for platforms that trigger FocusLost on calls to
|
||||
" system(). macvim (gui and terminal) and Linux terminal vim do not.
|
||||
let s:focusgained_ignore_time = localtime()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#is_popup_window(winnr)
|
||||
" Keep the statusline active if it's a popup window
|
||||
if exists('*win_gettype')
|
||||
return win_gettype(a:winnr) ==# 'popup' || win_gettype(a:winnr) ==# 'autocmd'
|
||||
else
|
||||
return airline#util#getwinvar(a:winnr, '&buftype', '') ==# 'popup'
|
||||
endif
|
||||
endfunction
|
||||
function! airline#util#has_lawrencium()
|
||||
if !exists("s:has_lawrencium")
|
||||
let s:has_lawrencium = exists('*lawrencium#statusline')
|
||||
endif
|
||||
return s:has_lawrencium
|
||||
endfunction
|
||||
|
||||
function! airline#util#try_focusgained()
|
||||
" Ignore lasts for at most one second and is cleared on the first
|
||||
" focusgained. We use ignore to prevent system() calls from triggering
|
||||
" FocusGained (which occurs 100% on win32 and seem to sometimes occur under
|
||||
" tmux).
|
||||
let dt = localtime() - s:focusgained_ignore_time
|
||||
let s:focusgained_ignore_time = 0
|
||||
return dt >= 1
|
||||
endfunction
|
||||
function! airline#util#has_vcscommand()
|
||||
if !exists("s:has_vcscommand")
|
||||
let s:has_vcscommand = exists('*VCSCommandGetStatusLine')
|
||||
endif
|
||||
return get(g:, 'airline#extensions#branch#use_vcscommand', 0) && s:has_vcscommand
|
||||
endfunction
|
||||
|
||||
function! airline#util#has_vim9_script()
|
||||
" Returns true, if Vim is new enough to understand vim9 script
|
||||
return (exists(":def") &&
|
||||
\ exists("v:versionlong") &&
|
||||
\ v:versionlong >= 8022844 &&
|
||||
\ get(g:, "airline_experimental", 0))
|
||||
endfunction
|
||||
function! airline#util#has_custom_scm()
|
||||
return !empty(get(g:, 'airline#extensions#branch#custom_head', ''))
|
||||
endfunction
|
||||
|
||||
function! airline#util#doautocmd(event)
|
||||
if !exists('#airline') && a:event !=? 'AirlineToggledOff'
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
try
|
||||
exe printf("silent doautocmd %s User %s", s:nomodeline, a:event)
|
||||
catch /^Vim\%((\a\+)\)\=:E48:/
|
||||
" Catch: Sandbox mode
|
||||
" no-op
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! airline#util#themes(match)
|
||||
let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:match.'*.vim', 1), "\n")
|
||||
return sort(map(files, 'fnamemodify(v:val, ":t:r")') + ('random' =~ a:match ? ['random'] : []))
|
||||
endfunction
|
||||
|
||||
function! airline#util#stl_disabled(winnr)
|
||||
" setting the statusline is disabled,
|
||||
" either globally, per window, or per buffer
|
||||
" w:airline_disabled is deprecated!
|
||||
return get(g:, 'airline_disable_statusline', 0) ||
|
||||
\ airline#util#getwinvar(a:winnr, 'airline_disable_statusline', 0) ||
|
||||
\ airline#util#getwinvar(a:winnr, 'airline_disabled', 0) ||
|
||||
\ airline#util#getbufvar(winbufnr(a:winnr), 'airline_disable_statusline', 0)
|
||||
endfunction
|
||||
|
||||
function! airline#util#ignore_next_focusgain()
|
||||
if has('win32')
|
||||
" Setup an ignore for platforms that trigger FocusLost on calls to
|
||||
" system(). macvim (gui and terminal) and Linux terminal vim do not.
|
||||
let s:focusgained_ignore_time = localtime()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#is_popup_window(winnr)
|
||||
" Keep the statusline active if it's a popup window
|
||||
if exists('*win_gettype')
|
||||
return win_gettype(a:winnr) ==# 'popup' || win_gettype(a:winnr) ==# 'autocmd'
|
||||
else
|
||||
return airline#util#getwinvar(a:winnr, '&buftype', '') ==# 'popup'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#try_focusgained()
|
||||
" Ignore lasts for at most one second and is cleared on the first
|
||||
" focusgained. We use ignore to prevent system() calls from triggering
|
||||
" FocusGained (which occurs 100% on win32 and seem to sometimes occur under
|
||||
" tmux).
|
||||
let dt = localtime() - s:focusgained_ignore_time
|
||||
let s:focusgained_ignore_time = 0
|
||||
return dt >= 1
|
||||
endfunction
|
||||
|
||||
function! airline#util#has_multiline()
|
||||
" Returns true, if Vim supports multiline statusline (Vim 9.2.0083)
|
||||
return (exists("+statuslineopt") &&
|
||||
\ get(g:, "airline_multiline", 0))
|
||||
endfunction
|
||||
|
||||
" End legacy Vim Script
|
||||
finish
|
||||
|
||||
else
|
||||
|
||||
def airline#util#winwidth(...args: list<any>): number
|
||||
const nr = get(args, 0, 0)
|
||||
# When statusline is on top, or using global statusline for Neovim
|
||||
# always return the number of columns
|
||||
if get(g:, 'airline_statusline_ontop', 0) || &laststatus > 2
|
||||
return &columns
|
||||
else
|
||||
return winwidth(nr)
|
||||
endif
|
||||
enddef
|
||||
|
||||
def airline#util#shorten(text: string, winwidth: number, minwidth: number, ...args: list<any>): string
|
||||
if airline#util#winwidth() < winwidth && len(split(text, '\zs')) > minwidth
|
||||
if get(args, 0, 0)
|
||||
# shorten from tail
|
||||
return '…' .. matchstr(text, '.\{' .. minwidth .. '}$')
|
||||
else
|
||||
# shorten from beginning of string
|
||||
return matchstr(text, '^.\{' .. minwidth .. '}') .. '…'
|
||||
endif
|
||||
else
|
||||
return text
|
||||
endif
|
||||
enddef
|
||||
|
||||
def airline#util#wrap(text: string, minwidth: number): string
|
||||
if minwidth > 0 && airline#util#winwidth() < minwidth
|
||||
return ''
|
||||
endif
|
||||
return text
|
||||
enddef
|
||||
|
||||
def airline#util#append(text: string, minwidth: number): string
|
||||
if minwidth > 0 && airline#util#winwidth() < minwidth
|
||||
return ''
|
||||
endif
|
||||
const prefix = s:spc == "\ua0" ? s:spc : s:spc .. s:spc
|
||||
return empty(text) ? '' : prefix .. g:airline_left_alt_sep .. s:spc .. text
|
||||
enddef
|
||||
|
||||
def airline#util#warning(msg: string)
|
||||
echohl WarningMsg
|
||||
echomsg "airline: " .. msg
|
||||
echohl Normal
|
||||
enddef
|
||||
|
||||
def airline#util#prepend(text: string, minwidth: number): string
|
||||
if minwidth > 0 && airline#util#winwidth() < minwidth
|
||||
return ''
|
||||
endif
|
||||
return empty(text) ? '' : text .. s:spc .. g:airline_right_alt_sep .. s:spc
|
||||
enddef
|
||||
|
||||
def airline#util#getbufvar(bufnr: number, key: string, def: any): any
|
||||
return getbufvar(bufnr, key, def)
|
||||
enddef
|
||||
|
||||
def airline#util#getwinvar(winnr: number, key: string, def: any): any
|
||||
return getwinvar(winnr, key, def)
|
||||
enddef
|
||||
|
||||
def airline#util#strchars(str: string): number
|
||||
if s:has_strchars
|
||||
return strchars(str)
|
||||
else
|
||||
return strlen(substitute(str, '.', 'a', 'g'))
|
||||
endif
|
||||
enddef
|
||||
|
||||
def airline#util#strcharpart(...values: list<any>): string
|
||||
if s:has_strcharpart
|
||||
return call('strcharpart', values)
|
||||
else
|
||||
# does not handle multibyte chars :(
|
||||
return values[1][values[2] : values[3]]
|
||||
endif
|
||||
enddef
|
||||
|
||||
def airline#util#ignore_buf(name: string): bool
|
||||
var pat = '\c\v' .. get(g:, 'airline#ignore_bufadd_pat', '') .. get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', '!|defx|gundo|nerd_tree|startify|tagbar|term://|undotree|vimfiler')
|
||||
return match(name, pat) > -1
|
||||
enddef
|
||||
|
||||
def airline#util#has_fugitive(): bool
|
||||
if !exists("s:has_fugitive")
|
||||
s:has_fugitive = exists('*FugitiveHead')
|
||||
endif
|
||||
return s:has_fugitive
|
||||
enddef
|
||||
|
||||
def airline#util#has_zhihu(): number
|
||||
return 0
|
||||
enddef
|
||||
|
||||
def airline#util#has_gina(): bool
|
||||
if !exists("s:has_gina")
|
||||
s:has_gina = (exists(':Gina') && v:version >= 800)
|
||||
endif
|
||||
return s:has_gina
|
||||
enddef
|
||||
|
||||
def airline#util#has_lawrencium(): bool
|
||||
if !exists("s:has_lawrencium")
|
||||
s:has_lawrencium = exists('*lawrencium#statusline')
|
||||
endif
|
||||
return s:has_lawrencium
|
||||
enddef
|
||||
|
||||
def airline#util#has_vcscommand(): bool
|
||||
if !exists("s:has_vcscommand")
|
||||
s:has_vcscommand = exists('*VCSCommandGetStatusLine')
|
||||
endif
|
||||
return get(g:, 'airline#extensions#branch#use_vcscommand', 0) && s:has_vcscommand
|
||||
enddef
|
||||
|
||||
def airline#util#has_custom_scm(): bool
|
||||
return !empty(get(g:, 'airline#extensions#branch#custom_head', ''))
|
||||
enddef
|
||||
|
||||
def airline#util#doautocmd(event: string)
|
||||
if !exists('#airline') && event !=? 'AirlineToggledOff'
|
||||
# airline disabled
|
||||
return
|
||||
endif
|
||||
try
|
||||
exe printf("silent doautocmd %s User %s", s:nomodeline, event)
|
||||
catch /^Vim\%((\a\+)\)\=:E48:/
|
||||
# Catch: Sandbox mode
|
||||
# no-op
|
||||
endtry
|
||||
enddef
|
||||
|
||||
def airline#util#themes(match_str: string): list<string>
|
||||
const files = split(globpath(&rtp, 'autoload/airline/themes/' .. match_str .. '*.vim', true), "\n")
|
||||
var theme_names = files->mapnew((_, val) => fnamemodify(val, ":t:r"))
|
||||
if "random" =~ match_str
|
||||
theme_names->add("random")
|
||||
endif
|
||||
return theme_names->sort()
|
||||
enddef
|
||||
|
||||
def airline#util#stl_disabled(winnr: number): bool
|
||||
# setting the statusline is disabled,
|
||||
# either globally, per window, or per buffer
|
||||
# w:airline_disabled is deprecated!
|
||||
return get(g:, 'airline_disable_statusline', 0) ||
|
||||
\ airline#util#getwinvar(winnr, 'airline_disable_statusline', 0) ||
|
||||
\ airline#util#getwinvar(winnr, 'airline_disabled', 0) ||
|
||||
\ airline#util#getbufvar(winbufnr(winnr), 'airline_disable_statusline', 0)
|
||||
enddef
|
||||
|
||||
def airline#util#ignore_next_focusgain()
|
||||
if has('win32')
|
||||
# Setup an ignore for platforms that trigger FocusLost on calls to
|
||||
# system(). macvim (gui and terminal) and Linux terminal vim do not.
|
||||
s:focusgained_ignore_time = localtime()
|
||||
endif
|
||||
enddef
|
||||
|
||||
def airline#util#is_popup_window(winnr: number): bool
|
||||
# Keep the statusline active if it's a popup window
|
||||
if exists('*win_gettype')
|
||||
return win_gettype(winnr) ==# 'popup' || win_gettype(winnr) ==# 'autocmd'
|
||||
else
|
||||
return airline#util#getwinvar(winnr, '&buftype', '') ==# 'popup'
|
||||
endif
|
||||
enddef
|
||||
|
||||
def airline#util#try_focusgained(): bool
|
||||
# Ignore lasts for at most one second and is cleared on the first
|
||||
# focusgained. We use ignore to prevent system() calls from triggering
|
||||
# FocusGained (which occurs 100% on win32 and seem to sometimes occur under
|
||||
# tmux).
|
||||
const dt = localtime() - s:focusgained_ignore_time
|
||||
s:focusgained_ignore_time = 0
|
||||
return dt >= 1
|
||||
enddef
|
||||
|
||||
def airline#util#has_multiline(): bool
|
||||
# Returns true, if Vim supports multiline statusline (Vim 9.2.0083)
|
||||
return (exists("+statuslineopt") &&
|
||||
\ get(g:, "airline_multiline", 0))
|
||||
enddef
|
||||
endif
|
||||
|
||||
+116
-23
@@ -1,4 +1,4 @@
|
||||
*airline.txt* Lean and mean status/tabline that's light as air
|
||||
*airline.txt* Lean and mean status/tabline that's light as air
|
||||
*airline* *vim-airline*
|
||||
_ _ _ _ ~
|
||||
__ _(_)_ __ ___ __ _(_)_ __| (_)_ __ ___ ~
|
||||
@@ -6,7 +6,7 @@
|
||||
\ V /| | | | | | |_____| (_| | | | | | | | | | __/ ~
|
||||
\_/ |_|_| |_| |_| \__,_|_|_| |_|_|_| |_|\___| ~
|
||||
~
|
||||
Version: 0.11
|
||||
Version: 0.12
|
||||
=============================================================================
|
||||
CONTENTS *airline-contents*
|
||||
|
||||
@@ -57,6 +57,8 @@ this: >
|
||||
+---------------------------------------------------------------------------+
|
||||
| A | B | C X | Y | Z | [...] |
|
||||
+---------------------------------------------------------------------------+
|
||||
| [...] |
|
||||
+---------------------------------------------------------------------------+
|
||||
|
||||
The statusline is the colored line at the bottom, which contains the sections
|
||||
(possibly in different colors):
|
||||
@@ -73,15 +75,16 @@ section meaning (example)~
|
||||
Z current position in the file
|
||||
percentage % ln: current line/number of lines ☰ cn: column
|
||||
So this: 10% ln:10/100☰ cn:20
|
||||
means: >
|
||||
means: >
|
||||
10% - 10 percent
|
||||
ln: - line number is
|
||||
ln: - line number is
|
||||
10/100☰ - 10 of 100 total lines
|
||||
cn: - column number is
|
||||
cn: - column number is
|
||||
20 - 20
|
||||
<
|
||||
[...] additional sections (warning/errors/statistics)
|
||||
from external plugins (e.g. YCM/syntastic/...)
|
||||
Can be shown on a second line optionally.
|
||||
|
||||
For a better look, those sections can be colored differently, depending on
|
||||
the mode and whether the current file is 'modified'
|
||||
@@ -124,6 +127,9 @@ values):
|
||||
" Currently: Enable Vim9 Script implementation
|
||||
let g:airline_experimental = 1
|
||||
|
||||
* enable multiline feature (requires Vim 9.2.0083) >
|
||||
let g:airline_multiline = 1
|
||||
|
||||
* the separator used on the left side >
|
||||
let g:airline_left_sep='>'
|
||||
<
|
||||
@@ -266,9 +272,9 @@ values):
|
||||
" disable per-buffer
|
||||
let b:airline_disable_statusline = 1
|
||||
|
||||
< This setting disables setting the 'statusline' option. This allows to use
|
||||
e.g. the tabline extension (|airline-tabline|) but keep the 'statusline'
|
||||
option totally configurable by a custom configuration.
|
||||
< This setting disables setting the 'statusline' option. This allows to use
|
||||
e.g. the tabline extension (|airline-tabline|) but keep the 'statusline'
|
||||
option totally configurable by a custom configuration.
|
||||
* Do not draw separators for empty sections (only for the active window) >
|
||||
let g:airline_skip_empty_sections = 1
|
||||
<
|
||||
@@ -306,6 +312,12 @@ values):
|
||||
* Display a short path in statusline: >
|
||||
let g:airline_stl_path_style = 'short'
|
||||
>
|
||||
* Display the file path relative to the git repository toplevel directory: >
|
||||
let g:airline_stl_path_style = 'gitrepo'
|
||||
<
|
||||
This shows the path as `reponame:path/to/file` instead of the full path.
|
||||
Requires fugitive plugin. Falls back to the full path for non-git files.
|
||||
|
||||
* Display a only file name in statusline: >
|
||||
let g:airline_section_c_only_filename = 1
|
||||
>
|
||||
@@ -374,6 +386,7 @@ its contents. >
|
||||
let g:airline_symbols.colnr = ' ㏇:'
|
||||
let g:airline_symbols.colnr = ' ℅:'
|
||||
let g:airline_symbols.crypt = '🔒'
|
||||
let g:airline_symbols.executable = '⚙'
|
||||
let g:airline_symbols.linenr = '☰'
|
||||
let g:airline_symbols.linenr = ' ␊:'
|
||||
let g:airline_symbols.linenr = ' :'
|
||||
@@ -427,7 +440,7 @@ window.
|
||||
>
|
||||
variable names default contents
|
||||
---------------------------------------------------------------------------
|
||||
let g:airline_section_a (mode, crypt, paste, spell, iminsert)
|
||||
let g:airline_section_a (mode, crypt, paste, spell, iminsert, executable)
|
||||
let g:airline_section_b (hunks, branch)[*]
|
||||
let g:airline_section_c (bufferline or filename, readonly)
|
||||
let g:airline_section_gutter (csv)
|
||||
@@ -438,6 +451,7 @@ window.
|
||||
languageclient_error_count)
|
||||
let g:airline_section_warning (ycm_warning_count, syntastic-warn,
|
||||
languageclient_warning_count, whitespace)
|
||||
let g:airline_section_warning2 (whitespace) [optional]
|
||||
|
||||
" [*] This section needs at least the fugitive extension or else
|
||||
" it will remain empty
|
||||
@@ -782,7 +796,7 @@ eclim <https://eclim.org>
|
||||
|airline-syntastic| extension. >
|
||||
let g:airline#extensions#eclim#enabled = 1
|
||||
|
||||
------------------------------------- *airline-fern*
|
||||
------------------------------------- *airline-fern*
|
||||
fern.vim <https://github.com/lambdalisue/fern.vim>
|
||||
|
||||
Airline displays the fern.vim specific statusline.
|
||||
@@ -903,6 +917,12 @@ LanguageClient <https://github.com/autozimu/LanguageClient-neovim>
|
||||
* languageclient close_lnum_symbol >
|
||||
let g:airline#extensions#languageclient#close_lnum_symbol = ')'
|
||||
|
||||
------------------------------------- *airline-linediff*
|
||||
linediff.vim <https://github.com/AndrewRadev/linediff.vim>
|
||||
|
||||
* enable/disable linediff buffername and position integration >
|
||||
let g:airline#extensions#linediff#enabled = 1
|
||||
|
||||
------------------------------------- *airline-localsearch*
|
||||
localsearch <https://github.com/mox-mox/vim-localsearch>
|
||||
|
||||
@@ -954,6 +974,18 @@ neomake <https://github.com/neomake/neomake>
|
||||
* neomake warning >
|
||||
let g:airline#extensions#neomake#warning_symbol = 'W:'
|
||||
<
|
||||
------------------------------------- *airline-nerdfont*
|
||||
NerdFont <https://github.com/lambdalisue/nerdfont.vim>
|
||||
|
||||
* enable/disable nerdfont integration >
|
||||
let g:airline#extensions#nerdfont#enabled = 1
|
||||
< default: 1
|
||||
|
||||
* nerdfont's tabline formatter >
|
||||
let g:airline#extensions#tabline#formatter = 'nerdfont'
|
||||
let g:airline#extensions#tabline#formatters#nerdfont#formatter = 'default'
|
||||
< default: 'default'
|
||||
|
||||
------------------------------------- *airline-nerdtree*
|
||||
NerdTree <https://github.com/preservim/nerdtree.git>
|
||||
|
||||
@@ -998,8 +1030,11 @@ vim-obsession <https://github.com/tpope/vim-obsession>
|
||||
* enable/disable vim-obsession integration >
|
||||
let g:airline#extensions#obsession#enabled = 1
|
||||
|
||||
* set marked window indicator string >
|
||||
* set marked window indicator string when recording session>
|
||||
let g:airline#extensions#obsession#indicator_text = '$'
|
||||
|
||||
* set marked window indicator string when recording session is paused>
|
||||
let g:airline#extensions#obsession#indicator_text_paused = ''
|
||||
<
|
||||
------------------------------------- *airline-omnisharp*
|
||||
OmniSharp <https://github.com/OmniSharp/omnisharp-vim>
|
||||
@@ -1127,8 +1162,8 @@ are supported!
|
||||
(only supported for ctrlspace plugin). >
|
||||
let g:airline#extensions#tabline#switch_buffers_and_tabs = 0
|
||||
|
||||
Note: If you are using neovim (has('tablineat') = 1), then you can click
|
||||
on the tabline with the left mouse button to switch to that buffer, and
|
||||
Note: If you are using Neovim or Vim with at least v9.2.0338, then you can
|
||||
click on the tabline with the left mouse button to switch to that buffer, and
|
||||
with the middle mouse button to delete that buffer.
|
||||
|
||||
* if you want to show the current active buffer like this:
|
||||
@@ -1207,7 +1242,7 @@ Note: Not displayed if the number of tabs is less than 1
|
||||
In default mode, when the variable is 1 Up to 10 mappings will be
|
||||
exposed. Note: As 10 and 1 have same prefix, we use 0 to replace 10. So,
|
||||
<leader>0 will jump to tenth buffer. Those mappings are not automatically
|
||||
created, vim-airline just exposes those `<Plug>AirlineSeelctTab` keys
|
||||
created, vim-airline just exposes those `<Plug>AirlineSelectTab` keys
|
||||
for you to map to a convenient key >
|
||||
|
||||
let g:airline#extensions#tabline#buffer_idx_mode = 1
|
||||
@@ -1250,9 +1285,14 @@ Note: Not displayed if the number of tabs is less than 1
|
||||
This matches that of the numbering scheme of |:buffers|, letting
|
||||
`<Plug>AirlineSelectTab67` to reference buffer 67.
|
||||
|
||||
Note: To avoid ambiguity, there won't be <Plug>AirlineSelectTab1
|
||||
- <Plug>AirlineSelectTab9 maps in mode 2 and 3.
|
||||
Note: To avoid ambiguity, there won't be
|
||||
<Plug>AirlineSelectTab1 - <Plug>AirlineSelectTab9
|
||||
maps in mode 2 and 3.
|
||||
|
||||
To go to the very first/last buffer, you can use: >
|
||||
nmap <Leader>FT <Plug>AirlineSelectFirstTab
|
||||
nmap <Leader>LT <Plug>AirlineSelectLastTab
|
||||
<
|
||||
Note: Mappings will be ignored for filetypes that match
|
||||
`g:airline#extensions#tabline#keymap_ignored_filetypes`.
|
||||
|
||||
@@ -1412,26 +1452,65 @@ Note: Enabling this extension will modify 'showtabline' and 'guioptions'.
|
||||
(neovim specific, only works with buffers and not real tabs, default: 0) >
|
||||
let g:airline#extensions#tabline#middle_click_preserves_windows = 1
|
||||
<
|
||||
*airline-tabline-hlgroups*
|
||||
* custom buffer filter function (name of |Funcref|), takes buffer number and
|
||||
* should return an empty value if a buffer shouldn't be displayed >
|
||||
let airline#extensions#tabline#filter_function = ''
|
||||
|
||||
------------------------------------- *airline-tabline-hlgroups*
|
||||
When the tabline is enabled, vim-airline exposes the following highlighting
|
||||
groups:
|
||||
|
||||
airline_tab: default highlighting group for the tabline
|
||||
airline_tab_right: idem, but for the right side of the tabline
|
||||
airline_tab: default highlighting group for the tabline
|
||||
airline_tab_right: idem, but for the right side of the tabline
|
||||
|
||||
airline_tabsel: highlighting group of the selected item
|
||||
airline_tabsel: highlighting group of the selected item
|
||||
airline_tabsel_right: idem, but for the right side of the tabline
|
||||
airline_tabmod: highlighting group for a 'modified' buffer
|
||||
airline_tabmod_right: idem, but on the right side
|
||||
airline_tabmod_unsel: unselected tab with modified buffer
|
||||
airline_tabmod_unsel_right: (unused)
|
||||
airline_tabtype: label group used by ctrlspace and tabws
|
||||
airline_tabfill: highlighting group for the filler space
|
||||
airline_tabfill: highlighting group for the filler space
|
||||
airline_tablabel: highlighting group for the label
|
||||
airline_tablabel_right: highlighting group for the label on the right side
|
||||
airline_tabhid: hidden buffer
|
||||
airline_tabhid: hidden buffer
|
||||
airline_tabhid_right: idem, but on the right
|
||||
|
||||
------------------------------------- *airline-tabpanel*
|
||||
|
||||
Vim supports a vertical tab panel (see |tabpanel|) that displays tab pages
|
||||
in a vertical side column. This extension provides airline-styled formatting
|
||||
for the tab panel. Requires a Vim version that supports 'tabpanel' (at least
|
||||
Vim >9.1.1391).
|
||||
|
||||
* enable/disable tabpanel integration >
|
||||
let g:airline#extensions#tabpanel#enabled = 1
|
||||
< default: 0
|
||||
|
||||
* configure the width of the tab panel (in columns) >
|
||||
let g:airline#extensions#tabpanel#columns = 20
|
||||
< default: 20
|
||||
|
||||
* configure the alignment of the tab panel >
|
||||
let g:airline#extensions#tabpanel#align = 'left'
|
||||
< default: '' (uses Vim's default)
|
||||
|
||||
* reserve a one-column scrollbar in the tabpanel showing the current scroll
|
||||
position; clicking or dragging the thumb jumps to that position (requires
|
||||
Vim patch 9.2.386) >
|
||||
let g:airline#extensions#tabpanel#scrollbar = 1
|
||||
< default: 1
|
||||
|
||||
Note: The tabpanel extension reuses the tabline highlight groups
|
||||
(|airline-tabline-hlgroups|) and respects the tabline tab number settings
|
||||
(|g:airline#extensions#tabline#show_tab_nr|,
|
||||
|g:airline#extensions#tabline#tab_nr_type|,
|
||||
|g:airline#extensions#tabline#tabnr_formatter|).
|
||||
|
||||
Note: Starting with Vim v9.2.0386 Vim adds mouse support for the tabpanel
|
||||
and each tab entry is clickable: a left mouse click switches to the tab and a
|
||||
middle click closes it, however 'mouse' setting needs to be enabled.
|
||||
|
||||
------------------------------------- *airline-scrollbar*
|
||||
|
||||
Displays an Ascii Scrollbar for active windows with a width > 200.
|
||||
@@ -1879,6 +1958,19 @@ default: '> Zoomed'
|
||||
|
||||
default: ''
|
||||
|
||||
------------------------------------- *airline-zhihu*
|
||||
zhihu.nvim <https://github.com/pxwg/zhihu.nvim>
|
||||
|
||||
* enable/disable zhihu integration >
|
||||
let g:airline#extensions#zhihu#enabled = 1
|
||||
< default: 1
|
||||
|
||||
* zhihu's tabline formatter >
|
||||
let g:airline#extensions#tabline#formatter = 'zhihu'
|
||||
let g:airline#extensions#tabline#formatters#nerdfont#formatter = 'default'
|
||||
< default: 'default'
|
||||
|
||||
|
||||
=============================================================================
|
||||
ADVANCED CUSTOMIZATION *airline-advanced-customization*
|
||||
|
||||
@@ -1918,6 +2010,7 @@ The following list of parts are predefined by vim-airline.
|
||||
* `iminsert` displays the current insert method
|
||||
* `paste` displays the paste indicator
|
||||
* `crypt` displays the crypted indicator
|
||||
* `exectuable` displays the executable indicator
|
||||
* `spell` displays the spell indicator
|
||||
* `filetype` displays the file type
|
||||
* `readonly` displays the read only indicator
|
||||
@@ -2168,7 +2261,7 @@ Contributions and pull requests are welcome.
|
||||
=============================================================================
|
||||
LICENSE *airline-license*
|
||||
|
||||
MIT License. Copyright © 2013-2021 Bailey Ling, Christian Brabandt, Mike
|
||||
MIT License. Copyright © 2013-2026 Bailey Ling, Christian Brabandt, Mike
|
||||
Hartington et al.
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user