X-Git-Url: http://git.iain.cx/?p=profile.git;a=blobdiff_plain;f=.vimrc;h=98c3c52c9faf8aae6d78a9be880090b2138ffe27;hp=96f8a1f3da3bbbaecbb35a43dad04bdc7a1911e8;hb=732626fa6ddea589ef0e67d3627ebb42f81734d4;hpb=3e4ed13b68141823f47f93acc00572a823c56995;ds=sidebyside diff --git a/.vimrc b/.vimrc index 96f8a1f..98c3c52 100644 --- a/.vimrc +++ b/.vimrc @@ -214,12 +214,6 @@ endfun " Grow or shrink the window size. fun! Resize_Columns(op) - " XXX: This won't work inside screen. - " We should really detect whether it would work rather than assume it won't. - if &term =~ '^screen' - return - endif - " Vim 5 hardcodes the size of numbers column to 8. if version >= "700" let l:numberwidth = &numberwidth @@ -227,7 +221,20 @@ fun! Resize_Columns(op) let l:numberwidth = 8 endif - exec "se columns" . a:op . "=" . l:numberwidth + let l:resize = "se columns" . a:op . "=" . l:numberwidth + + " HACK: Inside screen there is an extra line for the status bar. Vim + " manages the resize by sending an escape sequence to set the number of + " lines and number of columns in one action. To do this it will first query + " the number of lines and then set by . Because of the extra line for the status bar this results in + " the real terminal being shrunk by a line. We ask for the terminal to grow + " by a line so it ends up actually being the same. + if &term =~ '^screen' + let l:resize .= " lines+=1" + endif + + exec l:resize endfun " Toggle number display.