vimr icon indicating copy to clipboard operation
vimr copied to clipboard

Support `gui_running`

Open orip opened this issue 8 years ago • 4 comments

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

orip avatar Jun 26 '17 09:06 orip

There's gui_vimr flag as described in the wiki.

qvacua avatar Jun 26 '17 16:06 qvacua

Awesome, missed it

orip avatar Jun 26 '17 16:06 orip

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

cweagans avatar Nov 15 '17 04:11 cweagans

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

goerz avatar Mar 23 '19 20:03 goerz