The vimrc is sourced by both gvim and Console Vim; however, not every
console terminal can be resized by the program running in them. In those
which can't, weird things can happen if you try; and even if your
terminal can be resized, I supposed you'll probably prefer to resize it
by methods external to Vim, such as dragging one corner of the xterm,
konsole, gnome-terminal, Terminal.app, cmd.exe or similar window.
Therefore I recommend wrapping that command as follows:
if has('gui_running')
set lines=48 columns=80
endif
in order to only apply the ":set" command when we already know that we
are starting the GUI.
Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
207. You're given your one phone call in prison and you ask for a laptop.
Some terminal emulators can be resized (not that I'd recommend it); if
run in that kind of terminal, Console Vim can resize it.
Best regards,
Tony.
--
Gosh that takes me back... or is it forward? That's the trouble with
time travel, you never can tell."
-- Doctor Who "Androids of Tara"
> I was aware of Vim reading the .vimrc file and I never expected Vim to
> resize
> my terminal window because of those options. I was expecting, on the
> other
> side, that that line was considered only in the GUI case. The fact
> that those
> lines are read and cause a weird behaviour should be avoided, since
> weird
> behaviours are always undesirable.
Those options predate the GUI. They come from the original vi, and
were used to allow users to tell vi how large a screen it was running
on. With the introduction of the GUI in Vim it became possible for
setting those options to change the size of the window, but they still
need to be available in the non-GUI environment so people can tell Vim
how much space is available to it. If you set them to values that
don't match the real terminal size there's not much Vim can do about
it except trust that you know what you're doing.
--
Matthew Winn
I discovered when running vim in an xterm under KDE that setting
'lines' and 'columns' resizes the xterm, so these settings are not
just for gvim and for adjusting vim to the size of the terminal.
Regards,
Gary