extensions: Allow customization of filetypes

Define the variable :let g:airline_filetype_overrides to allow for
specific customization how a specific filetype will be displayed.

For e.g. a German display, you can use: >

    :let g:airline_filetype_overrides = {'help': ['Hilfe', ':%f']}
<

This defines how section a and b will look like for a window with that
specific filetype.

Closes #1888
This commit is contained in:
Christian Brabandt
2019-04-30 17:06:08 +02:00
parent 170b6d4c26
commit 7469672a46
2 changed files with 32 additions and 15 deletions

View File

@@ -203,12 +203,27 @@ values):
statusline modified >
let g:airline_exclude_filetypes = [] " see source for current list
<
* define the set of names to be displayed instead of a specific filetypes (for
section a and b): >
let g:airline_filetype_overrides = {
\ 'defx': ['defx', '%{b:defx.paths[0]}'],
\ 'gundo': [ 'Gundo', '' ],
\ 'help': [ 'Help', '%f' ],
\ 'minibufexpl': [ 'MiniBufExplorer', '' ],
\ 'nerdtree': [ get(g:, 'NERDTreeStatusline', 'NERD'), '' ],
\ 'startify': [ 'startify', '' ],
\ 'vim-plug': [ 'Plugins', '' ],
\ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ],
\ 'vimshell': ['vimshell','%{vimshell#get_status_string()}'],
\ }
<
* defines whether the preview window should be excluded from have its window
statusline modified (may help with plugins which use the preview window
heavily) >
let g:airline_exclude_preview = 0
<
* disable the Airline customization for selective windows (this is a
* disable the Airline customization for selected windows (this is a
window-local variable so you can disable it per-window) >
let w:airline_disabled = 1