nvui icon indicating copy to clipboard operation
nvui copied to clipboard

nvui window does not close with latest neovim releases.

Open damanis opened this issue 2 years ago • 4 comments

Steps to reproduce:

Expected: file saved, then nvui closed Problem: nvui window isn't closed. The neovim process (ps ax) does not exist, but nvui process still exists.

It is not nvui specific, goneovim also has it, but not nvim-qt. Seems, something changed in nvim API.

damanis avatar Jan 23 '23 07:01 damanis

It relates to configuration option o.clipboard = [[unnamed]] in nvim init file. When the option is commented out, there is no problem, but it required for PRIMARY selection support.

damanis avatar Jan 26 '23 05:01 damanis

Also, the problem caused by any clipboard operation, not change/save only.

damanis avatar Jan 31 '23 09:01 damanis

At exit the /usr/bin/xsel --nodetach -i -p is called to save * register to primary selection. Same for + register (system clipboard). By default, primary selection of X application should be lost when the application exists, but neovim changed this behavior and tries save it. The workaround below prevents nvui stuck at exit.

if vim.g.nvui then
  -- Workaround: clear primary before exit
  vim.api.nvim_exec([[
    :autocmd VimLeavePre * call setreg('*', [])
    :autocmd VimLeavePre * call setreg('+', [])
  ]], false)

damanis avatar Feb 06 '23 07:02 damanis