Tony Mechelynck wrote:
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

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.

I can confirm this - if I create a .gvimrc file containing
"set lines=999" I get a gvim window that fits the height of the screen.

This is because during the startup process, when lines is set from .[g]vimrc, set_num_option will not call set_shellsize, because gui.starting is true. However, later on after .[g]vimrc has been loaded, gui_set_shellsize does get called with the fit_to_display parameter set to TRUE, so it limits the window height to the display size even though a larger value for lines was set earlier.

However, this isn't sufficient for my use case, because I am wanting to expand the height from a custom command run using the -c command line option, which happens after the GUI has started up, so I just get an extremely tall window that extends below the bottom of the screen.

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.
> [...]

I have not been able to duplicate this - anytime I set lines to 999, I get a very tall window - even if I set it to 25 and then to 999 in the same command.

Which GUI flavour are you using under Linux? I'm using gvim with
GTK2-GNOME GUI.

I am using gvim with the plain GTK2 GUI (not GTK2-GNOME).

Best regards,
Tony.

Cheers,

Daniel

--
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