]>
Commit | Line | Data |
---|---|---|
1 | " Powerline - The ultimate statusline utility | |
2 | " | |
3 | " Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com> | |
4 | " Source repository: https://github.com/Lokaltog/vim-powerline | |
5 | ||
6 | " Script initialization {{{ | |
7 | if exists('g:Powerline_loaded') || &compatible || version < 702 | |
8 | finish | |
9 | endif | |
10 | ||
11 | let g:Powerline_loaded = 1 | |
12 | " }}} | |
13 | " Commands {{{ | |
14 | command! PowerlineClearCache call Pl#ClearCache() | |
15 | command! PowerlineReloadColorscheme call Pl#ReloadColorscheme() | |
16 | " }}} | |
17 | " Set default options {{{ | |
18 | for [s:key, s:value] in items({ | |
19 | \ 'theme' : 'default' | |
20 | \ , 'colorscheme' : 'default' | |
21 | \ , 'symbols' : 'compatible' | |
22 | \ , 'cache_enabled': 1 | |
23 | \ }) | |
24 | ||
25 | if ! exists('g:Powerline_' . s:key) | |
26 | exec printf('let g:Powerline_%s = %s', s:key, string(s:value)) | |
27 | endif | |
28 | endfor | |
29 | ||
30 | if ! exists('g:Powerline_cache_file') | |
31 | exec 'let g:Powerline_cache_file = '. string(printf('%s/Powerline_%s_%s_%s.cache' | |
32 | \ , simplify(expand('<sfile>:p:h') .'/..') | |
33 | \ , g:Powerline_theme | |
34 | \ , g:Powerline_colorscheme | |
35 | \ , g:Powerline_symbols | |
36 | \ )) | |
37 | endif | |
38 | " }}} | |
39 | " Autocommands {{{ | |
40 | augroup Powerline | |
41 | autocmd! | |
42 | ||
43 | " Reload statuslines when changing color scheme | |
44 | au ColorScheme * | |
45 | \ call Pl#Load() | |
46 | ||
47 | au BufEnter,WinEnter,FileType,BufUnload * | |
48 | \ call Pl#UpdateStatusline(1) | |
49 | ||
50 | au BufLeave,WinLeave * | |
51 | \ call Pl#UpdateStatusline(0) | |
52 | ||
53 | au BufWritePost */autoload/Powerline/Colorschemes/*.vim | |
54 | \ :PowerlineReloadColorscheme | |
55 | augroup END | |
56 | " }}} |