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/posts/snip_snap/index.html | 140 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 docs/posts/snip_snap/index.html (limited to 'docs/posts/snip_snap') 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 +
+
+ + -- cgit v1.2.3