diff options
Diffstat (limited to 'docs/index.xml')
-rw-r--r-- | docs/index.xml | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/docs/index.xml b/docs/index.xml index eb43379..046b4d2 100644 --- a/docs/index.xml +++ b/docs/index.xml | |||
@@ -12,6 +12,79 @@ | |||
12 | <language>en-us</language> | 12 | <language>en-us</language> |
13 | <copyright>Creative Commons BY-NC-SA 4.0</copyright> | 13 | <copyright>Creative Commons BY-NC-SA 4.0</copyright> |
14 | <item> | 14 | <item> |
15 | <title>Snip Snap</title> | ||
16 | <description><p>I regularly switch between exactly two things while working, a | ||
17 | “current” and an “alternate” item; a lot of tools I use seem to support | ||
18 | this flow.</p> | ||
19 | <h4 id="git">git</h4> | ||
20 | <p>Pass <code>-</code> to <code>git-checkout</code> to switch to the | ||
21 | previously active branch:</p> | ||
22 | <div class="sourceCode" id="cb1"><pre | ||
23 | class="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> | ||
24 | <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="ex">*</span> foo</span> | ||
25 | <span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">bar</span></span> | ||
26 | <span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a></span> | ||
27 | <span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git checkout bar</span> | ||
28 | <span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git branch</span> | ||
29 | <span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">foo</span></span> | ||
30 | <span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="ex">*</span> bar</span> | ||
31 | <span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a></span> | ||
32 | <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> | ||
33 | <span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git branch</span> | ||
34 | <span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a><span class="ex">*</span> foo</span> | ||
35 | <span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a> <span class="ex">bar</span></span></code></pre></div> | ||
36 | <h4 id="bash---cd">bash - cd</h4> | ||
37 | <p>This may not be exclusive to <code>bash</code>:</p> | ||
38 | <div class="sourceCode" id="cb2"><pre | ||
39 | class="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> | ||
40 | <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> | ||
41 | <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="ex">~/foo</span> $</span></code></pre></div> | ||
42 | <p>This is especially handy in combination with my <a | ||
43 | href="../curing_a_case_of_git-UX/">git-worktree flow</a>:</p> | ||
44 | <div class="sourceCode" id="cb3"><pre | ||
45 | class="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> | ||
46 | <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> | ||
47 | <span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">~/main-branch</span> $</span></code></pre></div> | ||
48 | <h4 id="bash---jobs">bash - jobs</h4> | ||
49 | <p>I often suspend multiple <code>vim</code> sessions with | ||
50 | <code>Ctrl-Z</code>:</p> | ||
51 | <div class="sourceCode" id="cb4"><pre | ||
52 | class="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> | ||
53 | <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> | ||
54 | <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> | ||
55 | <p>In the above example: I suspended <code>vim</code> when working on | ||
56 | <code>transform.rs</code>, and then began working on a commit by running | ||
57 | <code>git commit</code> without a message flag (lets you craft a message | ||
58 | in <code>$EDITOR</code>). To bring the current job to the foreground, | ||
59 | you can use <code>fg</code>:</p> | ||
60 | <div class="sourceCode" id="cb5"><pre | ||
61 | class="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> | ||
62 | <p>With a job identifier:</p> | ||
63 | <div class="sourceCode" id="cb6"><pre | ||
64 | class="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> | ||
65 | <p>Or switch to “last” job, or the second-most-recently-resumed job:</p> | ||
66 | <div class="sourceCode" id="cb7"><pre | ||
67 | class="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> | ||
68 | <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> | ||
69 | <h4 id="vim">vim</h4> | ||
70 | <p>Switch to the last active buffer with <code>Ctrl+^</code>. In | ||
71 | command-mode, <code>#</code> refers to the last active buffer, you can | ||
72 | use this as an argument to a few commands:</p> | ||
73 | <pre class="vimscript"><code>:b# &quot; switch to alternate buffer (same as Ctrl+^) | ||
74 | :vsp# &quot; create a vertical split with the alternate buffer | ||
75 | :read# &quot; read contents of alternate buffer into current buffer | ||
76 | :!wc # &quot; pass file name of alternate buffer to the command `wc`</code></pre> | ||
77 | <p>See <code>:help c_#</code> for more.</p> | ||
78 | <h4 id="tmux">tmux</h4> | ||
79 | <p>Switch to the last active tmux session with | ||
80 | <code>&lt;prefix&gt;+shift+L</code>.</p> | ||
81 | <h4 id="qutebrowser">qutebrowser</h4> | ||
82 | <p>Switch to the last active tab with <code>g$</code>.</p></description> | ||
83 | <link>https://peppe.rs/posts/snip_snap/</link> | ||
84 | <pubDate>Wed, 08 May 2024 10:38:00 +0000</pubDate> | ||
85 | <guid>https://peppe.rs/posts/snip_snap/</guid> | ||
86 | </item> | ||
87 | <item> | ||
15 | <title>Plain Text Journaling</title> | 88 | <title>Plain Text Journaling</title> |
16 | <description><p>I cobbled together a journaling system with {neo,}vim, coreutils and | 89 | <description><p>I cobbled together a journaling system with {neo,}vim, coreutils and |
17 | <a href="http://www.fresse.org/dateutils">dateutils</a>. This system is | 90 | <a href="http://www.fresse.org/dateutils">dateutils</a>. This system is |
@@ -1014,10 +1087,10 @@ class="sourceCode bash"><code class="sourceCode bash"><span id="cb20 | |||
1014 | your dependencies:</p> | 1087 | your dependencies:</p> |
1015 | <div class="sourceCode" id="cb21"><pre | 1088 | <div class="sourceCode" id="cb21"><pre |
1016 | class="sourceCode toml"><code class="sourceCode toml"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="co"># within Cargo.toml</span></span> | 1089 | class="sourceCode toml"><code class="sourceCode toml"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="co"># within Cargo.toml</span></span> |
1017 | <span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a><span class="kw">[</span><span class="dt">dependencies</span><span class="kw">]</span></span> | 1090 | <span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a><span class="kw">[dependencies]</span></span> |
1018 | <span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a><span class="dt">tree-sitter</span> <span class="op">=</span> <span class="st">&quot;0.20&quot;</span></span> | 1091 | <span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a><span class="dt">tree-sitter</span> <span class="op">=</span> <span class="st">&quot;0.20&quot;</span></span> |
1019 | <span id="cb21-4"><a href="#cb21-4" aria-hidden="true" tabindex="-1"></a></span> | 1092 | <span id="cb21-4"><a href="#cb21-4" aria-hidden="true" tabindex="-1"></a></span> |
1020 | <span id="cb21-5"><a href="#cb21-5" aria-hidden="true" tabindex="-1"></a><span class="kw">[</span><span class="dt">dependencies</span><span class="kw">.</span><span class="dt">tree-sitter-rust</span><span class="kw">]</span></span> | 1093 | <span id="cb21-5"><a href="#cb21-5" aria-hidden="true" tabindex="-1"></a><span class="kw">[dependencies.tree-sitter-rust]</span></span> |
1021 | <span id="cb21-6"><a href="#cb21-6" aria-hidden="true" tabindex="-1"></a><span class="dt">git</span> <span class="op">=</span> <span class="st">&quot;https://github.com/tree-sitter/tree-sitter-rust&quot;</span></span></code></pre></div> | 1094 | <span id="cb21-6"><a href="#cb21-6" aria-hidden="true" tabindex="-1"></a><span class="dt">git</span> <span class="op">=</span> <span class="st">&quot;https://github.com/tree-sitter/tree-sitter-rust&quot;</span></span></code></pre></div> |
1022 | <p>Let’s load in some Rust code to work with. As <a | 1095 | <p>Let’s load in some Rust code to work with. As <a |
1023 | href="https://en.wikipedia.org/wiki/Self-reference">an ode to Gödel</a> | 1096 | href="https://en.wikipedia.org/wiki/Self-reference">an ode to Gödel</a> |