mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 13:26:46 +08:00
Add promptline.vim extension
This commit is contained in:
parent
7a1801e9c4
commit
1c41ce53d9
|
@ -70,6 +70,9 @@ vim-airline integrates with a variety of plugins out of the box. These extensio
|
|||
#### [tmuxline][35]
|
||||
![image](https://f.cloud.github.com/assets/1532071/1559276/4c28fbac-4fc7-11e3-90ef-7e833d980f98.gif)
|
||||
|
||||
#### [promptline][36]
|
||||
![airline-promptline-sc](https://f.cloud.github.com/assets/1532071/1871900/7d4b28a0-789d-11e3-90e4-16f37269981b.gif)
|
||||
|
||||
## Extras
|
||||
|
||||
vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also:
|
||||
|
@ -204,3 +207,4 @@ MIT License. Copyright (c) 2013 Bailey Ling.
|
|||
[33]: https://github.com/bling/vim-airline/wiki/Test-Plan
|
||||
[34]: http://eclim.org
|
||||
[35]: https://github.com/edkolev/tmuxline.vim
|
||||
[36]: https://github.com/edkolev/promptline.vim
|
||||
|
|
|
@ -199,6 +199,10 @@ function! airline#extensions#load()
|
|||
call airline#extensions#tmuxline#init(s:ext)
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#promptline#enabled', 1) && exists(':PromptlineSnapshot') && len(get(g:, 'airline#extensions#promptline#snapshot_file', ''))
|
||||
call airline#extensions#promptline#init(s:ext)
|
||||
endif
|
||||
|
||||
" load all other extensions not part of the default distribution
|
||||
for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n")
|
||||
" we have to check both resolved and unresolved paths, since it's possible
|
||||
|
|
34
autoload/airline/extensions/promptline.vim
Normal file
34
autoload/airline/extensions/promptline.vim
Normal file
|
@ -0,0 +1,34 @@
|
|||
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':PromptlineSnapshot')
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('airline#extensions#promptline#snapshot_file') || !len('airline#extensions#promptline#snapshot_file')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:prompt_snapshot_file = get(g:, 'airline#extensions#promptline#snapshot_file', '')
|
||||
let s:color_template = get(g:, 'airline#extensions#promptline#color_template', 'normal')
|
||||
|
||||
function! airline#extensions#promptline#init(ext)
|
||||
call a:ext.add_theme_func('airline#extensions#promptline#set_prompt_colors')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#promptline#set_prompt_colors(palette)
|
||||
let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal'
|
||||
let mode_palette = a:palette[color_template]
|
||||
|
||||
if !has_key(g:, 'promptline_symbols')
|
||||
let g:promptline_symbols = {
|
||||
\ 'left' : g:airline_left_sep,
|
||||
\ 'right' : g:airline_right_sep,
|
||||
\ 'left_alt' : g:airline_left_alt_sep,
|
||||
\ 'right_alt' : g:airline_right_alt_sep}
|
||||
endif
|
||||
|
||||
let promptline_theme = promptline#api#create_theme_from_airline(mode_palette)
|
||||
call promptline#api#create_snapshot_with_theme(s:prompt_snapshot_file, promptline_theme)
|
||||
endfunction
|
|
@ -433,7 +433,7 @@ eclim <https://eclim.org>
|
|||
<
|
||||
Note: Enabling this extension will modify 'showtabline' and 'guioptions'.
|
||||
|
||||
------------------------------------- *airline-tmuxline*
|
||||
------------------------------------- *airline-tmuxline*
|
||||
tmuxline <https://github.com/edkolev/tmuxline.vim>
|
||||
|
||||
* enable/disable tmuxline integration >
|
||||
|
@ -450,6 +450,26 @@ tmuxline <https://github.com/edkolev/tmuxline.vim>
|
|||
startup >
|
||||
airline#extensions#tmuxline#snapshot_file = "~/.tmux-statusline-colors.conf"
|
||||
<
|
||||
------------------------------------- *airline-promptline*
|
||||
promptline <https://github.com/edkolev/promptline.vim>
|
||||
|
||||
* configure the path to the snapshot .sh file. Mandatory option. The created
|
||||
file should be sourced by the shell on login >
|
||||
" in .vimrc
|
||||
airline#extensions#promptline#snapshot_file = "~/.shell_prompt.sh"
|
||||
|
||||
" in .bashrc/.zshrc
|
||||
[ -f ~/.shell_prompt.sh ] && source ~/.shell_prompt.sh
|
||||
<
|
||||
* enable/disable promptline integration >
|
||||
let g:airline#extensions#promptline#enabled = 0
|
||||
<
|
||||
* configure which mode colors should be used in prompt >
|
||||
let airline#extensions#promptline#color_template = 'normal' (default)
|
||||
let airline#extensions#promptline#color_template = 'insert'
|
||||
let airline#extensions#promptline#color_template = 'visual'
|
||||
let airline#extensions#promptline#color_template = 'replace'
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
ADVANCED CUSTOMIZATION *airline-advanced-customization*
|
||||
|
|
Loading…
Reference in New Issue
Block a user