mirror of
https://github.com/powerline/powerline.git
synced 2025-07-27 07:44:36 +02:00
parent
1cc46c7126
commit
f877516e54
@ -14,6 +14,7 @@
|
|||||||
"position": "information:additional",
|
"position": "information:additional",
|
||||||
"single_tab": "line_current",
|
"single_tab": "line_current",
|
||||||
"many_tabs": "line_current",
|
"many_tabs": "line_current",
|
||||||
|
"bufnr": "information:unimportant",
|
||||||
"tabnr": "file_directory"
|
"tabnr": "file_directory"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -504,6 +504,18 @@ def tabnr(pl, segment_info, show_current=False):
|
|||||||
return str(tabnr)
|
return str(tabnr)
|
||||||
|
|
||||||
|
|
||||||
|
@requires_segment_info
|
||||||
|
def bufnr(pl, segment_info, show_current=False):
|
||||||
|
'''Show buffer number
|
||||||
|
|
||||||
|
:param bool show_current:
|
||||||
|
If False do not show current window number.
|
||||||
|
'''
|
||||||
|
bufnr = segment_info['bufnr']
|
||||||
|
if show_current or bufnr != vim.current.buffer.number:
|
||||||
|
return str(bufnr)
|
||||||
|
|
||||||
|
|
||||||
def single_tab(pl, single_text='Bufs', multiple_text='Tabs'):
|
def single_tab(pl, single_text='Bufs', multiple_text='Tabs'):
|
||||||
'''Show one text if there is only one tab and another if there are many
|
'''Show one text if there is only one tab and another if there are many
|
||||||
|
|
||||||
|
@ -793,6 +793,12 @@ class TestVim(TestCase):
|
|||||||
self.assertEqual(vim.tabnr(pl=pl, segment_info=segment_info, show_current=True), '1')
|
self.assertEqual(vim.tabnr(pl=pl, segment_info=segment_info, show_current=True), '1')
|
||||||
self.assertEqual(vim.tabnr(pl=pl, segment_info=segment_info, show_current=False), None)
|
self.assertEqual(vim.tabnr(pl=pl, segment_info=segment_info, show_current=False), None)
|
||||||
|
|
||||||
|
def test_bufnr(self):
|
||||||
|
pl = Pl()
|
||||||
|
segment_info = vim_module._get_segment_info()
|
||||||
|
self.assertEqual(vim.bufnr(pl=pl, segment_info=segment_info, show_current=True), str(segment_info['bufnr']))
|
||||||
|
self.assertEqual(vim.bufnr(pl=pl, segment_info=segment_info, show_current=False), None)
|
||||||
|
|
||||||
def test_single_tab(self):
|
def test_single_tab(self):
|
||||||
pl = Pl()
|
pl = Pl()
|
||||||
single_tab = partial(vim.single_tab, pl=pl)
|
single_tab = partial(vim.single_tab, pl=pl)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user