Permalink
Browse files

Powerline

  • Loading branch information...
1 parent 7cf4f27 commit 3389a14fa852bb0544778d69fa139f531689c153 @jyurek committed Nov 3, 2012
Showing with 3,412 additions and 0 deletions.
  1. +2 −0 vim/bundle/vim-powerline/.gitignore
  2. +107 −0 vim/bundle/vim-powerline/README.rst
  3. +183 −0 vim/bundle/vim-powerline/autoload/Pl.vim
  4. +145 −0 vim/bundle/vim-powerline/autoload/Pl/Colorscheme.vim
  5. +140 −0 vim/bundle/vim-powerline/autoload/Pl/Hi.vim
  6. +43 −0 vim/bundle/vim-powerline/autoload/Pl/Match.vim
  7. +40 −0 vim/bundle/vim-powerline/autoload/Pl/Mod.vim
  8. +371 −0 vim/bundle/vim-powerline/autoload/Pl/Parser.vim
  9. +188 −0 vim/bundle/vim-powerline/autoload/Pl/Segment.vim
  10. +100 −0 vim/bundle/vim-powerline/autoload/Pl/Theme.vim
  11. +166 −0 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/default.vim
  12. +192 −0 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim
  13. +141 −0 vim/bundle/vim-powerline/autoload/Powerline/Functions.vim
  14. +12 −0 vim/bundle/vim-powerline/autoload/Powerline/Functions/ft_man.vim
  15. +7 −0 vim/bundle/vim-powerline/autoload/Powerline/Functions/fugitive.vim
  16. +17 −0 vim/bundle/vim-powerline/autoload/Powerline/Functions/hgrev.vim
  17. +16 −0 vim/bundle/vim-powerline/autoload/Powerline/Functions/syntastic.vim
  18. +13 −0 vim/bundle/vim-powerline/autoload/Powerline/Matches.vim
  19. +30 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments.vim
  20. +20 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/ctrlp.vim
  21. +3 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/ft_man.vim
  22. +5 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/fugitive.vim
  23. +4 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/hgrev.vim
  24. +6 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/rvm.vim
  25. +5 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/syntastic.vim
  26. +6 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/tagbar.vim
  27. +5 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/virtualenv.vim
  28. +116 −0 vim/bundle/vim-powerline/autoload/Powerline/Themes/default.vim
  29. +116 −0 vim/bundle/vim-powerline/autoload/Powerline/Themes/skwp.vim
  30. +429 −0 vim/bundle/vim-powerline/doc/Powerline.txt
  31. +319 −0 vim/bundle/vim-powerline/fontpatcher/PowerlineSymbols.sfd
  32. +164 −0 vim/bundle/vim-powerline/fontpatcher/README.rst
  33. +232 −0 vim/bundle/vim-powerline/fontpatcher/fontpatcher
  34. +69 −0 vim/bundle/vim-powerline/plugin/Powerline.vim
@@ -0,0 +1,2 @@
+doc/tags
+*.cache
@@ -0,0 +1,107 @@
+=================
+Powerline for vim
+=================
+
+:Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com)
+:Source: https://github.com/Lokaltog/vim-powerline
+:Version: β
+
+Introduction
+------------
+
+Powerline is a utility plugin which allows you to create better-looking,
+more functional vim statuslines. See the screenshots below for
+a demonstration of the plugin's capabilities.
+
+It's recommended that you install the plugin using Pathogen_ or Vundle_.
+After the plugin is installed update your help tags and see ``:help
+Powerline`` for instructions on how to enable and configure the plugin.
+
+See the `Troubleshooting`_ section below if you're having any issues with
+the plugin or the font patcher.
+
+**Note:** You need a patched font to be able to use the symbols in the
+statusline. An experimental Python/fontforge-based font patcher is included
+in the ``fontpatcher`` directory. See ``fontpatcher/README.rst`` for usage
+instructions.
+
+.. _Pathogen: https://github.com/tpope/vim-pathogen
+.. _Vundle: https://github.com/gmarik/vundle
+
+Screenshots
+-----------
+
+.. image:: http://i.imgur.com/MsuIB.png
+
+Troubleshooting
+---------------
+
+I can't see the fancy symbols, what's wrong?
+ Make sure that you have ``let g:Powerline_symbols = 'fancy'`` in your
+ ``vimrc`` file. The settings may be loaded too late if you have this in
+ ``gvimrc``, so always put this in your ``vimrc``.
+
+ Clear the cache using ``:PowerlineClearCache`` and restart vim.
+
+ Make sure that you've configured gvim or your terminal emulator to use
+ a patched font.
+
+ Make sure that vim is compiled with the ``--with-features=big`` flag.
+
+The fancy symbols look a bit blurry or "off"!
+ Make sure that you have patched all variants of your font (i.e. both the
+ regular and the bold font files).
+
+I'm unable to patch my font, what should I do?
+ Font patching is only known to work on most Linux and OS X machines. If
+ you have followed the instructions in the fontpatcher README and still
+ have problems, please submit an issue on GitHub.
+
+ You can download some community-contributed patched fonts from the
+ `Powerline wiki`_ if you don't want to mess around with the font
+ patcher.
+
+The Syntastic/Fugitive statusline flags don't work!
+ These flags should work without any configuration. If you installed
+ either plugin after Powerline, you'll have to clear the cache using
+ ``:PowerlineClearCache`` and restart vim.
+
+The colors are weird in the default OS X Terminal app!
+ The default OS X Terminal app is known to have some issues with the
+ Powerline colors. Please use another terminal emulator. iTerm2 should
+ work fine.
+
+ The arrows may have the wrong colors if you have changed the "minimum
+ contrast" slider in the color tab of your OS X settings.
+
+The statusline has strange characters like ``^B`` in it!
+ Please add ``set encoding=utf-8`` to your ``vimrc``.
+
+ You may also need to set your ``LANG`` and ``LC_*`` environment
+ variables to a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your
+ Linux distro's documentation for information about setting these
+ variables correctly.
+
+The statusline has a lot of ``^`` or underline characters in it!
+ You need to configure the ``fillchars`` setting to disable statusline
+ fillchars (see ``:h fillchars`` for details). Add this to your
+ ``vimrc`` to solve this issue::
+
+ set fillchars+=stl:\ ,stlnc:\
+
+The statusline is hidden/only appears in split windows!
+ Make sure that you have ``set laststatus=2`` in your ``vimrc``.
+
+I'm using tmux and Powerline looks like crap, what's wrong?
+ You need to tell tmux that it has 256-color capabilities. Add this to
+ your ``.tmux.conf`` to solve this issue::
+
+ set -g default-terminal "screen-256color"
+
+ If you use iTerm2, make sure that you have enabled the setting 'Set
+ locale variables automatically' in Profiles > Terminal > Environment.
+
+If you have any other issues and you can't find the answer in the docs,
+please submit an issue on GitHub.
+
+.. _`Powerline wiki`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts
@@ -0,0 +1,183 @@
+" Powerline - The ultimate statusline utility
+"
+" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
+" Source repository: https://github.com/Lokaltog/vim-powerline
+
+" Script variables {{{
+ let g:Pl#OLD_STL = ''
+ let g:Pl#THEME = []
+ let g:Pl#THEME_CALLBACKS = []
+ let g:Pl#HL = []
+
+ " Cache revision, this must be incremented whenever the cache format is changed
+ let s:CACHE_REVISION = 7
+" }}}
+" Script initialization {{{
+ function! Pl#LoadCache() " {{{
+ if filereadable(g:Powerline_cache_file) && g:Powerline_cache_enabled
+ exec 'source' escape(g:Powerline_cache_file, ' \')
+
+ if ! exists('g:Powerline_cache_revision') || g:Powerline_cache_revision != s:CACHE_REVISION
+ " Cache revision differs, cache is invalid
+ unlet! g:Powerline_cache_revision
+
+ return 0
+ endif
+
+ " Create highlighting groups
+ for hi_cmd in g:Pl#HL
+ exec hi_cmd
+ endfor
+
+ " Run theme callbacks
+ for callback in g:Pl#THEME_CALLBACKS
+ " Substitute {{NEWLINE}} with newlines (strings must be
+ " stored without newlines characters to avoid vim errors)
+ exec substitute(callback[0], "{{NEWLINE}}", "\n", 'g')
+ exec substitute(callback[1], "{{NEWLINE}}", "\n", 'g')
+ endfor
+
+ return 1
+ endif
+
+ return 0
+ endfunction " }}}
+ function! Pl#ClearCache() " {{{
+ if filereadable(g:Powerline_cache_file)
+ " Delete the cache file
+ call delete(g:Powerline_cache_file)
+ endif
+
+ echo 'Powerline cache cleared. Please restart vim for the changes to take effect.'
+ endfunction " }}}
+ function! Pl#ReloadColorscheme() " {{{
+ call Pl#ClearCache()
+
+ " The colorscheme and theme files must be manually sourced because
+ " vim won't reload previously autoloaded files
+ "
+ " This is a bit hackish, but it works
+ unlet! g:Powerline#Colorschemes#{g:Powerline_colorscheme}#colorscheme
+ exec "source" split(globpath(&rtp, 'autoload/Powerline/Colorschemes/'. g:Powerline_colorscheme .'.vim', 1), '\n')[0]
+
+ unlet! g:Powerline#Themes#{g:Powerline_theme}#theme
+ exec "source" split(globpath(&rtp, 'autoload/Powerline/Themes/'. g:Powerline_theme .'.vim', 1), '\n')[0]
+
+ let g:Pl#THEME = []
+
+ call Pl#Load()
+ endfunction " }}}
+ function! Pl#Load() " {{{
+ if empty(g:Pl#OLD_STL)
+ " Store old statusline
+ let g:Pl#OLD_STL = &statusline
+ endif
+
+ if ! Pl#LoadCache()
+ try
+ " Autoload the theme dict first
+ let raw_theme = g:Powerline#Themes#{g:Powerline_theme}#theme
+ catch
+ echom 'Invalid Powerline theme! Please check your theme and colorscheme settings.'
+
+ return
+ endtry
+
+ " Create list with parsed statuslines
+ for buffer_statusline in raw_theme
+ unlet! mode_statuslines
+ let mode_statuslines = Pl#Parser#GetStatusline(buffer_statusline.segments)
+
+ if ! empty(buffer_statusline.callback)
+ " The callback function passes its arguments on to
+ " Pl#StatuslineCallback along with the normal/current mode
+ " statusline.
+ let s:cb_func = "function! PowerlineStatuslineCallback_". buffer_statusline.callback[1] ."(...)\n"
+ let s:cb_func .= "return Pl#StatuslineCallback(". string(mode_statuslines['n']) .", a:000)\n"
+ let s:cb_func .= "endfunction"
+
+ " The callback expression should be used to initialize any
+ " variables that will use the callback function. The
+ " expression requires a %s which will be replaced by the
+ " callback function name.
+ let s:cb_expr = printf(buffer_statusline.callback[2], 'PowerlineStatuslineCallback_'. buffer_statusline.callback[1])
+
+ exec s:cb_func
+ exec s:cb_expr
+
+ " Newlines must be substituted with another character
+ " because vim doesn't like newlines in strings
+ call add(g:Pl#THEME_CALLBACKS, [substitute(s:cb_func, "\n", "{{NEWLINE}}", 'g'), substitute(s:cb_expr, "\n", "{{NEWLINE}}", 'g')])
+
+ unlet! s:cb_func s:cb_expr
+
+ continue
+ endif
+
+ " Store the statuslines for matching specific buffers
+ call add(g:Pl#THEME, {
+ \ 'matches': buffer_statusline.matches,
+ \ 'mode_statuslines': mode_statuslines
+ \ })
+ endfor
+
+ if ! g:Powerline_cache_enabled
+ " Don't cache anything if caching is disabled or cache file isn't writeable
+ return
+ endif
+
+ " Prepare commands and statuslines for caching
+ let cache = [
+ \ 'let g:Powerline_cache_revision = '. string(s:CACHE_REVISION),
+ \ 'let g:Pl#HL = '. string(g:Pl#HL),
+ \ 'let g:Pl#THEME = '. string(g:Pl#THEME),
+ \ 'let g:Pl#THEME_CALLBACKS = '. string(g:Pl#THEME_CALLBACKS),
+ \ ]
+
+ call writefile(cache, g:Powerline_cache_file)
+ endif
+ endfunction " }}}
+" }}}
+" Statusline updater {{{
+ function! Pl#Statusline(statusline, current) " {{{
+ let mode = mode()
+
+ if ! a:current
+ let mode = 'N' " Normal (non-current)
+ elseif mode =~# '\v(v|V|)'
+ let mode = 'v' " Visual mode
+ elseif mode =~# '\v(s|S|)'
+ let mode = 's' " Select mode
+ elseif mode =~# '\vi'
+ let mode = 'i' " Insert mode
+ elseif mode =~# '\v(R|Rv)'
+ let mode = 'r' " Replace mode
+ else
+ " Fallback to normal mode
+ let mode = 'n' " Normal (current)
+ endif
+
+ return g:Pl#THEME[a:statusline].mode_statuslines[mode]
+ endfunction " }}}
+ function! Pl#StatuslineCallback(statusline, args) " {{{
+ " Replace %1, %2, etc. in the statusline with the callback args
+ return substitute(
+ \ a:statusline,
+ \ '\v\%(\d+)',
+ \ '\=a:args[submatch(1)]',
+ \ 'g')
+ endfunction " }}}
+ function! Pl#UpdateStatusline(current) " {{{
+ if empty(g:Pl#THEME)
+ " Load statuslines if they aren't loaded yet
+ call Pl#Load()
+ endif
+
+ for i in range(0, len(g:Pl#THEME) - 1)
+ if Pl#Match#Validate(g:Pl#THEME[i])
+ " Update window-local statusline
+ let &l:statusline = '%!Pl#Statusline('. i .','. a:current .')'
+ endif
+ endfor
+ endfunction " }}}
+" }}}
Oops, something went wrong. Retry.

0 comments on commit 3389a14

Please sign in to comment.