Setting exteKeys in tmux prints raw keys codes in neovim #5924
Replies: 6 comments 4 replies
-
has anyone found a workaround for this? |
Beta Was this translation helpful? Give feedback.
-
What is
My guess is that the new-line characters are being encoded with modifyOtherKeys or the Kitty keyboard protocol, and Neovim doesn't support that unless it enabled it. |
Beta Was this translation helpful? Give feedback.
-
For my case, I'm using nvim inside of tmux with Ghostty. By default, it could not register the key in nvim, hence I will need to add the following config to my tmux config:
key works in nvim with the config, however, when I copy something like the following text:
And paste with Previously I was using iTerm2, it did not give me issue, I'm not sure where to start figuring out what caused this. I'm aware of bracketed pasting, but this issue only happens if I use |
Beta Was this translation helpful? Give feedback.
-
I think this is happening because tmux supports fixterms but not Kitty keyboard protocol. Or there is a bug somewhere in between. There is an issue in tmux for supporting kitty keyboard protocol but unfortunately it's closed: tmux/tmux#3335 This is the workaround that I found, which is not great but at least works, here's a diff in my tmux.conf: -set -s extended-keys on
+# FIXME: extended-keys doesn't work with ghostty at the moment:
+# https://github.com/ghostty-org/ghostty/discussions/5924
+# https://github.com/tmux/tmux/issues/3335
+# set -s extended-keys on
+
+# This is a workaround while the extended-keys doesn't work with ghostty.
+# https://github.com/listx/syscfg/blob/ec89be49694f1befeb8a2dedaa46001632e41360/tmux/.tmux.conf#L360-L361
+# From https://github.com/alacritty/alacritty/pull/5358#issuecomment-1309433644
+bind-key -T root C-S-j send-keys Escape "[106;6u"
+bind-key -T root C-S-k send-keys Escape "[107;6u" So basically I had to remove the |
Beta Was this translation helpful? Give feedback.
-
I can confirm this after doing the same setup as OP. On the other hand, forgiving my naive question: What are those neovim keybinds you're using that need |
Beta Was this translation helpful? Give feedback.
-
Hi~ It seems that I have found a workable solution for the title. In short, you have to make sure your conda uninstall tmux
brew install tmux -s --HEAD And make sure I hope this can work for OP and people in this thread. EDIT: I should quote a line from the tmux project here. In short, we have to be patient on the next release (
I will put some links below in the details if you're interested in what I found/learned along the way, and the exact commit hash that tmux started to work: Neovim added support for Super and Meta modifiers for TUIneovim/neovim#24357, which was introduced in 2023/7. Someone contributed to tmux to support "mode1", "mode 2" key-encoding(I'm not sure whether this is related to "tmux's support for kitty's keyboard protocol" tho, but quoting for reference.)
The release was on 2024/9. From here, I also believed that there might be some inconsistency between Neovim or tmux regarding the encoding. There was a problem similar to the one here, and the author said the patch was not included in
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am using tmux with ghostty and have set the
set-option -g extended-keys always
to ensure that the modifier keys likeShift
andCtrl
are correctly recognised and work inside neovim.This work fine where the neovim mappings for
Shift
andCtrl
work correctly however I am noticing a weird side effect of setting the ``set-option -g extended-keys always` that whenever I paste something inside neovim within a tmux session it prints raw keys codes along with it.For example the below text
when pasted in neovim within tmux is rendered as
Doing quick check show that ghostty does not have support for
extkeys
and hence this issue seems little obvious.So I was wondering if there is a way to fix this or is this support planned for future ?
Beta Was this translation helpful? Give feedback.
All reactions