From 80db7df959910cb0b8235a79a32c3d3ce5a8caa0 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 14 Sep 2014 15:44:46 +0400 Subject: [PATCH] Do not use vim_funcs['bufnr'] for modified_buffers segment --- powerline/segments/vim/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/powerline/segments/vim/__init__.py b/powerline/segments/vim/__init__.py index 90047330..9b7e7c04 100644 --- a/powerline/segments/vim/__init__.py +++ b/powerline/segments/vim/__init__.py @@ -470,10 +470,13 @@ def modified_buffers(pl, text='+ ', join_str=','): :param str join_str: string to use for joining the modified buffer list ''' - buffer_len = vim_funcs['bufnr']('$') - buffer_mod = [str(bufnr) for bufnr in range(1, buffer_len + 1) if int(getbufvar(bufnr, '&modified') or 0)] - if buffer_mod: - return text + join_str.join(buffer_mod) + buffer_mod_text = join_str.join(( + str(buffer.number) + for buffer in vim.buffers + if int(vim_getbufoption({'buffer': buffer, 'bufnr': buffer.number}, 'modified')) + )) + if buffer_mod_text: + return text + buffer_mod_text return None