From 832105f1cffb94d0193777f6c1d3ddc98be1e24d Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Thu, 14 May 2009 11:26:41 +0100 Subject: [PATCH] Resize fixes. The numberwidth variable is only available in Vim 7. We had thought it was available in Vim 6. The winnr() function used to check whether any windows have &number on is present in Vim 7. Disable window resizing if the function isn't available. --- .vimrc | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.vimrc b/.vimrc index 690ad40..b6ba9a8 100644 --- a/.vimrc +++ b/.vimrc @@ -100,7 +100,7 @@ se hlsearch se titlestring=%{Show_TitleString()} " Syntax highlighting. New versions will use syn enable instead. -if version < 600 +if version < "600" syn on endif @@ -216,7 +216,7 @@ fun! Resize_Columns(op) endif " Vim 5 hardcodes the size of numbers column to 8. - if version >= 600 + if version >= "700" let l:numberwidth = &numberwidth else let l:numberwidth = 8 @@ -230,21 +230,23 @@ fun! Number() call Iain_Vars() let &number = ! &number - let l:i = 0 - let l:num_numbers = 0 - while l:i <= winnr("$") - if getwinvar(l:i, "&number") == 1 - let l:num_numbers = l:num_numbers + 1 + if version >= "700" + let l:i = 0 + let l:num_numbers = 0 + while l:i <= winnr("$") + if getwinvar(l:i, "&number") == 1 + let l:num_numbers = l:num_numbers + 1 + endif + let l:i = l:i + 1 + endwhile + + if l:num_numbers == 0 + let g:iainextracolumns = 0 + call Resize_Columns("-") + elseif g:iainextracolumns == 0 + let g:iainextracolumns = 1 + call Resize_Columns("+") endif - let l:i = l:i + 1 - endwhile - - if l:num_numbers == 0 - let g:iainextracolumns = 0 - call Resize_Columns("-") - elseif g:iainextracolumns == 0 - let g:iainextracolumns = 1 - call Resize_Columns("+") endif endfun -- 2.20.1