From 41c5f54507fd865c8c00fe1f4bb390a59b6894ef Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sun, 11 May 2025 13:08:53 +0200 Subject: [PATCH] Add executable status (#2723) closes: #2722 --- autoload/airline/init.vim | 6 +++++- autoload/airline/parts.vim | 8 ++++++++ doc/airline.txt | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index f2256b08..ebf20b6e 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -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 diff --git a/autoload/airline/parts.vim b/autoload/airline/parts.vim index ddbc6013..db2160de 100644 --- a/autoload/airline/parts.vim +++ b/autoload/airline/parts.vim @@ -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 diff --git a/doc/airline.txt b/doc/airline.txt index b012eefd..94ce27f8 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -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