Thursday, September 17, 2015

Re: gvim on cygwin/xfree inherits height of xterm

On Fri, Sep 18, 2015 at 2:58 AM, Paul <Paul.Domaskis@gmail.com> wrote:
> On Thu, Sep 17, 2015 at 5:10 PM, toothpik <toothpik6 <at> gmail.com>
> wrote:
> ! try putting
> !
> ! -geometry 95x45
> !
> ! as a startup option (or whatever numbers seem appropriate for you)
> ! -- see
> !
> ! :h gui_x11
> !
> ! for an explanation
> !
>
> Hmmm, that works pretty good. The default (from the non-cygwin gvim)
> seems to be 80x25. However, I think it might be beneficial to avoid
> X11 specific approaches simply because I have a bad habit of using
> both X11 and Windows gvims. I appreciate the idea and knowledge,
> though.
>
> Tony Mechelynck <antoine.mechelynck <at> gmail.com> writes:
> ! You could also (instead of -geometry which is not recognized on
> ! every GUI flavour on every platform) set 'lines' and 'columns' in
> ! your gvimrc if you have one, or between "if has('gui_running')" and
> ! the corresponding endif in your vimrc. For instance, to have gvim
> ! start in fullscreen (or a fraction of a character cell inside
> ! fullscreen):
> !
> ! if has('gui_running')
> ! set lines=999 columns=9999
> ! endif
> !
> ! has('gui_running') will be zero when remaining in console mode, and
> ! nonzero (probably 1) in GUI mode, or when starting in order to go to
> ! GUI mode. In the latter case, 'lines' and 'columns' (and 'guifont'
> ! and…) are remembered, and used once the GUI has started. This
> ! mechanism is common to all Vim GUI flavours on all platforms.
>
> Interesting. My decades old vimrc script uses has("gui"). Looks like
> things have gotten much more sophisticated.
>
> ! Vim will not let 'lines' and 'columns' exceed what is possible on
> ! your screen: for instance, I set them as above in my vimrc, and
> ! after gvim has started (and taking my 'guifont' into account), I
> ! find myself with lines=68 columns=180 which fill my X11 1280x1024
> ! display nicely.
> !
> ! See
> ! :help 'lines'
> ! :help 'columns'
> ! :help feature-list (read §2 then scroll down to gui_running)
>
> I like this solution. I will stick it into gvimrc and conditionally
> set lines/columns if has("gui"). If the running vim doesn't
> has("gui"), then it is a text terminal, and things will look saner
> if lines/columns was inherited from the text terminal.
>
> Thank you, Tony.
>

has('gui') means "compiled with GUI capability". On Unix-like
platforms (but not on Windows) it is possible to use a single
executable binary as both vim and gvim (with the help of symlinks
and/or command-line switches). It will have has('gui') on in both
cases, has('gui_running') on when it knows it is (or will soon be) in
GUI mode and off otherwise, and of course it doesn't source the gvimrc
when starting in Console mode. Of course a console-only Vim (where
has('gui') is zero) will never source a gvimrc (unless, of course, you
mistakenly specifically order ":source ~/.gvimrc" at the console or in
a script).

Best regards,
Tony.

--
--
You received this message from the "vim_use" 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: