DEV Community

Cover image for Quick tip: Increase keyboard repeat rate for faster typing

Quick tip: Increase keyboard repeat rate for faster typing

tomgranot profile image Tom Granot ・3 min read


This a short post to remind myself that some fruits are hanging so, so low, that you're a dummy for not thinking about them yourself.

If you're not a master of keyboard shortcuts to run around textual interfaces (like your code editor or your terminal), you've probably done the following many a time:

  1. Write many words of text.
  2. Figure out you made a mistake a few words back.
  3. Press and hold the left key button until you reach the word you need to fix.
  4. Fix word.
  5. Press and hold the right key button until you reach the place you were before.
  6. Repeat ad infinitum.

There are two potential paths for improvement here, both revolving around steps 3 & 5.

Become better at keyboard shortcuts

This will replace steps 3 & 5 with a combination of keys that performs the required action.

This is a worthwhile pursuit, as you will be spending insane amounts of time riding a keyboard. Check out this article for some great ones.

It does, however, take some time to get used to keyboard shortcuts, and if you're anything like me - i.e. always changing environments between remote servers, VMs, containers, different local code editors and basically any modern website with WYSISWYG capabilities - then you will have to memorize a large amount of shortcuts. This can get tiring very fast.

Solution: if you can't be faster, make your computer run faster.

Increase keyboard repeat rate

This will increase the speed of steps 3 & 5 with a neat keyboard trick.

The keyboard repeat delay of your machine is the amount of time that the computer waits between each repeat action you make.

In our case, it's the amount of time that passes between each "go left" (step 3) or "go right" (step 5) operations.

If we decrease that delay, we increase the rate at which those actions can happen in a sequence. This rate is called the keyboard repeat rate.

A cursor on a machine with a fast keyboard repeat rate looks much, much faster than it does on your current machine. It will basically ping-pong across lines of text, dashing to wherever you need it to be.

Here's how to employ this trick on different platforms - add a comment if you need some help or find this super-duper-cool like I did!

Mac OS

This can be done either graphcially, using System Preferences --> Keyboard:

The GUI way

Or textually, using the command line - just add the following commands to your shell user's config file, usually ~/.zshrc on newer macs:

# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
Enter fullscreen mode Exit fullscreen mode

Most Linux distros

Same, except swap ~/.zshrc for ~/.bashrc. Graphical way changes between distros, so I can't really attest to that.

Also, you're a Linux user. Use your shell! :)


Untested - see here.


Original idea from here and the ever-awesome Mathias Bynens.

Discussion (2)

Editor guide
johnsalzarulo profile image
John Jacob

Too true — do this on every new machine

tomgranot profile image