mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-26 15:34:32 +02:00
support section truncation based on window width. resolves #190.
This commit is contained in:
parent
1980c51971
commit
bc03ab5cbf
@ -25,9 +25,9 @@ Completely transform the statusline to your liking.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
# Integration with external plugins
|
# Seamless integration
|
||||||
|
|
||||||
vim-airline provides seamless integration with a variety of plugins. These extensions will be lazily loaded if and only if you have the other plugins installed (and of course you can turn them off if you don't like it).
|
vim-airline integrates with a variety of plugins out of the box. These extensions will be lazily loaded if and only if you have the other plugins installed (and of course you can turn them off).
|
||||||
|
|
||||||
### [ctrlp.vim][10]
|
### [ctrlp.vim][10]
|
||||||

|

|
||||||
@ -61,8 +61,7 @@ There's already [powerline][2], why yet another statusline?
|
|||||||
|
|
||||||
What about [vim-powerline][1]?
|
What about [vim-powerline][1]?
|
||||||
|
|
||||||
* the author has been active developing powerline, which was rewritten in python and expands its capabilities to tools outside of Vim, such as bash, zsh, and tmux.
|
* vim-powerline has been deprecated in favor of the newer, undifying powerline, which is under active development; the new version is written in python and expands its capabilities to tools outside of vim, such as bash, zsh, and tmux.
|
||||||
* vim-powerline has been deprecated as a result, and no features will be added to it.
|
|
||||||
* vim-powerline uses different font codes, so if you want to use it with a powerline themed tmux (for example), it will not work.
|
* vim-powerline uses different font codes, so if you want to use it with a powerline themed tmux (for example), it will not work.
|
||||||
|
|
||||||
# Where did the name come from?
|
# Where did the name come from?
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||||
" vim: et ts=2 sts=2 sw=2
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
|
let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', {
|
||||||
|
\ 'b': 90,
|
||||||
|
\ 'y': 90,
|
||||||
|
\ })
|
||||||
|
|
||||||
function! s:get_section(winnr, key, ...)
|
function! s:get_section(winnr, key, ...)
|
||||||
|
if has_key(s:section_truncate_width, a:key)
|
||||||
|
if winwidth(a:winnr) < s:section_truncate_width[a:key]
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
endif
|
||||||
let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key})
|
let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key})
|
||||||
let [prefix, suffix] = [get(a:000, 0, '%( '), get(a:000, 1, ' %)')]
|
let [prefix, suffix] = [get(a:000, 0, '%( '), get(a:000, 1, ' %)')]
|
||||||
return empty(text) ? '' : prefix.text.suffix
|
return empty(text) ? '' : prefix.text.suffix
|
||||||
|
@ -185,6 +185,17 @@ EXTENSIONS *airline-extensions*
|
|||||||
Most extensions are enabled by default and lazily loaded when the
|
Most extensions are enabled by default and lazily loaded when the
|
||||||
corresponding plugin (if any) is detected.
|
corresponding plugin (if any) is detected.
|
||||||
|
|
||||||
|
*airline-default*
|
||||||
|
The default extension understands all of the `g:` variables in the
|
||||||
|
|airline-configuration| section, however it also has some more fine-tuned
|
||||||
|
configuration values that you can use.
|
||||||
|
|
||||||
|
* control which sections get truncated and at what width. >
|
||||||
|
let g:airline#extensions#default#section_truncate_width = {
|
||||||
|
\ 'b': 90,
|
||||||
|
\ 'y': 90,
|
||||||
|
\ })
|
||||||
|
<
|
||||||
*airline-branch*
|
*airline-branch*
|
||||||
fugitive.vim <https://github.com/tpope/vim-fugitive>
|
fugitive.vim <https://github.com/tpope/vim-fugitive>
|
||||||
lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
|
lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
|
||||||
|
@ -118,7 +118,7 @@ function! s:airline_toggle()
|
|||||||
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
|
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
|
||||||
|
|
||||||
autocmd ColorScheme * call <sid>on_colorscheme_changed()
|
autocmd ColorScheme * call <sid>on_colorscheme_changed()
|
||||||
autocmd WinEnter,BufWinEnter,FileType,BufUnload,ShellCmdPost *
|
autocmd WinEnter,BufWinEnter,FileType,BufUnload,ShellCmdPost,VimResized *
|
||||||
\ call <sid>on_window_changed()
|
\ call <sid>on_window_changed()
|
||||||
|
|
||||||
autocmd BufWritePost */autoload/airline/themes/*.vim
|
autocmd BufWritePost */autoload/airline/themes/*.vim
|
||||||
|
Loading…
x
Reference in New Issue
Block a user