On 19/12/09 02:14, Mathieu wrote:
Here the first few lines of my .gvimrc:
$ head .gvimrc
set lines=500 " over zelous numbers of lines
let&lines = ((float2nr(0.85*&lines)>52)?float2nr(0.85*&lines):52)
set columns=85
" double the size of window if running diff
if&diff
let&columns = ((&columns * 2> 160)? 160:&columns*2)
endif
I wanted gvim to use 85% of the height of the screen or 52 lines,
whichever is greater. If I issue the first two commands by hand after
gvim has open. It will do what I want it to do. Why don't it work as
part of .gvimrc?
In addition to all that has been said, you might want not to resize
(after maximizing) if the full height of your screen is smaller than 52
lines:
set lines=999
redraw
if &lines > 52
let eightyfivelines = &lines * 85
if eightyfivelines < 5200
set lines=52
else
let &lines = eightyfivelines / 100
endif
unlet eightyfivelines
endif
Use of integer arithmetic allows the above code to work even in Vim
versions with no floating-point support (provided of course that
expression evaluation is compiled-in).
(Or maybe "fixed-point arithmetic" if we decide that the variable
eightyfivelines represents 85% of the screen height with an implied
decimal point two digits left of its right end, like a shop's cash
register where you would enter 500 to mean $5.00)
Best regards,
Tony.
--
ARTHUR: This new learning amazes me, Sir Bedevere. Explain again how
sheep's
bladders may be employed to prevent earthquakes.
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php