shpool: Key bindings don't work inside neovim session when using kitty as a terminal

What happened

When I run neovim inside a shpool session, the shpool key bindings don’t work.

I’ve tried the default key binding for detaching, as well as changing the default to Ctrl-a d and Ctrl-b d, but no matter which key binding I use, neovim still interprets the key binding rather than shpool.

The key bindings work fine once I exit neovim.

What I expected to happen

I expected the session to detach when I press shpool’s detach key binding.

To Reproduce

  1. Start the shpool user service
  2. Run shpool attach -f test
  3. Run neovim inside the shpool test session
  4. Observe how the shpool detach key binding doesn’t work

Version info

shpool 0.6.2

Logs

Nothing appears in the log when I press the key binding inside neovim. If I exit neovim and press the key binding, then I do see:

daemon.info shpool[2094806]: 2024-07-07T21:18:03.763689Z  INFO ThreadId(57) client->shell{s="test" cid=12}: Detach keybinding action fired
daemon.info shpool[2094806]: 2024-07-07T21:18:03.763736Z  INFO ThreadId(57) client->shell{s="test" cid=12}:action_detach: new
daemon.info shpool[2094806]: 2024-07-07T21:18:03.834319Z  INFO ThreadId(56) reader{s="test" cid=12}: disconnect, shutting down client stream
(...)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 21 (14 by maintainers)

Most upvoted comments

As a workaround, I’ve found you can just double-up the escape sequence in your nvim bindings. For instance I use <C-a> d to detach from the shell:

map({ "n", "v", "i" }, "<c-a>d", function()
    vim.cmd("!shpool detach")
end)

Actually, we can probably just create a Parser from the vte crate and attach it to the output stream. It contains a terminal-escape-sequence focused state machine that should do what we want for data coming out of the shell process. We already depend on vte, so it won’t even be a new dep. I’m not sure if that helps us with escape sequences being generated by the terminal though, and while in kitty mode those contain numbers we need to handle.

Oh yeah I see that now, sorry didn’t read your post closely enough. I would still like to get the full logs I requested. There isn’t much I can do to diagnose the issue without them since disconnect works fine for me when I’m in a neovim session.