expose stash to Vim

It needs the same modifications as the branch segment to correctly
function.
This commit is contained in:
XZS 2016-04-22 15:03:39 +02:00
parent 72053f688f
commit e027c5ed47
1 changed files with 20 additions and 1 deletions

View File

@ -22,7 +22,7 @@ from powerline.lib import add_divider_highlight_group
from powerline.lib.vcs import guess
from powerline.lib.humanize_bytes import humanize_bytes
from powerline.lib import wraps_saveargs as wraps
from powerline.segments.common.vcs import BranchSegment
from powerline.segments.common.vcs import BranchSegment, StashSegment
from powerline.segments import with_docstring
from powerline.lib.unicode import string, unicode
@ -510,6 +510,25 @@ Divider highlight group used: ``branch:divider``.
''')
@requires_filesystem_watcher
@requires_segment_info
class VimStashSegment(StashSegment):
divider_highlight_group = 'stash:divider'
@staticmethod
def get_directory(segment_info):
if vim_getbufoption(segment_info, 'buftype'):
return None
return buffer_name(segment_info)
stash = with_docstring(VimStashSegment(),
'''Return the number of stashes in the current working branch.
Highlight groups used: ``stash``.
''')
@requires_filesystem_watcher
@requires_segment_info
def file_vcs_status(pl, segment_info, create_watcher):