Sublime Forum

Long pressing keys does not print repeat characters

#1

Hi,

I am new to sublime text 3. I am noticing that long pressing a key does not repeat key inputs. For example, in vim mode (using sublime six), I have to press j key multiple times to move the cursor down instead of long pressing it. This behaviour is also seen in remote terminals via terminus. Only seen in sublime text so far.

Can anyone let me know what setting would be controlling this and how to change it. Thanks in advance.

0 Likes

#2

We don’t implement this, this is done by the operating system. Does it work in other applications? What OS are you using?

0 Likes

#3

Hi @bschaaf, thanks for your reply! It does work in other applications.

I am using macOS Big Sur 11.2.3. iterm and doom emacs do not operate in that way, only seeing this issue in st3.

0 Likes

#4

In macOS, the default behavior when holding down a key is to bring up a menu of characters with different diacritical marks. Try holding down ‘e’ to see this in action.

If you want to instead repeat characters when a key is held, there are two ways to enable this. The first is to execute the following command in the Terminal, and then reboot:

defaults write -g ApplePressAndHoldEnabled -bool false

The other way is to download and install TinkerTool from http://www.bresink.com/osx/TinkerTool.html . This is a graphical utility that allows you to set all kinds of hidden macOS options. Launch this utility, go to the General tab, and the relevant keyboard setting is at the top of the panel.

0 Likes

#5

Also, because key repeat does work in some applications (including Apple’s own built-in Terminal app), it’s likely that individual apps can choose to override this behavior. Which means that such an option could possibly be added to Sublime Text, if the developers were so inclined?

1 Like

#6

Terminals generally do input handling differently to standard GUI applications. The way to change how just ST works is to set the defaults configuration for just ST: defaults writes com.sublimetext.3 ApplePressAndHoldEnabled -bool false. (Use com.sublimetext.4 for ST4 and com.sublimemerge for Sublime Merge)

2 Likes

#7

Thanks, this worked! The main reason I was looking towards this is because I am used to vi keybindings. Pressing h,j,k,l for movement was slow without repetitive key feature. Now it works like a charm! Thanks for all the help @bschaaf @Doodpants

0 Likes

#8

Thanks for the answer, this is very useful. There was a typo in your reply. Here are the commands for Sublime 4

defaults write com.sublimetext.4 ApplePressAndHoldEnabled -bool false
defaults write com.sublimemerge ApplePressAndHoldEnabled -bool false
0 Likes

#9

The prevention of key repeat appears to be a feature of macOS. My guess is that Apple prefers to enable accent characters on long key press. To enable key repeat for all apps use the following:

defaults write -g ApplePressAndHoldEnabled 0
0 Likes