################################################################################
# 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.
" 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
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 <same number of lines> by <new number of
+ " columns>. 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.