Oni does not receive Ctrl key sequences for my MacBook user
I have a strange issue on my MacBook. The Control key does not seem to get into Oni when I type so it's not usable (no Ctrl-[, Ctrl-d, etc...). Now, this is kinda strange and I'm not sure if related to this repository, but maybe one of you has an idea.
Why not related? Because it also happens on VimR. This makes me think it's Electron related, but I didn't check it with another Electron app yet (please suggest a non-neovim frontend app, I'm not familiar with many "Electrons").
Deleting all kinds of ~/.electron did not help same as installing electron globally, which I think it not related at all.
It's also strange that Control does work with VSCode, and AFAIK it's also an Electron app.
To make things even stranger, I have another user on my MacBook and on that user... Oni does receive the Control and everything works! -sign-
In Oni, I tried to "decorate" the onkeydown (or similar name) function with a console.log using the integrated DevTools. It was kinda wacky but I managed to see keys like "m-a" for example for Meta I suppose, but when I Ctrl-a it was only "a" in that log.
So... I hope an Oni developer might have an idea, at least how to debug this further. I really want to use Oni as my main editor, it looks really promising.
Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.
Thats very odd!
I wouldn't expect its Electron related, since VimR is actually built on Swift I think. That and like you've said VSCode is and it seems to work....
Oni does have some built in debug logging you could check - If you stick Oni.log.enableDebugLogging() in the dev tools console, you should get some extra logging. It sounds like you added your own version of this already, but may still be helpful to see what our keyboard resolver sees.
You'd expect something like this :

Hopefully that would give us something more to go on.
@amireldor Do you have a lots of customizations on your init.vim? This problem happening on VimR might indicate some issue there...
Or a custom input method, neovim installation, etc...
@CrossR - I'm attaching three screenshots with Control, Alt, and Command tested with "[" or "a". It seems like only Command (meta) is being resolved with the pairing key ("a" in the screenshot). The Control and Alt modifiers both resolve to a single "[" instead of "c-[" (I assume that's what it should show).
@badosu - My init.vim is not being loaded currently. My Oni is pretty much tabula rasa.
Sorry for the height of this comment.
Hey friends, does anyone have any clue? I'd really like to try Oni as my main editor.
While I can try it with my other Mac user and my home Windows' user, the place I do most of my coding is in my Mac's work-user. There it will be the best testing ground for me with Oni.
Oops sorry, got caught up with a deadline!
You are correct that it should be being resolved to C-[ as far as I know, and on my machine I can see it is being resolved as that. As for a reason...I'm not too sure.
I don't know if @bryphe has any ideas for this, but it is very odd that it is being picked up as CtrlKey: true and the bracket is being picked up, but not as C-[.
The only thing that stands out to me is that the auto closing pairs logging is in the first one for some reason. Perhaps its worth trying setting "autoClosingPairs.enabled": false, in your config just to check if that changes anything. I wouldn't expect so since I have that enabled on mine, but I am on Windows rather than mac, so perhaps its worth seeing.
Hello again. I tried the autoClosingPair trick, but still the C-[ didn't work. Well... it doesn't work with mappings such as C-w as well so it's not bracket-only-related.
Are there any config folders besides ~/.config/oni that I might need to delete or reset?
I'm trying to think of any utility I might have installed on my Mac that is not installed on the other Oni-working user as well.
I'll be happy if anyone thinks of something that might cause this bug and if so then how I can try to eliminate possibilities of what might be causing this.
Hello again. I tried the autoClosingPair trick, but still the C-[ didn't work. Well... it doesn't work with mappings such as C-w as well so it's not bracket-only-related.
Thats true....I guess it can't the brackets then.
I'm running out of ideas of what could be causing this, it is odd.
All config is kept in ~/.config/oni/ so deleting that should be enough.
It sounds like it could be something specific to your machine...Have you rebound keys at all? Though if vscode is able to resolve the keys, that makes it even more confusing.
Hi @amireldor - here's a couple other ideas to try in the console - my guess is, based on the logging, it has something to do with the language / keymap settings.(these impact how we decide to resolve a keypress).
Could you please run these commands in the console and share the output?
require("keyboard-layout").getCurrentKeyboardLanguage()require("keyboard-layout").getCurrentKeyboardLayout()require("keyboard-layout").getCurrentKeymap()["BracketLeft"]
This gives us visibility into the current language / layout, as well as what our keyboard-mapping package sees as the info for the BracketLeft key. Based on what you mentioned at the top - my guess is that the users have different keyboard layouts/mappings that are impacting this - but this can help us confirm. Would be interesting to compare this output with your other user that works correctly, too!
sigh
This is strange. I'm trying to <C-p> to pop up the fuzzy search dialog but nothing happens. <C-S-p> however works! In the Oni.log.enableDebugLogging() I can see the problematic keybinding do resolve as <c-p>.
It's probably a different issue.
@bryphe the commands with the require(...) seem to yield the proper keymap and layout I'm using.
I'll try the other Mac user soon to see if I get this there too.
I tried to disable init.vim and useDefaultConfig and delete ~/.config/oni etc...
Oh, sorry, it's CMD+p on Mac. Sorry. I think I can start playing around now. Thanks.