All I Got Was A Card?!
The Girlfriend gave me a card on St George’s Day. It isn’t normal tradition, but I’m not in Catalonia either, so it’s fine. With this Coronavirus thing going on, it wouldn’t be possible visiting and experiencing the real deal either.
More Bash Tweaking
Learnt way more things about bash
keybindings and how to put those
under-utilised F1
..F12
function keys good use. First
off, to figure out what certain keys are represented in as escape
sequences, use the read
builtin. For example:
# Imagine you pressed the `F1` key after the read command
% read
^[[OP
So this gives you the mapping “\e[OP
” to into .inputrc
to map F1
to.
(The “^[
” meant escape, so you have to transliterate it into “\e
”.)
Thus you can now map all the function keys to do your bidding!
I was looking for a command line mnemonic alias of some sort lately, and
chanced upon ‘navi’. For someone who
spends all his terminal typing commands to test & debug and not wanting to
context switch, this tool is a gamechanger. And combined with the mapping to
the F1
key, which traditionally had always opened a ‘help’ screen…
# F1 - Invoke `navi` to search complete less commonly used commands
"\eOP": " \C-b\C-k \C-u`__call_navi`\e\C-e\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f"
Schweeet!
And while I was wandering around Rust-land looking for other nifty command line tools, I hit upon the documentation for rustyline, which, if you are confused to what the line of ‘gibberish’ you are looking at in the readline configuration, this page tells you what each of the keybindings are doing. And yes, I found this better documented in a Rust project than all of GNU Bash’s documentation.
GNU Stow
All the GNU stuff has, and still is documented for the 80s, or something.
But thankfully, with Rust’s initiatives to rewrite some of these ancient tools, they have also brought the documentation into mordenity as well.
One of these old tools that I had been trying to get a grip on was stow
. For
the longest time and with good intentions, I had been wanting to
save/restore all my configuration setups into ‘git’, and just use a tool to
backup and symlink them to the base OS’s file layout.
GNU stow
had always been something that I’ve heard now and again, to which
I’ve never really understood how it structured things. After touching bash
again, I was encouraged to give it another try.
To cheat, I thought I could rely on modern-era guides like YouTube to educate
me without doing man stow
, but I was pretty wrong. Every single demo video
out there had 0 explanation of what they are doing, with very little showcase
of the tool itself.
That was real discouraging, and it’s unbelievable that it could be so hard to
show how a simple tool like this works. So it was to bite the bullet and go
through the hard slog of working out what stow
was trying to do. Eventually
I understood.
For the longest time, I didn’t understand that stow
does not help you move
your files to a place to backup, then to symlink it! You’re responsible for
for moving it into a directory as a ‘pretend’ root overlay-directory in which
it will symlink to the target-directory controlled by the -t
flag. And that’s
all it was!
With that, I finally had a coherent means of stashing all my configuration and never having to worry about setting things up from scratch again!