neovim-gtk icon indicating copy to clipboard operation
neovim-gtk copied to clipboard

Fails to initialize Neovim when `Guifont` called in `.vimrc`

Open bk2204 opened this issue 1 year ago • 0 comments

Describe the bug

When running neovim-gtk with 0.9.4 or nightly installed, with the below .vimrc (tested using nvim-gtk -- -u FILE), Neovim fails to initialize with the error messages below. Note that this problem does not occur with 0.7.2. I don't believe the font is relevant; using monospace:h12 triggers the problem just as well.

I believe the problem is related to the fact that the newer versions set gui_running. I use a .vimrc that's shared between Vim and Neovim, so I used to have a branch for gvim (has("gui_running")) which simply called my SetGUIOptions function, and a branch for Neovim which did that on UIEnter.

Obviously I can change the order, but it seems less than ideal for neovim-gtk to hang when Guifont is invoked during startup. I should note that Neovim-Qt with 0.9.4 simply complains about the lack of Guifont, so it doesn't appear that this is an intrinsic limitation of newer versions of Neovim. If this isn't supported, an error is much more welcome than a hard-to-debug hang.

Error messages below:

[2023-12-06T00:08:21Z ERROR nvim_gtk::file_browser] Couldn't get cwd: Elapsed(())
[2023-12-06T00:08:21Z ERROR nvim_gtk::file_browser] Couldn't populate tree: No such file or directory (os error 2)
[2023-12-06T00:08:31Z ERROR nvim_gtk::subscriptions] Error manually running SubscriptionHandle { key: SubscriptionKey { event_name: "BufEnter", pattern: "*" }, index: 0 }
thread 'tokio-runtime-worker' panicked at 'Neovim request None timed out', src/nvim/ext.rs:45:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2023-12-06T00:08:41Z ERROR nvim_gtk::subscriptions] Error manually running SubscriptionHandle { key: SubscriptionKey { event_name: "BufEnter,BufFilePost,BufModifiedSet,DirChanged", pattern: "*" }, index: 0 }
thread 'tokio-runtime-worker' panicked at 'Neovim request None timed out', src/nvim/ext.rs:45:21
thread 'tokio-runtime-worker' panicked at 'Neovim request None timed out', src/nvim/ext.rs:45:21
thread 'tokio-runtime-worker' panicked at 'Neovim request None timed out', src/nvim/ext.rs:45:21
thread 'tokio-runtime-worker' panicked at 'Neovim request None timed out', src/nvim/ext.rs:45:21
thread 'tokio-runtime-worker' panicked at 'Neovim request None timed out', src/nvim/ext.rs:45:21
thread 'tokio-runtime-worker' panicked at 'Neovim request None timed out', src/nvim/ext.rs:45:21
[2023-12-06T00:08:51Z ERROR nvim_gtk::subscriptions] Error manually running SubscriptionHandle { key: SubscriptionKey { event_name: "OptionSet", pattern: "completeopt" }, index: 0 }
[2023-12-06T00:09:01Z ERROR nvim_gtk::subscriptions] Error manually running SubscriptionHandle { key: SubscriptionKey { event_name: "OptionSet", pattern: "background" }, index: 0 }
[2023-12-06T00:09:11Z ERROR nvim_gtk::subscriptions] Error manually running SubscriptionHandle { key: SubscriptionKey { event_name: "DirChanged", pattern: "*" }, index: 0 }
[2023-12-06T00:09:11Z ERROR nvim_gtk::error] Can't initialize nvim: TimeoutError(Elapsed(()))

.vimrc:

function! s:SetGUIOptions()
  " If we're in a Neovim GUI, such as Neovim-GTK…
  if has("nvim")
    Guifont SourceCodePro:h12
  endif
endfunction

if has("gui_running")
  call <SID>SetGUIOptions()
endif

Technical information (please complete the following information):

  • OS: Debian unstable and Ubuntu mantic (23.10)
  • Neovim version: 0.9.4 from Debian repository, Ubuntu nightly version from Ubuntu Neovim unstable PPA
  • Neovim-Gtk build version: 50f27f5a06582a7fb6b9fa03ca5f2d21d466c181 (current HEAD)

bk2204 avatar Dec 06 '23 00:12 bk2204