Memoize git branch segment in vim

This works kinda like a timer which ensures that the git branch segment
isn't called more than once every 2 seconds.

Refs #7.
This commit is contained in:
Kim Silkebækken 2012-12-13 14:06:29 +01:00
parent fbce4ac2da
commit 3037b9fbf1

View File

@ -4,6 +4,7 @@ import os
import vim import vim
from powerline.ext.vim.bindings import vim_get_func from powerline.ext.vim.bindings import vim_get_func
from powerline.lib.memoize import memoize
vim_funcs = { vim_funcs = {
'col': vim_get_func('col', rettype=int), 'col': vim_get_func('col', rettype=int),
@ -75,6 +76,7 @@ def readonly_indicator(text=u'⭤'):
return text if int(vim.eval('&readonly')) else None return text if int(vim.eval('&readonly')) else None
@memoize(2)
def branch(): def branch():
'''Return VCS branch. '''Return VCS branch.