-
-
Notifications
You must be signed in to change notification settings - Fork 807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wezterm preventing CTRL
+ /
from entering vim
#3180
Comments
Some quick notes here. I tested this on a windows machine this morning and wezterm performs as expected (passing the correct keycode into vim). So this may be something related to how key codes are handled in wezterm in relation to linux (if that helps narrow anything at all down) |
Things to try:
|
I will try that tonight when I get home!
I am using the standard US English keyset |
Here is the
|
Another quick update, this also happens in an Ubuntu 20.04 virtual machine (running on a different host). I suspect this is related to linux in general :( |
More interesting behavior. If I launch Don't know if that means anything but its interesting |
I'm currently encountering what I think is the same issue (running Pop OS and latest nightly wezterm:
|
Well how about that, that work around keys = {
{key="/", mods="CTRL", action=wezterm.action{SendString="\x1f"}},
} Worked :) I assume this will break down when running this on windows? |
I haven't had bandwidth to look at this in depth, but wanted to note that keyboard behavior can vary based on the encoding, and that Windows has a special win32 input mode that complicates things
Windows: likely a completely unrelated issue, and one that might be resolved by #2235 which I haven't had bandwidth to follow up on either. |
OK, I checked into this and wezterm behaves like xterm here, which is the intended behavior. The background is:
You can replicate the behavior yourself in xterm: $ printf "\e[>4;2m"
$ od -c Then if you press ^[[27;5;47~ So... what should you do? I think this might be either an nvim configuration issue, or possibly an nvim bug, if it doesn't see through that encoding. I saw this: which sounds sort of similar, although kitty doesn't appear to encode CTRL-/ the same way as xterm on my mac. If you open nvim in xterm, what behavior do you see? |
So just to clarify, my Linux machine is running Pop OS which I believe uses gnome-terminal (mentioning this because I think it's similar to xterm, but I'm not 100% sure). In Neovim on gnome-terminal |
Can you try with xterm? wezterm is modeled after xterm, not gnome-terminal |
Sure. Tried it with xterm and Neovim is again only registering the |
in nvim: Do the same in regular vim, it renders as I think this is a vim default mapping problem rather than a problem with anything else. |
I tried what the OP did in that Neovim issue you linked (changing the |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
@wez IMO this shouldn't be closed as there is no resolution for this yet. We do have a workaround for it, but the issue still persists without the workaround. |
I don't believe that there is anything to change in wezterm. It is working the same way as xterm, which is the intent. |
Hmm. I suppose if that is the goal (to emulate how xterm works), that makes sense. However from an end user perspective this still feels "wrong" if that makes sense. Sometimes the 2 don't meet though I suspect this kind of expectation vs reality mismatch (in relation to key chords) will occur more frequently as wezterm becomes more popular. Maybe worth putting some sort of FAQ doc somewhere to indicate how to address these kinds of "new comer" issues? That might actually exist on the wezterm doc somewhere, I don't know. |
The way I see it:
I'm open to having something get added to the FAQ to explain to folks how they can configure vim for this case; would you like to draft that? I don't use that key combination in vim and I don't really know what a good concrete example of its use might be. |
Nifty! I figured that was somewhere. Ya I can slap something together. I'll add a comment on this thread with it when I get it done. Probably tomorrow, its getting late here tonight |
How's this?
|
There's some nuance missing, and I think the solution is at the wrong layer; you don't (and shouldn't!) need to override the encoding in wezterm if the issue is that vim doesn't do anything with that key press. Try this in vim:
Pressing What do you typically assign |
I was so very confused for a moment. Initially I was like "Wait Wez, we can't do what you are asking, that is literally what this issue is about". But then I tried it and it worked. Digging into my neovim config, I find this vim.keymap.set('n', '<C-_>', ':lua require("Comment.api").toggle.linewise()<CR>', {silent = true})
vim.keymap.set('i', '<C-_>', '<ESC>:lua require("Comment.api").toggle.linewise()<CR>i', {silent = true})
vim.keymap.set('x', '<C-_>', '<ESC>:lua require("Comment.api").toggle.linewise(vim.fn.visualmode())<CR>', {silent = true}) So I am (finally) now understanding what is going on here. Yes, this can be rectified in a vim config, though So you are correct that the fix is something that can be done in vim land based on the terminal (working through how to figure that out right now). I will add a new comment to this thread with an updated set of FAQ text (probably with both vimscript (vim) and lua (neovim) solutions to the problem) |
The heart of this issue is that certain key combinations are, in the default terminal encoding scheme, ambiguous and low-fidelity. When a terminal fully implements If you had configured an application to use |
I could be missing something, but wanted to say that I agree that the solution is probably just a disclaimer to Vim/Neovim users that have a keymapping for Looks like @miversen33 had set
Is that right? |
It's more complex than Linux vs Windows. On Windows you may be using win32 input mode which is also capable of encoding If you must collapse this to a simple rule where you don't want to understand the reasons behind it, I would summarize it as:
|
What Operating System(s) are you seeing this problem on?
Linux X11
Which Wayland compositor or X11 Window manager(s) are you using?
X11 with Gnome Shell
WezTerm version
20230219-070657-23211fc8
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
I don't really know how to word this so I will simply describe the behavior I am seeing vs what I see in other terminal emulators
In Wezterm, if I open vim, enter
insert
mode, and pressCTRL+/
, vim inserts/
into the editor. This is not the correct key combination, instead I should see^_
(I can't remember what this key code actually is, but regardless).In Alacritty/Konsole/Windows Terminal, this operation performs correct (
^_
is inserted into the buffer as opposed to/
)To Reproduce
CTRL
and/
at the same time/
Configuration
return {}
Expected Behavior
Properly pass uncaptured key events to underlying programs
Logs
Anything else?
Interestingly
showkeys -s
does not show differing behavior with how wezterm and other terminals are handling this keypress so I don't really know what is going on here.The text was updated successfully, but these errors were encountered: