Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Set ApplePressAndHoldEnabled on macOS #1888

Open
clouds56 opened this issue Mar 22, 2018 · 18 comments · May be fixed by #2331
Open

Set ApplePressAndHoldEnabled on macOS #1888

clouds56 opened this issue Mar 22, 2018 · 18 comments · May be fixed by #2331

Comments

@clouds56
Copy link

According to the gist, on macOS, it would not treat press and hold (especially h/j/k/l) as repeat key press by default.
Should oni change the default settings of this defaults out-of-box?

@oni-bot
Copy link

oni-bot bot commented Mar 22, 2018

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.

@akinsho
Copy link
Member

akinsho commented Mar 22, 2018

@clouds56 I personally completely agree its very bizarre behaviour, I got very tripped up on that (granted I shouldn't be spamming keys but when desparate 😆 ) till we had that command added to the docs. I think in the oni.sh file which is run on macOS whilst installing, it could possibly be added, dont want to speak for every mac user but I think it'd be a great default

@CrossR
Copy link
Member

CrossR commented Mar 22, 2018

A second option could be to add a fix for it to the command palette, like we have for add to Path, and pop a notification up about it?

@akinsho
Copy link
Member

akinsho commented Mar 22, 2018

Tbh I remember it as one of my main blockers when I started using oni, which led to me often switching back to the terminal.

The notification I think is a good middle ground but would be curious to know if any mac users would prefer that.

Also I think for new users or people like me who occasionally lapse and spam keys in frustration/desperation the discoverability of the doc command (which even if placed at the top of the wiki will still depend on users actually reading the docs 😆 ) or even the path command which tbh I personally didn't discover till a month ago It can be a bit of an ?unnecessary risk for user experience if they have to run an obscure macOS command just to get vim to work normally 😢.

@clouds56
Copy link
Author

Sorry for haven't read the docs as well. After installing oni from brew cask, I struggled with Google for hours and finally find it's a macOS only issue.

Agree with @CrossR
I think if not all the users from macOS like changing defaults, at least show some notification at first startup (just like what atom does, I didn't know cmd+shift+p to open command palette until it told me)

Another option for macOS could be to simulate repeat key when receiving press and hold in normal and visual mode, and keep it as is in insert mode. (I'm not sure if it is possible)

@CrossR
Copy link
Member

CrossR commented Mar 22, 2018

Could always flip it the other way @Akin909 and apply the fix by default and have the notification go "Hey we've done this, you can disable it here" (or possibly have a button to open the cmd + shift+ p menu with that pre-typed if we add buttons to the notifications).

That way we preserve the choice but apply it by default.
Regardless (I don't use macOS so I could be wrong here) it feels like we should have the ability for the user to undo it, even if I see no benefit of it.

@tom-james-watson
Copy link
Contributor

tom-james-watson commented Mar 29, 2018

Anybody know what would the equivalent command to disable the ApplePressAndHoldEnabled for Oni only?

defaults write com.sublimetext.3 ApplePressAndHoldEnabled -bool false

E.g. what should com.sublimetext.3 be replaced with?

EDIT - after digging around it looks like it would be com.extropy.oni

@tom-james-watson
Copy link
Contributor

tom-james-watson commented Mar 31, 2018

@CrossR - just to be clear - basic text editing is completely broken without ApplePressAndHoldEnabled disabled. I don't just mean that keys won't repeat - if you hold down 'a', it will show the character accent menu, but at the same time keep inputting lots of 'a's, then if you press ctrl+c, all of those other 'a's will disappear.

I think we should definitely run the following by default.

defaults write com.extropy.oni ApplePressAndHoldEnabled -bool false

For me the editor was unusable until I ran that command.

I'm happy to make a pull request if somebody can point me to the correct area of code. I've worked with Electron before but I can't find anywhere that any kind of initialization script runs.

@EarthCitizen
Copy link

EarthCitizen commented Jun 17, 2018

I am running macOS and I do not have this problem with vimR nor with Atom (also Electron-based). I only have this problem with Oni.

@CrossR
Copy link
Member

CrossR commented Jun 17, 2018

Looks like we should be using https://github.com/electron/electron/blob/master/docs/api/system-preferences.md#systempreferencessetuserdefaultkey-type-value-macos to set the value?

@akinsho akinsho linked a pull request Jun 18, 2018 that will close this issue
1 task
@benjie
Copy link

benjie commented Jul 5, 2018

For Oni the equivalent is:

defaults write com.extropy.oni ApplePressAndHoldEnabled -bool false

@ghost
Copy link

ghost commented Sep 15, 2018

hello, solution by @benjie works for me on mac os, thanks! Maybe it would a good idea for Oni to set this setting on macs by default so newbies don't bounce off the software just because the keys don't repeat ;)

@benjie
Copy link

benjie commented Sep 16, 2018

Also I could not figure out what the equivalent was to use with the development build?

@CrossR
Copy link
Member

CrossR commented Sep 17, 2018

To my knowledge @benjie it should be the same? The small amount of work with a dev build on mac worked with the same I think, or perhaps @Akin909 remembers if there are any differences.

@benjie
Copy link

benjie commented Sep 17, 2018

I have that setting set (it works on Oni) but it didn't work for me on the development build. I probably did something wrong, but I wondered if the dev build using electron directly meant that instead of com.extropy.oni we should use something related to electron itself?

@atomdmac
Copy link

defaults write com.extropy.oni ApplePressAndHoldEnabled -bool false

I installed via brew cask and tried the solution above but it doesn't seem to have worked.

@benjie
Copy link

benjie commented Sep 24, 2018

Have you fully quit Oni after doing it?

@atomdmac
Copy link

@benjie :face_palm: I thought I had because I had run :q and the window closed but I didn't realize that the app itself was still running. After fully quitting and re-loading, it works now. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants