mirror of
https://github.com/powerline/powerline.git
synced 2025-04-08 19:25:04 +02:00
Add modified_buffers segment
This segment returns a comma-separated list of modified buffers. The segment is not enabled by default. Closes #173.
This commit is contained in:
parent
5399265135
commit
d386ae71fd
@ -82,7 +82,8 @@
|
||||
"line_percent_gradient6": { "fg": "gradient6", "bg": "gray4" },
|
||||
"line_current": { "fg": "gray1", "bg": "gray10", "attr": ["bold"] },
|
||||
"line_current_symbol": { "fg": "gray1", "bg": "gray10" },
|
||||
"col_current": { "fg": "gray6", "bg": "gray10" }
|
||||
"col_current": { "fg": "gray6", "bg": "gray10" },
|
||||
"modified_buffers": { "fg": "brightyellow", "bg": "gray2" }
|
||||
},
|
||||
"mode_translations": {
|
||||
"nc": {
|
||||
|
@ -167,6 +167,15 @@ def col_current(virtcol=True):
|
||||
return vim_funcs['virtcol' if virtcol else 'col']('.')
|
||||
|
||||
|
||||
def modified_buffers(text=u'+'):
|
||||
'''Return a comma-separated list of modified buffers.'''
|
||||
buffer_len = int(vim.eval('bufnr("$")'))
|
||||
buffer_mod = [str(bufnr) for bufnr in range(1, buffer_len + 1) if vim.eval('getbufvar({0}, "&mod")'.format(bufnr)) == '1']
|
||||
if buffer_mod:
|
||||
return u'{0} {1}'.format(text, ','.join(buffer_mod))
|
||||
return None
|
||||
|
||||
|
||||
@memoize(2)
|
||||
def branch():
|
||||
repo = guess(os.path.abspath(vim.current.buffer.name or os.getcwd()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user