mirror of
https://github.com/powerline/powerline.git
synced 2025-07-31 01:35:40 +02:00
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:
parent
fbce4ac2da
commit
3037b9fbf1
@ -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.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user