aboutsummaryrefslogtreecommitdiff
path: root/docs/posts/snip_snap
diff options
context:
space:
mode:
Diffstat (limited to 'docs/posts/snip_snap')
-rw-r--r--docs/posts/snip_snap/index.html140
1 files changed, 140 insertions, 0 deletions
diff --git a/docs/posts/snip_snap/index.html b/docs/posts/snip_snap/index.html
new file mode 100644
index 0000000..02fa674
--- /dev/null
+++ b/docs/posts/snip_snap/index.html
@@ -0,0 +1,140 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <link rel="stylesheet" href="/syntax.css">
6 <meta charset="UTF-8">
7 <meta name="viewport" content="initial-scale=1">
8 <meta content="#ffffff" name="theme-color">
9 <meta name="HandheldFriendly" content="true">
10 <meta property="og:title" content="Snip Snap">
11 <meta property="og:type" content="website">
12 <meta property="og:description" content="a static site {for, by, about} me ">
13 <meta property="og:url" content="https://peppe.rs">
14 <link rel="icon" type="image/x-icon" href="/favicon.png">
15 <title>Snip Snap · peppe.rs</title>
16 <body>
17 <div class="posts">
18 <div class="post">
19 <a href="/" class="post-end-link">Home</a>
20 <span>/</span>
21 <a href="/posts" class="post-end-link">Posts</a>
22 <span>/</span>
23 <a class="post-end-link">Snip Snap</a>
24 <a class="stats post-end-link" href="https://git.peppe.rs/web/site/plain/posts/snip_snap.md
25">View Raw</a>
26 <div class="separator"></div>
27 <div class="date">
28 08/05 — 2024
29 <div class="stats">
30 <span class="stats-number">
31 40.76
32 </span>
33 <span class="stats-unit">cm</span>
34 &nbsp
35 <span class="stats-number">
36 2.1
37 </span>
38 <span class="stats-unit">min</span>
39 </div>
40 </div>
41 <h1>
42 Snip Snap
43 </h1>
44 <div class="post-text">
45 <p>I regularly switch between exactly two things while working, a
46“current” and an “alternate” item; a lot of tools I use seem to support
47this flow.</p>
48<h4 id="git">git</h4>
49<p>Pass <code>-</code> to <code>git-checkout</code> to switch to the
50previously active branch:</p>
51<div class="sourceCode" id="cb1"><pre
52class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git branch</span>
53<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="ex">*</span> foo</span>
54<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">bar</span></span>
55<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a></span>
56<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git checkout bar</span>
57<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git branch</span>
58<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">foo</span></span>
59<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="ex">*</span> bar</span>
60<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a></span>
61<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git checkout <span class="at">-</span></span>
62<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git branch</span>
63<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a><span class="ex">*</span> foo</span>
64<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a> <span class="ex">bar</span></span></code></pre></div>
65<h4 id="bash---cd">bash - cd</h4>
66<p>This may not be exclusive to <code>bash</code>:</p>
67<div class="sourceCode" id="cb2"><pre
68class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">~/foo</span> $ cd ~/bar</span>
69<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="ex">~/bar</span> $ cd <span class="at">-</span></span>
70<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="ex">~/foo</span> $</span></code></pre></div>
71<p>This is especially handy in combination with my <a
72href="../curing_a_case_of_git-UX/">git-worktree flow</a>:</p>
73<div class="sourceCode" id="cb3"><pre
74class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">~/main-branch</span> $ gwj feature</span>
75<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">~/feat-branch</span> $ cd <span class="at">-</span></span>
76<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">~/main-branch</span> $</span></code></pre></div>
77<h4 id="bash---jobs">bash - jobs</h4>
78<p>I often suspend multiple <code>vim</code> sessions with
79<code>Ctrl-Z</code>:</p>
80<div class="sourceCode" id="cb4"><pre
81class="sourceCode bash"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> jobs</span>
82<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">[1]+</span> Stopped vim transpiler/src/transform.rs</span>
83<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">[2]-</span> Stopped git commit <span class="at">--verbose</span></span></code></pre></div>
84<p>In the above example: I suspended <code>vim</code> when working on
85<code>transform.rs</code>, and then began working on a commit by running
86<code>git commit</code> without a message flag (lets you craft a message
87in <code>$EDITOR</code>). To bring the current job to the foreground,
88you can use <code>fg</code>:</p>
89<div class="sourceCode" id="cb5"><pre
90class="sourceCode bash"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> fg</span></code></pre></div>
91<p>With a job identifier:</p>
92<div class="sourceCode" id="cb6"><pre
93class="sourceCode bash"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> fg %2 <span class="co"># resumes interactive git commit</span></span></code></pre></div>
94<p>Or switch to “last” job, or the second-most-recently-resumed job:</p>
95<div class="sourceCode" id="cb7"><pre
96class="sourceCode bash"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> fg %-</span>
97<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> %- <span class="co"># shorthand</span></span></code></pre></div>
98<h4 id="vim">vim</h4>
99<p>Switch to the last active buffer with <code>Ctrl+^</code>. In
100command-mode, <code>#</code> refers to the last active buffer, you can
101use this as an argument to a few commands:</p>
102<pre class="vimscript"><code>:b# &quot; switch to alternate buffer (same as Ctrl+^)
103:vsp# &quot; create a vertical split with the alternate buffer
104:read# &quot; read contents of alternate buffer into current buffer
105:!wc # &quot; pass file name of alternate buffer to the command `wc`</code></pre>
106<p>See <code>:help c_#</code> for more.</p>
107<h4 id="tmux">tmux</h4>
108<p>Switch to the last active tmux session with
109<code>&lt;prefix&gt;+shift+L</code>.</p>
110<h4 id="qutebrowser">qutebrowser</h4>
111<p>Switch to the last active tab with <code>g$</code>.</p>
112
113 </div>
114
115 <div class="intro">
116 Hi.
117 <div class="hot-links">
118 <a href="https://peppe.rs/index.xml" class="feed-button">Subscribe</a>
119 </div>
120 <p>I'm Akshay, programmer and pixel-artist.</p>
121 <p>
122 I write <a href="https://git.peppe.rs">open-source stuff</a> to pass time.
123 I also design fonts:
124 <a href="https://git.peppe.rs/fonts/scientifica/about">scientifica</a>,
125 <a href="https://git.peppe.rs/fonts/curie/about">curie</a>.
126 </p>
127 <p>Send me a mail at [email protected] or a message at [email protected].</p>
128 </div>
129
130 <a href="/" class="post-end-link">Home</a>
131 <span>/</span>
132 <a href="/posts" class="post-end-link">Posts</a>
133 <span>/</span>
134 <a class="post-end-link">Snip Snap</a>
135 <a class="stats post-end-link" href="https://git.peppe.rs/web/site/plain/posts/snip_snap.md
136">View Raw</a>
137 </div>
138 </div>
139 </body>
140</html>