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
CMD + SHIFT works as CMD only #1237
Comments
See #992 (comment). |
Partly closed by #1483. |
This should be fixed by #1899, it would be great if you can test that. |
@fredizzimo It doesn't seem to be fixed in 340571b. On Mac OS, I have this pair of key bindings: vim.keymap.set("n", "<D-]>", "gt")
vim.keymap.set("n", "<D-[>", "gT") They get triggered when pressing either ⌘-[ or ⌘-shift-[. On the other hand, if I write them as follows, neither key combination will trigger them: vim.keymap.set("n", "<D-S-]>", "gt")
vim.keymap.set("n", "<D-S-[>", "gT") |
@MultisampledNight I don't think the bug is resolved, #1237 (comment) is still true. |
I don't think that the issue that @mgax reported be fixed, unless we get a list of mapped keys from Neovim itself and choose which one of the mappings should be used. Otherwise, we need to know if pressing shift contributed to the character or not, and that's not some information we have. Currently we always assume that it contributes to it. There are two conditions where you should be able to map
Edit: I realized that there's another way of resolving it, but that has to be an option. Some users have requested the ability to use the base virtual keycode in the mappings #1899 (comment), without any kind of translation to the language actually used. In that case you would always have to use the base character + all modifiers for your mappings. But this is not supported by winit at the moment either. |
Would this work for
Makes sense. FWIW I'm happy with the current implementation, and don't have a need to distinguish between shift and no-shift key bidings, because my muscle memory is command-s to save the file, and command-shift-[ to switch to the previous tab, and both work, even if the key binding is slightly different than what I type. |
Yes, it should, but we probably need rust-windowing/winit#2887. On other plarforms we are able to do similar mappings. |
It seems like winit might not be reporting the shifted character at all in combination with neovide/src/window/keyboard_manager.rs Lines 119 to 134 in eeac6e7
|
Can someone confirm I am understanding this problem correctly? To map to, say, command-shift-p:
This doesn't seem to work for me. I've tried the same mapping, except with control, and the same result:
I'm currently on de22d0c |
@technicalpickles, I suspect that the problem is that neovide/src/window/keyboard_manager.rs Lines 89 to 96 in 8944541
Another possibility is that it takes the following branch, even if neovide/src/window/keyboard_manager.rs Lines 81 to 86 in 8944541
|
I can confirm, both command-r and command-shift-r are returned as
Nope, a |
It looks like it's more complex than I thought, the other platforms are actually not working correctly either in all cases. Nvim itself treats For some reason I also can't get any number keys plus control to work on Windows, that's this bug rust-windowing/winit#2898, I thought I tested it before and it worked for almost all numbers, but maybe I only did on Linux. So I think I need to re-think the control and cmd mappings completely. |
Could someone do some testing in combination with #1962, and attach the log here? That should give us more information to report the bug to Winit, and possibly about a workaround on the Neovide side. It would be good to test with both Note that I was wrong about the mapping of CTRL. for CTRL+SHIFT+alpha mappings. You should always include |
I just tested the branch with
And
|
I also got another log
I think that's enough I need to report the bug to the Winit team But @technicalpickles also reported that Ctrl+shift does not work, so I think it would be good to get a a similar log with that as well before reporting. We do have enough information to work around the bug, if we send |
This commit fixes it. Happy to open a PR, although the fix is a bit tactical and I'm not sure if you'll accept it (good enough for me until this gets resolved upstream). The problem is, I think, just the logic in |
No that's not the problem, but it's the last resort workaround we have. We should get the shifted character from winit, like we do in combination with other modifiers and on other platforms than macOS. Otherwise, it will only work for alpha keys, Neovim has no idea what a shifted number means for example. Before this workaround gets accepted, we should report the issue upstream and get at least a response from them that it's not possible to do. If someone wants to do that, feel free to do so, but personally I am waiting to get logs for the @technicalpickles wrote that |
Another reason why the patch is problematic is that with the fix you have to map like this |
Ah, I beg to differ. First, when it comes to the command key, there isn't a right answer actually. Since there is no official spec, let's just take a look what the popular macOS (n)vim GUIs do on cmd+shift+f
(curiously, we have all the combinations now) I'd take any of the first three, and since I'm trying to maintain most popular GUIs working on most OSes, I'm actually handling all of them in my config. It's a bit messy, I know, apologies :) It could be argued that I'd also like to point out that a |
MacVim is correct and that’s what Neovide should send too unless it’s impossible. Neovim-qt also sends an acceptable code, and for ascii characters, I’m pretty sure both of those mappings can be used interchangeably in Neovim. So we should report the bug upstream, so that we are able to send the same, before making any workarounds. And I will do that, as soon as I have all the required information to do so.
This is documented in intro.txt, but only for CTRL
So, |
Well, fair enough. Is it reasonable to ask, though, that unless this is fixed in winit for the next Neovide release, we get the very wrong solution instead of the no solution? Apart from that, since I have a Mac, and would love not to have to build Neovide from source, I'm very happy to do whatever you need in order to report/fix/test the wininit issue. I would just need some instructions on what to do. |
Yes, if we for some reason don't get a response from the Winit team or if it's more difficult than expected for them to fix, then we can look at alternative solutions.
Neovide main generates log events like this #1237 (comment), when you run it from main with Since it was reported that other modifiers behave the same way, I need similar logs for other modifiers, ctrl for example in combination with shift, so that all of it can be reported and fixed at the same time. And so that we also can report what works and what doesn't work. Note that for |
I reported the issue here now rust-windowing/winit#3078 with incomplete information, please fill in any details there if needed. |
If someone is able to help the Winit team debug and perhaps even fix the code, we can probably get this moving forward faster. I guess you could start by compiling winit from source and adding logging here https://github.com/rust-windowing/winit/blob/master/src/platform_impl/macos/event.rs#L111. If that does not give any results, then I guess we need to debug neovim-qt and/or MacVim, to see how they get the uppercase characters. I quickly tried to inspect the source code, but I didn't find anything special. But a debugger and/or logger should be able to reveal how. |
I just reported a Neovim issue that is related neovim/neovim#25068 (but not the cause of this). It just makes it different to map things with I might actually go ahead and make a similar fix it as part of fixing this #2017 (comment). But if I go and do that, there might be another breaking change in the future when Winit is updated, if the Neovim issue is not also fixed before that. |
Since there was another keyboard issue, which will require extensive testing, I combined it with a partial fix for this issue in this PR #2018. The advantage of the solution I chose is that it will continue working, even if it's actually gets fixed in Winit later on, without breaking user mapping, and it then also works correctly with non-alpha mappings. So please, test it if you can. You should always use the form NOTE: The reason why I think it's only partially working is that it likely does not work with special characters and non-ascii characters like |
Tested on mac, cmd+shift+8 produces |
|
The winit fix is now merged So, once a new release is made and we update, we should finally be able to completely close this issue. |
#2310, will finally close this. |
@fredizzimo thanks for your amazing work! I've tried neovide with winit |
Hm. this was merged and should be included, but I don't have a macOS computer myself, so I'm unable to test Maybe we also need to do something? |
@lttb, are you able to provide a log file |
@fredizzimo please let me know if I need to share more logs or data example of logs pressing `cmd+shift+f` (it seems it doesn't register S-D-f in neovim)
example of logs pressing `opt+shift+f` (registers S-M-f as expected)
|
Did you map it as |
right, that was it! I mapped it as |
Actually I think For the reason why |
I see, thank you for clarifying! do you think it makes sense to add these mapping details to https://neovide.dev/troubleshooting.html or https://neovide.dev/faq.html for example? I guess people coming from kitty might experience such issues, and probably some guidance there might help |
Yes, I think we need some documentation, I will check that after the release I'm preparing is out. |
out of curiosity, should logs
|
I think that's a bug actually. But I think it's fixed in Unfortunately, that PR has stalled, though, so I think someone else needs to take over. And it can actually be cleaned up quite much now, when we have added support for options listeners. |
Neovim 0.10 should now accept |
I can verify on my mac
that when i run neovide with this neovim config rust-tools.lualocal cargo_run = require("utils/cargo_run")
local cargo_bin = require("utils/cargo_bin")
function RustToggleInlayHints()
if vim.g.rust_inlay_hints_enabled then
vim.cmd("RustDisableInlayHints")
vim.g.rust_inlay_hints_enabled = false
else
vim.cmd("RustEnableInlayHints")
vim.g.rust_inlay_hints_enabled = true
end
end
vim.g.rust_inlay_hints_enabled = true
local custom_attach = function(_, bufnr)
if vim.fn.has("macunix") == 1 and vim.fn.exists("neovide") == 1 then
-- MacOS Keymaps
vim.keymap.set("n", "<D-S-R", RustToggleInlayHints, { silent = true, desc = "Rust Toggle Inlay Hints" })
vim.keymap.set("n", "<D-i>", RustToggleInlayHints, { silent = true, desc = "Rust Toggle Inlay Hints" })
vim.keymap.set("n", "<D-m>", ":RustExpandMacro<CR>", { silent = true, desc = "Expand Rust Macro" })
vim.keymap.set("n", "<D-y>", ":RustParentModule<CR>", { silent = true, desc = "Rust Parent Module" })
elseif
vim.fn.has("unix") == 1 and vim.fn.exists("neovide") == 1
or vim.fn.has("win32") and vim.fn.exists("neovide") == 1
then
-- Windows and Linux Keymaps
vim.keymap.set("n", "<M-r>", cargo_run, { silent = true, desc = "Rust Run App" })
vim.keymap.set("n", "<M-w>", cargo_bin, { silent = true, desc = "Run All your Installed Cargo Commands" })
vim.keymap.set("n", "<M-y>", ":RustParentModule<CR>", { silent = true, desc = "Rust Parent Module" })
vim.keymap.set("n", "<M-i>", ":RustToggleInlayHints<CR>", { silent = true, desc = "Rust Toggle Inlay Hints" })
vim.keymap.set("n", "<M-m>", ":RustExpandMacro<CR>", { silent = true, desc = "Expand Rust Macro" })
end
-- Universal Keymaps
-- Function keys
vim.keymap.set("n", "<F1>", ":RustRunnables<CR>", { silent = true, desc = "Rust Runnables" })
vim.keymap.set("n", "<F3>", ":RustDebuggables<CR>", { silent = true, desc = "Rust Debuggables" })
vim.keymap.set("n", "<M-r>", cargo_bin, { silent = true, desc = "Execute Cargo Bin" })
vim.keymap.set("n", "<F5>", ":RustReloadWorkspace<CR>", { silent = true, desc = "Reload Rust Workspace" })
vim.keymap.set("n", "<leader>rt", ':lua require("neotest").run.run()<CR>', { silent = true, desc = "Cargo Test" })
vim.keymap.set("n", "<leader>rr", ":RustRunnables<CR>", { silent = true, desc = "Rust Runnables" })
vim.keymap.set(
"n",
"<leader>rl",
':lua require("neotest").summary.toggle()<CR>',
{ silent = true, desc = "Test Summary" }
)
vim.keymap.set("n", "<leader>rb", cargo_bin, { silent = true, desc = "Run All your Installed Cargo Commands" })
vim.keymap.set("n", "<leader>rd", ":RustDebuggables<CR>", { silent = true, desc = "Rust Debuggables" })
vim.keymap.set("n", "<leader>rn", cargo_run, { silent = true, desc = "Cargo Run" })
vim.keymap.set("n", "<leader>rm", ":RustExpandMacro<CR>", { silent = true, desc = "Expand Rust Macro" })
vim.keymap.set("n", "<leader>rH", ":RustEnableInlayHints<CR>", { silent = true, desc = "Show Rust Inlay Hint" })
vim.keymap.set("n", "<leader>rh", ":RustDisableInlayHints<CR>", { silent = true, desc = "Disable Rust Inlay Hint" })
vim.keymap.set("n", "<leader>rf", ":!dx fmt<CR>", { silent = true, desc = "run Dioxus FMT" })
vim.keymap.set(
"n",
"<leader>ru",
":lua require('dapui').toggle(); vim.cmd('Neotree position=right')<CR>",
{ noremap = true, silent = true, desc = "Toggle Debugger UI" }
)
vim.keymap.set(
"n",
"<leader>rs",
':execute "RustStartStandaloneServerForBuffer" | LspStop<CR>',
{ silent = true, desc = "Rust Standalone Server" }
)
end
return custom_attach That This Issue Still Persists Current version of neovide im using
|
Ive enable CMD in neovide...
it works but i cant bind anything with SHIFT.
CTRL+SHIFT Works
also If i try to bind it is only registering the key as
this is not the case on other gui vim like VimR
The text was updated successfully, but these errors were encountered: