14 Commits

Author SHA1 Message Date
Christian Brabandt
b03fdc542f whitespace: verify existence of searchcount() function before using it
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-23 12:50:58 +01:00
Christian Brabandt
72acbef146 whitespace: add conflicts marker count
closes: #2736

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-23 09:38:13 +01:00
Christian Brabandt
499ae85357 fern: only change directory if we are in a fern window
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-02 14:56:51 +01:00
Christian Brabandt
e06b45a870 fern: handle cases when scheme is not fern of filetype is fern-
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
closes: #2735

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-11-28 12:16:22 +01:00
Will Wills
6b51799f26 fix(tabline): ensure tab_nr updates in buffers.vim (#2734)
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
Previously, when using the rendering in buffers.vim, the tabline only
considered the current buffer and column width when checking for
updates, despite optionally using the tab number in rendering. This
would cause incorrect tabline rendering when switching between tab pages
if the buffer and column width didn't change. This change mimics the
already existent behavior in `tabline/tabs.vim` which caches the current
tab number for comparison when updating. Some other formatting is
changed to align `buffers.vim` to `tabs.vim`.

Fixes: vim-airline/vim-airline#2733
2025-11-04 18:47:56 +01:00
Christian Brabandt
159573187e doc: use tabs as separator between tag and description
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
2025-09-22 19:24:02 +00:00
Stefan Morgenthaler
e40a696db0 feat: allow setting vim-obsession paused indicator (#2730)
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
2025-08-20 22:35:09 +02:00
Christian Brabandt
5ca7f0b7fe whitepace: add whitespace to conflict detection marker
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
closes: #2727

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-07-14 20:56:14 +02:00
Christian Brabandt
41c5f54507 Add executable status (#2723)
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
closes: #2722
2025-05-11 13:08:53 +02:00
Christian Brabandt
7fc376a4d5 CI: update Github runners to Ubuntu 22.04
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-05-01 16:48:35 +02:00
Finite State Machine
2e2afc1056 Update airline.txt to correct a typo (#2721)
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
2025-04-30 22:13:22 +02:00
Christian Brabandt
45003f9451 fern: use correct API to parse the fern protocol
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
related: #2717

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-04-14 07:50:28 +02:00
Christian Brabandt
0694335daa fern: failure when opening a path with spaces
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
Fix this by:
- decode the path using fern#fri#decode()
- use fnameescape() for the 'lcd' command
- add try catch around the 'lcd' command

closes: #2717

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-04-13 17:03:11 +02:00
Christian Brabandt
7ad8c717c6 tests: fix failing test
Some checks failed
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled
after c7704c6bc7 the tests fail, because the tests expect '%l'
in the output of `g:airline_section_z`, but it is now actually '%2l'.

So let's change the expected output for the test.

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-04-13 09:46:50 +02:00
10 changed files with 73 additions and 20 deletions

View File

@@ -11,7 +11,7 @@ on:
jobs:
test:
name: Test
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
vim:

View File

@@ -24,6 +24,7 @@ This is the Changelog for the vim-airline project.
- 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
- Other
- Changed CI from travis-ci.org to GitHub Actions
- Introduce Vim script static analysis using [reviewdog](https://github.com/reviewdog/action-vint)

View File

@@ -27,12 +27,22 @@ 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 = substitute(fri.path, 'file://', '', '')
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
execute 'lcd' abspath
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', '')

View File

@@ -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

View File

@@ -4,8 +4,8 @@
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
@@ -129,7 +130,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 +143,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)

View File

@@ -8,6 +8,7 @@ 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'],
@@ -51,7 +52,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 +63,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 +123,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,6 +154,9 @@ 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

View File

@@ -136,6 +136,7 @@ function! airline#init#bootstrap()
\ 'notexists': "\u0246",
\ 'dirty': "\u26a1",
\ 'crypt': nr2char(0x1F512),
\ 'executable': "\u2699",
\ }, 'keep')
" Note: If "\u2046" (Ɇ) does not show up, try to use "\u2204" (∄)
if exists("*setcellwidths")
@@ -160,6 +161,7 @@ function! airline#init#bootstrap()
\ 'notexists': "\u0246",
\ 'crypt': nr2char(0x1F512),
\ 'dirty': '!',
\ 'executable': "\u2699",
\ }, 'keep')
else
" Symbols for ASCII terminals
@@ -177,6 +179,7 @@ function! airline#init#bootstrap()
\ 'notexists': '?',
\ 'crypt': 'cr',
\ 'dirty': '!',
\ 'executable': 'x',
\ }, 'keep')
endif
@@ -189,6 +192,7 @@ 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',
@@ -253,7 +257,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

View File

@@ -206,3 +206,11 @@ 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

View File

@@ -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*
_ _ _ _ ~
__ _(_)_ __ ___ __ _(_)_ __| (_)_ __ ___ ~
@@ -374,6 +374,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 +428,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)
@@ -998,8 +999,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>
@@ -1207,7 +1211,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
@@ -1918,6 +1922,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

View File

@@ -47,7 +47,7 @@ Describe init.vim
It section z should be line numbers
Assert Match(g:airline_section_z, '%p%%')
Assert Match(g:airline_section_z, '%l')
Assert Match(g:airline_section_z, '%2l')
Assert Match(g:airline_section_z, '%v')
End