Vimr: Support `gui_running`

Created on 26 Jun 2017  路  5Comments  路  Source: qvacua/vimr

It would be nice to be able to detect vimR running in the rc file, like gvim / MacVim support. For example:

if has('gui_running')
  " set a special colorscheme
endif

A common alternative - hooking the GUIEnter event - also doesn't work:

autocmd GUIEnter * colorscheme elflord

Most helpful comment

FWIW, I'd like to see vimr support gui_running as well for consistency with other vim GUIs.

All 5 comments

There's gui_vimr flag as described in the wiki.

Awesome, missed it

FWIW, I'd like to see vimr support gui_running as well for consistency with other vim GUIs.

The goyo plugin uses has('gui_running') to detect which highlights it has to set to create its "distraction free" writing environment, cf. https://github.com/junegunn/goyo.vim/blob/057fe68e442e7d4ffa45a3c992389e19e64abc7c/autoload/goyo.vim#L36

As a result, Goyo inside VimR doesn't realize it's being run in a GUI, which causes problems like this:
https://github.com/junegunn/goyo.vim/issues/71

In principle, that line in the goyo plugin could be modified to include has("gui_vimr"). However, while it's fine to have has("gui_vimr") to detect VimR specifically, I would strongly suggest that has('gui_running') should also be true: It's a standard flag, and plugins (goyo or others) depend on it. Plugins can't possibly anticipate a custom flag for every possible vim GUI program.

Incidentally, this problem seems to be a regression: goyo works fine with VimR Version 0.24.0 (282), but not VimR Version 0.26.8 (311).

A layman in vimscript here: is there some way to set this myself while this issue is not handled by vimr?

A lot of plugins only rely on gui_running...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hobbes3 picture hobbes3  路  4Comments

numbcoder picture numbcoder  路  3Comments

TravisDart picture TravisDart  路  7Comments

hakamadare picture hakamadare  路  4Comments

tjdoc picture tjdoc  路  6Comments