On 25/06/12 01:02, Daniel Harding wrote:
Hello All,

I am trying to configure gvim in a portable manner to use the maximum
number of lines that will fit on the screen.  After a bit of searching,
I found this under the help for 'lines':

     When Vim is running in the GUI or in a resizable window, setting
     this option will cause the window size to be changed.  When you only
     want to use the size for the GUI, put the command in your |gvimrc|
     file.  Vim limits the number of lines to what fits on the screen.
     You can use this command to get the tallest window possible:
         :set lines=999

When I am running under Windows, this works great.  However, when
running under Linux, it doesn't limit the window to the size of the
screen - I get a really tall window that extends well below the bottom
of the screen.
[...]

In my Linux .vimrc I have

if has('gui_running')
...
        set lines=999 columns=9999
...
else
...
endif

(where the ... lines represent additional lines not relevant to the present discussion). The result is that Vim opens maximized (well, minus a couple of pixels maybe) when running in GUI mode, but doesn't try to change the terminal size when running in a terminal.

The behaviour I see is that at startup, or if the GUI height is lower than the screen size, I get maximum height (48 lines in my case, which is maybe a few pixels more than "the screen height minus one line"). If the GUI is already at 48 lines or more (with my usual 'guifont'), ":set lines=999" makes the GUI expand to I don't know how much more than the screen. Repeating it immediately doesn't bring it back within the screen, but ":set lines=25" followed by ":set lines=999" (or, in a single command, ":set lines=25 lines=999") does. The weird thing is of course that since the command line is below the bottom of the screen, this command must be typed "blind" (i.e. sight unseen). But it works for me. The above might be intentional, in order to work around the case where the screen size is not "guessed" correctly: ":set lines=999" gives you (the first time) the maximum "guessed" size; but ":set lines=435 lines=435" gives you 435 lines regardless of what had been "guessed" (or obtained from the system). You can always come back to the guessed maximum by going back first to some height which you know is smaller than the screen but high enough for your current number of split windows (in any tabpage, even other than the current one). (Trying to set 'lines' too low gives you an error; you get the minimum possible and anything after that in the same :set command is not processed.)

Which GUI flavour are you using under Linux? I'm using gvim with GTK2-GNOME GUI. It can be seen near the top of the output of :version, just before the list of features present or absent by virtue of compile-time settings.


Best regards,
Tony.
--
"If you wants to get elected president, you'se got to think up some
memoraboble homily so's school kids can be pestered into memorizin' it,
even if they don't know what it means."
                -- Walt Kelly, "The Pogo Party"

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui