mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 09:22:53 +08: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.
|
|||
|
||||
![allyourbase](https://f.cloud.github.com/assets/306502/1022714/e150034a-0da7-11e3-94a5-ca9d58a297e8.png)
|
||||
|
||||
# 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]
|
||||
![image](https://f.cloud.github.com/assets/306502/962258/7345a224-04ec-11e3-8b5a-f11724a47437.png)
|
||||
|
@ -61,8 +61,7 @@ There's already [powerline][2], why yet another statusline?
|
|||
|
||||
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 as a result, and no features will be added to it.
|
||||
* 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 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?
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" 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, ...)
|
||||
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 [prefix, suffix] = [get(a:000, 0, '%( '), get(a:000, 1, ' %)')]
|
||||
return empty(text) ? '' : prefix.text.suffix
|
||||
|
|
|
@ -185,6 +185,17 @@ EXTENSIONS *airline-extensions*
|
|||
Most extensions are enabled by default and lazily loaded when the
|
||||
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*
|
||||
fugitive.vim <https://github.com/tpope/vim-fugitive>
|
||||
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 ColorScheme * call <sid>on_colorscheme_changed()
|
||||
autocmd WinEnter,BufWinEnter,FileType,BufUnload,ShellCmdPost *
|
||||
autocmd WinEnter,BufWinEnter,FileType,BufUnload,ShellCmdPost,VimResized *
|
||||
\ call <sid>on_window_changed()
|
||||
|
||||
autocmd BufWritePost */autoload/airline/themes/*.vim
|
||||
|
|
Loading…
Reference in New Issue
Block a user