How do you move through the document you are editing?
Do you use the mouse? Do you use the arrow keys?
Knowing standard shortcuts such as Ctrl+Home
can make a big difference.
But there is one secret to move faster, which is to shorten the delay
between two repetitions of the same key.
When editing a text file the mouse will only slow you down. During the time it takes to move your hand to the mouse, perform the appropriate gesture and go back to your keyboard, you may even lose track of why you wanted to move in the first place!
If you already do not use the mouse, you can probably skip the next section.
So how do you move efficiently using the keyboard only? The first step is to learn standard shortcuts which work in almost all editors. This includes web browsers and mail clients. You are probably already familiar with most of them.
Page Up
: move up several lines at once (exact number varies)Page Down
: move down several lines at onceHome
: go to the beginning of the current lineEnd
: go to the end of the current lineCtrl+Left
: go to the beginning of the current or previous wordCtrl+Right
: go to the end of the current or next wordCtrl+Up
: go to the beginning of the current or previous paragraphCtrl+Down
: go to the end of the current or next paragraphCtrl+Home
: go to the beginning of the documentCtrl+End
: go to the end of the documentThose shortcuts are not just for moving around. If you press Shift
at
the same time, you will select text. Want to select the whole paragraph?
Refrain from using the mouse; just press Ctrl+Up
to move to the beginning
of the paragraph, and then Shift+Ctrl+Down
to select it.
Press Shift+Ctrl+Down
again to select the next paragraph as well.
Depending on your editor, Alt
may also have some effect when combined
with one of the above keys. Try it! But save first. Sometimes it will
actually move text around.
Ctrl+Up
and Ctrl+Down
are especially useful, but only
if you leave a few empty lines in your document. When programming, I
try to leave some empty lines here and there not just to make the code
more readable but also to help me navigate through it.
If you use Emacs, you may also want to try the following.
M-C-Left
(i.e. Alt+Ctrl+Left
), bound to backward-sexp
M-C-Right
(i.e. Alt+Ctrl+Right
), bound to forward-sexp
They allow you to move around parenthesized chunks of your document.
If the cursor is at a left parenthesis for instance, M-C-Right
moves to the
corresponding right parenthesis.
When you press and hold a key, like character A
, an arrow key or even Enter
,
it acts as follow:
Reducing the initial delay and the repetition delay is very convenient.
I don't type long sequences of the same letters
like aaaaaaaaaaaaa
very often (although I just did). I do sometimes
write long sequences of stars ********
to separate sections in my code.
But the real advantage is, once again, to move faster using
the arrow keys.
On Windows, the delays can be found somewhere in the Control Panel. But last time I checked (which was a long time ago) the defaults were already at the minimum, which is painfully slow. Too bad. I had the same issue with graphical configuration tools on Linux.
Yet on Linux there is actually a way to go below the minimum. Run the following command in a terminal:
xset r rate 250 60
This will set the initial delay to 250ms and the repetition rate to 60Hz,
that is, about 16ms.
You can also achieve the same result using xkbset
, except this time
the repetition rate is specified in milliseconds instead of hertz:
xkbset r rate 250 16
Those settings are the ones I use and they are significantly faster than
the minimum which is usually proposed by graphical tools. Yet they are
not so fast that it becomes impossible to type. Having a reasonable
initial delay is important to avoid accidentally pressing the same key twice.
(If you want to have fun, try xkbset r rate 1 1
. But save your work first.)
With those settings, it becomes actually reasonable to move around using just the arrow keys. That's the real secret.