vhakulinen / gnvim

GUI for neovim, without any web bloat
MIT License
1.84k stars 69 forks source link

`g:gnvim` is not defined anymore #208

Closed p00f closed 1 year ago

p00f commented 1 year ago

I want to check if gnvim is running before setting winbar, but g:gnvim is not defined anymore

vhakulinen commented 1 year ago

About that.

The old gnvim version did set that variable out of old habits, but when rewriting for 0.2 I noticed this in the neovim documentation

Call |nvim_set_client_info()| after connecting, so users and plugins can detect the UI by handling the |ChanInfo| event. This avoids the need for special variables and UI-specific config files (gvimrc, macvimrc, …).

https://github.com/neovim/neovim/blob/07883940b2294e0ab32fb58e6624d18d9dd1715a/runtime/doc/develop.txt#L457-L459

Since gnvim calls nvim_set_client_info with a proper name, you should be able to detect when gnvim connects to neovim using the ChanInfo autocmd (or even UIEnter? dunno).

Personally, I would prefer to have the g:gnvim variable set but I also want to follow the neovim guidelines.

Also ref https://github.com/neovim/neovim/issues/3656#issuecomment-417846295

diamondburned commented 1 year ago

What should the config snippet be now?

I was referring to https://github.com/vhakulinen/gnvim/issues/97#issuecomment-536731701, however it seems au UIEnter also makes it run in the terminal.