Quick tip: Increase keyboard repeat rate for faster typing
Tags: learning, productivity, beginners, webdev
Published: 2020-07-27 21:33:01

## Why?

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 dev.to article](https://dev.to/designpuddle/27-no-frills-keyboard-shortcuts-every-developer-should-follow-4jd) 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](https://dev-to-uploads.s3.amazonaws.com/i/kkq57tpz9mb62477q3pb.png)

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

```shell
# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
```

## 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! :)

## Windows

Untested - see [here](https://bltt.org/adjust-windows-keyboard-repeat-rate/).

## Props

Original idea from [here](https://github.com/mathiasbynens/dotfiles/blob/main/.macos#L154-L156) and the ever-awesome [Mathias Bynens](https://github.com/mathiasbynens).