~chambln/cosine.blue

ref: 1fe2eee4f07d41f9275708e92937cef5be9c1386 cosine.blue/src/article/2020-12-06-firefox-keyboard.html -rw-r--r-- 11.2 KiB
1fe2eee4Gregory Chamberlain Reword kakoune-interactively description 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<small>
  All software packages mentioned in this article
  are <a href="https://www.gnu.org/philosophy/free-sw.html">free as in
  freedom</a>.  There is no need to be using proprietary browsers
  these days.
</small>

<h1>Is it worth the time?</h1>

<p>Last weekend I carved out half an hour to read Mozilla’s support
page
titled <a href="https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly"><cite>Keyboard
shortcuts - Perform common Firefox tasks quickly</cite></a>.  Sounds
boring I know.  But it was time well spent and my only regret is not
having read it sooner (like 5 years sooner).</p>

<p>Many of the key combinations described therein were familiar
friends of mine, but with others I had no acquaintance.  I won’t lie
to you: a fair number of them are worthless.  But others are essential
for keyboard-only browsing.</p>

<p>Over the last decade I must have spent ten thousand hours using a
web browser.  And I don’t think I’m an outlier here.  The Web has
steamrolled into the twenty-first century and for better or worse
become the ubiquitous interface through which the world now wants us
to read and write, to listen and speak and to otherwise occupy
ourselves.</p>

<p>Let’s say you have to use a web browser just once a day on average
for the next 5 years.  According to the chart below, even if you can
shave off 1 measly second from this daily obligation, it is worth your
time to set aside up to 30 minutes today to achieve that daily time
saving.</p>

<figure>
    <img src="xkcd1205.png" alt="xkcd: Is It Worth the Time?" />
    <figcaption>
        From xkcd:
        <a href="https://xkcd.com/1205/"><cite>Is It Worth the Time?</cite></a>
        (<a href="http://creativecommons.org/licenses/by-nc/2.5/">CC BY-NC 2.5</a>).
    </figcaption>
</figure>

<p>It takes half a second to move your hand from the typing position
to the mouse (or touch pad or whatever) and another half a second to
point your cursor at the right spot.  Learning a few keyboard
shortcuts will surely shave off a few seconds every now and then.</p>

<p>You’ve already wasted 2 minutes reading this page and another 3
staring at that incredibly insightful chart so you’d better get
cracking.</p>

<p>
  I’ve outlined below a few of my favourite shortcuts that comprise my
  general strategy for keyboard-only navigation, which works better on
  some sites than others.  A good site to practise on is Wikipedia
  (or, you know, this one).  In particular, we will eventually get to
  the apostrophe key <kbd>'</kbd> which enables lightning fast link
  following and makes the whole experience much smoother.
</p>

<p>
  You won’t need to go digging through any settings or configuration
  files to try these; they are built into Firefox and enabled by
  default.
</p>

<p>
  Learning to use the keyboard as much as possible can be really
  beneficial to your efficiency and ergonomics when using a computer
  because it is profoundly more expressive and reliable than any
  pointing device.  If you’re looking to become more proficient with
  keyboard-driven software but not ready to learn something like Vim
  or Emacs then this article might be a good stepping stone.
</p>

<small>Mozilla have made some
<a href="https://blog.mozilla.org/blog/2020/02/25/firefox-continues-push-to-bring-dns-over-https-by-default-for-us-users/">increasingly</a>
<a href="https://arstechnica.com/information-technology/2020/08/firefox-maker-mozilla-lays-off-250-workers-says-covid-19-lowered-revenue/">questionable</a>
<a href="http://calpaterson.com/mozilla.html">decisions</a>
<a href="https://vpn.mozilla.org/">lately</a>, but there are a few
<a href="https://unixsheikh.com/articles/choose-your-browser-carefully.html">privacy-respecting alternatives</a>
such as <a href="https://www.gnu.org/software/gnuzilla/">GNU Icecat</a>
and <a href="https://www.torproject.org/">Tor Browser</a>
which are based on Firefox and have all the same keyboard
shortcuts.</small>

<h1>The basics</h1>

<p>
  Obviously you can scroll the page screenful-by-screenful
  using <kbd>PgUp</kbd> and <kbd>PgDn</kbd>.  When the page is in
  focus, <kbd>Space</kbd> and <kbd>Shift</kbd> + <kbd>Space</kbd> do
  the same and are more accessible from the home position on full size
  keyboards. The vertical arrows
  keys <kbd>&uarr;</kbd> <kbd>&darr;</kbd> are best reserved for
  making fine adjustments to the viewport.  For jumping to the
  beginning and end of the page, use <kbd>Home</kbd>
  and <kbd>End</kbd>.
</p>

<p>
  <kbd>Ctrl</kbd> + <kbd>Tab</kbd> and its <kbd>Shift</kbd>ed
  equivalent are not unheard of even among novice computer users, but
  holding <kbd>Alt</kbd> and hitting <kbd>1</kbd>&ndash;<kbd>8</kbd>
  to immediately switch to the corresponding tab will surely impress
  on-lookers.  You probably know <kbd>Ctrl</kbd> + <kbd>w</kbd> closes
  the current tab but did you know <kbd>Ctrl</kbd> + <kbd>Shift</kbd>
  + <kbd>W</kbd> closes the current window?  Also essential
  are <kbd>Ctrl</kbd> + <kbd>t</kbd> to open a new tab and crucially
  <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>T</kbd>
  to <em>restore</em> that tab you really wish you hadn’t closed.
</p>

<p>
  Continuing the <kbd>Shift</kbd> key theme, I think most people are
  familiar with <kbd>Ctrl</kbd> + <kbd>r</kbd> to refresh the
  page&mdash;but hold <kbd>Shift</kbd> to clean the cache while doing
  so.
</p>

<p>
  Of course there are shortcuts like <kbd>Ctrl</kbd> + <kbd>h</kbd>
  and <kbd>Ctrl</kbd> + <kbd>b</kbd> to open the history and bookmarks
  sidebars, but in practice I rarely use these&mdash;instead I use
  <kbd>Ctrl</kbd> + <kbd>l</kbd> or <kbd>Alt</kbd> + <kbd>d</kbd> to
  bring the address bar into focus and begin searching through history
  and bookmarks right there.  <kbd>Ctrl</kbd> + <kbd>d</kbd>, however,
  is really handy for quickly throwing the current page into your
  bookmarks list&mdash;you can then <kbd>Tab</kbd>
  and <kbd>Shift</kbd> + <kbd>Tab</kbd> around the little dialogue
  window to make adjustments.
</p>

<p>
  As with most graphical applications, you can generally ‘tab around’
  between UI elements and hyperlinks with <kbd>Tab</kbd>
  and <kbd>Shift</kbd> + <kbd>Tab</kbd>.  This is a cumbersome and
  frustrating way of getting around but it is often necessary.  It can
  be tempting to rely on this in Firefox but think of it as a last
  resort.  In the next section we will learn some faster techniques.
</p>

<h1>Quick find and navigation</h1>

You may know you can hold <kbd>Alt</kbd> and use the horizontal arrow
keys <kbd>&larr;</kbd> <kbd>&rarr;</kbd> to go back and forward.  Make
sure you’re comfortable using them as they’ll become somewhat
important later.

<p>Everybody knows <kbd>Ctrl</kbd> + <kbd>f</kbd> launches the
familiar <em>find in page</em> rigmarole, and there is certainly a
time and a place for its case sensitive and whole word matching.  But
in most cases all you need is <em>quick find</em>.  Hit forward
slash <kbd>/</kbd> to begin.  It works much the same but is less
annoying because it soon gets out of your way; you can still
hold <kbd>Ctrl</kbd> and hit <kbd>g</kbd> and <kbd>Shift</kbd>
+ <kbd>G</kbd> to jump between matches, but when you do something else
like press <kbd>Tab</kbd> or <kbd>Enter</kbd>, or even just pause for
a few moments, the bar slides away and page focus is restored.  I
often use this to get back to where I was reading by quick-searching
for the short string of words I last read.  You can always upgrade to
the fully-featured find-in-page mode by hitting <kbd>Ctrl</kbd>
+ <kbd>f</kbd>.</p>

<small>By the way, wherever you see an underlined letter in a menu,
that means you can hold <kbd>Alt</kbd> and hit the corresponding key
to activate it.  Try toggling <q>Whole Words</q> matching in the
find-in-page bar using <kbd>Alt</kbd> + <kbd>w</kbd></small>

<p>
  Finally we are ready to meet the apostrophe key <kbd>'</kbd>.  This
  puts you into the same kind of quick search prompt,
  but <strong>results are limited to links only</strong>.  This
  is <em>magical</em>.  By using <kbd>Ctrl</kbd> + <kbd>g</kbd>
  and <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>G</kbd> to jump
  between matches and <kbd>Enter</kbd> to follow them, interspersed
  with the <kbd>Alt</kbd> plus arrow key combos mentioned earlier, you
  can zip around between web pages at light speed with a modicum of
  keystrokes.
</p>

<p>
  If you follow the wrong link and react before it loads, quickly
  reach for <kbd>Esc</kbd> to cancel it.  If you’re too late, remember
  there’s always <kbd>Alt</kbd> + <kbd>&larr;</kbd> to go back.
</p>

<p>
  When following a focused link with <kbd>Enter</kbd>, you can
  hold <kbd>Ctrl</kbd> to make it open in a new tab.  It won’t switch
  to that new tab immediately though; to do that use <kbd>Ctrl</kbd>
  + <kbd>Shift</kbd> + <kbd>Enter</kbd> instead.
</p>

<p>
  These key commands are great and all, but some rely on <em>page
  focus</em>; when the address bar or other UI element has keyboard
  focus, shortcuts like <kbd>/</kbd> and <kbd>'</kbd> become
  inaccessible.  Well, get used to hitting <kbd>F6</kbd> to bring
  focus back to the page itself&mdash;you should see a thin black and
  white dotted rectangle surrounding the page viewport to indicate
  page focus.
  <small>
    Frustratingly <kbd>F6</kbd> actually <em>toggles</em> focus
    between page and address bar so you can’t always be certain you’ll
    end up with one or the other without having first hit,
    say, <kbd>Ctrl</kbd> + <kbd>l</kbd> or looking for focus clues
    afterwards.
  </small>
</p>

<h1>A word for the wizards</h1>

<p>
  Now, an elite minority among you will no doubt be laughing away from
  the comfort of one of those Vi-like modal keyboard layer add-ons
  that grant you web browsing super powers and sing and dance and brew
  your coffee at the same time.  They’re fantastic and I’ve been
  there.  There are even standalone browsers designed around this
  idea, and they certainly can be worth the time investment.
  <small>
    See add-ons <a href="https://krabby.netlify.app/">Krabby</a>
    and <a href="https://github.com/philc/vimium">Vimium</a>;
    standalone browsers <a href="https://qutebrowser.org">Qutebrowser</a>,
    <a href="https://luakit.github.io/">Luakit</a>,
    <a href="https://nyxt.atlas.engineer/">Nyxt Browser</a>,
    <a href="https://fanglingsu.github.io/vimb/">Vimb</a>,
    even <a href="http://surf.suckless.org/">surf</a>
    with <a href="http://tools.suckless.org/tabbed/">tabbed</a> and
    the right combination of patches; and
    <a href="https://github.com/alexherbo2/krabby/blob/master/docs/alternatives.md">many
    others</a>.  Also worth mentioning are terminal and text-based
    browsers such
    as <a href="https://lynx.browser.org/">lynx</a>, <a href="http://w3m.sourceforge.net/">w3m</a>
    and <a href="https://www.gnu.org/software/emacs/manual/eww.html">EWW</a>.
  </small>
  But there are reasons to (and times when you have no choice but to)
  revert to the bog standard, vanilla, <em>de facto</em> tool.
</p>

<p>
  Also, those keyboard-centric browsers have steep learning curves.
  They can be dauntingly unfamiliar to new users and behave in
  unexpected ways to begin with.  On the other hand, picking up some
  of the keyboard-driven techniques outlined above doesn’t mean
  throwing everything you know about your browser out the window.
</p>