Add executable status (#2723)

closes: #2722
This commit is contained in:
Christian Brabandt 2025-05-11 13:08:53 +02:00 committed by GitHub
parent 7fc376a4d5
commit 41c5f54507
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 2 deletions

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

@ -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)
@ -1918,6 +1919,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