qvacua / vimr

VimR — Neovim GUI for macOS in Swift
https://twitter.com/VimRefined
MIT License
6.61k stars 218 forks source link

Support `gui_running` #476

Open orip opened 7 years ago

orip commented 7 years ago

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
qvacua commented 7 years ago

There's gui_vimr flag as described in the wiki.

orip commented 7 years ago

Awesome, missed it

cweagans commented 6 years ago

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

goerz commented 5 years ago

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

lourenci commented 4 years ago

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