I'm using IntelliJ IDEA 14.1.4 Community Edition in Mac OS Yosemite 10.10.5.
I already know about the global ApplePressAndHoldEnabled
fix:
defaults write -g ApplePressAndHoldEnabled -bool false
But I want to disable it only for IntelliJ IDEA, and none of these commands work when using the "IdeaVim" plugin with Scala (With restarting IDEA):
defaults write com.jetbrains.intellij.ce ApplePressAndHoldEnabled -bool false
defaults write com.jetbrains.intellij ApplePressAndHoldEnabled -bool false
defaults write com.jetbrains.AppCode ApplePressAndHoldEnabled -bool false
Or any of the other commands listed here.
How do you disable ApplePressAndHoldEnabled
for a specific application?
Here is the canonical, complete solution to this problem:
ApplePressAndHoldEnabled
:The boolean values of the ApplePressAndHoldEnabled
Mac OS defaults
correspond to the following settings:
true
=> show-character-accents-menu
: Holding a keyboard key down will bring up a character modification menu like so:
(Note that even when set to true, various symbol keys should still repeat on long press, such as !@#$%^&*()_+{}|:"<>?-=[];'.,/ )
false
=> repeat-character-while-key-held
: Holding a keyboard key down will repeat that key continuously, after a delay, until the key is released:
show-character-accents-menu
behaviour globally by default, but repeat-character-while-key-held
behaviour per-application:ApplePressAndHoldEnabled
default
must be unset globally (rather than being set to true
or false
), with the following command:defaults delete -g ApplePressAndHoldEnabled # Unset globally
ApplePressAndHoldEnabled
default
must be set to false
for each application for which you wish to set the repeat-character-while-key-held
behaviour, with the following command:defaults write "$APP_ID" ApplePressAndHoldEnabled -bool false
Where $APP_ID
is something like com.jetbrains.intellij.ce
for "IntelliJ IDEA Community Edition".
Paste this code in the terminal to set the repeat-character-while-key-held
behaviour for all IntelliJ IDEs, but set show-character-accents-menu
behviour globally:
KEY='ApplePressAndHoldEnabled' \
&& defaults delete -g "$KEY" \
; echo \
&& APP_ID_PREFIX='com\.jetbrains\.' \
&& defaults read | egrep -o "${APP_ID_PREFIX}[^\"]+" | sort --unique \
| while read APP_ID; do
echo "Setting \"repeat-character-while-key-held\" for application: '$APP_ID'..."
defaults write "$APP_ID" "$KEY" -bool 'false'
done
ApplePressAndHoldEnabled
:Values can be checked like this:
defaults read -g ApplePressAndHoldEnabled # Global
defaults read "$APP_ID" ApplePressAndHoldEnabled # Per-application
Paste this code in to the terminal to show the settings for ApplePressAndHoldEnabled
globally and per-application:
KEY='ApplePressAndHoldEnabled'
APP_ID_PREFIX='com\.jetbrains\.' \
&& echo \
&& printf "%-30s %-20s %-8s\n" \
"Application" \
"Type" \
"Value" \
&& printf "%-30s %-20s %-8s\n" \
"$(printf -- '-%.0s' {1..30})" \
"$(printf -- '-%.0s' {1..16})" \
"$(printf -- '-%.0s' {1..8})" \
&& (defaults read | egrep -o "${APP_ID_PREFIX}[^\"]+" | sort --unique && echo '-g') \
| while read APP_ID; do
printf "%-30s %-20s %-4s\n" \
"${APP_ID}" "\
$(defaults read-type "${APP_ID}" "$KEY" 2> /dev/null || echo '(unset)')" \
"$(defaults read "${APP_ID}" "$KEY" 2> /dev/null || echo '(unset)')"
done \
&& echo
Where this is the expected output:
Application Type Value
------------------------------ ---------------- --------
com.jetbrains.WebStorm Type is boolean 0
com.jetbrains.intellij Type is boolean 0
com.jetbrains.intellij.ce Type is boolean 0
com.jetbrains.pycharm Type is boolean 0
-g (unset) (unset)