Browse files

Tie the cache file to the current configuration

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...
1 parent c1c22ea commit f2acebb789583367c39a6c665e6caed5fc2b7b72 @Lokaltog committed Jan 22, 2012
Showing with 17 additions and 17 deletions.
  1. +1 −1 .gitignore
  2. +1 −8 README.rst
  3. +6 −7 doc/Powerline.txt
  4. +9 −1 plugin/Powerline.vim
View
2 .gitignore
@@ -1,2 +1,2 @@
doc/tags
-Powerline.cache
+*.cache
View
9 README.rst
@@ -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
-----------
@@ -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
View
13 doc/Powerline.txt
@@ -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*
@@ -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*
View
10 plugin/Powerline.vim
@@ -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

0 comments on commit f2acebb

Please sign in to comment.