From 560a40492e1954d19f4528d58c2f45b07379cff5 Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 8 May 2024 11:40:31 +0100 Subject: new post: snip snap --- docs/art/index.html | 58 ++++----- docs/index.html | 24 ++-- docs/index.xml | 77 +++++++++++- docs/posts/auto-currying_rust_functions/index.html | 2 +- docs/posts/bash_harder_with_vim/index.html | 2 +- docs/posts/call_to_ARMs/index.html | 2 +- docs/posts/color_conundrum/index.html | 2 +- docs/posts/font_size_fallacies/index.html | 2 +- docs/posts/index.html | 41 ++++-- docs/posts/lightweight_linting/index.html | 4 +- docs/posts/my_setup/index.html | 2 +- docs/posts/pixel_art_in_GIMP/index.html | 2 +- docs/posts/plain_text_journaling/index.html | 2 +- docs/posts/rapid_refactoring_with_vim/index.html | 2 +- docs/posts/snip_snap/index.html | 140 +++++++++++++++++++++ docs/posts/static_sites_with_bash/index.html | 2 +- docs/posts/termux_tandem/index.html | 2 +- docs/posts/turing_complete_type_systems/index.html | 2 +- 18 files changed, 299 insertions(+), 69 deletions(-) create mode 100644 docs/posts/snip_snap/index.html (limited to 'docs') diff --git a/docs/art/index.html b/docs/art/index.html index 22f7b3f..ce7e64f 100644 --- a/docs/art/index.html +++ b/docs/art/index.html @@ -38,7 +38,7 @@
Wane
-
02/07 — 2023
+
01/07 — 2023
@@ -82,7 +82,7 @@
Ferris
-
29/08 — 2022
+
28/08 — 2022
@@ -93,7 +93,7 @@
Locus
-
09/06 — 2022
+
08/06 — 2022
@@ -104,7 +104,7 @@
Ivory Tower
-
03/06 — 2022
+
02/06 — 2022
@@ -115,7 +115,7 @@
The Sect
-
03/06 — 2022
+
02/06 — 2022
@@ -126,7 +126,7 @@
Elephant
-
21/05 — 2022
+
20/05 — 2022
@@ -137,7 +137,7 @@
2022
-
13/03 — 2022
+
12/03 — 2022
@@ -148,7 +148,7 @@
Scenes From A Memory
-
21/12 — 2021
+
20/12 — 2021
@@ -159,7 +159,7 @@
B8
-
04/10 — 2021
+
03/10 — 2021
@@ -170,7 +170,7 @@
Goat
-
23/08 — 2021
+
22/08 — 2021
@@ -181,7 +181,7 @@
B6
-
10/07 — 2021
+
09/07 — 2021
@@ -192,7 +192,7 @@
PV-3
-
27/06 — 2021
+
26/06 — 2021
@@ -203,7 +203,7 @@
Rekindled
-
11/06 — 2021
+
10/06 — 2021
@@ -214,7 +214,7 @@
Bison
-
05/06 — 2021
+
04/06 — 2021
@@ -225,7 +225,7 @@
Notre-Dame
-
30/05 — 2021
+
29/05 — 2021
@@ -236,7 +236,7 @@
Pineapple
-
29/05 — 2021
+
28/05 — 2021
@@ -247,7 +247,7 @@
B4
-
22/05 — 2021
+
21/05 — 2021
@@ -258,7 +258,7 @@
Isopod
-
22/05 — 2021
+
21/05 — 2021
@@ -269,7 +269,7 @@
Wraith
-
14/05 — 2021
+
13/05 — 2021
@@ -280,7 +280,7 @@
Antique
-
08/05 — 2021
+
07/05 — 2021
@@ -291,7 +291,7 @@
Grimoire
-
06/05 — 2021
+
05/05 — 2021
@@ -302,7 +302,7 @@
Aviator Owl
-
01/05 — 2021
+
30/04 — 2021
@@ -313,7 +313,7 @@
Beret Beaver
-
01/05 — 2021
+
30/04 — 2021
@@ -324,7 +324,7 @@
Monocle Rabbit
-
01/05 — 2021
+
30/04 — 2021
@@ -335,7 +335,7 @@
Ramen Noodles
-
26/03 — 2021
+
25/03 — 2021
@@ -346,7 +346,7 @@
Shark
-
22/02 — 2021
+
21/02 — 2021
@@ -357,7 +357,7 @@
Moonshine
-
25/04 — 2020
+
24/04 — 2020
@@ -368,7 +368,7 @@
Onigiri
-
09/04 — 2020
+
08/04 — 2020
@@ -379,7 +379,7 @@
The Observer
-
17/01 — 2020
+
16/01 — 2020
diff --git a/docs/index.html b/docs/index.html index e1230ed..ba79b10 100644 --- a/docs/index.html +++ b/docs/index.html @@ -40,15 +40,15 @@
- 19/06 — 2023 + 08/05 — 2024
- - Plain Text Journaling + + Snip Snap - 8.9 + 2.1 min @@ -57,15 +57,15 @@
- 03/09 — 2022 + 18/06 — 2023
- - Curing A Case Of Git-UX + + Plain Text Journaling - 9.6 + 8.9 min @@ -74,15 +74,15 @@
- 28/08 — 2022 + 03/09 — 2022
- - Programming On 34 Keys + + Curing A Case Of Git-UX - 6.2 + 9.6 min 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 @@ en-us Creative Commons BY-NC-SA 4.0 +Snip Snap +<p>I regularly switch between exactly two things while working, a +“current” and an “alternate” item; a lot of tools I use seem to support +this flow.</p> +<h4 id="git">git</h4> +<p>Pass <code>-</code> to <code>git-checkout</code> to switch to the +previously active branch:</p> +<div class="sourceCode" id="cb1"><pre +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> +<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="ex">*</span> foo</span> +<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">bar</span></span> +<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a></span> +<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git checkout bar</span> +<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git branch</span> +<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">foo</span></span> +<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="ex">*</span> bar</span> +<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a></span> +<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> +<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git branch</span> +<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a><span class="ex">*</span> foo</span> +<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a> <span class="ex">bar</span></span></code></pre></div> +<h4 id="bash---cd">bash - cd</h4> +<p>This may not be exclusive to <code>bash</code>:</p> +<div class="sourceCode" id="cb2"><pre +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> +<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> +<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="ex">~/foo</span> $</span></code></pre></div> +<p>This is especially handy in combination with my <a +href="../curing_a_case_of_git-UX/">git-worktree flow</a>:</p> +<div class="sourceCode" id="cb3"><pre +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> +<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> +<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">~/main-branch</span> $</span></code></pre></div> +<h4 id="bash---jobs">bash - jobs</h4> +<p>I often suspend multiple <code>vim</code> sessions with +<code>Ctrl-Z</code>:</p> +<div class="sourceCode" id="cb4"><pre +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> +<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> +<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> +<p>In the above example: I suspended <code>vim</code> when working on +<code>transform.rs</code>, and then began working on a commit by running +<code>git commit</code> without a message flag (lets you craft a message +in <code>$EDITOR</code>). To bring the current job to the foreground, +you can use <code>fg</code>:</p> +<div class="sourceCode" id="cb5"><pre +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> +<p>With a job identifier:</p> +<div class="sourceCode" id="cb6"><pre +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> +<p>Or switch to “last” job, or the second-most-recently-resumed job:</p> +<div class="sourceCode" id="cb7"><pre +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> +<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> +<h4 id="vim">vim</h4> +<p>Switch to the last active buffer with <code>Ctrl+^</code>. In +command-mode, <code>#</code> refers to the last active buffer, you can +use this as an argument to a few commands:</p> +<pre class="vimscript"><code>:b# &quot; switch to alternate buffer (same as Ctrl+^) +:vsp# &quot; create a vertical split with the alternate buffer +:read# &quot; read contents of alternate buffer into current buffer +:!wc # &quot; pass file name of alternate buffer to the command `wc`</code></pre> +<p>See <code>:help c_#</code> for more.</p> +<h4 id="tmux">tmux</h4> +<p>Switch to the last active tmux session with +<code>&lt;prefix&gt;+shift+L</code>.</p> +<h4 id="qutebrowser">qutebrowser</h4> +<p>Switch to the last active tab with <code>g$</code>.</p> +https://peppe.rs/posts/snip_snap/ +Wed, 08 May 2024 10:38:00 +0000 +https://peppe.rs/posts/snip_snap/ + + Plain Text Journaling <p>I cobbled together a journaling system with {neo,}vim, coreutils and <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 your dependencies:</p> <div class="sourceCode" id="cb21"><pre 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> -<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> +<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a><span class="kw">[dependencies]</span></span> <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> <span id="cb21-4"><a href="#cb21-4" aria-hidden="true" tabindex="-1"></a></span> -<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> +<span id="cb21-5"><a href="#cb21-5" aria-hidden="true" tabindex="-1"></a><span class="kw">[dependencies.tree-sitter-rust]</span></span> <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> <p>Let’s load in some Rust code to work with. As <a href="https://en.wikipedia.org/wiki/Self-reference">an ode to Gödel</a> diff --git a/docs/posts/auto-currying_rust_functions/index.html b/docs/posts/auto-currying_rust_functions/index.html index 83e5c86..49b4c79 100644 --- a/docs/posts/auto-currying_rust_functions/index.html +++ b/docs/posts/auto-currying_rust_functions/index.html @@ -25,7 +25,7 @@ ">View Raw
- 09/05 — 2020 + 08/05 — 2020
356.44 diff --git a/docs/posts/bash_harder_with_vim/index.html b/docs/posts/bash_harder_with_vim/index.html index e62f1aa..db81097 100644 --- a/docs/posts/bash_harder_with_vim/index.html +++ b/docs/posts/bash_harder_with_vim/index.html @@ -25,7 +25,7 @@ ">View Raw
- 31/07 — 2019 + 30/07 — 2019
24.38 diff --git a/docs/posts/call_to_ARMs/index.html b/docs/posts/call_to_ARMs/index.html index 3b5e780..6aae1d8 100644 --- a/docs/posts/call_to_ARMs/index.html +++ b/docs/posts/call_to_ARMs/index.html @@ -25,7 +25,7 @@ ">View Raw
- 08/02 — 2020 + 07/02 — 2020
33.57 diff --git a/docs/posts/color_conundrum/index.html b/docs/posts/color_conundrum/index.html index 3178da8..aef6081 100644 --- a/docs/posts/color_conundrum/index.html +++ b/docs/posts/color_conundrum/index.html @@ -25,7 +25,7 @@ ">View Raw
- 31/12 — 2019 + 30/12 — 2019
14.39 diff --git a/docs/posts/font_size_fallacies/index.html b/docs/posts/font_size_fallacies/index.html index bebec46..513b1ef 100644 --- a/docs/posts/font_size_fallacies/index.html +++ b/docs/posts/font_size_fallacies/index.html @@ -25,7 +25,7 @@ ">View Raw
- 17/03 — 2020 + 16/03 — 2020
32.37 diff --git a/docs/posts/index.html b/docs/posts/index.html index 2a7c1a3..f048493 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -27,7 +27,24 @@
- 19/06 — 2023 + 08/05 — 2024 +
+ + Snip Snap + + + + + 2.1 + + min + + + + + +
+ 18/06 — 2023
Plain Text Journaling @@ -214,7 +231,7 @@
- 18/06 — 2020 + 17/06 — 2020
Turing Complete Type Systems @@ -231,7 +248,7 @@
- 09/05 — 2020 + 08/05 — 2020
Auto-currying Rust Functions @@ -248,7 +265,7 @@
- 09/04 — 2020 + 08/04 — 2020
Pixel Art In GIMP @@ -265,7 +282,7 @@
- 01/04 — 2020 + 31/03 — 2020
Rapid Refactoring With Vim @@ -282,7 +299,7 @@
- 17/03 — 2020 + 16/03 — 2020
Font Size Fallacies @@ -299,7 +316,7 @@
- 08/03 — 2020 + 07/03 — 2020
Termux Tandem @@ -316,7 +333,7 @@
- 08/02 — 2020 + 07/02 — 2020
Call To ARMs @@ -333,7 +350,7 @@
- 31/12 — 2019 + 30/12 — 2019
Color Conundrum @@ -350,7 +367,7 @@
- 23/11 — 2019 + 22/11 — 2019
Static Sites With Bash @@ -367,7 +384,7 @@
- 07/11 — 2019 + 06/11 — 2019
My Setup @@ -435,7 +452,7 @@
- 31/07 — 2019 + 30/07 — 2019
Bash Harder With Vim diff --git a/docs/posts/lightweight_linting/index.html b/docs/posts/lightweight_linting/index.html index 3f9bed6..9982385 100644 --- a/docs/posts/lightweight_linting/index.html +++ b/docs/posts/lightweight_linting/index.html @@ -217,10 +217,10 @@ class="sourceCode bash">
# within Cargo.toml
-[dependencies]
+[dependencies]
 tree-sitter = "0.20"
 
-[dependencies.tree-sitter-rust]
+[dependencies.tree-sitter-rust]
 git = "https://github.com/tree-sitter/tree-sitter-rust"

Let’s load in some Rust code to work with. As an ode to Gödel diff --git a/docs/posts/my_setup/index.html b/docs/posts/my_setup/index.html index 8df18f6..09843b3 100644 --- a/docs/posts/my_setup/index.html +++ b/docs/posts/my_setup/index.html @@ -25,7 +25,7 @@ ">View Raw

- 07/11 — 2019 + 06/11 — 2019
10.39 diff --git a/docs/posts/pixel_art_in_GIMP/index.html b/docs/posts/pixel_art_in_GIMP/index.html index e5be70c..d68ff60 100644 --- a/docs/posts/pixel_art_in_GIMP/index.html +++ b/docs/posts/pixel_art_in_GIMP/index.html @@ -25,7 +25,7 @@ ">View Raw
- 09/04 — 2020 + 08/04 — 2020
55.54 diff --git a/docs/posts/plain_text_journaling/index.html b/docs/posts/plain_text_journaling/index.html index 74faf0c..b96821a 100644 --- a/docs/posts/plain_text_journaling/index.html +++ b/docs/posts/plain_text_journaling/index.html @@ -25,7 +25,7 @@ ">View Raw
- 19/06 — 2023 + 18/06 — 2023
138.66 diff --git a/docs/posts/rapid_refactoring_with_vim/index.html b/docs/posts/rapid_refactoring_with_vim/index.html index 2303878..ac375b3 100644 --- a/docs/posts/rapid_refactoring_with_vim/index.html +++ b/docs/posts/rapid_refactoring_with_vim/index.html @@ -25,7 +25,7 @@ ">View Raw
- 01/04 — 2020 + 31/03 — 2020
79.12 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 @@ + + + + + + + + + + + + + + + Snip Snap · peppe.rs + +
+
+ Home + / + Posts + / + Snip Snap + View Raw +
+
+ 08/05 — 2024 +
+ + 40.76 + + cm +   + + 2.1 + + min +
+
+

+ Snip Snap +

+
+

I regularly switch between exactly two things while working, a +“current” and an “alternate” item; a lot of tools I use seem to support +this flow.

+

git

+

Pass - to git-checkout to switch to the +previously active branch:

+
$ git branch
+* foo
+  bar
+
+$ git checkout bar
+$ git branch
+  foo
+* bar
+
+$ git checkout -
+$ git branch
+* foo
+  bar
+

bash - cd

+

This may not be exclusive to bash:

+
~/foo $ cd ~/bar
+~/bar $ cd -
+~/foo $
+

This is especially handy in combination with my git-worktree flow:

+
~/main-branch $ gwj feature
+~/feat-branch $ cd -
+~/main-branch $
+

bash - jobs

+

I often suspend multiple vim sessions with +Ctrl-Z:

+
$ jobs
+[1]+  Stopped                 vim transpiler/src/transform.rs
+[2]-  Stopped                 git commit --verbose
+

In the above example: I suspended vim when working on +transform.rs, and then began working on a commit by running +git commit without a message flag (lets you craft a message +in $EDITOR). To bring the current job to the foreground, +you can use fg:

+
$ fg
+

With a job identifier:

+
$ fg %2    # resumes interactive git commit
+

Or switch to “last” job, or the second-most-recently-resumed job:

+
$ fg %-
+$ %-      # shorthand
+

vim

+

Switch to the last active buffer with Ctrl+^. In +command-mode, # refers to the last active buffer, you can +use this as an argument to a few commands:

+
:b#      " switch to alternate buffer (same as Ctrl+^)
+:vsp#    " create a vertical split with the alternate buffer
+:read#   " read contents of alternate buffer into current buffer
+:!wc #   " pass file name of alternate buffer to the command `wc`
+

See :help c_# for more.

+

tmux

+

Switch to the last active tmux session with +<prefix>+shift+L.

+

qutebrowser

+

Switch to the last active tab with g$.

+ +
+ +
+ Hi. + +

I'm Akshay, programmer and pixel-artist.

+

+ I write open-source stuff to pass time. + I also design fonts: + scientifica, + curie. +

+

Send me a mail at nerdy@peppe.rs or a message at np@irc.rizon.net.

+
+ + Home + / + Posts + / + Snip Snap + View Raw +
+
+ + diff --git a/docs/posts/static_sites_with_bash/index.html b/docs/posts/static_sites_with_bash/index.html index c58a324..3123847 100644 --- a/docs/posts/static_sites_with_bash/index.html +++ b/docs/posts/static_sites_with_bash/index.html @@ -25,7 +25,7 @@ ">View Raw
- 23/11 — 2019 + 22/11 — 2019
21.18 diff --git a/docs/posts/termux_tandem/index.html b/docs/posts/termux_tandem/index.html index a5b15ef..5c6a8c6 100644 --- a/docs/posts/termux_tandem/index.html +++ b/docs/posts/termux_tandem/index.html @@ -25,7 +25,7 @@ ">View Raw
- 08/03 — 2020 + 07/03 — 2020
19.18 diff --git a/docs/posts/turing_complete_type_systems/index.html b/docs/posts/turing_complete_type_systems/index.html index 5f2ac60..06e44e6 100644 --- a/docs/posts/turing_complete_type_systems/index.html +++ b/docs/posts/turing_complete_type_systems/index.html @@ -25,7 +25,7 @@ ">View Raw
- 18/06 — 2020 + 17/06 — 2020
9.19 -- cgit v1.2.3