From 6efabc170df106d43041e3ab8d264809397b2dfb Mon Sep 17 00:00:00 2001 From: John Drouhard Date: Sat, 14 Nov 2015 12:38:07 -0600 Subject: [PATCH] Fix performance issue with tabline and showtabline=2 vim_getbufoption(segment, 'buflisted') was causing vim to update the tabline for every keystroke. using vim.eval('buflisted(nr)') allows vim to optimize when it needs to update Fixes #1281 --- powerline/listers/vim.py | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/powerline/listers/vim.py b/powerline/listers/vim.py index c1995957..9a8b4a8e 100644 --- a/powerline/listers/vim.py +++ b/powerline/listers/vim.py @@ -89,22 +89,13 @@ def bufferlister(pl, segment_info, show_unlisted=False, **kwargs): return dct return ( - ( - buf_segment_info, - add_multiplier(buf_segment_info['buffer'], {'highlight_group_prefix': prefix}) - ) - for buf_segment_info, prefix in ( - ( - buffer_updated_segment_info( - segment_info, - buffer - ), - ('buf' if buffer is cur_buffer else 'buf_nc') - ) - for buffer in vim.buffers - ) if ( - buf_segment_info['buffer'] is cur_buffer - or show_unlisted - or int(vim_getbufoption(buf_segment_info, 'buflisted')) + (lambda buffer, prefix: ( + buffer_updated_segment_info(segment_info, buffer), + add_multiplier(buffer, {'highlight_group_prefix': prefix} + ))(buffer, 'buf' if buffer is cur_buffer else 'buf_nc') + for buffer in vim.buffers if ( + buffer is cur_buffer + or show_unlisted + or int(vim.eval('buflisted(%s)' % buffer.number)) > 0 ) )