├── .gitignore ├── README.rst ├── autoload ├── Pl.vim ├── Pl │ ├── Colorscheme.vim │ ├── Hi.vim │ ├── Match.vim │ ├── Mod.vim │ ├── Parser.vim │ ├── Segment.vim │ └── Theme.vim └── Powerline │ ├── Colorschemes │ ├── default.vim │ ├── solarized.vim │ ├── solarized16.vim │ └── solarized256.vim │ ├── Functions.vim │ ├── Functions │ ├── ft_man.vim │ ├── fugitive.vim │ ├── hgrev.vim │ └── syntastic.vim │ ├── Matches.vim │ ├── Segments.vim │ ├── Segments │ ├── ctrlp.vim │ ├── ft_man.vim │ ├── fugitive.vim │ ├── hgrev.vim │ ├── rvm.vim │ ├── syntastic.vim │ ├── tagbar.vim │ └── virtualenv.vim │ └── Themes │ ├── default.vim │ ├── solarized16.vim │ └── solarized256.vim ├── doc └── Powerline.txt ├── fontpatcher ├── PowerlineSymbols.sfd ├── README.rst └── fontpatcher └── plugin └── Powerline.vim /.gitignore: -------------------------------------------------------------------------------- 1 | doc/tags 2 | *.cache 3 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | =================== 2 | DEPRECATION WARNING 3 | =================== 4 | 5 | Plugin is currently in maintenance mode, no feature requests will be accepted. 6 | Vim-powerline will be deprecated in favour of https://github.com/Lokaltog/powerline once it is ready. 7 | 8 | ================= 9 | Powerline for vim 10 | ================= 11 | 12 | :Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com) 13 | :Source: https://github.com/Lokaltog/vim-powerline 14 | :Version: β 15 | 16 | Introduction 17 | ------------ 18 | 19 | Powerline is a utility plugin which allows you to create better-looking, 20 | more functional vim statuslines. See the screenshots below for 21 | a demonstration of the plugin's capabilities. 22 | 23 | It's recommended that you install the plugin using Pathogen_ or Vundle_. 24 | After the plugin is installed update your help tags and see ``:help 25 | Powerline`` for instructions on how to enable and configure the plugin. 26 | 27 | See the `Troubleshooting`_ section below if you're having any issues with 28 | the plugin or the font patcher. 29 | 30 | **Note:** You need a patched font to be able to use the symbols in the 31 | statusline. An experimental Python/fontforge-based font patcher is included 32 | in the ``fontpatcher`` directory. See ``fontpatcher/README.rst`` for usage 33 | instructions. 34 | 35 | .. _Pathogen: https://github.com/tpope/vim-pathogen 36 | .. _Vundle: https://github.com/gmarik/vundle 37 | 38 | Screenshots 39 | ----------- 40 | 41 | .. image:: http://i.imgur.com/MsuIB.png 42 | 43 | Troubleshooting 44 | --------------- 45 | 46 | I can't see the fancy symbols, what's wrong? 47 | Make sure that you have ``let g:Powerline_symbols = 'fancy'`` in your 48 | ``vimrc`` file. The settings may be loaded too late if you have this in 49 | ``gvimrc``, so always put this in your ``vimrc``. 50 | 51 | Clear the cache using ``:PowerlineClearCache`` and restart vim. 52 | 53 | Make sure that you've configured gvim or your terminal emulator to use 54 | a patched font. 55 | 56 | Make sure that vim is compiled with the ``--with-features=big`` flag. 57 | 58 | The fancy symbols look a bit blurry or "off"! 59 | Make sure that you have patched all variants of your font (i.e. both the 60 | regular and the bold font files). 61 | 62 | I'm unable to patch my font, what should I do? 63 | Font patching is only known to work on most Linux and OS X machines. If 64 | you have followed the instructions in the fontpatcher README and still 65 | have problems, please submit an issue on GitHub. 66 | 67 | You can download some community-contributed patched fonts from the 68 | `Powerline wiki`_ if you don't want to mess around with the font 69 | patcher. 70 | 71 | The Syntastic/Fugitive statusline flags don't work! 72 | These flags should work without any configuration. If you installed 73 | either plugin after Powerline, you'll have to clear the cache using 74 | ``:PowerlineClearCache`` and restart vim. 75 | 76 | The colors are weird in the default OS X Terminal app! 77 | The default OS X Terminal app is known to have some issues with the 78 | Powerline colors. Please use another terminal emulator. iTerm2 should 79 | work fine. 80 | 81 | The arrows may have the wrong colors if you have changed the "minimum 82 | contrast" slider in the color tab of your OS X settings. 83 | 84 | The statusline has strange characters like ``^B`` in it! 85 | Please add ``set encoding=utf-8`` to your ``vimrc``. 86 | 87 | You may also need to set your ``LANG`` and ``LC_*`` environment 88 | variables to a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your 89 | Linux distro's documentation for information about setting these 90 | variables correctly. 91 | 92 | The statusline has a lot of ``^`` or underline characters in it! 93 | You need to configure the ``fillchars`` setting to disable statusline 94 | fillchars (see ``:h fillchars`` for details). Add this to your 95 | ``vimrc`` to solve this issue:: 96 | 97 | set fillchars+=stl:\ ,stlnc:\ 98 | 99 | The statusline is hidden/only appears in split windows! 100 | Make sure that you have ``set laststatus=2`` in your ``vimrc``. 101 | 102 | I'm using tmux and Powerline looks like crap, what's wrong? 103 | You need to tell tmux that it has 256-color capabilities. Add this to 104 | your ``.tmux.conf`` to solve this issue:: 105 | 106 | set -g default-terminal "screen-256color" 107 | 108 | If you use iTerm2, make sure that you have enabled the setting 'Set 109 | locale variables automatically' in Profiles > Terminal > Environment. 110 | 111 | If you have any other issues and you can't find the answer in the docs, 112 | please submit an issue on GitHub. 113 | 114 | .. _`Powerline wiki`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts 115 | -------------------------------------------------------------------------------- /autoload/Pl.vim: -------------------------------------------------------------------------------- 1 | " Powerline - The ultimate statusline utility 2 | " 3 | " Author: Kim Silkebækken 4 | " Source repository: https://github.com/Lokaltog/vim-powerline 5 | 6 | " Script variables {{{ 7 | let g:Pl#OLD_STL = '' 8 | let g:Pl#THEME = [] 9 | let g:Pl#THEME_CALLBACKS = [] 10 | let g:Pl#HL = [] 11 | 12 | " Cache revision, this must be incremented whenever the cache format is changed 13 | let s:CACHE_REVISION = 7 14 | " }}} 15 | " Script initialization {{{ 16 | function! Pl#LoadCache() " {{{ 17 | if filereadable(g:Powerline_cache_file) && g:Powerline_cache_enabled 18 | exec 'source' escape(g:Powerline_cache_file, ' \') 19 | 20 | if ! exists('g:Powerline_cache_revision') || g:Powerline_cache_revision != s:CACHE_REVISION 21 | " Cache revision differs, cache is invalid 22 | unlet! g:Powerline_cache_revision 23 | 24 | return 0 25 | endif 26 | 27 | " Create highlighting groups 28 | for hi_cmd in g:Pl#HL 29 | exec hi_cmd 30 | endfor 31 | 32 | " Run theme callbacks 33 | for callback in g:Pl#THEME_CALLBACKS 34 | " Substitute {{NEWLINE}} with newlines (strings must be 35 | " stored without newlines characters to avoid vim errors) 36 | exec substitute(callback[0], "{{NEWLINE}}", "\n", 'g') 37 | exec substitute(callback[1], "{{NEWLINE}}", "\n", 'g') 38 | endfor 39 | 40 | return 1 41 | endif 42 | 43 | return 0 44 | endfunction " }}} 45 | function! Pl#ClearCache() " {{{ 46 | if filereadable(g:Powerline_cache_file) 47 | " Delete the cache file 48 | call delete(g:Powerline_cache_file) 49 | endif 50 | 51 | echo 'Powerline cache cleared. Please restart vim for the changes to take effect.' 52 | endfunction " }}} 53 | function! Pl#ReloadColorscheme() " {{{ 54 | call Pl#ClearCache() 55 | 56 | " The colorscheme and theme files must be manually sourced because 57 | " vim won't reload previously autoloaded files 58 | " 59 | " This is a bit hackish, but it works 60 | unlet! g:Powerline#Colorschemes#{g:Powerline_colorscheme}#colorscheme 61 | exec "source" split(globpath(&rtp, 'autoload/Powerline/Colorschemes/'. g:Powerline_colorscheme .'.vim', 1), '\n')[0] 62 | 63 | unlet! g:Powerline#Themes#{g:Powerline_theme}#theme 64 | exec "source" split(globpath(&rtp, 'autoload/Powerline/Themes/'. g:Powerline_theme .'.vim', 1), '\n')[0] 65 | 66 | let g:Pl#THEME = [] 67 | 68 | call Pl#Load() 69 | endfunction " }}} 70 | function! Pl#Load() " {{{ 71 | if empty(g:Pl#OLD_STL) 72 | " Store old statusline 73 | let g:Pl#OLD_STL = &statusline 74 | endif 75 | 76 | if ! Pl#LoadCache() 77 | try 78 | " Autoload the theme dict first 79 | let raw_theme = g:Powerline#Themes#{g:Powerline_theme}#theme 80 | catch 81 | echom 'Invalid Powerline theme! Please check your theme and colorscheme settings.' 82 | 83 | return 84 | endtry 85 | 86 | " Create list with parsed statuslines 87 | for buffer_statusline in raw_theme 88 | unlet! mode_statuslines 89 | let mode_statuslines = Pl#Parser#GetStatusline(buffer_statusline.segments) 90 | 91 | if ! empty(buffer_statusline.callback) 92 | " The callback function passes its arguments on to 93 | " Pl#StatuslineCallback along with the normal/current mode 94 | " statusline. 95 | let s:cb_func = "function! PowerlineStatuslineCallback_". buffer_statusline.callback[1] ."(...)\n" 96 | let s:cb_func .= "return Pl#StatuslineCallback(". string(mode_statuslines['n']) .", a:000)\n" 97 | let s:cb_func .= "endfunction" 98 | 99 | " The callback expression should be used to initialize any 100 | " variables that will use the callback function. The 101 | " expression requires a %s which will be replaced by the 102 | " callback function name. 103 | let s:cb_expr = printf(buffer_statusline.callback[2], 'PowerlineStatuslineCallback_'. buffer_statusline.callback[1]) 104 | 105 | exec s:cb_func 106 | exec s:cb_expr 107 | 108 | " Newlines must be substituted with another character 109 | " because vim doesn't like newlines in strings 110 | call add(g:Pl#THEME_CALLBACKS, [substitute(s:cb_func, "\n", "{{NEWLINE}}", 'g'), substitute(s:cb_expr, "\n", "{{NEWLINE}}", 'g')]) 111 | 112 | unlet! s:cb_func s:cb_expr 113 | 114 | continue 115 | endif 116 | 117 | " Store the statuslines for matching specific buffers 118 | call add(g:Pl#THEME, { 119 | \ 'matches': buffer_statusline.matches, 120 | \ 'mode_statuslines': mode_statuslines 121 | \ }) 122 | endfor 123 | 124 | if ! g:Powerline_cache_enabled 125 | " Don't cache anything if caching is disabled or cache file isn't writeable 126 | return 127 | endif 128 | 129 | " Prepare commands and statuslines for caching 130 | let cache = [ 131 | \ 'let g:Powerline_cache_revision = '. string(s:CACHE_REVISION), 132 | \ 'let g:Pl#HL = '. string(g:Pl#HL), 133 | \ 'let g:Pl#THEME = '. string(g:Pl#THEME), 134 | \ 'let g:Pl#THEME_CALLBACKS = '. string(g:Pl#THEME_CALLBACKS), 135 | \ ] 136 | 137 | call writefile(cache, g:Powerline_cache_file) 138 | endif 139 | endfunction " }}} 140 | " }}} 141 | " Statusline updater {{{ 142 | function! Pl#Statusline(statusline, current) " {{{ 143 | let mode = mode() 144 | 145 | if ! a:current 146 | let mode = 'N' " Normal (non-current) 147 | elseif mode =~# '\v(v|V|)' 148 | let mode = 'v' " Visual mode 149 | elseif mode =~# '\v(s|S|)' 150 | let mode = 's' " Select mode 151 | elseif mode =~# '\vi' 152 | let mode = 'i' " Insert mode 153 | elseif mode =~# '\v(R|Rv)' 154 | let mode = 'r' " Replace mode 155 | else 156 | " Fallback to normal mode 157 | let mode = 'n' " Normal (current) 158 | endif 159 | 160 | return g:Pl#THEME[a:statusline].mode_statuslines[mode] 161 | endfunction " }}} 162 | function! Pl#StatuslineCallback(statusline, args) " {{{ 163 | " Replace %1, %2, etc. in the statusline with the callback args 164 | return substitute( 165 | \ a:statusline, 166 | \ '\v\%(\d+)', 167 | \ '\=a:args[submatch(1)]', 168 | \ 'g') 169 | endfunction " }}} 170 | function! Pl#UpdateStatusline(current, ...) " {{{ 171 | if empty(g:Pl#THEME) 172 | " Load statuslines if they aren't loaded yet 173 | call Pl#Load() 174 | endif 175 | 176 | for i in range(len(g:Pl#THEME)) 177 | if Pl#Match#Validate(g:Pl#THEME[i], a:0 ? a:1 : 0) 178 | " Update window-local statusline 179 | call setwinvar(a:0 ? a:1 : 0, '&statusline', 180 | \ '%!Pl#Statusline('. i .','. a:current .')') 181 | endif 182 | endfor 183 | endfunction " }}} 184 | " }}} 185 | -------------------------------------------------------------------------------- /autoload/Pl/Colorscheme.vim: -------------------------------------------------------------------------------- 1 | function! Pl#Colorscheme#Init(hi) " {{{ 2 | let colorscheme = {} 3 | 4 | for hi in a:hi 5 | " Ensure that the segments are a list 6 | let segments = type(hi[0]) == type('') ? [ hi[0] ] : hi[0] 7 | let mode_hi_dict = hi[1] 8 | 9 | for segment in segments 10 | let colorscheme[segment] = mode_hi_dict 11 | endfor 12 | endfor 13 | 14 | return colorscheme 15 | endfunction " }}} 16 | function! Pl#Colorscheme#Apply(colorscheme, buffer_segments) " {{{ 17 | " Set color parameters for all segments in a:buffer_segments 18 | 19 | " TODO This function should be recursive and work on both segments and groups 20 | " TODO We could probably handle the NS stuff here... 21 | 22 | try 23 | let colorscheme = g:Powerline#Colorschemes#{a:colorscheme}#colorscheme 24 | catch 25 | echom 'Color scheme "'. a:colorscheme .'" doesn''t exist!' 26 | 27 | return 28 | endtry 29 | 30 | let buffer_segments = a:buffer_segments 31 | 32 | " This is a bit complex, I'll walk you through exactly what happens here... 33 | " 34 | " First of all we loop through the buffer_segments, which are the segments that 35 | " this specific buffer will have. 36 | for buffer_segment in buffer_segments 37 | " The buffer_segment consists of a 'matches' list and a 'segments' list. 38 | " The 'matches' list has conditions to limit this statusline to specific buffers/windows. 39 | " The 'segments' list has each segment and segment group for this buffer 40 | for segment in buffer_segment.segments 41 | let type = get(segment, 'type', '') 42 | 43 | if type == 'segment_group' 44 | " We're going to handle segment groups different from single segments. Segment groups 45 | " have child segments which may have their own highlighting (e.g. fileinfo.flags), 46 | " and these child segments may be grouped (e.g. fileinfo.flags.ro) to provide very 47 | " specific highlighting. So here we'll handle all that: 48 | 49 | " Set the default/fallback colors for this group 50 | for i in range(len(segment.variants), 0, -1) 51 | " Check for available highlighting for the main group segment 52 | " 53 | " This works like the segment highlighting below 54 | " TODO Create a function for this 55 | let seg_variants = join(segment.variants[0:i], '.') 56 | 57 | let seg_name = i > 0 ? segment.name .'.'. seg_variants : segment.name 58 | let seg_ns_name = len(segment.ns) > 0 ? segment.ns .':'. seg_name : seg_name 59 | 60 | if has_key(colorscheme, seg_ns_name) 61 | " We have a namespaced highlight group 62 | let segment.colors = colorscheme[seg_ns_name] 63 | break 64 | elseif has_key(colorscheme, seg_name) 65 | " We have a non-namespaced group 66 | let segment.colors = colorscheme[seg_name] 67 | break 68 | endif 69 | endfor 70 | 71 | " The reason why we need to deepcopy the group's segments is that the child segments 72 | " all point to the same base segments and that screws up highlighting if we highlight 73 | " some child segments with different namespaced colors 74 | let segment.segments = deepcopy(segment.segments) 75 | 76 | " Apply colors to each child segment 77 | for child_segment in segment.segments 78 | " Check if this child segment is grouped (e.g. fileinfo.flags.group.subgroup) 79 | " We're going to prioritize the most specific grouping and then work back to the 80 | " most common group (e.g. fileinfo.flags) 81 | 82 | " FIXME We don't have the variants from before because group children aren't run through Pl#Segment#Get 83 | let child_segment.variants = [seg_name] + split(child_segment.name, '\.') 84 | 85 | " Use the parent group's namespace 86 | let child_segment.ns = segment.ns 87 | 88 | for i in range(len(child_segment.variants), 0, -1) 89 | " Check for available highlighting for the main group segment 90 | let child_seg_name = join(child_segment.variants[0:i], '.') 91 | 92 | let child_seg_ns_name = len(child_segment.ns) > 0 ? child_segment.ns .':'. child_seg_name : child_seg_name 93 | 94 | if has_key(colorscheme, child_seg_ns_name) 95 | " We have a namespaced highlight group 96 | let child_segment.colors = colorscheme[child_seg_ns_name] 97 | break 98 | elseif has_key(colorscheme, child_seg_name) 99 | " We have a non-namespaced group 100 | let child_segment.colors = colorscheme[child_seg_name] 101 | break 102 | endif 103 | endfor 104 | endfor 105 | elseif type == 'segment' 106 | for i in range(len(segment.variants), 0, -1) 107 | " Check for available highlighting 108 | " 109 | " This is done in the following manner, using the segment gundo:static_filename.text.buffer as an example: 110 | " 111 | " * Look for the hl group: gundo:static_filename.text.buffer 112 | " * Look for the hl group: static_filename.text.buffer 113 | " * Look for the hl group: gundo:static_filename.text 114 | " * Look for the hl group: static_filename.text 115 | " * Look for the hl group: gundo:static_filename 116 | " * Look for the hl group: static_filename 117 | " * Return the segment without highlighting, causing an error in the parser 118 | let seg_variants = join(segment.variants[0:i], '.') 119 | 120 | let seg_name = i > 0 ? segment.name .'.'. seg_variants : segment.name 121 | let seg_ns_name = len(segment.ns) > 0 ? segment.ns .':'. seg_name : seg_name 122 | 123 | if has_key(colorscheme, seg_ns_name) 124 | " We have a namespaced highlight group 125 | let segment.colors = colorscheme[seg_ns_name] 126 | break 127 | elseif has_key(colorscheme, seg_name) 128 | " We have a non-namespaced group 129 | let segment.colors = colorscheme[seg_name] 130 | break 131 | endif 132 | endfor 133 | endif 134 | 135 | unlet! segment 136 | endfor 137 | endfor 138 | 139 | " Good luck parsing this return value 140 | " 141 | " It's a huge dict with all segments for all buffers with their respective syntax highlighting. 142 | " It will be parsed by the main Powerline code, where all the data will be shortened to a simple 143 | " array consiting of a statusline for each mode, with generated highlighting groups and dividers. 144 | return buffer_segments 145 | endfunction " }}} 146 | -------------------------------------------------------------------------------- /autoload/Pl/Hi.vim: -------------------------------------------------------------------------------- 1 | " cterm -> gui color dict {{{ 2 | let s:cterm2gui_dict = { 3 | \ 16: 0x000000, 17: 0x00005f, 18: 0x000087, 19: 0x0000af, 20: 0x0000d7, 21: 0x0000ff, 4 | \ 22: 0x005f00, 23: 0x005f5f, 24: 0x005f87, 25: 0x005faf, 26: 0x005fd7, 27: 0x005fff, 5 | \ 28: 0x008700, 29: 0x00875f, 30: 0x008787, 31: 0x0087af, 32: 0x0087d7, 33: 0x0087ff, 6 | \ 34: 0x00af00, 35: 0x00af5f, 36: 0x00af87, 37: 0x00afaf, 38: 0x00afd7, 39: 0x00afff, 7 | \ 40: 0x00d700, 41: 0x00d75f, 42: 0x00d787, 43: 0x00d7af, 44: 0x00d7d7, 45: 0x00d7ff, 8 | \ 46: 0x00ff00, 47: 0x00ff5f, 48: 0x00ff87, 49: 0x00ffaf, 50: 0x00ffd7, 51: 0x00ffff, 9 | \ 52: 0x5f0000, 53: 0x5f005f, 54: 0x5f0087, 55: 0x5f00af, 56: 0x5f00d7, 57: 0x5f00ff, 10 | \ 58: 0x5f5f00, 59: 0x5f5f5f, 60: 0x5f5f87, 61: 0x5f5faf, 62: 0x5f5fd7, 63: 0x5f5fff, 11 | \ 64: 0x5f8700, 65: 0x5f875f, 66: 0x5f8787, 67: 0x5f87af, 68: 0x5f87d7, 69: 0x5f87ff, 12 | \ 70: 0x5faf00, 71: 0x5faf5f, 72: 0x5faf87, 73: 0x5fafaf, 74: 0x5fafd7, 75: 0x5fafff, 13 | \ 76: 0x5fd700, 77: 0x5fd75f, 78: 0x5fd787, 79: 0x5fd7af, 80: 0x5fd7d7, 81: 0x5fd7ff, 14 | \ 82: 0x5fff00, 83: 0x5fff5f, 84: 0x5fff87, 85: 0x5fffaf, 86: 0x5fffd7, 87: 0x5fffff, 15 | \ 88: 0x870000, 89: 0x87005f, 90: 0x870087, 91: 0x8700af, 92: 0x8700d7, 93: 0x8700ff, 16 | \ 94: 0x875f00, 95: 0x875f5f, 96: 0x875f87, 97: 0x875faf, 98: 0x875fd7, 99: 0x875fff, 17 | \ 100: 0x878700, 101: 0x87875f, 102: 0x878787, 103: 0x8787af, 104: 0x8787d7, 105: 0x8787ff, 18 | \ 106: 0x87af00, 107: 0x87af5f, 108: 0x87af87, 109: 0x87afaf, 110: 0x87afd7, 111: 0x87afff, 19 | \ 112: 0x87d700, 113: 0x87d75f, 114: 0x87d787, 115: 0x87d7af, 116: 0x87d7d7, 117: 0x87d7ff, 20 | \ 118: 0x87ff00, 119: 0x87ff5f, 120: 0x87ff87, 121: 0x87ffaf, 122: 0x87ffd7, 123: 0x87ffff, 21 | \ 124: 0xaf0000, 125: 0xaf005f, 126: 0xaf0087, 127: 0xaf00af, 128: 0xaf00d7, 129: 0xaf00ff, 22 | \ 130: 0xaf5f00, 131: 0xaf5f5f, 132: 0xaf5f87, 133: 0xaf5faf, 134: 0xaf5fd7, 135: 0xaf5fff, 23 | \ 136: 0xaf8700, 137: 0xaf875f, 138: 0xaf8787, 139: 0xaf87af, 140: 0xaf87d7, 141: 0xaf87ff, 24 | \ 142: 0xafaf00, 143: 0xafaf5f, 144: 0xafaf87, 145: 0xafafaf, 146: 0xafafd7, 147: 0xafafff, 25 | \ 148: 0xafd700, 149: 0xafd75f, 150: 0xafd787, 151: 0xafd7af, 152: 0xafd7d7, 153: 0xafd7ff, 26 | \ 154: 0xafff00, 155: 0xafff5f, 156: 0xafff87, 157: 0xafffaf, 158: 0xafffd7, 159: 0xafffff, 27 | \ 160: 0xd70000, 161: 0xd7005f, 162: 0xd70087, 163: 0xd700af, 164: 0xd700d7, 165: 0xd700ff, 28 | \ 166: 0xd75f00, 167: 0xd75f5f, 168: 0xd75f87, 169: 0xd75faf, 170: 0xd75fd7, 171: 0xd75fff, 29 | \ 172: 0xd78700, 173: 0xd7875f, 174: 0xd78787, 175: 0xd787af, 176: 0xd787d7, 177: 0xd787ff, 30 | \ 178: 0xd7af00, 179: 0xd7af5f, 180: 0xd7af87, 181: 0xd7afaf, 182: 0xd7afd7, 183: 0xd7afff, 31 | \ 184: 0xd7d700, 185: 0xd7d75f, 186: 0xd7d787, 187: 0xd7d7af, 188: 0xd7d7d7, 189: 0xd7d7ff, 32 | \ 190: 0xd7ff00, 191: 0xd7ff5f, 192: 0xd7ff87, 193: 0xd7ffaf, 194: 0xd7ffd7, 195: 0xd7ffff, 33 | \ 196: 0xff0000, 197: 0xff005f, 198: 0xff0087, 199: 0xff00af, 200: 0xff00d7, 201: 0xff00ff, 34 | \ 202: 0xff5f00, 203: 0xff5f5f, 204: 0xff5f87, 205: 0xff5faf, 206: 0xff5fd7, 207: 0xff5fff, 35 | \ 208: 0xff8700, 209: 0xff875f, 210: 0xff8787, 211: 0xff87af, 212: 0xff87d7, 213: 0xff87ff, 36 | \ 214: 0xffaf00, 215: 0xffaf5f, 216: 0xffaf87, 217: 0xffafaf, 218: 0xffafd7, 219: 0xffafff, 37 | \ 220: 0xffd700, 221: 0xffd75f, 222: 0xffd787, 223: 0xffd7af, 224: 0xffd7d7, 225: 0xffd7ff, 38 | \ 226: 0xffff00, 227: 0xffff5f, 228: 0xffff87, 229: 0xffffaf, 230: 0xffffd7, 231: 0xffffff, 39 | \ 232: 0x080808, 233: 0x121212, 234: 0x1c1c1c, 235: 0x262626, 236: 0x303030, 237: 0x3a3a3a, 40 | \ 238: 0x444444, 239: 0x4e4e4e, 240: 0x585858, 241: 0x626262, 242: 0x6c6c6c, 243: 0x767676, 41 | \ 244: 0x808080, 245: 0x8a8a8a, 246: 0x949494, 247: 0x9e9e9e, 248: 0xa8a8a8, 249: 0xb2b2b2, 42 | \ 250: 0xbcbcbc, 251: 0xc6c6c6, 252: 0xd0d0d0, 253: 0xdadada, 254: 0xe4e4e4, 255: 0xeeeeee 43 | \ } 44 | " }}} 45 | " Allocated color dict {{{ 46 | let s:allocated_colors = { 47 | \ 'NONE': 'NONE', 48 | \ } 49 | " }}} 50 | function! s:Cterm2GUI(cterm) " {{{ 51 | if toupper(a:cterm) == 'NONE' 52 | return 'NONE' 53 | endif 54 | 55 | if ! has_key(s:cterm2gui_dict, a:cterm) 56 | return 0xff0000 57 | endif 58 | 59 | return s:cterm2gui_dict[a:cterm] 60 | endfunction " }}} 61 | function! Pl#Hi#Segments(segments, mode_colors) " {{{ 62 | let mode_translate = { 63 | \ 'normal': 'n', 64 | \ 'noncurrent': 'N', 65 | \ 'insert': 'i', 66 | \ 'visual': 'v', 67 | \ 'replace': 'r', 68 | \ 'select': 's', 69 | \ } 70 | 71 | let attributes = ['bold', 'italic', 'underline'] 72 | 73 | let segments = a:segments 74 | let mode_hi_dict = {} 75 | 76 | " Mode dict 77 | for [mode, colors] in items(a:mode_colors) 78 | if has_key(mode_translate, mode) 79 | let mode = mode_translate[mode] 80 | endif 81 | 82 | unlet! fg 83 | let fg = s:allocated_colors[colors[0]] 84 | 85 | let hi = { 86 | \ 'cterm': [fg['cterm'], ''], 87 | \ 'gui' : [fg['gui'], ''], 88 | \ 'attr' : [] 89 | \ } 90 | 91 | if exists('colors[1]') 92 | if type(colors[1]) == type([]) 93 | " We don't have a BG color, but we have attributes 94 | let hi.attr = colors[1] 95 | else 96 | " The second parameter is the background color 97 | unlet! bg 98 | let bg = s:allocated_colors[colors[1]] 99 | 100 | let hi.cterm[1] = bg['cterm'] 101 | let hi.gui[1] = bg['gui'] 102 | endif 103 | endif 104 | 105 | if exists('colors[2]') && type(colors[2]) == type([]) 106 | " The third parameter is always an attribute list 107 | let hi.attr = colors[2] 108 | endif 109 | 110 | let mode_hi_dict[mode] = { 111 | \ 'ctermfg': (empty(hi['cterm'][0]) ? '' : (string(hi['cterm'][0]) == 'NONE' ? 'NONE' : hi['cterm'][0])), 112 | \ 'ctermbg': (empty(hi['cterm'][1]) ? '' : (string(hi['cterm'][1]) == 'NONE' ? 'NONE' : hi['cterm'][1])), 113 | \ 'guifg' : (empty(hi['gui'][0]) ? '' : (string(hi['gui'][0]) == 'NONE' ? 'NONE' : hi['gui'][0])), 114 | \ 'guibg' : (empty(hi['gui'][1]) ? '' : (string(hi['gui'][1]) == 'NONE' ? 'NONE' : hi['gui'][1])), 115 | \ 'attr' : (! len(hi['attr']) ? 'NONE' : join(hi['attr'], ',')) 116 | \ } 117 | endfor 118 | 119 | return [segments, mode_hi_dict] 120 | endfunction " }}} 121 | function! Pl#Hi#Allocate(colors) " {{{ 122 | for [key, color] in items(a:colors) 123 | if type(color) == type(0) 124 | " Only terminal color 125 | let cterm = color 126 | let gui = s:Cterm2GUI(color) 127 | elseif type(color) == type([]) && len(color) == 2 128 | " Terminal and GUI colors 129 | let cterm = color[0] 130 | let gui = color[1] 131 | endif 132 | 133 | let s:allocated_colors[key] = { 134 | \ 'cterm': cterm, 135 | \ 'gui': gui, 136 | \ } 137 | 138 | unlet! color 139 | endfor 140 | endfunction " }}} 141 | -------------------------------------------------------------------------------- /autoload/Pl/Match.vim: -------------------------------------------------------------------------------- 1 | function! Pl#Match#Add(pat, expr) " {{{ 2 | return [a:pat, a:expr] 3 | endfunction " }}} 4 | function! Pl#Match#Any(...) " {{{ 5 | let matches = [] 6 | 7 | for match_name in a:000 8 | if empty(match_name) 9 | " Skip empty match parameters 10 | continue 11 | endif 12 | 13 | if has_key(g:Powerline#Matches#matches, match_name) 14 | call add(matches, g:Powerline#Matches#matches[match_name]) 15 | endif 16 | 17 | unlet! match_name 18 | endfor 19 | 20 | return ['match', 'any', matches] 21 | endfunction " }}} 22 | function! Pl#Match#Validate(theme, window) " {{{ 23 | let match = a:theme.matches[1] 24 | 25 | if match == 'none' 26 | return 0 27 | elseif match == 'any' 28 | let matches = a:theme.matches[2] 29 | 30 | if ! len(matches) 31 | " Empty match array matches everything 32 | return 1 33 | endif 34 | 35 | for [eval, re] in matches 36 | if match(eval(eval), '\v\C'. re) != -1 37 | return 1 38 | endif 39 | endfor 40 | 41 | return 0 42 | endif 43 | endfunction " }}} 44 | -------------------------------------------------------------------------------- /autoload/Pl/Mod.vim: -------------------------------------------------------------------------------- 1 | let s:segment_mods = [] 2 | 3 | function! Pl#Mod#AddSegmentMod(action, properties) " {{{ 4 | call add(s:segment_mods, [a:action, a:properties]) 5 | endfunction " }}} 6 | function! Pl#Mod#ApplySegmentMods(theme) " {{{ 7 | let theme = deepcopy(a:theme) 8 | 9 | for mod in s:segment_mods 10 | let [action, properties] = mod 11 | 12 | " We have to loop through the segments instead of using index() because some 13 | " segments are lists! 14 | let target_seg_idx = -1 15 | 16 | for i in range(0, len(theme) - 1) 17 | unlet! segment 18 | let segment = theme[i] 19 | 20 | if type(segment) == type(properties.target_segment) && segment == properties.target_segment 21 | let target_seg_idx = i 22 | break 23 | endif 24 | endfor 25 | 26 | if action == 'insert_segment' 27 | " Insert segment 28 | if target_seg_idx != -1 29 | call insert(theme, properties.new_segment, (properties.where == 'before' ? target_seg_idx : target_seg_idx + 1)) 30 | endif 31 | elseif action == 'remove_segment' 32 | " Remove segment 33 | if target_seg_idx != -1 34 | call remove(theme, target_seg_idx) 35 | endif 36 | endif 37 | endfor 38 | 39 | return theme 40 | endfunction " }}} 41 | -------------------------------------------------------------------------------- /autoload/Pl/Parser.vim: -------------------------------------------------------------------------------- 1 | let g:Pl#Parser#Symbols = { 2 | \ 'compatible': { 3 | \ 'dividers': [ '', [0x2502], '', [0x2502] ] 4 | \ , 'symbols' : { 5 | \ 'BRANCH': 'BR:' 6 | \ , 'RO' : 'RO' 7 | \ , 'FT' : 'FT' 8 | \ , 'LINE' : 'LN' 9 | \ } 10 | \ }, 11 | \ 'unicode': { 12 | \ 'dividers': [ [0x25b6], [0x276f], [0x25c0], [0x276e] ] 13 | \ , 'symbols' : { 14 | \ 'BRANCH': [0x26a1] 15 | \ , 'RO' : [0x2613] 16 | \ , 'FT' : [0x2691] 17 | \ , 'LINE' : [0x204b] 18 | \ }, 19 | \ }, 20 | \ 'fancy': { 21 | \ 'dividers': [ [0x2b80], [0x2b81], [0x2b82], [0x2b83] ] 22 | \ , 'symbols' : { 23 | \ 'BRANCH': [0x2b60] 24 | \ , 'RO' : [0x2b64] 25 | \ , 'FT' : [0x2b62, 0x2b63] 26 | \ , 'LINE' : [0x2b61] 27 | \ } 28 | \ } 29 | \ } 30 | 31 | " Handle symbol overrides 32 | for [s:key, s:value] in items(g:Powerline_symbols_override) 33 | let g:Pl#Parser#Symbols[g:Powerline_symbols].symbols[s:key] = s:value 34 | 35 | unlet! s:key s:value 36 | endfor 37 | 38 | " Handle divider overrides 39 | if len(g:Powerline_dividers_override) == 4 40 | let g:Pl#Parser#Symbols[g:Powerline_symbols].dividers = g:Powerline_dividers_override 41 | endif 42 | 43 | let s:LEFT_SIDE = 0 44 | let s:RIGHT_SIDE = 2 45 | 46 | let s:PADDING = 1 47 | 48 | let s:EMPTY_SEGMENT = { 'type': 'empty' } 49 | 50 | let s:HARD_DIVIDER = 0 51 | let s:SOFT_DIVIDER = 1 52 | 53 | function! Pl#Parser#GetStatusline(segments) " {{{ 54 | let statusline = { 55 | \ 'n': '' 56 | \ , 'N': '' 57 | \ , 'v': '' 58 | \ , 'i': '' 59 | \ , 'r': '' 60 | \ , 's': '' 61 | \ } 62 | 63 | " Run through the different modes and create the statuslines 64 | for mode in keys(statusline) 65 | " Create an empty statusline list 66 | let stl = [] 67 | 68 | call extend(stl, s:ParseSegments(mode, s:LEFT_SIDE, a:segments)) 69 | 70 | let statusline[mode] .= join(stl, '') 71 | endfor 72 | 73 | return statusline 74 | endfunction " }}} 75 | function! Pl#Parser#ParseChars(arg) " {{{ 76 | " Handles symbol arrays which can be either an array of hex values, 77 | " or a string. Will convert the hex array to a string, or return the 78 | " string as-is. 79 | let arg = a:arg 80 | 81 | if type(arg) == type([]) 82 | " Hex array 83 | call map(arg, 'nr2char(v:val)') 84 | 85 | return join(arg, '') 86 | endif 87 | 88 | " Anything else, just return it as it is 89 | return arg 90 | endfunction " }}} 91 | function! s:ParseSegments(mode, side, segments, ...) " {{{ 92 | let mode = a:mode 93 | let side = a:side 94 | let segments = a:segments 95 | 96 | let level = exists('a:1') ? a:1 : 0 97 | let base_color = exists('a:2') ? a:2 : {} 98 | 99 | let ret = [] 100 | 101 | for i in range(0, len(segments) - 1) 102 | unlet! seg_prev seg_curr seg_next 103 | 104 | " Prepare some resources (fetch previous, current and next segment) 105 | let seg_curr = deepcopy(get(segments, i)) 106 | 107 | " Find previous segment 108 | let seg_prev = s:EMPTY_SEGMENT 109 | 110 | " If we're currently at i = 0 we have to start on 0 or else we will start on the last segment (list[-1]) 111 | let range_start = (i == 0 ? i : i - 1) 112 | for j in range(range_start, 0, -1) 113 | let seg = deepcopy(get(segments, j)) 114 | if get(seg, 'name') ==# 'TRUNCATE' 115 | " Skip truncate segments 116 | continue 117 | endif 118 | 119 | " Look ahead for another segment that's visible in this mode 120 | if index(get(seg, 'modes'), mode) != -1 121 | " Use this segment 122 | let seg_prev = seg 123 | 124 | break 125 | endif 126 | endfor 127 | 128 | "" Find next segment 129 | let seg_next = s:EMPTY_SEGMENT 130 | 131 | " If we're currently at i = len(segments) - 1 we have to start on i or else we will get an error because the index doesn't exist 132 | let range_start = (i == len(segments) - 1 ? i : i + 1) 133 | for j in range(range_start, len(segments) - 1, 1) 134 | let seg = deepcopy(get(segments, j)) 135 | if get(seg, 'name') ==# 'TRUNCATE' 136 | " Skip truncate segments 137 | continue 138 | endif 139 | 140 | " Look ahead for another segment that's visible in this mode 141 | if index(get(seg, 'modes'), mode) != -1 142 | " Use this segment 143 | let seg_next = seg 144 | 145 | break 146 | endif 147 | endfor 148 | 149 | if index(get(seg_curr, 'modes', []), mode) == -1 150 | " The segment is invisible in this mode, skip it 151 | " FIXME When two segments after each other are hidden, a gap appears where the segments would be, this is probably due to segment padding 152 | continue 153 | endif 154 | 155 | " Handle the different segment types 156 | if seg_curr.type == 'segment' 157 | if seg_curr.name ==# 'TRUNCATE' 158 | " Truncate statusline 159 | call add(ret, '%<') 160 | elseif seg_curr.name ==# 'SPLIT' 161 | " Split statusline 162 | 163 | " Switch sides 164 | let side = s:RIGHT_SIDE 165 | 166 | " Handle highlighting 167 | let mode_colors = get(seg_curr.colors, mode, seg_curr.colors['n']) 168 | let hl_group = s:HlCreate(mode_colors) 169 | 170 | " Add segment text 171 | call add(ret, '%#'. hl_group .'#%=') 172 | else 173 | " Add segment text 174 | let text = seg_curr.text 175 | 176 | " Decide on whether to use the group's colors or the segment's colors 177 | let colors = get(seg_curr, 'colors', base_color) 178 | 179 | " Fallback to normal (current) highlighting if we don't have mode-specific highlighting 180 | let mode_colors = get(colors, mode, get(colors, 'n', {})) 181 | 182 | if empty(mode_colors) 183 | echom 'Segment doesn''t have any colors! NS: "'. seg_curr.ns .'" SEG: "'. seg_curr.name .'"' 184 | 185 | continue 186 | endif 187 | 188 | " Check if we're in a group (level > 0) 189 | if level > 0 190 | " If we're in a group we don't have dividers between 191 | " segments, so we should only pad one side, but only pad 192 | " if the segment doesn't have Pl#Segment#NoPadding() set 193 | let padding_right = (seg_curr.padding && side == s:LEFT_SIDE ? repeat(' ', s:PADDING) : '') 194 | let padding_left = (seg_curr.padding && side == s:RIGHT_SIDE ? repeat(' ', s:PADDING) : '') 195 | 196 | " Check if we lack a bg/fg color for this segment 197 | " If we do, use the bg/fg color from base_color 198 | let base_color_mode = ! has_key(base_color, mode) ? base_color['n'] : base_color[mode] 199 | 200 | for col in ['ctermbg', 'ctermfg', 'guibg', 'guifg'] 201 | if empty(mode_colors[col]) 202 | let mode_colors[col] = base_color_mode[col] 203 | endif 204 | endfor 205 | else 206 | "" If we're outside a group we have dividers and must pad both sides 207 | let padding_left = repeat(' ', s:PADDING) 208 | let padding_right = repeat(' ', s:PADDING) 209 | endif 210 | 211 | " Get main hl group for segment 212 | let hl_group = s:HlCreate(mode_colors) 213 | 214 | " Prepare segment text 215 | let text = '%(%#'. hl_group .'#'. padding_left . text . padding_right . '%)' 216 | 217 | if level == 0 218 | " Add divider to single segments 219 | let text = s:AddDivider(text, side, mode, colors, seg_prev, seg_curr, seg_next) 220 | endif 221 | 222 | call add(ret, text) 223 | endif 224 | elseif seg_curr.type == 'segment_group' 225 | " Recursively parse segment group 226 | let func_params = [mode, side, seg_curr.segments, level + 1] 227 | 228 | if has_key(seg_curr, 'colors') 229 | " Pass the base colors on to the child segments 230 | call add(func_params, seg_curr.colors) 231 | endif 232 | 233 | " Get segment group string 234 | let text = join(call('s:ParseSegments', func_params), '') 235 | 236 | " Pad on the opposite side of the divider 237 | let padding_right = (side == s:RIGHT_SIDE ? repeat(' ', s:PADDING) : '') 238 | let padding_left = (side == s:LEFT_SIDE ? repeat(' ', s:PADDING) : '') 239 | 240 | let text = s:AddDivider(padding_left . text . padding_right, side, mode, seg_curr.colors, seg_prev, seg_curr, seg_next) 241 | 242 | call add(ret, text) 243 | endif 244 | endfor 245 | 246 | return ret 247 | endfunction " }}} 248 | function! s:HlCreate(hl) " {{{ 249 | " Create a short and unique highlighting group name 250 | " It uses the hex values of all the color properties and an attribute flag at the end 251 | " NONE colors are translated to NN for cterm and NNNNNN for gui colors 252 | let hi_group = printf('Pl%s%s%s%s%s' 253 | \ , (a:hl['ctermfg'] == 'NONE' ? 'NN' : printf('%02x', a:hl['ctermfg'])) 254 | \ , (a:hl['guifg'] == 'NONE' ? 'NNNNNN' : printf('%06x', a:hl['guifg'] )) 255 | \ , (a:hl['ctermbg'] == 'NONE' ? 'NN' : printf('%02x', a:hl['ctermbg'])) 256 | \ , (a:hl['guibg'] == 'NONE' ? 'NNNNNN' : printf('%06x', a:hl['guibg'] )) 257 | \ , substitute(a:hl['attr'], '\v([a-zA-Z])[a-zA-Z]*,?', '\1', 'g') 258 | \ ) 259 | 260 | if ! s:HlExists(hi_group) 261 | let ctermbg = a:hl['ctermbg'] == 'NONE' ? 'NONE' : printf('%d', a:hl['ctermbg']) 262 | if (has('win32') || has('win64')) && !has('gui_running') && ctermbg != 'NONE' && ctermbg > 128 263 | let ctermbg -= 128 264 | endif 265 | let hi_cmd = printf('hi %s ctermfg=%s ctermbg=%s cterm=%s guifg=%s guibg=%s gui=%s' 266 | \ , hi_group 267 | \ , a:hl['ctermfg'] == 'NONE' ? 'NONE' : printf('%d', a:hl['ctermfg']) 268 | \ , ctermbg 269 | \ , a:hl['attr'] 270 | \ , (a:hl['guifg'] == 'NONE' ? 'NONE' : printf('#%06x', a:hl['guifg'])) 271 | \ , (a:hl['guibg'] == 'NONE' ? 'NONE' : printf('#%06x', a:hl['guibg'])) 272 | \ , a:hl['attr'] 273 | \ ) 274 | 275 | exec hi_cmd 276 | 277 | " Add command to Pl#HL list for caching 278 | call add(g:Pl#HL, hi_cmd) 279 | endif 280 | 281 | " Return only the highlighting group name 282 | return hi_group 283 | endfunction " }}} 284 | function! s:HlExists(hl) " {{{ 285 | if ! hlexists(a:hl) 286 | return 0 287 | endif 288 | 289 | redir => hlstatus 290 | silent exec 'hi' a:hl 291 | redir END 292 | 293 | return (hlstatus !~ 'cleared') 294 | endfunction " }}} 295 | function! s:AddDivider(text, side, mode, colors, prev, curr, next) " {{{ 296 | let seg_prev = a:prev 297 | let seg_curr = a:curr 298 | let seg_next = a:next 299 | 300 | " Set default color/type for the divider 301 | let div_colors = get(a:colors, a:mode, a:colors['n']) 302 | let div_type = s:SOFT_DIVIDER 303 | 304 | " Define segment to compare 305 | let cmp_seg = a:side == s:LEFT_SIDE ? seg_next : seg_prev 306 | 307 | let cmp_all_colors = get(cmp_seg, 'colors', {}) 308 | let cmp_colors = get(cmp_all_colors, a:mode, get(cmp_all_colors, 'n', {})) 309 | 310 | if ! empty(cmp_colors) 311 | " Compare the highlighting groups 312 | " 313 | " If the background color for cterm is equal, use soft divider with the current segment's highlighting 314 | " If not, use hard divider with a new highlighting group 315 | " 316 | " Note that if the previous/next segment is the split, a hard divider is always used 317 | if get(div_colors, 'ctermbg') != get(cmp_colors, 'ctermbg') || get(seg_next, 'name') ==# 'SPLIT' || get(seg_prev, 'name') ==# 'SPLIT' 318 | let div_type = s:HARD_DIVIDER 319 | 320 | " Create new highlighting group 321 | if div_colors['attr'] =~ 'reverse' && cmp_colors['attr'] =~ 'reverse' 322 | " Use FG = CURRENT FG, BG = CMP FG 323 | let div_colors['ctermbg'] = get(cmp_colors, 'ctermfg') 324 | let div_colors['guibg'] = get(cmp_colors, 'guifg') 325 | 326 | let div_colors['attr'] = div_colors['attr'] =~ 'bold' ? 'bold' : 'NONE' 327 | elseif div_colors['attr'] =~ 'reverse' 328 | " Use FG = CURRENT FG, BG = CMP BG 329 | let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg') 330 | let div_colors['guibg'] = get(cmp_colors, 'guibg') 331 | 332 | let div_colors['attr'] = div_colors['attr'] =~ 'bold' ? 'bold' : 'NONE' 333 | elseif cmp_colors['attr'] =~ 'reverse' 334 | " Use FG = CMP FG, BG = CURRENT BG : reversed 335 | let div_colors['ctermfg'] = get(cmp_colors, 'ctermfg') 336 | let div_colors['guifg'] = get(cmp_colors, 'guifg') 337 | 338 | let div_colors['attr'] = 'reverse' 339 | 340 | else 341 | " Use FG = CURRENT BG, BG = CMP BG 342 | let div_colors['ctermfg'] = get(div_colors, 'ctermbg') 343 | let div_colors['guifg'] = get(div_colors, 'guibg') 344 | 345 | let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg') 346 | let div_colors['guibg'] = get(cmp_colors, 'guibg') 347 | 348 | let div_colors['attr'] = 'NONE' 349 | endif 350 | endif 351 | endif 352 | 353 | " Prepare divider 354 | let divider_raw = deepcopy(g:Pl#Parser#Symbols[g:Powerline_symbols].dividers[a:side + div_type]) 355 | let divider = Pl#Parser#ParseChars(divider_raw) 356 | 357 | " Don't add dividers for segments adjacent to split (unless it's a hard divider) 358 | if ((get(seg_next, 'name') ==# 'SPLIT' || get(seg_prev, 'name') ==# 'SPLIT') && div_type != s:HARD_DIVIDER) 359 | return '' 360 | endif 361 | 362 | if a:side == s:LEFT_SIDE 363 | " Left side 364 | " Divider to the right 365 | return printf('%%(%s%%#%s#%s%%)', a:text, s:HlCreate(div_colors), divider) 366 | else 367 | " Right side 368 | " Divider to the left 369 | return printf('%%(%%#%s#%s%s%%)', s:HlCreate(div_colors), divider, a:text) 370 | endif 371 | endfunction " }}} 372 | -------------------------------------------------------------------------------- /autoload/Pl/Segment.vim: -------------------------------------------------------------------------------- 1 | let s:default_modes = ['n', 'N', 'v', 'i', 'r', 's'] 2 | 3 | function! s:CheckConditions(params) " {{{ 4 | " Check conditions for a segment/group 5 | " Integer parameters are always conditions 6 | for param in a:params 7 | if type(param) == type(0) && param == 0 8 | " Break here if it's an integer parameter and it's false (0) 9 | return 0 10 | endif 11 | unlet! param 12 | endfor 13 | 14 | return 1 15 | endfunction " }}} 16 | function! Pl#Segment#Create(name, ...) " {{{ 17 | " Check condition parameters 18 | if ! s:CheckConditions(a:000) 19 | return {} 20 | endif 21 | 22 | let name = a:name 23 | let modes = s:default_modes 24 | let padding = 1 25 | let segments = [] 26 | 27 | for param in a:000 28 | " Lookup modes for this segment/group 29 | if type(param) == type([]) && param[0] == 'modes' 30 | let modes = param[1] 31 | elseif type(param) == type([]) && param[0] == 'nopadding' 32 | let padding = 0 33 | elseif type(a:1) == type([]) && a:1[0] == 'segment' 34 | call add(segments, param[1]) 35 | endif 36 | 37 | unlet! param 38 | endfor 39 | 40 | if type(a:1) == type([]) && a:1[0] == 'segment' 41 | " This is a segment group 42 | return ['segment_group', { 43 | \ 'type': 'segment_group' 44 | \ , 'name': name 45 | \ , 'segments': segments 46 | \ , 'modes': modes 47 | \ , 'padding': padding 48 | \ }] 49 | else 50 | " This is a single segment 51 | let text = a:1 52 | 53 | " Search/replace symbols 54 | for [key, symbol] in items(g:Pl#Parser#Symbols[g:Powerline_symbols].symbols) 55 | let text = substitute( 56 | \ text, 57 | \ '\v\$('. key .')', 58 | \ '\=Pl#Parser#ParseChars(g:Pl#Parser#Symbols[g:Powerline_symbols].symbols[submatch(1)])', 59 | \ 'g') 60 | 61 | unlet! key symbol 62 | endfor 63 | 64 | return ['segment', { 65 | \ 'type': 'segment' 66 | \ , 'name': name 67 | \ , 'text': text 68 | \ , 'modes': modes 69 | \ , 'padding': padding 70 | \ }] 71 | endif 72 | 73 | endfunction " }}} 74 | function! Pl#Segment#Init(params) " {{{ 75 | " Check condition parameters 76 | if ! s:CheckConditions(a:params) 77 | return {} 78 | endif 79 | 80 | let segments = {} 81 | let ns = '' 82 | 83 | for param in a:params 84 | if type(param) == type('') 85 | " String parameters is the namespace 86 | let ns = param 87 | elseif type(param) == type([]) 88 | " The data dict is in param[1] 89 | " By default we don't have a namespace for the segment 90 | let segment = param[1] 91 | 92 | if ! empty(ns) 93 | " Update segment so that it includes the namespace 94 | " Add the namespace to the segment dict key 95 | let segment.ns = ns 96 | let segment.name = join([segment.ns, segment.name], ':') 97 | endif 98 | 99 | let key = segment.name 100 | 101 | let segments[key] = segment 102 | endif 103 | 104 | unlet! param 105 | endfor 106 | 107 | return segments 108 | endfunction " }}} 109 | function! Pl#Segment#Modes(modes) " {{{ 110 | " Handle modes for both segments and groups 111 | let modes = split(a:modes, '\zs') 112 | 113 | if modes[0] == '!' 114 | " Filter modes (e.g. "!nr" will ignore the segment in normal and replace modes) 115 | let modes = filter(deepcopy(s:default_modes), 'v:val !~# "['. join(modes[1:]) .']"') 116 | endif 117 | 118 | return ['modes', modes] 119 | endfunction " }}} 120 | function! Pl#Segment#NoPadding() " {{{ 121 | return ['nopadding'] 122 | endfunction " }}} 123 | function! Pl#Segment#Split(...) " {{{ 124 | return a:0 ? a:1 .':SPLIT' : 'SPLIT' 125 | endfunction " }}} 126 | function! Pl#Segment#Truncate() " {{{ 127 | return 'TRUNCATE' 128 | endfunction " }}} 129 | function! Pl#Segment#Get(name) " {{{ 130 | " Return a segment data dict 131 | let args = [] 132 | 133 | " Check for printf segments (lists) 134 | if type(a:name) == type([]) 135 | " We're dealing with a segment with printf arguments 136 | let seg_orig_name = a:name[0] 137 | let args = a:name[1:] 138 | else 139 | let seg_orig_name = a:name 140 | endif 141 | 142 | " Fetch namespace and variants for storing in the segment dict 143 | let seg_ns = '' 144 | let seg_variants = [] 145 | 146 | " Retrieve color scheme variants 147 | let seg_name_split = split(seg_orig_name, '\v\.') 148 | if len(seg_name_split) > 1 149 | let seg_variants = seg_name_split[1:] 150 | endif 151 | 152 | " Retrieve segment name and namespace 153 | " Use the first piece of the split string, we can't have variants in the final segment name 154 | let seg_name_split = split(seg_name_split[0], '\v:') 155 | let seg_name = seg_name_split[0] 156 | 157 | if len(seg_name_split) > 1 158 | let seg_ns = seg_name_split[0] 159 | let seg_name = seg_name_split[-1] 160 | endif 161 | 162 | try 163 | " If we have a namespace, try to use the namespaced segment first (i.e. search for the segment in the namespaced file first) 164 | let return_segment = deepcopy(g:Powerline#Segments#{seg_ns}#segments[seg_ns .':'. seg_name]) 165 | catch 166 | try 167 | " We didn't find a namespaced segment, fall back to common segments 168 | let return_segment = deepcopy(g:Powerline#Segments#segments[seg_name]) 169 | catch 170 | " Didn't find the segment among the common segments either, just skip it 171 | return {} 172 | endtry 173 | endtry 174 | 175 | if len(args) && has_key(return_segment, 'text') 176 | " Handle segment printf arguments 177 | " printf doesn't accept lists as its second argument, so we have to work around that 178 | let return_segment.text = call('printf', [ return_segment.text ] + args) 179 | endif 180 | 181 | " Assign namespace, name and variants 182 | let return_segment.ns = seg_ns 183 | let return_segment.name = seg_name 184 | let return_segment.orig_name = seg_orig_name 185 | let return_segment.variants = seg_variants 186 | 187 | return return_segment 188 | endfunction " }}} 189 | -------------------------------------------------------------------------------- /autoload/Pl/Theme.vim: -------------------------------------------------------------------------------- 1 | function! Pl#Theme#Create(...) " {{{ 2 | let buffer_segments = [] 3 | 4 | for buffer_segment in a:000 5 | " Remove empty segments (e.g. 'Pl#Theme#Function's) 6 | if empty(buffer_segment) 7 | continue 8 | endif 9 | 10 | call add(buffer_segments, buffer_segment) 11 | endfor 12 | 13 | let buffer_segments = Pl#Colorscheme#Apply(g:Powerline_colorscheme, buffer_segments) 14 | 15 | return buffer_segments 16 | endfunction " }}} 17 | function! Pl#Theme#Callback(name, expr) " {{{ 18 | return ['callback', a:name, a:expr] 19 | endfunction " }}} 20 | function! Pl#Theme#Buffer(ns, ...) " {{{ 21 | let segments = [] 22 | let ns = ! empty(a:ns) ? a:ns .':' : '' 23 | 24 | " Match namespace parameter by default 25 | let matches = Pl#Match#Any(a:ns) 26 | let callback = [] 27 | 28 | let args = a:000 29 | let args = Pl#Mod#ApplySegmentMods(args) 30 | 31 | " Fetch segment data dicts 32 | for item in args 33 | if type(item) == type([]) 34 | if item[0] == 'match' 35 | " Match item, overrides default namespace match 36 | let matches = item 37 | 38 | unlet! item 39 | continue 40 | elseif item[0] == 'callback' 41 | " Store the item as a callback expression 42 | let matches = ['match', 'none'] 43 | let callback = [a:ns, item[1], item[2]] 44 | 45 | unlet! item 46 | continue 47 | endif 48 | 49 | " printf segment, append ns to first item in list 50 | let item[0] = ns . item[0] 51 | else 52 | let item = ns . item 53 | endif 54 | 55 | let segment = Pl#Segment#Get(item) 56 | 57 | if ! empty(segment) 58 | " Skip empty (possible disabled) segments 59 | call add(segments, segment) 60 | endif 61 | 62 | unlet! item 63 | endfor 64 | 65 | return { 66 | \ 'matches': matches 67 | \ , 'callback': callback 68 | \ , 'segments': segments 69 | \ } 70 | endfunction " }}} 71 | function! Pl#Theme#InsertSegment(new_segment, where, target_segment) " {{{ 72 | " It's very important to NOT refer to the theme dict until everything's loaded! 73 | " 74 | " Because these functions are called from the vimrc, we need to put the 75 | " actions in a list which will be parsed later. 76 | " 77 | " These functions don't accept a name parameter, because they work on the 78 | " currently selected theme (will change any selected theme) 79 | call Pl#Mod#AddSegmentMod('insert_segment', { 80 | \ 'new_segment': a:new_segment, 81 | \ 'where': a:where, 82 | \ 'target_segment': a:target_segment 83 | \ }) 84 | endfunction " }}} 85 | function! Pl#Theme#RemoveSegment(target_segment) " {{{ 86 | " It's very important to NOT refer to the theme dict until everything's loaded! 87 | " 88 | " Because these functions are called from the vimrc, we need to put the 89 | " actions in a list which will be parsed later. 90 | " 91 | " These functions don't accept a name parameter, because they work on the 92 | " currently selected theme (will change any selected theme) 93 | call Pl#Mod#AddSegmentMod('remove_segment', { 94 | \ 'target_segment': a:target_segment 95 | \ }) 96 | endfunction " }}} 97 | function! Pl#Theme#ReplaceSegment(old_segment, new_segment) " {{{ 98 | call Pl#Theme#InsertSegment(a:new_segment, 'after', a:old_segment) 99 | call Pl#Theme#RemoveSegment(a:old_segment) 100 | endfunction " }}} 101 | -------------------------------------------------------------------------------- /autoload/Powerline/Colorschemes/default.vim: -------------------------------------------------------------------------------- 1 | call Pl#Hi#Allocate({ 2 | \ 'black' : 16, 3 | \ 'white' : 231, 4 | \ 5 | \ 'darkestgreen' : 22, 6 | \ 'darkgreen' : 28, 7 | \ 'mediumgreen' : 70, 8 | \ 'brightgreen' : 148, 9 | \ 10 | \ 'darkestcyan' : 23, 11 | \ 'mediumcyan' : 117, 12 | \ 13 | \ 'darkestblue' : 24, 14 | \ 'darkblue' : 31, 15 | \ 16 | \ 'darkestred' : 52, 17 | \ 'darkred' : 88, 18 | \ 'mediumred' : 124, 19 | \ 'brightred' : 160, 20 | \ 'brightestred' : 196, 21 | \ 22 | \ 'darkestpurple' : 55, 23 | \ 'mediumpurple' : 98, 24 | \ 'brightpurple' : 189, 25 | \ 26 | \ 'brightorange' : 208, 27 | \ 'brightestorange': 214, 28 | \ 29 | \ 'gray0' : 233, 30 | \ 'gray1' : 235, 31 | \ 'gray2' : 236, 32 | \ 'gray3' : 239, 33 | \ 'gray4' : 240, 34 | \ 'gray5' : 241, 35 | \ 'gray6' : 244, 36 | \ 'gray7' : 245, 37 | \ 'gray8' : 247, 38 | \ 'gray9' : 250, 39 | \ 'gray10' : 252, 40 | \ }) 41 | 42 | let g:Powerline#Colorschemes#default#colorscheme = Pl#Colorscheme#Init([ 43 | \ Pl#Hi#Segments(['SPLIT'], { 44 | \ 'n': ['white', 'gray2'], 45 | \ 'N': ['white', 'gray0'], 46 | \ 'i': ['white', 'darkestblue'], 47 | \ }), 48 | \ 49 | \ Pl#Hi#Segments(['mode_indicator'], { 50 | \ 'n': ['darkestgreen', 'brightgreen', ['bold']], 51 | \ 'i': ['darkestcyan', 'white', ['bold']], 52 | \ 'v': ['darkred', 'brightorange', ['bold']], 53 | \ 'r': ['white', 'brightred', ['bold']], 54 | \ 's': ['white', 'gray5', ['bold']], 55 | \ }), 56 | \ 57 | \ Pl#Hi#Segments(['branch', 'scrollpercent', 'raw', 'filesize'], { 58 | \ 'n': ['gray9', 'gray4'], 59 | \ 'N': ['gray4', 'gray1'], 60 | \ 'i': ['mediumcyan', 'darkblue'], 61 | \ }), 62 | \ 63 | \ Pl#Hi#Segments(['fileinfo', 'filename'], { 64 | \ 'n': ['white', 'gray4', ['bold']], 65 | \ 'N': ['gray7', 'gray0', ['bold']], 66 | \ 'i': ['white', 'darkblue', ['bold']], 67 | \ }), 68 | \ 69 | \ Pl#Hi#Segments(['fileinfo.filepath'], { 70 | \ 'n': ['gray10'], 71 | \ 'N': ['gray5'], 72 | \ 'i': ['mediumcyan'], 73 | \ }), 74 | \ 75 | \ Pl#Hi#Segments(['static_str'], { 76 | \ 'n': ['white', 'gray4'], 77 | \ 'N': ['gray7', 'gray1'], 78 | \ 'i': ['white', 'darkblue'], 79 | \ }), 80 | \ 81 | \ Pl#Hi#Segments(['fileinfo.flags'], { 82 | \ 'n': ['brightestred', ['bold']], 83 | \ 'N': ['darkred'], 84 | \ 'i': ['brightestred', ['bold']], 85 | \ }), 86 | \ 87 | \ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { 88 | \ 'n': ['gray8', 'gray2'], 89 | \ 'i': ['mediumcyan', 'darkestblue'], 90 | \ }), 91 | \ 92 | \ Pl#Hi#Segments(['lineinfo'], { 93 | \ 'n': ['gray2', 'gray10', ['bold']], 94 | \ 'N': ['gray7', 'gray1', ['bold']], 95 | \ 'i': ['darkestcyan', 'mediumcyan', ['bold']], 96 | \ }), 97 | \ 98 | \ Pl#Hi#Segments(['errors'], { 99 | \ 'n': ['brightestorange', 'gray2', ['bold']], 100 | \ 'i': ['brightestorange', 'darkestblue', ['bold']], 101 | \ }), 102 | \ 103 | \ Pl#Hi#Segments(['lineinfo.line.tot'], { 104 | \ 'n': ['gray6'], 105 | \ 'N': ['gray5'], 106 | \ 'i': ['darkestcyan'], 107 | \ }), 108 | \ 109 | \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { 110 | \ 'n': ['white', 'brightred', ['bold']], 111 | \ }), 112 | \ 113 | \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { 114 | \ 'n': ['white', 'mediumred', ['bold']], 115 | \ 'N': ['brightred', 'darkestred', ['bold']], 116 | \ }), 117 | \ 118 | \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { 119 | \ 'n': ['white', 'darkred'], 120 | \ 'N': ['brightred', 'darkestred'], 121 | \ }), 122 | \ 123 | \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { 124 | \ 'n': ['white', 'darkred'], 125 | \ 'N': ['white', 'darkestred'], 126 | \ }), 127 | \ 128 | \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { 129 | \ 'n': ['white', 'mediumgreen', ['bold']], 130 | \ 'N': ['mediumgreen', 'darkestgreen', ['bold']], 131 | \ }), 132 | \ 133 | \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { 134 | \ 'n': ['brightgreen', 'darkgreen'], 135 | \ 'N': ['mediumgreen', 'darkestgreen'], 136 | \ }), 137 | \ 138 | \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { 139 | \ 'n': ['white', 'darkgreen'], 140 | \ 'N': ['white', 'darkestgreen'], 141 | \ }), 142 | \ 143 | \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { 144 | \ 'n': ['brightpurple', 'darkestpurple'], 145 | \ }), 146 | \ 147 | \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], { 148 | \ 'n': ['white', 'mediumpurple'], 149 | \ }), 150 | \ 151 | \ Pl#Hi#Segments(['ctrlp:item'], { 152 | \ 'n': ['darkestpurple', 'white', ['bold']], 153 | \ }), 154 | \ 155 | \ Pl#Hi#Segments(['ctrlp:marked'], { 156 | \ 'n': ['brightestred', 'darkestpurple', ['bold']], 157 | \ }), 158 | \ 159 | \ Pl#Hi#Segments(['ctrlp:count'], { 160 | \ 'n': ['darkestpurple', 'white'], 161 | \ }), 162 | \ 163 | \ Pl#Hi#Segments(['ctrlp:SPLIT'], { 164 | \ 'n': ['white', 'darkestpurple'], 165 | \ }), 166 | \ ]) 167 | -------------------------------------------------------------------------------- /autoload/Powerline/Colorschemes/solarized.vim: -------------------------------------------------------------------------------- 1 | 2 | " Solarized color scheme for Powerline 3 | " N = no focus 4 | " 16 hex colors as defined on http://ethanschoonover.com/solarized 5 | call Pl#Hi#Allocate({ 6 | \ 'base03' : [8, 0x002b36], 7 | \ 'base02' : [0, 0x073642], 8 | \ 'base01' : [10, 0x586e75], 9 | \ 'base00' : [11, 0x657b83], 10 | \ 'base0' : [12, 0x839496], 11 | \ 'base1' : [14, 0x93a1a1], 12 | \ 'base2' : [7, 0xeee8d5], 13 | \ 'base3' : [15, 0xfdf6e3], 14 | \ 'yellow' : [3, 0xb58900], 15 | \ 'orange' : [9, 0xcb4b16], 16 | \ 'red' : [1, 0xdc322f], 17 | \ 'magenta' : [5, 0xd33682], 18 | \ 'violet' : [13, 0x6c71c4], 19 | \ 'blue' : [4, 0x268bd2], 20 | \ 'cyan' : [6, 0x2aa198], 21 | \ 'green' : [2, 0x859900], 22 | \ }) 23 | 24 | let g:Powerline#Colorschemes#solarized#colorscheme = Pl#Colorscheme#Init([ 25 | \ Pl#Hi#Segments(['SPLIT'], { 26 | \ 'n': ['base3', 'base2'], 27 | \ 'N': ['base3', 'base2'], 28 | \ 'i': ['base3', 'base2'], 29 | \ }), 30 | \ 31 | \ Pl#Hi#Segments(['mode_indicator'], { 32 | \ 'n': ['base2', 'blue', ['bold']], 33 | \ 'i': ['base3', 'orange', ['bold']], 34 | \ 'v': ['base3', 'magenta', ['bold']], 35 | \ 'r': ['base3', 'violet', ['bold']], 36 | \ 's': ['base3', 'yellow', ['bold']], 37 | \ }), 38 | \ 39 | \ Pl#Hi#Segments(['branch'], { 40 | \ 'n': ['base2', 'base02'], 41 | \ 'N': ['base02', 'base1'], 42 | \ 'i': ['base2', 'base00'], 43 | \ }), 44 | \ 45 | \ Pl#Hi#Segments(['scrollpercent', 'raw', 'filesize'], { 46 | \ 'n': ['base2', 'base0'], 47 | \ 'N': ['base00', 'base2'], 48 | \ 'i': ['base2', 'base1'], 49 | \ }), 50 | \ 51 | \ Pl#Hi#Segments(['fileinfo', 'filename'], { 52 | \ 'n': ['base2', 'base01', ['bold']], 53 | \ 'N': ['base01', 'base2' ], 54 | \ 'i': ['base3', 'base1', ['bold']], 55 | \ }), 56 | \ 57 | \ Pl#Hi#Segments(['fileinfo.filepath'], { 58 | \ 'n': ['base1'], 59 | \ 'N': ['base1'], 60 | \ 'i': ['base01'], 61 | \ }), 62 | \ 63 | \ Pl#Hi#Segments(['static_str'], { 64 | \ 'n': ['base3', 'green'], 65 | \ 'N': ['base02', 'base01'], 66 | \ 'i': ['base3', 'blue'], 67 | \ }), 68 | \ 69 | \ Pl#Hi#Segments(['fileinfo.flags'], { 70 | \ 'n': ['base3'], 71 | \ 'N': ['base00'], 72 | \ 'i': ['base3'], 73 | \ }), 74 | \ 75 | \ Pl#Hi#Segments(['currenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { 76 | \ 'n': ['base00', 'base2'], 77 | \ 'i': ['base0', 'base2'], 78 | \ }), 79 | \ 80 | \ Pl#Hi#Segments(['lineinfo'], { 81 | \ 'n': ['base2', 'base01', ['bold']], 82 | \ 'N': ['base02', 'base0'], 83 | \ 'i': ['base2', 'base00', ['bold']], 84 | \ }), 85 | \ 86 | \ Pl#Hi#Segments(['errors'], { 87 | \ 'n': ['red', 'base2', ['bold']], 88 | \ 'i': ['red', 'base2', ['bold']], 89 | \ }), 90 | \ 91 | \ Pl#Hi#Segments(['lineinfo.line.tot'], { 92 | \ 'n': ['base3'], 93 | \ 'N': ['base02'], 94 | \ 'i': ['base3'], 95 | \ }), 96 | \ 97 | \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { 98 | \ 'n': ['base3', 'red', ['bold']], 99 | \ }), 100 | \ 101 | \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { 102 | \ 'n': ['base3', 'red', ['bold']], 103 | \ 'N': ['base02', 'base01', ['bold']], 104 | \ }), 105 | \ 106 | \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { 107 | \ 'n': ['base3', 'base00'], 108 | \ 'N': ['base0', 'base02'], 109 | \ }), 110 | \ 111 | \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { 112 | \ 'n': ['base3', 'base02'], 113 | \ 'N': ['base0', 'base03'], 114 | \ }), 115 | \ 116 | \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { 117 | \ 'n': ['base2', 'green', ['bold']], 118 | \ 'N': ['base02', 'base1'], 119 | \ }), 120 | \ 121 | \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { 122 | \ 'n': ['base3', 'base01'], 123 | \ 'N': ['base02', 'base01'], 124 | \ }), 125 | \ 126 | \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { 127 | \ 'n': ['base2', 'base2'], 128 | \ 'N': ['base2', 'base2'], 129 | \ }), 130 | \ 131 | \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { 132 | \ 'n': ['base03', 'base01'], 133 | \ }), 134 | \ 135 | \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], { 136 | \ 'n': ['base3', 'base00'], 137 | \ }), 138 | \ 139 | \ Pl#Hi#Segments(['ctrlp:item'], { 140 | \ 'n': ['base3', 'violet', ['bold']], 141 | \ }), 142 | \ 143 | \ Pl#Hi#Segments(['ctrlp:marked'], { 144 | \ 'n': ['base1', 'base01', ['bold']], 145 | \ }), 146 | \ 147 | \ Pl#Hi#Segments(['ctrlp:count'], { 148 | \ 'n': ['base3', 'violet'], 149 | \ }), 150 | \ 151 | \ Pl#Hi#Segments(['ctrlp:SPLIT'], { 152 | \ 'n': ['base3', 'base03'], 153 | \ }), 154 | \ ]) 155 | -------------------------------------------------------------------------------- /autoload/Powerline/Colorschemes/solarized16.vim: -------------------------------------------------------------------------------- 1 | " Authors: 2 | " @stephenmckinney 3 | " 4 | " This colorscheme is based on Solarized-dark colors, setting the specific 5 | " values for the Solarized palette, using the terminal's 16 ansi 6 | " color values. It combines Solarized with Powerline native colors. 7 | call Pl#Hi#Allocate({ 8 | \ 'black' : 16, 9 | \ 'white' : 231, 10 | \ 11 | \ 'darkestgreen' : 22, 12 | \ 'darkgreen' : 28, 13 | \ 'mediumgreen' : 70, 14 | \ 'brightgreen' : 148, 15 | \ 16 | \ 'darkestcyan' : 23, 17 | \ 'mediumcyan' : 117, 18 | \ 19 | \ 'darkestblue' : 24, 20 | \ 'darkblue' : 31, 21 | \ 22 | \ 'darkestred' : 52, 23 | \ 'darkred' : 88, 24 | \ 'mediumred' : 124, 25 | \ 'brightred' : 160, 26 | \ 'brightestred' : 196, 27 | \ 28 | \ 'darkestpurple' : 55, 29 | \ 'mediumpurple' : 98, 30 | \ 'brightpurple' : 189, 31 | \ 32 | \ 'brightorange' : 208, 33 | \ 'brightestorange': 214, 34 | \ 35 | \ 'gray0' : 233, 36 | \ 'gray1' : 235, 37 | \ 'gray2' : 236, 38 | \ 'gray3' : 239, 39 | \ 'gray4' : 240, 40 | \ 'gray5' : 241, 41 | \ 'gray6' : 244, 42 | \ 'gray7' : 245, 43 | \ 'gray8' : 247, 44 | \ 'gray9' : 250, 45 | \ 'gray10' : 252, 46 | \ 47 | \ 'base03' : [8, 0x002b36], 48 | \ 'base02' : [0, 0x073642], 49 | \ 'base01' : [10, 0x586e75], 50 | \ 'base00' : [11, 0x657b83], 51 | \ 'base0' : [12, 0x839496], 52 | \ 'base1' : [14, 0x93a1a1], 53 | \ 'base2' : [7, 0xeee8d5], 54 | \ 'base3' : [15, 0xfdf6e3], 55 | \ 'yellow' : [3, 0xb58900], 56 | \ 'orange' : [9, 0xcb4b16], 57 | \ 'red' : [1, 0xdc322f], 58 | \ 'magenta' : [5, 0xd33682], 59 | \ 'violet' : [13, 0x6c71c4], 60 | \ 'blue' : [4, 0x268bd2], 61 | \ 'cyan' : [6, 0x2aa198], 62 | \ 'green' : [2, 0x859900], 63 | \ }) 64 | 65 | let g:Powerline#Colorschemes#solarized16#colorscheme= Pl#Colorscheme#Init([ 66 | \ Pl#Hi#Segments(['SPLIT'], { 67 | \ 'n': ['white', 'base02'], 68 | \ 'N': ['white', 'base02'], 69 | \ }), 70 | \ 71 | \ Pl#Hi#Segments(['mode_indicator'], { 72 | \ 'n': ['darkestgreen', 'brightgreen', ['bold']], 73 | \ 'i': ['darkestcyan', 'white', ['bold']], 74 | \ 'v': ['red', 'brightorange', ['bold']], 75 | \ 'r': ['white', 'violet', ['bold']], 76 | \ 's': ['white', 'gray5', ['bold']], 77 | \ }), 78 | \ 79 | \ Pl#Hi#Segments(['branch', 'raw', 'filesize'], { 80 | \ 'n': ['base03', 'blue'], 81 | \ 'N': ['base00', 'base03'], 82 | \ }), 83 | \ 84 | \ Pl#Hi#Segments(['fileinfo', 'filename', 'filepath'], { 85 | \ 'n': ['base3', 'darkestblue', ['bold']], 86 | \ 'N': ['base0', 'base02', ['bold']], 87 | \ }), 88 | \ 89 | \ Pl#Hi#Segments(['fileinfo.filepath'], { 90 | \ 'n': ['base2'], 91 | \ 'N': ['base00'], 92 | \ }), 93 | \ 94 | \ Pl#Hi#Segments(['static_str'], { 95 | \ 'n': ['base3', 'violet'], 96 | \ 'N': ['base1', 'base02'], 97 | \ 'i': ['white', 'base02'], 98 | \ }), 99 | \ 100 | \ Pl#Hi#Segments(['fileinfo.flags'], { 101 | \ 'n': ['base03', ['bold']], 102 | \ 'N': ['gray5'], 103 | \ 'i': ['base03', ['bold']], 104 | \ }), 105 | \ 106 | \ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { 107 | \ 'n': ['base1', 'base02'], 108 | \ 'N': ['base00', 'base03'], 109 | \ }), 110 | \ 111 | \ Pl#Hi#Segments(['scrollpercent'], { 112 | \ 'n': ['base1', 'base02', ['bold']], 113 | \ 'N': ['base00', 'base03'], 114 | \ }), 115 | \ 116 | \ Pl#Hi#Segments(['lineinfo'], { 117 | \ 'n': ['gray2', 'gray10', ['bold']], 118 | \ 'N': ['gray7', 'gray1', ['bold']], 119 | \ 'i': ['darkestcyan', 'mediumcyan', ['bold']], 120 | \ }), 121 | \ 122 | \ Pl#Hi#Segments(['errors'], { 123 | \ 'n': ['orange', 'base02', ['bold']], 124 | \ 'N': ['gray5', 'base03', ['bold']], 125 | \ }), 126 | \ 127 | \ Pl#Hi#Segments(['lineinfo.line.tot'], { 128 | \ 'n': ['gray6'], 129 | \ 'N': ['gray5'], 130 | \ 'i': ['darkestcyan'], 131 | \ }), 132 | \ 133 | \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { 134 | \ 'n': ['base3', 'red', ['bold']], 135 | \ }), 136 | \ 137 | \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { 138 | \ 'n': ['base3', 'darkblue', ['bold']], 139 | \ 'N': ['base1', 'base03', ['bold']], 140 | \ }), 141 | \ 142 | \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { 143 | \ 'n': ['white', 'base02'], 144 | \ 'N': ['gray5', 'base02'], 145 | \ }), 146 | \ 147 | \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { 148 | \ 'n': ['white', 'base02'], 149 | \ 'N': ['white', 'base02'], 150 | \ }), 151 | \ 152 | \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { 153 | \ 'n': ['base3', 'darkestblue', ['bold']], 154 | \ 'N': ['base01', 'base02', ['bold']], 155 | \ }), 156 | \ 157 | \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { 158 | \ 'n': ['base3', 'blue'], 159 | \ 'N': ['gray5', 'base02'], 160 | \ }), 161 | \ 162 | \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { 163 | \ 'n': ['gray3', 'base02'], 164 | \ 'N': ['gray3', 'base02'], 165 | \ }), 166 | \ 167 | \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { 168 | \ 'n': ['green', 'base02'], 169 | \ }), 170 | \ 171 | \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next'], { 172 | \ 'n': ['green', 'base02'], 173 | \ }), 174 | \ 175 | \ Pl#Hi#Segments(['ctrlp:item', 'ctrlp:pwd'], { 176 | \ 'n': ['base2', 'darkestblue', ['bold']], 177 | \ }), 178 | \ 179 | \ Pl#Hi#Segments(['ctrlp:marked'], { 180 | \ 'n': ['green', 'base02'], 181 | \ }), 182 | \ 183 | \ Pl#Hi#Segments(['ctrlp:count'], { 184 | \ 'n': ['base0', 'base02'], 185 | \ }), 186 | \ 187 | \ Pl#Hi#Segments(['ctrlp:SPLIT'], { 188 | \ 'n': ['white', 'base02'], 189 | \ }), 190 | \ 191 | \ Pl#Hi#Segments(['status'], { 192 | \ 'n': ['green', 'base02'], 193 | \ 'N': ['gray5', 'base02'], 194 | \ }), 195 | \ ]) 196 | -------------------------------------------------------------------------------- /autoload/Powerline/Colorschemes/solarized256.vim: -------------------------------------------------------------------------------- 1 | " Authors: 2 | " @skwp 3 | " 4 | " This colorscheme is based on Solarized-dark colors, combined 5 | " with Powerline native colors 6 | call Pl#Hi#Allocate({ 7 | \ 'black' : 16, 8 | \ 'white' : 231, 9 | \ 10 | \ 'darkestgreen' : 22, 11 | \ 'darkgreen' : 28, 12 | \ 'mediumgreen' : 70, 13 | \ 'brightgreen' : 148, 14 | \ 15 | \ 'darkestcyan' : 23, 16 | \ 'mediumcyan' : 117, 17 | \ 18 | \ 'darkestblue' : 24, 19 | \ 'darkblue' : 31, 20 | \ 21 | \ 'darkestred' : 52, 22 | \ 'darkred' : 88, 23 | \ 'mediumred' : 124, 24 | \ 'brightred' : 160, 25 | \ 'brightestred' : 196, 26 | \ 27 | \ 'darkestpurple' : 55, 28 | \ 'mediumpurple' : 98, 29 | \ 'brightpurple' : 189, 30 | \ 31 | \ 'brightorange' : 208, 32 | \ 'brightestorange': 214, 33 | \ 34 | \ 'gray0' : 233, 35 | \ 'gray1' : 235, 36 | \ 'gray2' : 236, 37 | \ 'gray3' : 239, 38 | \ 'gray4' : 240, 39 | \ 'gray5' : 241, 40 | \ 'gray6' : 244, 41 | \ 'gray7' : 245, 42 | \ 'gray8' : 247, 43 | \ 'gray9' : 250, 44 | \ 'gray10' : 252, 45 | \ 46 | \ 'base03' : [234, 0x002b36], 47 | \ 'base02' : [235, 0x073642], 48 | \ 'base01' : [240, 0x586e75], 49 | \ 'base00' : [241, 0x657b83], 50 | \ 'base0' : [244, 0x839496], 51 | \ 'base1' : [245, 0x93a1a1], 52 | \ 'base2' : [254, 0xeee8d5], 53 | \ 'base3' : [230, 0xfdf6e3], 54 | \ 'yellow' : [136, 0xb58900], 55 | \ 'orange' : [166, 0xcb4b16], 56 | \ 'red' : [160, 0xdc322f], 57 | \ 'magenta' : [125, 0xd33682], 58 | \ 'violet' : [61, 0x6c71c4], 59 | \ 'blue' : [33, 0x268bd2], 60 | \ 'cyan' : [37, 0x2aa198], 61 | \ 'green' : [64, 0x859900], 62 | \ }) 63 | 64 | let g:Powerline#Colorschemes#solarized256#colorscheme = Pl#Colorscheme#Init([ 65 | \ Pl#Hi#Segments(['SPLIT'], { 66 | \ 'n': ['white', 'base02'], 67 | \ 'N': ['white', 'base02'], 68 | \ }), 69 | \ 70 | \ Pl#Hi#Segments(['mode_indicator'], { 71 | \ 'n': ['darkestgreen', 'brightgreen', ['bold']], 72 | \ 'i': ['darkestcyan', 'white', ['bold']], 73 | \ 'v': ['red', 'brightorange', ['bold']], 74 | \ 'r': ['white', 'violet', ['bold']], 75 | \ 's': ['white', 'gray5', ['bold']], 76 | \ }), 77 | \ 78 | \ Pl#Hi#Segments(['branch', 'raw', 'filesize'], { 79 | \ 'n': ['base03', 'blue'], 80 | \ 'N': ['gray5', 'base03'], 81 | \ }), 82 | \ 83 | \ Pl#Hi#Segments(['scrollpercent'], { 84 | \ 'n': ['gray7', 'gray2'], 85 | \ 'N': ['base2', 'base02'], 86 | \ }), 87 | \ 88 | \ Pl#Hi#Segments(['fileinfo', 'filename', 'filepath'], { 89 | \ 'n': ['base2', 'darkestblue', ['bold']], 90 | \ 'N': ['base1', 'base02', ['bold']], 91 | \ }), 92 | \ 93 | \ Pl#Hi#Segments(['fileinfo.filepath'], { 94 | \ 'n': ['gray10'], 95 | \ 'N': ['gray5'], 96 | \ 'i': ['mediumcyan'], 97 | \ }), 98 | \ 99 | \ Pl#Hi#Segments(['static_str'], { 100 | \ 'n': ['base3', 'violet'], 101 | \ 'N': ['base1', 'base02'], 102 | \ 'i': ['white', 'base02'], 103 | \ }), 104 | \ 105 | \ Pl#Hi#Segments(['fileinfo.flags'], { 106 | \ 'n': ['base03', ['bold']], 107 | \ 'N': ['gray5'], 108 | \ 'i': ['base03', ['bold']], 109 | \ }), 110 | \ 111 | \ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { 112 | \ 'n': ['gray5', 'gray2'], 113 | \ 'i': ['mediumcyan', 'base02'], 114 | \ }), 115 | \ 116 | \ Pl#Hi#Segments(['lineinfo'], { 117 | \ 'n': ['gray2', 'gray10', ['bold']], 118 | \ 'N': ['gray7', 'gray1', ['bold']], 119 | \ 'i': ['darkestcyan', 'mediumcyan', ['bold']], 120 | \ }), 121 | \ 122 | \ Pl#Hi#Segments(['errors'], { 123 | \ 'n': ['orange', 'base02', ['bold']], 124 | \ 'N': ['gray5', 'base03', ['bold']], 125 | \ }), 126 | \ 127 | \ Pl#Hi#Segments(['lineinfo.line.tot'], { 128 | \ 'n': ['gray6'], 129 | \ 'N': ['gray5'], 130 | \ 'i': ['darkestcyan'], 131 | \ }), 132 | \ 133 | \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { 134 | \ 'n': ['base3', 'red', ['bold']], 135 | \ }), 136 | \ 137 | \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { 138 | \ 'n': ['base3', 'darkblue', ['bold']], 139 | \ 'N': ['base1', 'base03', ['bold']], 140 | \ }), 141 | \ 142 | \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { 143 | \ 'n': ['white', 'base02'], 144 | \ 'N': ['gray5', 'base02'], 145 | \ }), 146 | \ 147 | \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { 148 | \ 'n': ['white', 'base02'], 149 | \ 'N': ['white', 'base02'], 150 | \ }), 151 | \ 152 | \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { 153 | \ 'n': ['gray10', 'darkestblue', ['bold']], 154 | \ 'N': ['gray3', 'base02', ['bold']], 155 | \ }), 156 | \ 157 | \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { 158 | \ 'n': ['base3', 'blue'], 159 | \ 'N': ['gray5', 'base02'], 160 | \ }), 161 | \ 162 | \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { 163 | \ 'n': ['gray3', 'base02'], 164 | \ 'N': ['gray3', 'base02'], 165 | \ }), 166 | \ 167 | \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { 168 | \ 'n': ['green', 'base03'], 169 | \ }), 170 | \ 171 | \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], { 172 | \ 'n': ['green', 'base02'], 173 | \ }), 174 | \ 175 | \ Pl#Hi#Segments(['ctrlp:item'], { 176 | \ 'n': ['base2', 'darkestblue', ['bold']], 177 | \ }), 178 | \ 179 | \ Pl#Hi#Segments(['ctrlp:marked'], { 180 | \ 'n': ['brightgreen', 'base03', ['bold']], 181 | \ }), 182 | \ 183 | \ Pl#Hi#Segments(['ctrlp:count'], { 184 | \ 'n': ['base0', 'base03'], 185 | \ }), 186 | \ 187 | \ Pl#Hi#Segments(['ctrlp:SPLIT'], { 188 | \ 'n': ['white', 'base03'], 189 | \ }), 190 | \ 191 | \ Pl#Hi#Segments(['status'], { 192 | \ 'n': ['green', 'base02'], 193 | \ 'N': ['gray5', 'base02'], 194 | \ }), 195 | \ ]) 196 | -------------------------------------------------------------------------------- /autoload/Powerline/Functions.vim: -------------------------------------------------------------------------------- 1 | " Recalculate the trailing whitespace warning when idle, and after saving 2 | autocmd CursorHold,BufWritePost,InsertLeave * unlet! b:statusline_trailing_space_warning 3 | 4 | function! Powerline#Functions#GetFilepath() " {{{ 5 | " Recalculate the filepath when cwd changes. 6 | let cwd = getcwd() 7 | if exists("b:Powerline_cwd") && cwd != b:Powerline_cwd 8 | unlet! b:Powerline_filepath 9 | endif 10 | let b:Powerline_cwd = cwd 11 | 12 | if exists('b:Powerline_filepath') 13 | return b:Powerline_filepath 14 | endif 15 | 16 | let dirsep = has('win32') && ! &shellslash ? '\' : '/' 17 | let filepath = expand('%:p') 18 | 19 | if empty(filepath) 20 | return '' 21 | endif 22 | 23 | let ret = '' 24 | 25 | if g:Powerline_stl_path_style == 'short' 26 | " Display a short path where the first directory is displayed with its 27 | " full name, and the subsequent directories are shortened to their 28 | " first letter, i.e. "/home/user/foo/foo/bar/baz.vim" becomes 29 | " "~/foo/f/b/baz.vim" 30 | " 31 | " This displays the shortest possible path, relative to ~ or the 32 | " current directory. 33 | let mod = (exists('+acd') && &acd) ? ':~:h' : ':~:.:h' 34 | let fpath = split(fnamemodify(filepath, mod), dirsep) 35 | let fpath_shortparts = map(fpath[1:], 'v:val[0]') 36 | let ret = join(extend([fpath[0]], fpath_shortparts), dirsep) . dirsep 37 | elseif g:Powerline_stl_path_style == 'relative' 38 | " Display a relative path, similar to the %f statusline item 39 | let ret = fnamemodify(filepath, ':~:.:h') . dirsep 40 | elseif g:Powerline_stl_path_style == 'full' 41 | " Display the full path, similar to the %F statusline item 42 | let ret = fnamemodify(filepath, ':h') . dirsep 43 | endif 44 | 45 | if ret == ('.' . dirsep) 46 | let ret = '' 47 | endif 48 | 49 | let b:Powerline_filepath = ret 50 | return ret 51 | endfunction " }}} 52 | function! Powerline#Functions#GetShortPath(threshold) " {{{ 53 | let fullpath = split(expand('%:~'), '[/\\]') 54 | 55 | if len(fullpath) > a:threshold 56 | let fullpath = [fullpath[0], '…'] + fullpath[-a:threshold + 1 :] 57 | endif 58 | 59 | return join(fullpath, '/') 60 | endfunction " }}} 61 | function! Powerline#Functions#GetMode() " {{{ 62 | let mode = mode() 63 | 64 | if mode ==# 'v' 65 | let mode = get(g:, "Powerline_mode_v", "VISUAL") 66 | elseif mode ==# 'V' 67 | let mode = get(g:, "Powerline_mode_V", "V⋅LINE") 68 | elseif mode ==# '' 69 | let mode = get(g:, "Powerline_mode_cv", "V⋅BLOCK") 70 | elseif mode ==# 's' 71 | let mode = get(g:, "Powerline_mode_s", "SELECT") 72 | elseif mode ==# 'S' 73 | let mode = get(g:, "Powerline_mode_S", "S⋅LINE") 74 | elseif mode ==# '' 75 | let mode = get(g:, "Powerline_mode_cs", "S⋅BLOCK") 76 | elseif mode =~# '\vi' 77 | let mode = get(g:, "Powerline_mode_i", "INSERT") 78 | elseif mode =~# '\v(R|Rv)' 79 | let mode = get(g:, "Powerline_mode_R", "REPLACE") 80 | else 81 | " Fallback to normal mode 82 | let mode = get(g:, "Powerline_mode_n", "NORMAL") 83 | endif 84 | 85 | return mode 86 | endfunction " }}} 87 | function! Powerline#Functions#GetFilesize() " {{{ 88 | let bytes = getfsize(expand("%:p")) 89 | 90 | if bytes <= 0 91 | return '' 92 | endif 93 | 94 | if bytes < 1024 95 | return bytes . 'B' 96 | else 97 | return (bytes / 1024) . 'kB' 98 | endif 99 | endfunction "}}} 100 | function! Powerline#Functions#GetCharCode() " {{{ 101 | " Get the output of :ascii 102 | redir => ascii 103 | silent! ascii 104 | redir END 105 | 106 | if match(ascii, 'NUL') != -1 107 | return 'NUL' 108 | endif 109 | 110 | " Zero pad hex values 111 | let nrformat = '0x%02x' 112 | 113 | let encoding = (&fenc == '' ? &enc : &fenc) 114 | 115 | if encoding == 'utf-8' 116 | " Zero pad with 4 zeroes in unicode files 117 | let nrformat = '0x%04x' 118 | endif 119 | 120 | " Get the character and the numeric value from the return value of :ascii 121 | " This matches the two first pieces of the return value, e.g. 122 | " " 70" => char: 'F', nr: '70' 123 | let [str, char, nr; rest] = matchlist(ascii, '\v\<(.{-1,})\>\s*([0-9]+)') 124 | 125 | " Format the numeric value 126 | let nr = printf(nrformat, nr) 127 | 128 | return "'". char ."' ". nr 129 | endfunction "}}} 130 | function! Powerline#Functions#GetWSMarker() " {{{ 131 | " Return '...' if trailing white space is detected 132 | " Return '' otherwise 133 | if ! exists("b:statusline_trailing_space_warning") 134 | if search('\s$', 'nw') != 0 135 | let b:statusline_trailing_space_warning = ' … ' 136 | else 137 | let b:statusline_trailing_space_warning = '' 138 | endif 139 | endif 140 | return b:statusline_trailing_space_warning 141 | endfunction " }}} 142 | -------------------------------------------------------------------------------- /autoload/Powerline/Functions/ft_man.vim: -------------------------------------------------------------------------------- 1 | function! Powerline#Functions#ft_man#GetName() " {{{ 2 | let matches = matchlist(getline(1), '\v^([a-zA-Z_\.\-]+)\((\d+)\)') 3 | 4 | if ! len(matches) 5 | return 'n/a' 6 | endif 7 | 8 | let file = tolower(matches[1]) 9 | let num = matches[2] 10 | 11 | return file 12 | endfunction " }}} 13 | -------------------------------------------------------------------------------- /autoload/Powerline/Functions/fugitive.vim: -------------------------------------------------------------------------------- 1 | function! Powerline#Functions#fugitive#GetBranch(symbol) " {{{ 2 | let ret = fugitive#statusline() 3 | 4 | let ret = substitute(ret, '\c\v\[?GIT\(([a-z0-9\-_\./:]+)\)\]?', a:symbol .' \1', 'g') 5 | 6 | return ret 7 | endfunction " }}} 8 | -------------------------------------------------------------------------------- /autoload/Powerline/Functions/hgrev.vim: -------------------------------------------------------------------------------- 1 | function! Powerline#Functions#hgrev#Status(symbol) " {{{ 2 | if ! exists('*HGRev') 3 | " HGRev hasn't been loaded yet 4 | return '' 5 | endif 6 | if !exists("b:statusline_hg_status") 7 | silent execute "RefreshMercurialRev" 8 | endif 9 | let b:statusline_hg_status=HGRev() 10 | if b:statusline_hg_status != '-' 11 | let ret = "\u26A1". '' . substitute(b:statusline_hg_status, '^[^ ]*', '\1', 'g') 12 | let ret=substitute(ret,' M$','+','g') 13 | else 14 | let ret='' 15 | endif 16 | return ret 17 | endfunction " }}} 18 | -------------------------------------------------------------------------------- /autoload/Powerline/Functions/syntastic.vim: -------------------------------------------------------------------------------- 1 | function! Powerline#Functions#syntastic#GetErrors(line_symbol) " {{{ 2 | if ! exists('g:syntastic_stl_format') 3 | " Syntastic hasn't been loaded yet 4 | return '' 5 | endif 6 | 7 | " Temporarily change syntastic output format 8 | let old_stl_format = g:syntastic_stl_format 9 | let g:syntastic_stl_format = '%E{ ERRORS (%e) '. a:line_symbol .' %fe }%W{ WARNINGS (%w) '. a:line_symbol .' %fw }' 10 | 11 | let ret = SyntasticStatuslineFlag() 12 | 13 | let g:syntastic_stl_format = old_stl_format 14 | 15 | return ret 16 | endfunction " }}} 17 | -------------------------------------------------------------------------------- /autoload/Powerline/Matches.vim: -------------------------------------------------------------------------------- 1 | let g:Powerline#Matches#matches = { 2 | \ 'command_t' : Pl#Match#Add('bufname(winbufnr(a:window))', '^GoToFile$'), 3 | \ 'bt_help' : Pl#Match#Add('getwinvar(a:window, "&bt")' , '^help$'), 4 | \ 'ft_man' : Pl#Match#Add('getwinvar(a:window, "&ft")' , '^man$'), 5 | \ 'ft_qf' : Pl#Match#Add('getwinvar(a:window, "&ft")' , '^qf$'), 6 | \ 'ft_vimpager' : Pl#Match#Add('getwinvar(a:window, "&ft")' , 'vimpager'), 7 | \ 'gundo_preview' : Pl#Match#Add('bufname(winbufnr(a:window))', '^__Gundo_Preview__$'), 8 | \ 'gundo_tree' : Pl#Match#Add('bufname(winbufnr(a:window))', '^__Gundo__$'), 9 | \ 'lustyexplorer' : Pl#Match#Add('bufname(winbufnr(a:window))', '\[LustyExplorer\-Buffers\]'), 10 | \ 'minibufexplorer' : Pl#Match#Add('bufname(winbufnr(a:window))', '^\-MiniBufExplorer\-$'), 11 | \ 'tagbar' : Pl#Match#Add('getwinvar(a:window, "&ft")' , '^tagbar$'), 12 | \ 'nerdtree' : Pl#Match#Add('getwinvar(a:window, "&ft")' , '^nerdtree$'), 13 | \ } 14 | -------------------------------------------------------------------------------- /autoload/Powerline/Segments.vim: -------------------------------------------------------------------------------- 1 | let g:Powerline#Segments#segments = Pl#Segment#Init([ 2 | \ Pl#Segment#Create('SPLIT' , '__split__'), 3 | \ Pl#Segment#Create('TRUNCATE', '__truncate__'), 4 | \ 5 | \ Pl#Segment#Create('paste_indicator' , '%{&paste ? "PASTE" : ""}', Pl#Segment#Modes('!N')), 6 | \ Pl#Segment#Create('mode_indicator' , '%{Powerline#Functions#GetMode()}', Pl#Segment#Modes('!N')), 7 | \ Pl#Segment#Create('fileinfo', 8 | \ Pl#Segment#Create('flags.ro' , '%{&readonly ? "$RO" : ""}'), 9 | \ Pl#Segment#Create('filepath' , '%{Powerline#Functions#GetFilepath()}', Pl#Segment#NoPadding()), 10 | \ Pl#Segment#Create('filename' , '%t'), 11 | \ Pl#Segment#Create('flags.mod' , '%M'), 12 | \ Pl#Segment#Create('flags.type' , '%H%W'), 13 | \ ), 14 | \ Pl#Segment#Create('filename' , '%t'), 15 | \ Pl#Segment#Create('filesize' , '%{Powerline#Functions#GetFilesize()}', Pl#Segment#Modes('!N')), 16 | \ Pl#Segment#Create('pwd' , '%{substitute(getcwd(), expand("$HOME"), "~", "g")}'), 17 | \ Pl#Segment#Create('static_str' , '%%{"%s"}'), 18 | \ Pl#Segment#Create('raw' , '%s'), 19 | \ Pl#Segment#Create('fileformat' , '%{&fileformat}', Pl#Segment#Modes('!N')), 20 | \ Pl#Segment#Create('fileencoding' , '%{(&fenc == "" ? &enc : &fenc)}', Pl#Segment#Modes('!N')), 21 | \ Pl#Segment#Create('filetype' , '%{strlen(&ft) ? &ft : "no ft"}', Pl#Segment#Modes('!N')), 22 | \ Pl#Segment#Create('scrollpercent' , '%3p%%'), 23 | \ Pl#Segment#Create('lineinfo', 24 | \ Pl#Segment#Create('line.cur' , '$LINE %3l'), 25 | \ Pl#Segment#Create('line.tot' , ':%-2v', Pl#Segment#NoPadding()), 26 | \ ), 27 | \ Pl#Segment#Create('charcode' , '%{Powerline#Functions#GetCharCode()}', Pl#Segment#Modes('!N')), 28 | \ Pl#Segment#Create('currhigroup' , '%{synIDattr(synID(line("."), col("."), 1), "name")}', Pl#Segment#Modes('!N')), 29 | \ Pl#Segment#Create('ws_marker' , '%{Powerline#Functions#GetWSMarker()}', Pl#Segment#Modes('!N')), 30 | \ ]) 31 | -------------------------------------------------------------------------------- /autoload/Powerline/Segments/ctrlp.vim: -------------------------------------------------------------------------------- 1 | if !exists("g:Powerline#Segments#ctrlp#segments#focus ") 2 | let g:Powerline#Segments#ctrlp#segments#focus = '%{"%0"}' 3 | endif 4 | if !exists("g:Powerline#Segments#ctrlp#segments#prev ") 5 | let g:Powerline#Segments#ctrlp#segments#prev = '%-3{"%3"}' 6 | endif 7 | if !exists("g:Powerline#Segments#ctrlp#segments#next ") 8 | let g:Powerline#Segments#ctrlp#segments#next = '%-3{"%5"}' 9 | endif 10 | 11 | let g:Powerline#Segments#ctrlp#segments = Pl#Segment#Init(['ctrlp' 12 | \ , Pl#Segment#Create('focus', g:Powerline#Segments#ctrlp#segments#focus) 13 | \ , Pl#Segment#Create('byfname', '%{"%1"}') 14 | \ , Pl#Segment#Create('prev', g:Powerline#Segments#ctrlp#segments#prev) 15 | \ , Pl#Segment#Create('item', '%-9{"%4"}') 16 | \ , Pl#Segment#Create('next', g:Powerline#Segments#ctrlp#segments#next) 17 | \ , Pl#Segment#Create('marked', '%{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)}') 18 | \ 19 | \ , Pl#Segment#Create('count', '%-6{"%0"}') 20 | \ ]) 21 | -------------------------------------------------------------------------------- /autoload/Powerline/Segments/ft_man.vim: -------------------------------------------------------------------------------- 1 | let g:Powerline#Segments#ft_man#segments = Pl#Segment#Init(['ft_man', 2 | \ Pl#Segment#Create('filename', '%{Powerline#Functions#ft_man#GetName()}') 3 | \ ]) 4 | -------------------------------------------------------------------------------- /autoload/Powerline/Segments/fugitive.vim: -------------------------------------------------------------------------------- 1 | let g:Powerline#Segments#fugitive#segments = Pl#Segment#Init(['fugitive', 2 | \ (exists('g:loaded_fugitive') && g:loaded_fugitive == 1), 3 | \ 4 | \ Pl#Segment#Create('branch', '%{Powerline#Functions#fugitive#GetBranch("$BRANCH")}') 5 | \ ]) 6 | -------------------------------------------------------------------------------- /autoload/Powerline/Segments/hgrev.vim: -------------------------------------------------------------------------------- 1 | let g:Powerline#Segments#hgrev#segments = Pl#Segment#Init(['hgrev', 2 | \ (exists('hgrev_loaded')), 3 | \ Pl#Segment#Create('branch', '%{Powerline#Functions#hgrev#Status("$BRANCH")}') 4 | \ ]) 5 | -------------------------------------------------------------------------------- /autoload/Powerline/Segments/rvm.vim: -------------------------------------------------------------------------------- 1 | let g:Powerline#Segments#rvm#segments = Pl#Segment#Init(['rvm', 2 | \ (exists('g:loaded_rvm') && g:loaded_rvm == 1), 3 | \ 4 | \ Pl#Segment#Create('string', '%{rvm#string()}'), 5 | \ Pl#Segment#Create('statusline', '%{rvm#statusline()}') 6 | \ ]) 7 | -------------------------------------------------------------------------------- /autoload/Powerline/Segments/syntastic.vim: -------------------------------------------------------------------------------- 1 | let g:Powerline#Segments#syntastic#segments = Pl#Segment#Init(['syntastic', 2 | \ (exists('g:loaded_syntastic_plugin') && g:loaded_syntastic_plugin == 1), 3 | \ 4 | \ Pl#Segment#Create('errors', '%{Powerline#Functions#syntastic#GetErrors("$LINE")}', Pl#Segment#Modes('!N')) 5 | \ ]) 6 | -------------------------------------------------------------------------------- /autoload/Powerline/Segments/tagbar.vim: -------------------------------------------------------------------------------- 1 | let g:Powerline#Segments#tagbar#segments = Pl#Segment#Init(['tagbar', 2 | \ (exists(':Tagbar') > 0), 3 | \ 4 | \ Pl#Segment#Create('currenttag', '%{tagbar#currenttag("%s", "")}', Pl#Segment#Modes('!N')), 5 | \ Pl#Segment#Create('fullcurrenttag', '%{tagbar#currenttag("%s", "", "f")}', Pl#Segment#Modes('!N')) 6 | \ ]) 7 | -------------------------------------------------------------------------------- /autoload/Powerline/Segments/virtualenv.vim: -------------------------------------------------------------------------------- 1 | let g:Powerline#Segments#virtualenv#segments = Pl#Segment#Init(['virtualenv', 2 | \ has('python') && (exists('g:virtualenv_loaded') && g:virtualenv_loaded == 1), 3 | \ 4 | \ Pl#Segment#Create('statusline', '%{virtualenv#statusline()}') 5 | \ ]) 6 | -------------------------------------------------------------------------------- /autoload/Powerline/Themes/default.vim: -------------------------------------------------------------------------------- 1 | let g:Powerline#Themes#default#theme = Pl#Theme#Create( 2 | \ Pl#Theme#Buffer('' 3 | \ , 'paste_indicator' 4 | \ , 'mode_indicator' 5 | \ , 'fugitive:branch' 6 | \ , 'hgrev:branch' 7 | \ , 'fileinfo' 8 | \ , 'syntastic:errors' 9 | \ , Pl#Segment#Truncate() 10 | \ , 'tagbar:currenttag' 11 | \ , Pl#Segment#Split() 12 | \ , 'rvm:string' 13 | \ , 'virtualenv:statusline' 14 | \ , 'fileformat' 15 | \ , 'fileencoding' 16 | \ , 'filetype' 17 | \ , 'scrollpercent' 18 | \ , 'lineinfo' 19 | \ ), 20 | \ 21 | \ Pl#Theme#Buffer('command_t' 22 | \ , ['static_str.name', 'Command-T'] 23 | \ , Pl#Segment#Truncate() 24 | \ , Pl#Segment#Split() 25 | \ , ['raw.line', '%10(Match #%l%)'] 26 | \ ), 27 | \ 28 | \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree') 29 | \ , ['static_str.name', 'Gundo'] 30 | \ , ['static_str.buffer', 'Undo tree'] 31 | \ , Pl#Segment#Truncate() 32 | \ , Pl#Segment#Split() 33 | \ ), 34 | \ 35 | \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview') 36 | \ , ['static_str.name', 'Gundo'] 37 | \ , ['static_str.buffer', 'Diff preview'] 38 | \ , Pl#Segment#Truncate() 39 | \ , Pl#Segment#Split() 40 | \ ), 41 | \ 42 | \ Pl#Theme#Buffer('bt_help' 43 | \ , ['static_str.name', 'Help'] 44 | \ , 'filename' 45 | \ , Pl#Segment#Truncate() 46 | \ , Pl#Segment#Split() 47 | \ , 'scrollpercent' 48 | \ ), 49 | \ 50 | \ Pl#Theme#Buffer('ft_vimpager' 51 | \ , ['static_str.name', 'Pager'] 52 | \ , 'filename' 53 | \ , Pl#Segment#Truncate() 54 | \ , Pl#Segment#Split() 55 | \ , 'scrollpercent' 56 | \ ), 57 | \ 58 | \ Pl#Theme#Buffer('lustyexplorer' 59 | \ , ['static_str.name', 'LustyExplorer'] 60 | \ , ['static_str.buffer', 'Buffer list'] 61 | \ , Pl#Segment#Truncate() 62 | \ , Pl#Segment#Split() 63 | \ ), 64 | \ 65 | \ Pl#Theme#Buffer('ft_man' 66 | \ , ['static_str.name', 'Man page'] 67 | \ , 'filename' 68 | \ , Pl#Segment#Truncate() 69 | \ , Pl#Segment#Split() 70 | \ , 'scrollpercent' 71 | \ ), 72 | \ 73 | \ Pl#Theme#Buffer('minibufexplorer' 74 | \ , ['static_str.name', 'MiniBufExplorer'] 75 | \ , Pl#Segment#Truncate() 76 | \ , Pl#Segment#Split() 77 | \ ), 78 | \ 79 | \ Pl#Theme#Buffer('ft_qf' 80 | \ , ['static_str.name', 'Quickfix'] 81 | \ , Pl#Segment#Truncate() 82 | \ , Pl#Segment#Split() 83 | \ ), 84 | \ 85 | \ Pl#Theme#Buffer('tagbar' 86 | \ , ['static_str.name', 'Tagbar'] 87 | \ , ['static_str.buffer', 'Tree'] 88 | \ , Pl#Segment#Truncate() 89 | \ , Pl#Segment#Split() 90 | \ ), 91 | \ 92 | \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"') 93 | \ , 'ctrlp:prev' 94 | \ , 'ctrlp:item' 95 | \ , 'ctrlp:next' 96 | \ , 'ctrlp:marked' 97 | \ , Pl#Segment#Truncate() 98 | \ , Pl#Segment#Split() 99 | \ , 'ctrlp:focus' 100 | \ , 'ctrlp:byfname' 101 | \ , 'pwd' 102 | \ ), 103 | \ 104 | \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"') 105 | \ , 'ctrlp:count' 106 | \ , Pl#Segment#Truncate() 107 | \ , Pl#Segment#Split() 108 | \ , 'pwd' 109 | \ ), 110 | \ 111 | \ Pl#Theme#Buffer('nerdtree' 112 | \ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}'] 113 | \ , Pl#Segment#Truncate() 114 | \ , Pl#Segment#Split() 115 | \ ) 116 | \ ) 117 | -------------------------------------------------------------------------------- /autoload/Powerline/Themes/solarized16.vim: -------------------------------------------------------------------------------- 1 | " Authors: 2 | " @stephenmckinney 3 | " 4 | let g:Powerline#Themes#solarized16#theme = Pl#Theme#Create( 5 | \ Pl#Theme#Buffer('' 6 | \ , 'fugitive:branch' 7 | \ , 'fileinfo' 8 | \ , 'flags.mod' 9 | \ , 'syntastic:errors' 10 | \ , Pl#Segment#Truncate() 11 | \ , Pl#Segment#Split() 12 | \ , 'sass:status' 13 | \ , 'rvm:string' 14 | \ , 'filetype' 15 | \ , 'scrollpercent' 16 | \ , 'paste_indicator' 17 | \ ), 18 | \ 19 | \ Pl#Theme#Buffer('command_t' 20 | \ , ['static_str.name', 'Command-T'] 21 | \ , Pl#Segment#Truncate() 22 | \ , Pl#Segment#Split() 23 | \ , ['raw.line', '%10(Match #%l%)'] 24 | \ ), 25 | \ 26 | \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree') 27 | \ , ['static_str.name', 'Gundo'] 28 | \ , ['static_str.buffer', 'Undo tree'] 29 | \ , Pl#Segment#Truncate() 30 | \ , Pl#Segment#Split() 31 | \ ), 32 | \ 33 | \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview') 34 | \ , ['static_str.name', 'Gundo'] 35 | \ , ['static_str.buffer', 'Diff preview'] 36 | \ , Pl#Segment#Truncate() 37 | \ , Pl#Segment#Split() 38 | \ ), 39 | \ 40 | \ Pl#Theme#Buffer('bt_help' 41 | \ , ['static_str.name', 'Help'] 42 | \ , 'filename' 43 | \ , Pl#Segment#Truncate() 44 | \ , Pl#Segment#Split() 45 | \ , 'scrollpercent' 46 | \ ), 47 | \ 48 | \ Pl#Theme#Buffer('ft_vimpager' 49 | \ , ['static_str.name', 'Pager'] 50 | \ , 'filename' 51 | \ , Pl#Segment#Truncate() 52 | \ , Pl#Segment#Split() 53 | \ , 'scrollpercent' 54 | \ ), 55 | \ 56 | \ Pl#Theme#Buffer('lustyexplorer' 57 | \ , ['static_str.name', 'LustyExplorer'] 58 | \ , ['static_str.buffer', 'Buffer list'] 59 | \ , Pl#Segment#Truncate() 60 | \ , Pl#Segment#Split() 61 | \ ), 62 | \ 63 | \ Pl#Theme#Buffer('ft_man' 64 | \ , ['static_str.name', 'Man page'] 65 | \ , 'filename' 66 | \ , Pl#Segment#Truncate() 67 | \ , Pl#Segment#Split() 68 | \ , 'scrollpercent' 69 | \ ), 70 | \ 71 | \ Pl#Theme#Buffer('minibufexplorer' 72 | \ , ['static_str.name', 'MiniBufExplorer'] 73 | \ , Pl#Segment#Truncate() 74 | \ , Pl#Segment#Split() 75 | \ ), 76 | \ 77 | \ Pl#Theme#Buffer('ft_qf' 78 | \ , ['static_str.name', 'Quickfix'] 79 | \ , Pl#Segment#Truncate() 80 | \ , Pl#Segment#Split() 81 | \ ), 82 | \ 83 | \ Pl#Theme#Buffer('tagbar' 84 | \ , ['static_str.name', 'Tagbar'] 85 | \ , ['static_str.buffer', 'Tree'] 86 | \ , Pl#Segment#Truncate() 87 | \ , Pl#Segment#Split() 88 | \ ), 89 | \ 90 | \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"') 91 | \ , 'ctrlp:prev' 92 | \ , 'ctrlp:item' 93 | \ , 'ctrlp:next' 94 | \ , 'ctrlp:marked' 95 | \ , Pl#Segment#Truncate() 96 | \ , Pl#Segment#Split() 97 | \ , 'ctrlp:focus' 98 | \ , 'ctrlp:byfname' 99 | \ , 'pwd' 100 | \ ), 101 | \ 102 | \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"') 103 | \ , 'ctrlp:count' 104 | \ , Pl#Segment#Truncate() 105 | \ , Pl#Segment#Split() 106 | \ , 'pwd' 107 | \ ), 108 | \ 109 | \ Pl#Theme#Buffer('nerdtree' 110 | \ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}'] 111 | \ , Pl#Segment#Truncate() 112 | \ , Pl#Segment#Split() 113 | \ ) 114 | \ ) 115 | -------------------------------------------------------------------------------- /autoload/Powerline/Themes/solarized256.vim: -------------------------------------------------------------------------------- 1 | " Authors: 2 | " @skwp 3 | " 4 | " Disabled: 5 | " Add the following line into the first theme group to see the highlight 6 | " group 7 | " \ , 'currhigroup' 8 | " 9 | " Line info taken out - I know which line number I'm on from the gutter 10 | "\ , 'lineinfo' 11 | let g:Powerline#Themes#solarized256#theme = Pl#Theme#Create( 12 | \ Pl#Theme#Buffer('' 13 | \ , 'fugitive:branch' 14 | \ , 'fileinfo' 15 | \ , 'flags.mod' 16 | \ , 'syntastic:errors' 17 | \ , Pl#Segment#Truncate() 18 | \ , Pl#Segment#Split() 19 | \ , 'sass:status' 20 | \ , 'rvm:string' 21 | \ , 'paste_indicator' 22 | \ ), 23 | \ 24 | \ Pl#Theme#Buffer('command_t' 25 | \ , ['static_str.name', 'Command-T'] 26 | \ , Pl#Segment#Truncate() 27 | \ , Pl#Segment#Split() 28 | \ , ['raw.line', '%10(Match #%l%)'] 29 | \ ), 30 | \ 31 | \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree') 32 | \ , ['static_str.name', 'Gundo'] 33 | \ , ['static_str.buffer', 'Undo tree'] 34 | \ , Pl#Segment#Truncate() 35 | \ , Pl#Segment#Split() 36 | \ ), 37 | \ 38 | \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview') 39 | \ , ['static_str.name', 'Gundo'] 40 | \ , ['static_str.buffer', 'Diff preview'] 41 | \ , Pl#Segment#Truncate() 42 | \ , Pl#Segment#Split() 43 | \ ), 44 | \ 45 | \ Pl#Theme#Buffer('bt_help' 46 | \ , ['static_str.name', 'Help'] 47 | \ , 'filename' 48 | \ , Pl#Segment#Truncate() 49 | \ , Pl#Segment#Split() 50 | \ , 'scrollpercent' 51 | \ ), 52 | \ 53 | \ Pl#Theme#Buffer('ft_vimpager' 54 | \ , ['static_str.name', 'Pager'] 55 | \ , 'filename' 56 | \ , Pl#Segment#Truncate() 57 | \ , Pl#Segment#Split() 58 | \ , 'scrollpercent' 59 | \ ), 60 | \ 61 | \ Pl#Theme#Buffer('lustyexplorer' 62 | \ , ['static_str.name', 'LustyExplorer'] 63 | \ , ['static_str.buffer', 'Buffer list'] 64 | \ , Pl#Segment#Truncate() 65 | \ , Pl#Segment#Split() 66 | \ ), 67 | \ 68 | \ Pl#Theme#Buffer('ft_man' 69 | \ , ['static_str.name', 'Man page'] 70 | \ , 'filename' 71 | \ , Pl#Segment#Truncate() 72 | \ , Pl#Segment#Split() 73 | \ , 'scrollpercent' 74 | \ ), 75 | \ 76 | \ Pl#Theme#Buffer('minibufexplorer' 77 | \ , ['static_str.name', 'MiniBufExplorer'] 78 | \ , Pl#Segment#Truncate() 79 | \ , Pl#Segment#Split() 80 | \ ), 81 | \ 82 | \ Pl#Theme#Buffer('ft_qf' 83 | \ , ['static_str.name', 'Quickfix'] 84 | \ , Pl#Segment#Truncate() 85 | \ , Pl#Segment#Split() 86 | \ ), 87 | \ 88 | \ Pl#Theme#Buffer('tagbar' 89 | \ , ['static_str.name', 'Tagbar'] 90 | \ , ['static_str.buffer', 'Tree'] 91 | \ , Pl#Segment#Truncate() 92 | \ , Pl#Segment#Split() 93 | \ ), 94 | \ 95 | \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"') 96 | \ , 'ctrlp:prev' 97 | \ , 'ctrlp:item' 98 | \ , 'ctrlp:next' 99 | \ , 'ctrlp:marked' 100 | \ , Pl#Segment#Truncate() 101 | \ , Pl#Segment#Split() 102 | \ , 'ctrlp:focus' 103 | \ , 'ctrlp:byfname' 104 | \ , 'pwd' 105 | \ ), 106 | \ 107 | \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"') 108 | \ , 'ctrlp:count' 109 | \ , Pl#Segment#Truncate() 110 | \ , Pl#Segment#Split() 111 | \ , 'pwd' 112 | \ ), 113 | \ 114 | \ Pl#Theme#Buffer('nerdtree' 115 | \ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}'] 116 | \ , Pl#Segment#Truncate() 117 | \ , Pl#Segment#Split() 118 | \ ) 119 | \ ) 120 | -------------------------------------------------------------------------------- /doc/Powerline.txt: -------------------------------------------------------------------------------- 1 | *Powerline.txt* For Vim version 7.3. Last change: 2011 Nov 23 2 | 3 | ______ 4 | _________ \ /__ 5 | \_____ \______ _ _____________ / /'__' ___ ____ 6 | | ___/ _ \ \/ \/ / __ \_ ___\ / | |/ \_/ __ \ 7 | | | | (_) \ _ / ___/| | / /__| | | \ ___/ 8 | '___' \____/ \/ \/ \___ |__' /___ /'__'__| /\___ \ 9 | \/ / / \/ \/ 10 | | / 11 | |/ 12 | ' 13 | 14 | ============================================================================== 15 | CONTENTS *Powerline-contents* 16 | 17 | 1. Introduction ....................... |Powerline-introduction| 18 | 2. Usage .............................. |Powerline-usage| 19 | 3. Requirements ....................... |Powerline-requirements| 20 | 3.1 Recommended settings ........... |Powerline-recommended-settings| 21 | 4. Configuration ...................... |Powerline-configuration| 22 | 4.1 Powerline_cache_file ........... |Powerline_cache_file| 23 | 4.1.1 Clearing the cache ....... |:PowerlineClearCache| 24 | 4.1.2 Powerline_cache_dir ...... |Powerline_cache_dir| 25 | 4.2 Powerline_cache_enabled ........ |Powerline_cache_enabled| 26 | 4.3 Powerline_symbols .............. |Powerline_symbols| 27 | 4.3.1 Compatible symbols ....... |Powerline-symbols-compatible| 28 | 4.3.2 Fancy symbols ............ |Powerline-symbols-fancy| 29 | 4.3.3 Overriding symbols ....... |Powerline_symbols_override| 30 | 4.3.4 Overriding dividers ...... |Powerline_dividers_override| 31 | 4.4 Powerline_theme ................ |Powerline_theme| 32 | 4.5 Powerline_colorscheme .......... |Powerline_colorscheme| 33 | 4.6 Powerline_stl_path_style ....... |Powerline_stl_path_style| 34 | 5. Fonts .............................. |Powerline-fonts| 35 | 6. Customization ...................... |Powerline-customization| 36 | 6.1 Basic customization ............ |Powerline-basic-customization| 37 | 6.2 Advanced customization ......... |Powerline-advanced-customization| 38 | 6.2.1 Colorschemes ............. |Powerline-cust-colorschemes| 39 | 6.2.2 Functions ................ |Powerline-cust-functions| 40 | 6.2.3 Segments ................. |Powerline-cust-segments| 41 | 6.2.4 Themes ................... |Powerline-cust-themes| 42 | 7. License ............................ |Powerline-license| 43 | 8. Known issues ....................... |Powerline-known-issues| 44 | 9. Contributing ....................... |Powerline-contributing| 45 | 46 | ============================================================================== 47 | 1. Introduction *Powerline* *Powerline-introduction* 48 | 49 | Powerline is a utility plugin which allows you to create better-looking, more 50 | functional Vim statuslines. 51 | 52 | ============================================================================== 53 | 2. Usage *Powerline-usage* 54 | 55 | Powerline is automatically enabled when it's installed, either by unzipping 56 | the provided archive or by adding it as a Pathogen/Vundle bundle. 57 | 58 | Powerline replaces the standard Vim 'statusline' with a custom statusline made 59 | up of Powerline segments. 60 | 61 | Powerline ignores any 'statusline' customizations you have defined in your 62 | |vimrc|. If you remove Powerline, your 'statusline' customizations are 63 | restored. 64 | 65 | ============================================================================== 66 | 3. Requirements *Powerline-requirements* 67 | 68 | Powerline has been developed and tested in Vim 7.3, but it should run without 69 | any problems in Vim 7.2. The default configuration requires a Unix-like system 70 | to work properly. 71 | 72 | The plugin only works with Vim running in an 88/256-color terminal or Gvim. 73 | 74 | Vi-compatible mode must be disabled. 75 | 76 | ------------------------------------------------------------------------------ 77 | 3.1 Recommended settings *Powerline-recommended-settings* 78 | 79 | The following configuration options should be set in your |vimrc|: > 80 | 81 | set nocompatible " Disable vi-compatibility 82 | set laststatus=2 " Always show the statusline 83 | set encoding=utf-8 " Necessary to show Unicode glyphs 84 | 85 | Note: If you're using an 88/256-color terminal but still don't see the colored 86 | statusline, you may have to set the following option as well: > 87 | 88 | set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors 89 | 90 | ============================================================================== 91 | 4. Configuration *Powerline-configuration* 92 | 93 | Powerline will work fine without any user configuration, but default behavior 94 | can be overridden by setting configuration variables globally in your |vimrc| 95 | file. 96 | 97 | ------------------------------------------------------------------------------ 98 | 4.1 Powerline_cache_file *Powerline_cache_file* 99 | 100 | By default Powerline caches all the statuslines and colors in a cache file in 101 | the plugin's directory (or the Vim directory, depending on the installation 102 | method used). 103 | 104 | It's recommended that you enable the cache, as this dramatically improves Vim 105 | startup time after the cache file has been generated (the plugin usually loads 106 | within ~100ms without the cache and ~1ms with the cache). 107 | 108 | Note: The default cache filename includes the current theme, colorscheme and 109 | symbol settings in order to tie the cache file to your current configuration, 110 | so the cache file will be regenerated when you change any settings. This may 111 | leave several old cache files in your Vim folder, and these may safely be 112 | deleted. 113 | 114 | Defaults: "|Powerline_cache_dir|/Powerline___.cache" 115 | 116 | ------------------------------------------------------------------------------ 117 | 4.1.1 Powerline_cache_dir *Powerline_cache_dir* 118 | 119 | This is the directory used for |Powerline_cache_file|. 120 | 121 | Default: Plugin directory: > 122 | 123 | let g:Powerline_cache_dir = simplify(expand(':p:h') .'/..') 124 | < 125 | ------------------------------------------------------------------------------ 126 | 4.1.2 Clearing the cache *:PowerlineClearCache* 127 | 128 | Powerline provides a command to easily clear the cache after changing your 129 | settings or updating your theme. Simply run the following command to clear 130 | your cache, and restart Vim afterwards: > 131 | 132 | :PowerlineClearCache 133 | < 134 | ------------------------------------------------------------------------------ 135 | 4.2 Powerline_cache_enabled *Powerline_cache_enabled* 136 | 137 | It's possible to disable statusline caching by setting this option to 0. This 138 | is mostly useful when developing statuslines. 139 | 140 | Example: > 141 | 142 | let g:Powerline_cache_enabled = 0 143 | < 144 | 145 | Default: 1 146 | 147 | ------------------------------------------------------------------------------ 148 | 4.3 Powerline_symbols *Powerline_symbols* 149 | 150 | This option defines which set of symbols and dividers you want to use. There 151 | are currently three available options: "compatible", "unicode" and "fancy". 152 | 153 | TYPE DESCRIPTION ~ 154 | compatible Doesn't use any special characters. 155 | unicode Simulates icons and arrows using similar Unicode glyphs. 156 | fancy Custom icons and arrows. Requires a patched font. 157 | 158 | Example: > 159 | 160 | let g:Powerline_symbols = 'fancy' 161 | < 162 | 163 | Default: "compatible" 164 | 165 | Symbols can be inserted into statuslines by using the following variables 166 | (just insert the variables as text in your segments): 167 | 168 | VARIABLE DESCRIPTION ~ 169 | $BRANCH Inserts a branch symbol 170 | $RO Inserts a read-only symbol 171 | $FT Inserts a filetype symbol 172 | $LINE Inserts a line number symbol 173 | 174 | ------------------------------------------------------------------------------ 175 | 4.3.1 Compatible symbols *Powerline-symbols-compatible* 176 | 177 | These symbols will work in any configuration, and do not require a special 178 | font to work. This option will replace the fancy icons with plain text, and 179 | the pointy dividers with straight lines. 180 | 181 | ------------------------------------------------------------------------------ 182 | 4.3.2 Fancy symbols *Powerline-symbols-fancy* 183 | 184 | These symbols require a custom font to work. A font patcher is provided for 185 | adding the required symbols to any outline font and some bitmap fonts, see 186 | |Powerline-fonts| and the provided README file for usage details. 187 | 188 | ------------------------------------------------------------------------------ 189 | 4.3.3 Overriding symbols *Powerline_symbols_override* 190 | 191 | You can override symbols by adding your symbols to the 192 | g:Powerline_symbols_override dictionary. Example: If you want the branch 193 | symbol to be "∓" (hex code 0x2213) and the line symbol to be "L" you can add 194 | the following to your |vimrc|: > 195 | 196 | let g:Powerline_symbols_override = { 197 | \ 'BRANCH': [0x2213], 198 | \ 'LINE': 'L', 199 | \ } 200 | < 201 | ------------------------------------------------------------------------------ 202 | 4.3.4 Overriding dividers *Powerline_dividers_override* 203 | 204 | If you for some reason want to override the dividers then you can set 205 | g:Powerline_dividers_override to a list with exactly four elements: 206 | 207 | 1: Hard right-pointing arrow 208 | 2: Soft right-pointing arrow 209 | 3: Hard left-pointing arrow 210 | 4: Soft left-pointing arrow 211 | 212 | Example: > 213 | 214 | let g:Powerline_dividers_override = ['>>', '>', '<<', '<'] 215 | < 216 | 217 | ------------------------------------------------------------------------------ 218 | 4.3.5 Overriding mode names *Powerline_mode* 219 | 220 | You can change the names used for modes at the far left by setting some 221 | variables in your |vimrc|. For example you can change "N" to "NORMAL" with: > 222 | 223 | let g:Powerline_mode_n = 'NORMAL' 224 | < 225 | The variables are all named beginning with 'g:Powerline_mode_', as follows: 226 | 227 | mode name default note ~ 228 | Normal n ' N ' (surrounded by spaces) 229 | Insert i INSERT 230 | Replace R REPLACE |Replace-mode| 231 | Visual v VISUAL |Visual-mode| 232 | Visual linewise V V⋅LINE 233 | Visual blockwise cv V⋅BLOCK 234 | Select s SELECT |Select-mode| 235 | Select linewise S S⋅LINE 236 | Select blockwise cs S⋅BLOCK 237 | 238 | ----------------------------------------------------------------------------- 239 | 4.4 Powerline_theme *Powerline_theme* 240 | 241 | This option defines the theme Powerline uses. The available themes are located 242 | in autoload/Powerline/Themes/. A theme is a pre-defined set of Powerline 243 | segments which make up the statusline. 244 | 245 | Example: > 246 | 247 | let g:Powerline_theme = 'solarized256' 248 | < 249 | 250 | Default: "default" 251 | 252 | ------------------------------------------------------------------------------ 253 | 4.5 Powerline_colorscheme *Powerline_colorscheme* 254 | 255 | This option defines the colorscheme Powerline uses. The available colorschemes 256 | are located in autoload/Powerline/Colorschemes/. 257 | 258 | Example: > 259 | 260 | let g:Powerline_colorscheme = 'solarized256' 261 | < 262 | 263 | Default: "default" 264 | 265 | ------------------------------------------------------------------------------ 266 | 4.6 Powerline_stl_path_style *Powerline_stl_path_style* 267 | 268 | There are currently four ways to display the current path and file name. The 269 | default is to only display the file name like the %t statusline item. By 270 | setting this configuration value you can choose from the following ways 271 | display the current path and file name: 272 | 273 | VALUE DESCRIPTION ~ 274 | filename Display only the file name using the %t statusline item. 275 | short Display a short path. The home directory is substituted with 276 | "~", the first directory is displayed with its full name, and 277 | subsequent directories are shortened to their first letter. 278 | I.e. "/home/user/foo/bar/baz.vim" becomes "~/f/b/baz.vim" and 279 | "long/relative/path/foo/bar/baz.vim becomes 280 | "long/r/p/f/b/baz.vim". 281 | relative Display a relative path, similar to the %f statusline item. 282 | full Display the full path, similar to the %F statusline item. 283 | 284 | Example: > 285 | 286 | let g:Powerline_stl_path_style = 'full' 287 | < 288 | 289 | Default: "relative" 290 | 291 | ============================================================================== 292 | 5. Fonts *Powerline-fonts* 293 | 294 | TODO 295 | 296 | ============================================================================== 297 | 6. Customization *Powerline-customization* 298 | 299 | There are currently two ways of customizing Powerline: Basic customization 300 | using a couple of functions to insert and remove existing segments from the 301 | statusline, and advanced customization using your own autoload files. The 302 | customization features of Powerline allow you to create your own statuslines 303 | without ever touching the original source code. 304 | 305 | ------------------------------------------------------------------------------ 306 | 6.1 Basic customization *Powerline-basic-customization* 307 | 308 | Powerline provides the following functions to alter the default statusline 309 | look. These functions should be called from your |vimrc| file or another file 310 | which is sourced at Vim startup. 311 | 312 | Note: These functions are currently applied to all statuslines, so if you 313 | insert a segment after a segment which is present in many statuslines (e.g. 314 | the "filename" segment), all the statuslines will have the inserted segment. 315 | This behavior may be changed in a future version of Powerline. 316 | 317 | Note: Remember to clear your cache with |:PowerlineClearCache| after changing 318 | your statusline! 319 | 320 | Example: > 321 | 322 | " Insert the charcode segment after the filetype segment 323 | call Pl#Theme#InsertSegment('charcode', 'after', 'filetype') 324 | 325 | " Replace the scrollpercent segment with the charcode segment 326 | call Pl#Theme#ReplaceSegment('scrollpercent', 'fileinfo') 327 | < 328 | *Pl#Theme#InsertSegment* 329 | Pl#Theme#InsertSegment({newsegment}, {location}, {targetsegment}) 330 | 331 | This function inserts {newsegment} before or after {targetsegment}. The 332 | {location} parameter specifies the location of the new segment, valid values 333 | are "before" and "after". You can see all the available segments in 334 | autoload/Powerline/Segments.vim and the files specified in 335 | |Powerline-cust-segments|. 336 | 337 | Pl#Theme#RemoveSegment({targetsegment}) *Pl#Theme#RemoveSegment* 338 | 339 | This function removes the {targetsegment} segment entirely. 340 | 341 | Pl#Theme#ReplaceSegment({oldsegment}, {newsegment}) *Pl#Theme#ReplaceSegment* 342 | 343 | This function replaces {oldsegment} with {newsegment}. 344 | 345 | ------------------------------------------------------------------------------ 346 | 6.2 Advanced customization *Powerline-advanced-customization* 347 | 348 | Because Powerline utilizes Vim's autoload functionality, you can easily create 349 | your own segments, themes, functions and colorschemes without touching the 350 | original source code. This is a bit more complex than using the utility 351 | functions, but it allows you to do a lot more with your statusline. 352 | 353 | Your custom autoload files should be stored in your |runtimepath| (usually in 354 | "~/.vim/autoload/Powerline/*"). 355 | 356 | Note: Remember to clear your cache with |:PowerlineClearCache| after changing 357 | your statusline! 358 | 359 | 6.2.1 Colorschemes *Powerline-cust-colorschemes* 360 | ------------------------------------------------------------------------------ 361 | 362 | Colorschemes should be stored as separate files in 363 | {runtimepath}/autoload/Powerline/Colorschemes/. 364 | 365 | SYNTAX ~ 366 | 367 | TODO 368 | 369 | EXAMPLE ~ 370 | 371 | TODO 372 | 373 | 6.2.2 Functions *Powerline-cust-functions* 374 | ------------------------------------------------------------------------------ 375 | 376 | Functions should be stored as separate files in 377 | {runtimepath}/autoload/Powerline/Functions/. 378 | 379 | SYNTAX ~ 380 | 381 | TODO 382 | 383 | EXAMPLE ~ 384 | 385 | TODO 386 | 387 | 6.2.3 Segments *Powerline-cust-segments* 388 | ------------------------------------------------------------------------------ 389 | 390 | Segments should be stored as separate files in 391 | {runtimepath}/autoload/Powerline/Segments/. 392 | 393 | SYNTAX ~ 394 | 395 | TODO 396 | 397 | EXAMPLE ~ 398 | 399 | TODO 400 | 401 | 6.2.4 Themes *Powerline-cust-themes* 402 | ------------------------------------------------------------------------------ 403 | 404 | Themes should be stored as separate files in 405 | {runtimepath}/autoload/Powerline/Themes/. 406 | 407 | SYNTAX ~ 408 | 409 | TODO 410 | 411 | EXAMPLE ~ 412 | 413 | TODO 414 | 415 | ============================================================================== 416 | 7. License *Powerline-license* 417 | 418 | Creative Commons Attribution-ShareAlike 3.0 Unported 419 | 420 | http://creativecommons.org/licenses/by-sa/3.0/ 421 | 422 | ============================================================================== 423 | 8. Known issues *Powerline-known-issues* 424 | 425 | See the issue tracker at 426 | https://github.com/Lokaltog/vim-powerline/issues 427 | 428 | ============================================================================== 429 | 9. Contributing *Powerline-contributing* 430 | 431 | If you experience any bugs or have feature requests, please open an issue on 432 | GitHub. Fork the source repository on GitHub and send a pull request if you 433 | have any code improvements. 434 | 435 | Author: Kim Silkebækken 436 | Source repository: https://github.com/Lokaltog/vim-powerline 437 | 438 | ============================================================================== 439 | vim:tw=78:sw=4:ts=8:ft=help:norl: 440 | -------------------------------------------------------------------------------- /fontpatcher/PowerlineSymbols.sfd: -------------------------------------------------------------------------------- 1 | SplineFontDB: 3.0 2 | FontName: PowerlineSymbols 3 | FullName: PowerlineSymbols 4 | FamilyName: PowerlineSymbols 5 | Weight: Medium 6 | Copyright: 7 | UComments: "2011-11-21: Created." 8 | Version: 001.000 9 | ItalicAngle: 0 10 | UnderlinePosition: -98.6328 11 | UnderlineWidth: 48.8281 12 | Ascent: 800 13 | Descent: 200 14 | LayerCount: 2 15 | Layer: 0 0 "Back" 1 16 | Layer: 1 0 "Fore" 0 17 | XUID: [1021 211 26716215 11021609] 18 | FSType: 0 19 | OS2Version: 0 20 | OS2_WeightWidthSlopeOnly: 0 21 | OS2_UseTypoMetrics: 1 22 | CreationTime: 1321867751 23 | ModificationTime: 1326665029 24 | OS2TypoAscent: 0 25 | OS2TypoAOffset: 1 26 | OS2TypoDescent: 0 27 | OS2TypoDOffset: 1 28 | OS2TypoLinegap: 90 29 | OS2WinAscent: 0 30 | OS2WinAOffset: 1 31 | OS2WinDescent: 0 32 | OS2WinDOffset: 1 33 | HheadAscent: 0 34 | HheadAOffset: 1 35 | HheadDescent: 0 36 | HheadDOffset: 1 37 | OS2Vendor: 'PfEd' 38 | MarkAttachClasses: 1 39 | DEI: 91125 40 | Encoding: UnicodeFull 41 | Compacted: 1 42 | UnicodeInterp: none 43 | NameList: Adobe Glyph List 44 | DisplaySize: -24 45 | AntiAlias: 1 46 | FitToEm: 1 47 | WinInfo: 0 31 18 48 | BeginPrivate: 0 49 | EndPrivate 50 | BeginChars: 1114112 9 51 | 52 | StartChar: uni2B80 53 | Encoding: 11136 11136 0 54 | Width: 621 55 | Flags: HMW 56 | LayerCount: 2 57 | Fore 58 | SplineSet 59 | 0 1000 m 1 60 | 621 379 l 1 61 | 0 -243 l 1 62 | 0 1000 l 1 63 | EndSplineSet 64 | EndChar 65 | 66 | StartChar: uni2B81 67 | Encoding: 11137 11137 1 68 | Width: 621 69 | Flags: HMW 70 | LayerCount: 2 71 | Fore 72 | SplineSet 73 | 10 991 m 0 74 | 16 997 23 1000 32 1000 c 0 75 | 41 1000 48 996 54 990 c 2 76 | 613 400 l 2 77 | 619 394 621 386 621 378 c 0 78 | 621 370 618 362 613 357 c 2 79 | 54 -233 l 2 80 | 48 -239 41 -242 32 -242 c 0 81 | 23 -242 16 -240 10 -234 c 0 82 | 4 -228 0 -221 0 -212 c 0 83 | 0 -203 3 -196 8 -190 c 2 84 | 547 379 l 1 85 | 8 948 l 2 86 | 3 954 0 961 0 970 c 0 87 | 0 979 4 985 10 991 c 0 88 | EndSplineSet 89 | EndChar 90 | 91 | StartChar: uni2B82 92 | Encoding: 11138 11138 2 93 | Width: 621 94 | Flags: HMW 95 | LayerCount: 2 96 | Fore 97 | SplineSet 98 | 621 1000 m 5 99 | 621 -243 l 5 100 | 0 379 l 5 101 | 621 1000 l 5 102 | EndSplineSet 103 | EndChar 104 | 105 | StartChar: uni2B83 106 | Encoding: 11139 11139 3 107 | Width: 621 108 | Flags: HMW 109 | LayerCount: 2 110 | Fore 111 | SplineSet 112 | 612 991 m 0 113 | 618 985 621 979 621 970 c 0 114 | 621 961 619 954 613 948 c 2 115 | 74 379 l 1 116 | 613 -190 l 2 117 | 619 -196 621 -203 621 -212 c 0 118 | 621 -221 618 -228 612 -234 c 0 119 | 606 -240 598 -242 589 -242 c 0 120 | 580 -242 574 -239 568 -233 c 2 121 | 8 357 l 2 122 | 3 362 0 370 0 378 c 0 123 | 0 386 3 394 8 400 c 2 124 | 568 990 l 2 125 | 574 996 580 1000 589 1000 c 0 126 | 598 1000 606 997 612 991 c 0 127 | EndSplineSet 128 | EndChar 129 | 130 | StartChar: uni2B61 131 | Encoding: 11105 11105 4 132 | Width: 555 133 | VWidth: 0 134 | Flags: HMW 135 | LayerCount: 2 136 | Fore 137 | SplineSet 138 | 0 800 m 5 139 | 92 800 l 5 140 | 92 513 l 5 141 | 253 513 l 5 142 | 253 444 l 5 143 | 0 444 l 5 144 | 0 800 l 5 145 | 236 312 m 5 146 | 339 312 l 5 147 | 468 67 l 5 148 | 468 312 l 5 149 | 555 312 l 5 150 | 555 -44 l 5 151 | 453 -44 l 5 152 | 323 200 l 5 153 | 323 -44 l 5 154 | 236 -44 l 5 155 | 236 312 l 5 156 | EndSplineSet 157 | EndChar 158 | 159 | StartChar: uni2B60 160 | Encoding: 11104 11104 5 161 | Width: 676 162 | Flags: HMW 163 | LayerCount: 2 164 | Fore 165 | SplineSet 166 | 0 197 m 1 167 | 94 207 419 279 419 384 c 2 168 | 419 537 l 1 169 | 278 501 l 1 170 | 478 794 l 1 171 | 677 501 l 1 172 | 536 537 l 1 173 | 536 384 l 2 174 | 536 196 208 126 208 21 c 2 175 | 208 -244 l 1 176 | 0 -244 l 1 177 | 0 197 l 1 178 | 0 288 m 1 179 | 0 405 0 944 0 944 c 1 180 | 208 944 l 1 181 | 208 944 208 451 208 334 c 1 182 | 185 311 12 288 0 288 c 1 183 | EndSplineSet 184 | EndChar 185 | 186 | StartChar: uni2B62 187 | Encoding: 11106 11106 6 188 | Width: 428 189 | VWidth: 0 190 | Flags: HMW 191 | LayerCount: 2 192 | Fore 193 | SplineSet 194 | 88 677 m 2 195 | 429 677 l 1 196 | 429 589 l 1 197 | 88 589 l 1 198 | 88 162 l 1 199 | 198 162 l 1 200 | 198 343 l 1 201 | 374 343 l 1 202 | 374 427 l 1 203 | 198 427 l 1 204 | 198 506 l 1 205 | 429 506 l 1 206 | 429 274 l 1 207 | 416 263 391 255 374 255 c 2 208 | 286 255 l 1 209 | 286 162 l 2 210 | 286 114 246 74 198 74 c 2 211 | 88 74 l 2 212 | 40 74 0 114 0 162 c 2 213 | 0 589 l 2 214 | 0 637 40 677 88 677 c 2 215 | EndSplineSet 216 | EndChar 217 | 218 | StartChar: uni2B63 219 | Encoding: 11107 11107 7 220 | Width: 428 221 | VWidth: 0 222 | Flags: HMW 223 | LayerCount: 2 224 | Fore 225 | SplineSet 226 | 0 677 m 5 227 | 341 677 l 6 228 | 389 677 429 637 429 589 c 6 229 | 429 506 l 6 230 | 429 458 389 418 341 418 c 6 231 | 287 418 l 5 232 | 287 162 l 6 233 | 287 114 247 74 199 74 c 6 234 | 89 74 l 6 235 | 41 74 1 114 1 162 c 6 236 | 1 274 l 6 237 | 0 274 l 6 238 | 0 506 l 5 239 | 89 506 l 5 240 | 89 162 l 5 241 | 199 162 l 5 242 | 199 506 l 5 243 | 341 506 l 5 244 | 341 589 l 5 245 | 0 589 l 5 246 | 0 677 l 5 247 | EndSplineSet 248 | EndChar 249 | 250 | StartChar: uni2B64 251 | Encoding: 11108 11108 8 252 | Width: 546 253 | VWidth: 0 254 | Flags: HMW 255 | LayerCount: 2 256 | Fore 257 | SplineSet 258 | 273 733 m 4 259 | 429 733 430 538 430 538 c 5 260 | 430 420 l 5 261 | 547 420 l 5 262 | 547 303 l 5 263 | 547 303 546 -9 273 -9 c 4 264 | 0 -9 0 303 0 303 c 5 265 | 0 420 l 5 266 | 117 420 l 5 267 | 117 538 l 5 268 | 117 538 117 733 273 733 c 4 269 | 273 655 m 4 270 | 195 655 195 576 195 420 c 5 271 | 352 420 l 5 272 | 352 576 351 655 273 655 c 4 273 | 273 342 m 4 274 | 195 342 195 147 273 147 c 4 275 | 351 147 351 342 273 342 c 4 276 | EndSplineSet 277 | EndChar 278 | EndChars 279 | BitmapFont: 10 10 8 2 1 280 | BDFChar: 0 11136 6 0 4 -2 7 281 | JAC+4q"X@:^jlCb 282 | BDFChar: 1 11137 6 0 4 -2 7 283 | J3Y4g#RCta5_&h7 284 | BDFChar: 2 11138 6 1 5 -2 7 285 | #T,OGq"T(n(^L*A 286 | BDFChar: 3 11139 6 1 5 -2 7 287 | #S8+DJ:Km-&-r79 288 | BDFChar: 4 11105 6 1 4 -1 7 289 | J:N1>!0GR3O8o7\ 290 | BDFChar: 5 11104 7 0 5 -2 7 291 | ^rYQ3 296 | BDFChar: 8 11108 5 0 5 0 6 297 | 0M"b4bku\c 298 | EndBitmapFont 299 | BitmapFont: 12 10 10 2 1 300 | BDFChar: 0 11136 7 0 6 -2 11 301 | !!%Pbi:-O>r:od>^jlCb 302 | BDFChar: 1 11137 7 0 6 -3 11 303 | !!%O7+:ne]":,P]5_&h7 304 | BDFChar: 2 11138 7 0 6 -2 11 305 | !!!-1*'AWHr-UUH$j6P1 306 | BDFChar: 3 11139 7 0 6 -2 11 307 | !!!--&0O5gJ3Y4g#Qt,- 308 | BDFChar: 4 11105 7 0 5 0 8 309 | J:N1>!$jBP,QIfE 310 | BDFChar: 5 11104 8 0 8 -3 11 311 | z^];.Ma8juqa8j9]a8jQehuLOm^];.Mz 312 | BDFChar: 6 11106 5 1 6 0 8 313 | !-j$]R"1Qc?iU0, 314 | BDFChar: 7 11107 5 0 5 0 7 315 | p]QtGOH>Q3 316 | BDFChar: 8 11108 7 0 5 0 8 317 | 0M"`*r63C_GQ7^D 318 | EndBitmapFont 319 | EndSplineFont 320 | -------------------------------------------------------------------------------- /fontpatcher/README.rst: -------------------------------------------------------------------------------- 1 | ====================== 2 | Powerline font patcher 3 | ====================== 4 | 5 | :Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com) 6 | 7 | Description 8 | ----------- 9 | 10 | This font patcher creates dividers and symbols for use with Powerline. The 11 | script requires Python 2 and FontForge compiled with Python bindings. 12 | 13 | Patched fonts are renamed by default (" for Powerline" is added to the font 14 | name) so they don't conflict with existing fonts. Use the ``--no-rename`` 15 | option to disable font renaming. 16 | 17 | Glyph table 18 | ----------- 19 | 20 | All the glyphs are stored in the ``U+2B60``-``U+2BFF`` range ("Misc symbols 21 | and arrows"). 22 | 23 | +------------+-------------------+ 24 | | Code point | Description | 25 | +============+===================+ 26 | | ``U+2B60`` | Branch symbol | 27 | +------------+-------------------+ 28 | | ``U+2B61`` | LN (line) symbol | 29 | +------------+-------------------+ 30 | | ``U+2B62`` | FT symbol, part 1 | 31 | +------------+-------------------+ 32 | | ``U+2B63`` | FT symbol, part 2 | 33 | +------------+-------------------+ 34 | | ``U+2B64`` | Padlock (closed) | 35 | +------------+-------------------+ 36 | | ``U+2B80`` | Hard right arrow | 37 | +------------+-------------------+ 38 | | ``U+2B81`` | Soft right arrow | 39 | +------------+-------------------+ 40 | | ``U+2B82`` | Hard left arrow | 41 | +------------+-------------------+ 42 | | ``U+2B83`` | Soft left arrow | 43 | +------------+-------------------+ 44 | 45 | =================== 46 | Font patching guide 47 | =================== 48 | 49 | There's a `GitHub wiki page`_ dedicated to community-contributed patched 50 | fonts. You may download one of the fonts on that page if you don't want to 51 | patch the fonts yourself. 52 | 53 | If you do patch a font that's not included in the wiki (and you have 54 | permission to distribute it), please include it on the wiki page. 55 | 56 | **Note:** The fonts in the wiki may be outdated, and may have different 57 | glyphs than the ones provided in the latest version of Powerline. It's 58 | recommended that you always patch your fonts yourself if you have the 59 | required software. 60 | 61 | .. _`GitHub wiki page`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts 62 | 63 | Linux 64 | ----- 65 | 66 | 1. Install fontforge with Python bindings. For Ubuntu users the required 67 | package is ``python-fontforge``, for Arch Linux users the required 68 | package is ``fontforge``. It should be something similar for other 69 | distros. 70 | 71 | 2. Run the font patcher:: 72 | 73 | $ /path/to/fontpatcher MyFontFile.ttf 74 | 75 | 3. Copy the font file into ``~/.fonts`` (or another X font directory):: 76 | 77 | $ cp MyFontFile-Powerline.otf ~/.fonts 78 | 79 | **Note:** If the font is a pure bitmap font (e.g. a PCF font) it will be 80 | stored in the BDF format. This is usually not a problem, and you may 81 | convert the font back to the PCF format using ``bdftopcf`` if you want 82 | to. All other fonts will be stored in the OTF format regardless of the 83 | original format. 84 | 85 | 4. Update your font cache:: 86 | 87 | $ sudo fc-cache -vf 88 | 89 | **Note:** If you use vim in rxvt-unicode in the client/daemon mode, you 90 | may need to close all running terminals as well for the font to be 91 | updated. 92 | 93 | 5. **For gvim users:** Update the GUI font in your ``vimrc`` file:: 94 | 95 | set guifont=MyFont\ for\ Powerline 96 | 97 | **For terminal users:** Update your terminal configuration to use the 98 | patched font. 99 | 100 | 6. Update your ``vimrc`` configuration to use the new symbols:: 101 | 102 | let g:Powerline_symbols = 'fancy' 103 | 104 | 7. Make sure that the cache file is deleted:: 105 | 106 | $ rm /tmp/Powerline.cache 107 | 108 | 8. Start vim and enjoy your new statusline! 109 | 110 | OS X 111 | ---- 112 | 113 | 1. Check if you have a FontForge version with Python support by running 114 | ``fontforge -version``. You should see something like this:: 115 | 116 | $ fontforge -version 117 | Copyright (c) 2000-2011 by George Williams. 118 | Executable based on sources from 13:48 GMT 22-Feb-2011-D. 119 | Library based on sources from 13:48 GMT 22-Feb-2011. 120 | fontforge 20110222 121 | libfontforge 20110222 122 | 123 | Make sure that the executable version number doesn't have ``NoPython`` in 124 | it. If everything looks OK, skip ahead to step 4. 125 | 126 | 2. If you have FontForge but with ``NoPython`` in the version number, please 127 | try to update to a later version:: 128 | 129 | $ brew uninstall fontforge 130 | $ brew update 131 | $ brew install --use-gcc fontforge 132 | 133 | **Note:** You may have to use ``--use-clang`` instead of ``--use-gcc`` 134 | when compiling FontForge. 135 | 136 | 3. If you don't have FontForge, install it with Homebrew:: 137 | 138 | $ brew update 139 | $ brew install --use-gcc fontforge 140 | 141 | 4. Patch your fonts by passing the ``fontpatcher`` script as a parameter to 142 | FontForge:: 143 | 144 | $ fontforge -script /path/to/fontpatcher MyFontFile.ttf 145 | 146 | 5. Install the font by double-clicking the font file in Finder and click 147 | "Install this font" from the preview window. 148 | 149 | 6. **For gvim users:** Update the GUI font in your ``vimrc`` file:: 150 | 151 | set guifont=MyFont\ for\ Powerline 152 | 153 | **For terminal users:** Update your terminal configuration to use the 154 | patched font. 155 | 156 | 7. Update your ``vimrc`` configuration to use the new symbols:: 157 | 158 | let g:Powerline_symbols = 'fancy' 159 | 160 | 8. Make sure that the cache file is deleted:: 161 | 162 | $ rm /tmp/Powerline.cache 163 | 164 | 9. Start vim and enjoy your new statusline! 165 | -------------------------------------------------------------------------------- /fontpatcher/fontpatcher: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """Font patcher for Powerline. 4 | 5 | Creates dividers and symbols for use with Powerline. Requires FontForge with Python bindings. 6 | 7 | Stores glyphs in the 2b60-2bff Unicode range ("Misc symbols and arrows"). 8 | 9 | [2b60] Branch symbol 10 | [2b61] LN (line) symbol 11 | [2b62] FT symbol 1 12 | [2b63] FT symbol 2 13 | [2b64] Padlock (closed) symbol 14 | [2b80] Hard right arrow 15 | [2b81] Soft right arrow 16 | [2b82] Hard left arrow 17 | [2b83] Soft left arrow 18 | """ 19 | 20 | from __future__ import division 21 | 22 | import argparse 23 | import os 24 | import sys 25 | import re 26 | 27 | try: 28 | import fontforge 29 | import psMat 30 | except ImportError: 31 | sys.stderr.write('The required FontForge modules could not be loaded.\n\n') 32 | 33 | if sys.version_info.major > 2: 34 | sys.stderr.write('FontForge only supports Python 2. Please run this script with the Python 2 executable - e.g. "python2 {0}"\n'.format(sys.argv[0])) 35 | else: 36 | sys.stderr.write('You need FontForge with Python bindings for this script to work.\n') 37 | 38 | sys.exit(1) 39 | 40 | # Handle command-line arguments 41 | parser = argparse.ArgumentParser(description='Font patcher for Powerline. Creates dividers and symbols in FontForge-compatible font files. Requires FontForge with Python bindings. Stores glyphs in the U+2B80-U+2BFF range ("Miscellaneous symbols and arrows"). Stores the patched font as a new, renamed font file by default.') 42 | 43 | parser.add_argument('fonts', help='font file to patch', metavar='font', nargs='+') 44 | parser.add_argument('--no-rename', help='don\'t add " for Powerline" to the font name', default=True, action='store_false', dest='rename') 45 | parser.add_argument('--symbol-font', help='font file with symbols', metavar='font', dest='symbol_font', default='{0}/PowerlineSymbols.sfd'.format(sys.path[0])) 46 | parser.add_argument('--fix-mono', help='fixes some mono-fonts which have glyphs of 0 widths', default=False, action='store_true', dest='fixmono') 47 | parser.add_argument('--fix-win', help='modifies font names such that Windows correctly recognizes font families', default=False, action='store_true', dest='fixwin') 48 | 49 | args = parser.parse_args() 50 | 51 | SYM_ATTR = { 52 | # Right/left-aligned glyphs will have their advance width reduced in order to overlap the next glyph slightly 53 | 0x2b60: { 'align': 'c', 'stretch': 'y' , 'overlap': False }, 54 | 0x2b61: { 'align': 'c', 'stretch': '' , 'overlap': False }, 55 | 0x2b62: { 'align': 'r', 'stretch': '' , 'overlap': False }, 56 | 0x2b63: { 'align': 'l', 'stretch': '' , 'overlap': False }, 57 | 0x2b64: { 'align': 'c', 'stretch': '' , 'overlap': False }, 58 | 0x2b80: { 'align': 'l', 'stretch': 'xy', 'overlap': True }, 59 | 0x2b81: { 'align': 'l', 'stretch': 'xy', 'overlap': True }, 60 | 0x2b82: { 'align': 'r', 'stretch': 'xy', 'overlap': True }, 61 | 0x2b83: { 'align': 'r', 'stretch': 'xy', 'overlap': True }, 62 | } 63 | 64 | # Open symbol font 65 | try: 66 | symbols = fontforge.open(args.symbol_font) 67 | except EnvironmentError: 68 | sys.exit(1) 69 | 70 | # Patch provided fonts 71 | for font_path in args.fonts: 72 | try: 73 | font = fontforge.open(font_path) 74 | except EnvironmentError: 75 | sys.exit(1) 76 | 77 | # Rename font 78 | if args.rename: 79 | font.familyname += ' for Powerline' 80 | font.fullname += ' for Powerline' 81 | font.fontname += 'ForPowerline' 82 | font.appendSFNTName('English (US)', 'Preferred Family', font.familyname) 83 | font.appendSFNTName('English (US)', 'Compatible Full', font.fullname) 84 | if args.fixwin: 85 | font.fontname = re.sub(r'\W', '', font.familyname) 86 | 87 | # Force the em size to be equal 88 | symbols.em = font.em 89 | 90 | # Initial font dimensions 91 | font_dim = { 92 | 'xmin' : 0, 93 | 'ymin' : -font.descent, 94 | 'xmax' : 0, 95 | 'ymax' : font.ascent, 96 | 97 | 'width' : 0, 98 | 'height': 0, 99 | } 100 | 101 | # Find the biggest char width and height 102 | # 103 | # 0x00-0x17f is the Latin Extended-A range 104 | # 0x2500-0x2600 is the box drawing range 105 | for glyph in range(0x00, 0x17f) + range(0x2500, 0x2600): 106 | try: 107 | (xmin, ymin, xmax, ymax) = font[glyph].boundingBox() 108 | except TypeError: 109 | continue 110 | 111 | if font_dim['width'] == 0: 112 | font_dim['width'] = font[glyph].width 113 | 114 | if ymin < font_dim['ymin']: font_dim['ymin'] = ymin 115 | if ymax > font_dim['ymax']: font_dim['ymax'] = ymax 116 | if xmax > font_dim['xmax']: font_dim['xmax'] = xmax 117 | 118 | # Calculate font height 119 | font_dim['height'] = abs(font_dim['ymin']) + font_dim['ymax'] 120 | 121 | # Update the font encoding to ensure that the Unicode glyphs are available 122 | font.encoding = 'ISO10646' 123 | 124 | # Fetch this property before adding outlines 125 | onlybitmaps = font.onlybitmaps 126 | 127 | def get_dim(glyph): 128 | bbox = glyph.boundingBox() 129 | 130 | return { 131 | 'xmin' : bbox[0], 132 | 'ymin' : bbox[1], 133 | 'xmax' : bbox[2], 134 | 'ymax' : bbox[3], 135 | 136 | 'width' : bbox[2] + (-bbox[0]), 137 | 'height': bbox[3] + (-bbox[1]), 138 | } 139 | 140 | # Create glyphs from symbol font 141 | for sym_glyph in symbols.glyphs(): 142 | sym_attr = SYM_ATTR[sym_glyph.unicode] 143 | 144 | # Prepare symbol glyph dimensions 145 | sym_dim = get_dim(sym_glyph) 146 | 147 | # Select and copy symbol from its encoding point 148 | symbols.selection.select(sym_glyph.encoding) 149 | symbols.copy() 150 | 151 | # Select and paste symbol to its unicode code point 152 | font.selection.select(sym_glyph.unicode) 153 | font.paste() 154 | 155 | # Now that we have copy/pasted the glyph, it's time to scale and move it 156 | 157 | # Handle glyph stretching 158 | if 'x' in sym_attr['stretch']: 159 | # Stretch the glyph horizontally 160 | scale_ratio = font_dim['width'] / sym_dim['width'] 161 | 162 | font.transform(psMat.scale(scale_ratio, 1)) 163 | if 'y' in sym_attr['stretch']: 164 | # Stretch the glyph vertically 165 | scale_ratio = font_dim['height'] / sym_dim['height'] 166 | 167 | font.transform(psMat.scale(1, scale_ratio)) 168 | 169 | # Use the dimensions from the pasted and stretched glyph 170 | sym_dim = get_dim(font[sym_glyph.unicode]) 171 | 172 | # Center-align the glyph vertically 173 | font_ycenter = font_dim['height'] / 2 174 | sym_ycenter = sym_dim['height'] / 2 175 | 176 | # First move it to the ymax (top) 177 | font.transform(psMat.translate(0, font_dim['ymax'] - sym_dim['ymax'])) 178 | 179 | # Then move it the y center difference 180 | font.transform(psMat.translate(0, sym_ycenter - font_ycenter)) 181 | 182 | # Ensure that the glyph doesn't extend outside the font's bounding box 183 | if sym_dim['width'] > font_dim['width']: 184 | # The glyph is too wide, scale it down to fit 185 | scale_matrix = psMat.scale(font_dim['width'] / sym_dim['width'], 1) 186 | 187 | font.transform(scale_matrix) 188 | 189 | # Use the dimensions from the stretched glyph 190 | sym_dim = get_dim(font[sym_glyph.unicode]) 191 | 192 | # Handle glyph alignment 193 | if sym_attr['align'] == 'c': 194 | # Center align 195 | align_matrix = psMat.translate(font_dim['width'] / 2 - sym_dim['width'] / 2 , 0) 196 | elif sym_attr['align'] == 'r': 197 | # Right align 198 | align_matrix = psMat.translate(font_dim['width'] - sym_dim['width'], 0) 199 | else: 200 | # No alignment (left alignment) 201 | align_matrix = psMat.translate(0, 0) 202 | 203 | font.transform(align_matrix) 204 | 205 | if sym_attr['overlap'] is True: 206 | overlap_width = font.em / 48 207 | 208 | # Stretch the glyph slightly horizontally if it should overlap 209 | font.transform(psMat.scale((sym_dim['width'] + overlap_width) / sym_dim['width'], 1)) 210 | 211 | if sym_attr['align'] == 'l': 212 | # The glyph should be left-aligned, so it must be moved overlap_width to the left 213 | # This only applies to left-aligned glyphs because the glyph is scaled to the right 214 | font.transform(psMat.translate(-overlap_width, 0)) 215 | 216 | # Ensure the font is considered monospaced on Windows 217 | font[sym_glyph.unicode].width = font_dim['width'] 218 | 219 | if font.bitmapSizes and not onlybitmaps: 220 | # If this is an outline font with bitmaps, regenerate bitmaps for the changed glyphs 221 | font.selection.changed() 222 | 223 | for size in font.bitmapSizes: 224 | font.regenBitmaps((size, )) 225 | 226 | output_name, extension = os.path.split(font_path)[1].rsplit('.', 1) 227 | if extension.lower() not in ['ttf', 'otf']: 228 | # Default to OpenType if input is not TrueType/OpenType 229 | extension = 'otf' 230 | if args.fixmono: 231 | for glyph in font.glyphs(): 232 | if glyph.width == 0: glyph.width = font_dim['width'] 233 | 234 | if onlybitmaps: 235 | # Generate BDF font 236 | font.generate('{0}-Powerline.bdf'.format(output_name, bitmap_type='bdf')) 237 | else: 238 | # Generate OTF/TTF font 239 | font.generate('{0}-Powerline.{1}'.format(output_name, extension)) 240 | 241 | -------------------------------------------------------------------------------- /plugin/Powerline.vim: -------------------------------------------------------------------------------- 1 | " Powerline - The ultimate statusline utility 2 | " 3 | " Author: Kim Silkebækken 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 | \ , 'symbols_override' : {} 23 | \ , 'dividers_override': [] 24 | \ , 'stl_path_style' : 'relative' 25 | \ , 'cache_enabled' : 1 26 | \ }) 27 | 28 | if ! exists('g:Powerline_' . s:key) 29 | exec printf('let g:Powerline_%s = %s', s:key, string(s:value)) 30 | endif 31 | 32 | unlet! s:key s:value 33 | endfor 34 | 35 | if ! exists('g:Powerline_cache_dir') 36 | let g:Powerline_cache_dir = simplify(expand(':p:h') .'/..') 37 | endif 38 | 39 | if ! exists('g:Powerline_cache_file') 40 | exec 'let g:Powerline_cache_file = '. string(printf('%s/Powerline_%s_%s_%s.cache' 41 | \ , g:Powerline_cache_dir 42 | \ , g:Powerline_theme 43 | \ , g:Powerline_colorscheme 44 | \ , g:Powerline_symbols 45 | \ )) 46 | endif 47 | " }}} 48 | " Autocommands {{{ 49 | function! s:Startup() 50 | augroup PowerlineMain 51 | autocmd! 52 | 53 | " Reload statuslines when changing color scheme 54 | autocmd ColorScheme * 55 | \ call Pl#Load() 56 | 57 | autocmd BufEnter,WinEnter,FileType,BufUnload,CmdWinEnter * 58 | \ call Pl#UpdateStatusline(1) 59 | 60 | autocmd BufLeave,WinLeave,CmdWinLeave * 61 | \ call Pl#UpdateStatusline(0) 62 | 63 | autocmd BufWritePost */autoload/Powerline/Colorschemes/*.vim 64 | \ :PowerlineReloadColorscheme 65 | augroup END 66 | 67 | let curwindow = winnr() 68 | for window in range(1, winnr('$')) 69 | call Pl#UpdateStatusline(window == curwindow, window) 70 | endfor 71 | endfunction 72 | 73 | augroup PowerlineStartup 74 | autocmd! 75 | 76 | autocmd VimEnter * call s:Startup() 77 | augroup END 78 | " }}} 79 | --------------------------------------------------------------------------------