From: Iain Patterson Date: Tue, 23 Jun 2009 10:39:19 +0000 (+0100) Subject: Resize windows inside screen. X-Git-Url: http://git.iain.cx/?p=profile.git;a=commitdiff_plain;h=732626fa6ddea589ef0e67d3627ebb42f81734d4 Resize windows inside screen. --- diff --git a/.screenrc b/.screenrc index df17c1d..9624f7c 100644 --- a/.screenrc +++ b/.screenrc @@ -39,6 +39,8 @@ bind V hardstatus alwaysignore ################################################################################ # How to set the foreground and background colours. termcapinfo putty*|rxvt-unicode|xterm-* 'AB=\E[48;5;%dm:AF=\E[38;5;%dm' +# How to resize the window. +termcapinfo putty*|rxvt-unicode|xterm-* 'WS=\E[8;%d;%dt' # How to set the hardstatus line (ie title bar). Even though we don't use it. termcapinfo xterm* 'ts=\E]0;:fs=\007:ds=\E]0;\007' # Allow PgUp/PgDn to work correctly. 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.