Skip to content

Instantly share code, notes, and snippets.

@pastacolsugo
Forked from kconragan/keyrepeat.shell
Last active December 5, 2022 16:02
Show Gist options
  • Save pastacolsugo/4c6446bedb0a60ccb357f620b7a15e77 to your computer and use it in GitHub Desktop.
Save pastacolsugo/4c6446bedb0a60ccb357f620b7a15e77 to your computer and use it in GitHub Desktop.
Enable key repeat in Apple Lion for Sublime Text in Vim mode

Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key that enables you to choose a character from a menu of options. If you are on Lion try it by pressing and holding down 'e' in any app that uses the default NSTextField for input.

It's a nice feature and continues the blending of Mac OS X and iOS features. However, it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode, as it means you cannot press and hold h/j/k/l to move through your file. You have to repeatedly press the keys to navigate.

You can disable this feature system-wide, by using this command on bash:

defaults write -g ApplePressAndHoldEnabled -bool false

Alternatively you can disable this feature just for some applications (in this example for Sublime Text 3), by issuing the following command in your terminal:

defaults write com.sublimetext.3 ApplePressAndHoldEnabled -bool false

For VS Code Insiders:

defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false

For GitHub Atom:

defaults write com.github.atom ApplePressAndHoldEnabled -bool false

For Jetbrain's IntelliJ IDEA:

  • Ultimate : defaults write com.jetbrains.intellij ApplePressAndHoldEnabled -bool false
  • Community Edition: defaults write com.jetbrains.intellij.ce ApplePressAndHoldEnabled -bool false

For Jetbrain's Rider:

  • defaults write com.jetbrains.rider ApplePressAndHoldEnabled -bool false

To find your own:

defaults read | grep "com."

OR

defaults read | grep "com.organizationName"

and find the correct application for the default, or ask Google. Replace the correct application and run the same command.

Note: replace com.sublimetext.3 with whichever version of Sublime Text you are running eg. 'com.sublimetext.2'

In either case you'll need to restart your editor for the change to take place.

Happy coding!


IntelliJ default source: https://stackoverflow.com/questions/39606031/intellij-key-repeating-idea-vim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment