Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Commit

Permalink
Tie the cache file to the current configuration
Browse files Browse the repository at this point in the history
By including the current theme, colorscheme and symbol settings the
cache file will be tied to a specific configuration, and regenerated
when any setting is changed.
  • Loading branch information
Lokaltog committed Jan 22, 2012
1 parent c1c22ea commit f2acebb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,2 +1,2 @@
doc/tags
Powerline.cache
*.cache
9 changes: 1 addition & 8 deletions README.rst
Expand Up @@ -28,13 +28,6 @@ instructions.
.. _Pathogen: https://github.com/tpope/vim-pathogen
.. _Vundle: https://github.com/gmarik/vundle

Important information about caching
-----------------------------------

Powerline caches the statuslines by default to improve startup time.
**Please remember to clear the cache after changing any settings!** Run
``:PowerlineClearCache`` and restart vim to clear the cache.

Screenshots
-----------

Expand Down Expand Up @@ -91,7 +84,7 @@ I'm unable to patch my font, what should I do?
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``.
``: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
Expand Down
13 changes: 6 additions & 7 deletions doc/Powerline.txt
Expand Up @@ -89,11 +89,13 @@ It's recommended that you enable the cache, as this dramatically improves vim
startup time after the cache file has been generated (the plugin usually loads
within ~100ms without the cache and ~1ms with the cache).

Note: You need to clear the cache after changing any Powerline settings. Run
":PowerlineClearCache" to clear the cache and restart vim for the changes to
take effect.
Note: The default cache filename includes the current theme, colorscheme and
symbol settings in order to tie the cache file your current configuration, so
the cache file will be regenerated when you change any settings. This may
leave several old cache files in your vim folder, and these may safely be
deleted.

Defaults: "<plugin directory>/Powerline.cache"
Defaults: "<plugin_directory>/Powerline_<theme>_<colorscheme>_<symbols>.cache"

------------------------------------------------------------------------------
4.2 Powerline_cache_enabled *Powerline_cache_enabled*
Expand Down Expand Up @@ -124,9 +126,6 @@ Symbols can be inserted into statuslines by using the following variables:

Default: "compatible"

Note: You'll need to delete the |Powerline_cache_file| after changing this
option for the changes to take effect.

------------------------------------------------------------------------------
4.3.1 Compatible symbols *Powerline-symbols-compatible*

Expand Down
10 changes: 9 additions & 1 deletion plugin/Powerline.vim
Expand Up @@ -15,14 +15,22 @@
\ 'theme' : 'distinguished'
\ , 'colorscheme' : 'distinguished'
\ , 'symbols' : 'compatible'
\ , 'cache_file' : simplify(expand('<sfile>:p:h') . '/../Powerline.cache')
\ , 'cache_enabled': 1
\ })

if ! exists('g:Powerline_' . key)
exec printf('let g:Powerline_%s = %s', key, string(value))
endif
endfor

if ! exists('g:Powerline_cache_file')
exec 'let g:Powerline_cache_file = '. string(printf('%s/Powerline_%s_%s_%s.cache'
\ , simplify(expand('<sfile>:p:h') .'/..')
\ , g:Powerline_theme
\ , g:Powerline_colorscheme
\ , g:Powerline_symbols
\ ))
endif
" }}}
" Autocommands {{{
augroup Powerline
Expand Down

0 comments on commit f2acebb

Please sign in to comment.