@user495470's answer is great for native apps, but for whatever reason, it appears to have messed up key repeat for me in XQuartz windows. To work around the issue, I initially ran this in the terminal:
xset r rate <initial wait> <number of repeated strokes per second>
Leaving off the last 2 arguments will reset the system defaults.
I read that you have to run this command every time you run XQuartz anew, but when I put it in my login script, it caused the system to hang on shutdown (until I killed the hung xset commands) and on startup, so I discovered that a better way to change the key repeat setting is to first disable the little bubble menu that appears above a typed character upon press & hold, e.g. hold down the a key and you are presented with a bubble containing alternate 'a' characters with various umlauts, accents, etc..:
defaults write -g ApplePressAndHoldEnabled -bool false
Then run the key repeat commands:
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
If you do it this way, key repeats will work in XQuartz windows without needing to run
xset r # #.