aboutsummaryrefslogtreecommitdiff
path: root/build/blog/2014-11-30-opera-style-advanced-keyboard-shortcuts-in-safari.html
blob: c6b44b26cf148752d18e0e57a74f90f531eddbe3 (plain)
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta content="pandoc" name="generator"/>
<meta content="Zhiming Wang" name="author"/>
<meta content="2014-11-30T17:20:20-0800" name="date"/>
<title>Opera-style advanced keyboard shortcuts in Safari</title>
<link href="/img/apple-touch-icon-152.png" rel="apple-touch-icon-precomposed"/>
<meta content="#FFFFFF" name="msapplication-TileColor"/>
<meta content="/img/favicon-144.png" name="msapplication-TileImage"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<link href="/css/normalize.min.css" media="all" rel="stylesheet" type="text/css"/>
<link href="/css/theme.css" media="all" rel="stylesheet" type="text/css"/>
<link href="/css/highlight.css" media="all" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="archival-notice">This blog has been archived.<br/>Visit my home page at <a href="https://zhimingwang.org">zhimingwang.org</a>.</div>
<nav class="nav">
<a class="nav-icon" href="/" title="Home"><!--blog icon--></a>
<a class="nav-title" href="/"><!--blog title--></a>
<a class="nav-author" href="https://github.com/zmwangx" target="_blank"><!--blog author--></a>
</nav>
<article class="content">
<header class="article-header">
<h1 class="article-title">Opera-style advanced keyboard shortcuts in Safari</h1>
<div class="article-metadata">
<time class="article-timestamp" datetime="2014-11-30T17:20:20-0800">November 30, 2014</time>
</div>
</header>
<p>I've been using the Chromuim Opera for a long time, after Chrome's design went unbearably ugly around v32 (IIRC Opera stable channel was on v19 when I switched, which was released on January 28, 2014). From then on, Opera's <a href="http://help.opera.com/opera/Mac/1583/en/fasterBrowsing.html#advanced">advanced keyboard shortcuts</a> has become an integral part of my browsing habit. In particular, the following are especially handy for me:</p>
<ul>
<li><code>1</code>: Cycle left through tabs;</li>
<li><code>2</code>: Cycle right through tabs;</li>
<li><code>/</code>: Find on page;</li>
<li><code>Z</code>: Go back one page;</li>
<li><code>X</code>: Go forward one page;</li>
<li><code>0</code>: Zoom in;</li>
<li><code>9</code>: Zoom out;</li>
<li><code>6</code>: Reset zoom to 100%.</li>
</ul>
<p>Lately, with the Yosemite release, Safari has become a much more competitive browser. I won't say why, and I admit that it has major missing features that still prevents it from becoming my default ā€” but I have to say Iā€™m gradually moving more of more of my browsing, especially reading, to Safari. It would be nice if I could carry my power user shortcuts with me. Fortunately, this is possible. Just modify the plist in the following way:</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="co">#!/usr/bin/env bash</span>
<span class="ex">defaults</span> write com.apple.Safari NSUserKeyEquivalents <span class="st">'{</span>
<span class="st">"Actual Size"="6";</span>
<span class="st">"Back"="z";</span>
<span class="st">"Find..."="/";</span>
<span class="st">"Forward"="x";</span>
<span class="st">"Show Previous Tab"="1";</span>
<span class="st">"Show Next Tab"="2";</span>
<span class="st">"Zoom In"="0";</span>
<span class="st">"Zoom Out"="9";</span>
<span class="st">}'</span></code></pre></div>
<p>Relaunch Safari. You are all set! Enjoy the ultrafast single key navigating experience. To reset,</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="ex">defaults</span> delete com.apple.Safari NSUserKeyEquivalents</code></pre></div>
<hr/>
<p><strong><em>2014/12/22 Update:</em></strong></p>
<p>There's one caveat to this approach ā€” unlike in Opera, where the default layman shortcuts (e.g., āŒ˜F) are still available when advanced keyboard shorts are enabled, in Safari they are simply overwritten. This is annoying when the web page or web app binds certain keys, especially <code>/</code> to its own search bar (a notable example being google.com). In that case I have to admit defeat and click on the menu bar item, which takes a hundred times as long as a single <code>/</code> keystroke.</p>
</article>
<hr class="content-separator"/>
<footer class="footer">
<span class="rfooter">
<a class="rss-icon" href="/rss.xml" target="_blank" title="RSS feed"><!--RSS feed icon--></a><a class="atom-icon" href="/atom.xml" target="_blank" title="Atom feed"><!--Atom feed icon--></a><a class="cc-icon" href="https://creativecommons.org/licenses/by/4.0/" target="_blank" title="Released under the Creative Commons Attribution 4.0 International license."><!--CC icon--></a>
<a href="https://github.com/zmwangx" target="_blank">Zhiming Wang</a>
</span>
</footer>
</body>
</html>