Create a gist now

Instantly share code, notes, and snippets.

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 for just Sublime Text by issuing the following command
# in your terminal (*not* the Sublime Text console):
defaults write com.sublimetext.3 ApplePressAndHoldEnabled -bool false
# Note: replace com.sublimetext.3 with whichever version of Sublime Text you are running
# eg. 'com.sublimetext.2'
# Alternately, if you want this feature disabled globally, you can enter this:
defaults write -g ApplePressAndHoldEnabled -bool false
# In either case you'll need to restart Sublime Text for the change to take place.
# Happy coding!
@cloudrave

Thanks! I had to restart Sublime to apply changes, but worked perfectly!

@barmstrong

Also, worth noting: you enter this in the OS X terminal, not the sublime terminal (which was my first, incorrect, guess). Thanks for the tip!

@kenmgrimm

THANK YOU!!!

@styts
styts commented Nov 14, 2012

Already had to use this twice. Thank you!!!!

@bruceharris

+1 very useful!

@lancekruegger

Yup this worked perfectly!

@jasperridge

Perfect! Thanks!

@kernelp4nic

Thanks! :)

@marcelomagf

+1 thanks!

@ethagnawl

Thanks, @kconragan!

@namklabs

+1 awesome, but should be renamed keypeat.shell for maximum brevity and cleverness :P

@deevus
deevus commented May 8, 2013

I love you. Works in ST3 too! (with a minor change)

defaults write com.sublimetext.3 ApplePressAndHoldEnabled -bool false
@alancwoo-gist

Thank you, fantastic. Should note also didn't need to restart the computer, only sublime text.

@rwifeng
rwifeng commented Jun 8, 2013

perfect thx!

@philipphoffmann

cool, thx!

@ourweakness

Much Appreciated!

@chaseadamsio

+1. Absolutely Useful.

@luisvillamarin

Thanks!

@kzsh
kzsh commented Sep 11, 2013

Thank you.

@victoria-gramlich

Thank you! Much appreciated, worked with no problems.

@ronaldballard

Thanks.

@soharu
soharu commented Oct 27, 2013

Thank you! :D

@danijel
danijel commented Nov 5, 2013

Thanks!

@dxslly
dxslly commented Nov 5, 2013

Really helpful, thanks!

@uiureo
uiureo commented Nov 7, 2013

+1

@srigi
srigi commented Nov 12, 2013

Cannot make it work in Mavericks. Any ideas?

@dcmoore
dcmoore commented Nov 15, 2013

This is awesome! Thanks for sharing. 👏

@emwalker

+1

An important detail here is the com.sublimetext.3 -- the documentation is outdated (and Google picks up the older v2 docs).

@teddy1004

Thanks for sharing! This really helps me!

@hahla
hahla commented Dec 8, 2013

+1

@kodosaru

Kai, you rock! Thanks a lot for solving one problem along the way in my quest to find the perfect editor.

Side note:

defaults write com.sublimetext.3 ApplePressAndHoldEnabled -bool false

didn't work for me after restarting Sublime, but your global command did:

defaults write -g ApplePressAndHoldEnabled -bool false

@michael-odell

Thank you very much! Appreciate the documentation and options presented.

@thedodd
thedodd commented Jan 17, 2014

Solid +1

@xinxu
xinxu commented Jan 22, 2014

Thank you! That save me from so much pain.

@maikeldaloo

Thanks - this was a great helper.

@pshomov
pshomov commented Feb 10, 2014

This has been bugging me for some time now, thanx a lot!

@rpond-pa
rpond-pa commented Mar 5, 2014

:+1 Thanks. Perfect answer.

@luigi
luigi commented Mar 17, 2014

Any idea how to get this to work on Mavericks? The global flag works (-g) but I actually want to keep the feature for other apps.

@davidlygagnon

Awesome!

@skinp
skinp commented Mar 26, 2014

Finally!! Thanks!

@bahtou
bahtou commented Apr 4, 2014

such fantastic

@gerrywastaken

Thank you. :) Sublime should throw up a warning about this when you activate vintage mode on OSX.

@ghost
ghost commented Jul 11, 2014

Thank you.

@tortillacrisis

saved me - thanks.

@elvis-bi
elvis-bi commented Oct 9, 2014

+1 Thanks!

@ain
ain commented Oct 17, 2014

If someone has the same problem on Terminal (e.g. Vim), go with

defaults write com.apple.Terminal ApplePressAndHoldEnabled -bool false

and restart Terminal.

@Kinghack

So cool!

Thanks!

@nemish
nemish commented Nov 30, 2014

With you, guys, I always solve my problems in a couple of minutes. Thanks!

@st4lk
st4lk commented Dec 17, 2014

Awesome, many thanks! 👍

@roseperrone

Thank you!!

@sancel22

Thanks (y)

@justinjmoses

👍

@BakedSweetPotato

Thanks, saved my day!

@elegantcoder

👍

@dimiii
dimiii commented Feb 20, 2015

Большое спасибо!

@awingla
awingla commented Feb 26, 2015

Thank you!

@medington

👍

@drajguru

Thanks!

@limichange

谢谢!

@alissapajer

Thanks! :)

@arya-s
arya-s commented Mar 27, 2015

Much appreciated

@hlu200
hlu200 commented Mar 27, 2015

Valuable tip!

@plutoshe
plutoshe commented Apr 7, 2015

Thanks a lot! It works very well!

@lnx
lnx commented Apr 14, 2015

Work like a charm!

@hlzz
hlzz commented Apr 17, 2015

fantistic!

@amalantony

Thanks!

@OmarMakled

Thanks

@joshjung

Damn this is perfect

@voischev

Спасибо!

@taein2301

wow Thanks you~

@GabeIsman

This is awesome, thank you. Just turned on vintage mode and was immediately infuriated. You saved me much frustration.

@smahi
smahi commented Jun 23, 2015

Thank you very much.

@bgenchel

My hero.

@jimwhitfield

👍

@egonina
egonina commented Jul 8, 2015

thanks x1000!

@ablegao
ablegao commented Jul 14, 2015

Thanks !

@xiaoronglv

Thanks.

@adc-mmanfredi

SWWWWEEEEEEEEET! Thank you!

@kumarabinash

Just what I was looking for! Thanks a lot!

@Sitebase

Thanks!

@jonathancross

Thanks!
Let's see if this works... @ChangeTip, send $1 to @kconragan

@RathanKumar

Thanks! nice tip :)

@wwboynton

Thank you! This is excellent!

@dakoo
dakoo commented Sep 9, 2015

You really saved my day

@varunxyz

Awesome :)

@eliseumds

👍 Ty!

@Rhinomcd

Thanks!

@hstcscolor

Awesome

@SauloSilva

thx (=

@ggomesfe

Thank you very much!

@Paulo-Rogerio

Yeah, It works !!! Thank =)

@timq
timq commented Feb 22, 2016

Thank you!

@jallen89

thanks!

@liugangnhm

it works, thanks

@rvnath
rvnath commented May 10, 2016

is it possible to enable arrow keys for navigation? I can see that only alphabets can be used to traverse lines.

@tony-haibo-zhu

It works , thx !!!

@borregoho

Thanks a lot! I really appreciate this tip!

@alfonsodev
alfonsodev commented May 28, 2016 edited

this doesn't seem to work anymore,
Mac OS 10.11.1 Sublime 3 build 3114

defaults read  com.sublimetext.3
{
    ApplePressAndHoldEnabled = 0;
    NSNavLastRootDirectory = "~/Desktop/inProgress";
    NSNavPanelExpandedSizeForSaveMode = "{712, 521}";
    NSNavPanelExpandedStateForSaveMode = 1;
}
@himito
himito commented May 30, 2016

In Mac OSX 10.11.4 works perfectly !!!

Thank you very much !

@sebascar
sebascar commented Jun 3, 2016

Works on El Capitan too! ;-) You're awesome!

@nickjwebb

👍

@TomTangelder

Awesome. Thank You!

@bluenautilus2

THANK YOU i love you

@jinyuli
jinyuli commented Nov 22, 2016

Thanks!

@imfangli

Awesome!!!

@djosephsen

omfg 🥇

@alexvbush

thanks!

@gaojun0816

that's really help. thanks a lot!

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