109

I just installed IntelliJ CE and IdeaVim plugin.

One small popup asked about key repeating and if I want to make it enabled. But I just clicked "no" without knowing what it is asking about clearly. But it was about the moving keys: h j k l.

I cannot hold down these keys to move my cursor continuously. I've tried to revert this setting but no luck.

Most answers are either defaults write com.jetbrains.intellij.ce ApplePressAndHoldEnabled -bool false or defaults write com.jetbrains.intellij ApplePressAndHoldEnabled -bool false, but no changes.

I am on OS X El Capitan 10.11.6 and IntelliJ IDEA CE 2016.2.4

Arturo Herrero
  • 12,772
  • 11
  • 42
  • 73
ijung
  • 2,319
  • 3
  • 11
  • 8
  • 1
    Why go through the hassle of installing a "vim plugin" in your IDE if you don't want to take advantage of advanced Vim motions? – romainl Sep 21 '16 at 05:34
  • 1
    @romainl what do you mean by "advanced vim motions"? am I missing something? – ijung Sep 21 '16 at 05:43
  • Holding `hjkl` down is exactly the same as holding the cursor keys down. If you only use `hjkl` there's no point installing a "vim plugin". – romainl Sep 21 '16 at 07:15
  • 1
    Possible duplicate of [Intellij-idea: auto-repetition of letter keys](http://stackoverflow.com/questions/15107321/intellij-idea-auto-repetition-of-letter-keys) – P.Brian.Mackey May 12 '17 at 16:23
  • 18
    @romainl You seem to assume Vim is only about navigating, and that OP only uses Vim for navigation. – whirlwin Aug 01 '18 at 12:41
  • if you are confused what `Do you want to enable repeating keys in Mac OS X on press and hold?` means it means if you hold a key if it should keep pressing it automatically for you. I always expect that behaviour and can't think of a time it's not doing that so I'd suggest pressing `yes`. If you are to late see answers bellow. – Charlie Parker Jun 16 '21 at 21:53
  • Also, I think that having the navigation right in your home row is still a big improvement over having to move your hand to some random place depending on the keyboard - even if you use them rather naively... – david.mihola Jan 05 '23 at 09:48

6 Answers6

121

it turns out that I need to type this in the mac terminal:

defaults write -g ApplePressAndHoldEnabled -bool false

This is not related with any of vim, intelliJ, etc. It seems that Mac wants to support accent characters by holding the key.

ijung
  • 2,319
  • 3
  • 11
  • 8
  • 41
    If it's still not working, you should press `Command+Q` to quit IntelliJ first. – Hearen Jul 08 '19 at 07:27
  • 12
    FYI I just installed IdeaVim and the popup says "You can do it manually by running `defaults write -g ApplePressAndHoldEnabled 0`" – aaronpenne Feb 12 '20 at 16:26
  • After months of pain and suffering, I cannot take it anymore. I had to find a way, and the above tip worked! Thank you so very much!! – daparic Sep 18 '21 at 12:09
  • 1
    @aaronpenne's comment worked, not the answer. You should make yours an answer. – laughing_man Sep 25 '22 at 21:27
  • 1
    @Chethan bandi's solution is best if you want this change to only apply to your IDE, not your whole system – safay Dec 12 '22 at 21:43
87

you can enable key repeating per application

for Intellij Ultimate edition

defaults write com.jetbrains.intellij ApplePressAndHoldEnabled -bool false

for Intellij community edition

defaults write com.jetbrains.intellij.ce ApplePressAndHoldEnabled -bool false

ref https://intellij-support.jetbrains.com/hc/en-us/community/posts/206845385-FYI-for-Lion-users-who-use-IdeaVIM

Chethan Bandi
  • 970
  • 7
  • 5
  • 7
    This answer is proper solution since I often don't need this feature when I'm not working in IDE. But how could I find the app name for this command? – Vladislav Kovechenkov Mar 08 '20 at 09:50
  • 2
    If you're using PyCharm: `defaults write com.jetbrains.pycharm ApplePressAndHoldEnabled -bool false` – safay Dec 12 '22 at 21:41
  • You can type `defaults write com.jetbrains.` in the terminal and then hit the tab to auto-complete. This gave me the following for webstorm: `defaults write com.jetbrains.WebStorm` – niklaas Apr 28 '23 at 16:46
7

@aaronpenne's 2020 comment is too useful to be just a comment. His was the only suggestion that worked:

FYI I just installed IdeaVim and the popup says "You can do it manually by running defaults write -g ApplePressAndHoldEnabled 0"

Ben Ogorek
  • 497
  • 7
  • 21
  • 1
    This worked for me. Remember to restart the IDE after running the command for the change to take effect. – Bower Mar 16 '23 at 15:56
2

If you've already set the global value with the defaults write -g command (or JetBrains did it for you), it may be necessary to delete the global default before you can use an application-specific default as noted in this SuperUser post.

defaults delete -g ApplePressAndHoldEnabled

After I did that and set an application-specific value for RubyMine...

defaults write com.jetbrains.rubymine ApplePressAndHoldEnabled -bool true

...I could use IdeaVim in RubyMine and still use the press and hold accent dialog in all other applications.

Jim Breen
  • 81
  • 3
  • 1
    Thanks for this, although to get key repeat to work as I desired in RubyMine I set it to false rather than true: `defaults write com.jetbrains.rubymine ApplePressAndHoldEnabled -bool false`, then restarted RubyMine. – Eliot Sykes Feb 17 '22 at 15:13
1

if anyone else was confused what the message from pycharm meant, but lets read it first:

Do you want to enable repeating keys in Mac OS X on press and hold?

what it means is that if you keep pressing the same key it is as if it is pressing it many times (the expected behaviour). That is all.

I might not be a vim expert but I personally wouldn't want the keyboard to act different from what I am used to so I suggest to press yes.

If you are too late and can't fix it do what the other answers suggest e.g.

for Intellij Ultimate edition

defaults write com.jetbrains.intellij ApplePressAndHoldEnabled -bool false

for Intellij community edition

defaults write com.jetbrains.intellij.ce ApplePressAndHoldEnabled -bool false
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
0

I found this gist for various different Jetbrains IDEs:

Credits go to this: https://gist.github.com/lsd/1e1826907ab7e49c536a

    Community Edition IntelliJ: - defaults write com.jetbrains.intellij.ce ApplePressAndHoldEnabled -bool false
    Ultimate Edition IntelliJ: defaults write com.jetbrains.intellij ApplePressAndHoldEnabled -bool false
    AppCode: defaults write com.jetbrains.AppCode ApplePressAndHoldEnabled -bool false
    PyCharm: defaults write com.jetbrains.PyCharm ApplePressAndHoldEnabled -bool false
    Android Studio: defaults write com.google.android.studio ApplePressAndHoldEnabled -bool false
    WebStorm: defaults write com.jetbrains.WebStorm ApplePressAndHoldEnabled -bool false *
    RubyMine: defaults write com.jetbrains.RubyMine ApplePressAndHoldEnabled -bool false *
I'm a frog dragon
  • 7,865
  • 7
  • 46
  • 49