Search Icon, Magnifying Glass

Marmanold.com

Graduation Cap Heart Question Mark Magnifying Glass

Z Shell One-Year Update

I’ve been using Z Shell for over a year now and I’ve been very pleased with it. Honestly, I should have moved off macOS’s antiquated default Bash ages ago. Below is an update on where my .zshrc is sitting a while down the road.

Oh My ZSH Plug-ins

I keep the Oh My ZSH plug-ins pretty light. Partially because I want to keep startup times low and partially because I can’t remember the commands anyways.

plugins=(copyfile copydir extract command-not-found zsh_reload safe-paste)

zsh_reload

I’m always playing around with my aliases and other things in my .zshrc file, so having zsh_reload around is extremly helpful. Calling src in my active terminal session to load my changes helps save a lot of time when testing changes.

safe-paste & command-not-found

safe-paste and command-not-found are around mostly because I sometimes think faster than I can type. They don’t catch a lot of errors, but when they do, they save me a lot of time in debugging. This is especially useful during a production issue triage event.

copyfile, copydir, & extract

copyfile, copydir, and extract are basically around because I’m bad at remembering command parameters. These plug-ins replace my workflow of using tldr pages to remind myself of syntax before writing the command. Again, really useful in stressful triage situations.

LS Aliases & EXA

EXA in Action

I’m not sure where I found out about Exa, but I’m sure glad I did. Exa is a modern drop-in replacement for the venerable ls command. Exa offers colorization, tree views, columns, and so much more.

I’ve aliased my various Exa commands to my old ls aliases, so I don’t even have to retrain my fingers. ls gives me your basic directory listing, but colorized and with directories appearing first. lsa — my old shorthand alias for ls -a — does the same, but with hidden files visible. I’m particularly proud of lls. lls helps me work with large directories, by putting everything in a list and then piping it out to less where I can search and do other navigation tasks.

alias lsa="exa --all --group-directories-first"
alias lls="exa --long --all -h --git --group-directories-first --color always | less -RN"
alias ls="exa --group-directories-first"

Update Aliases

alias update="brew update; brew upgrade; brew upgrade --cask; brew autoremove; tldr --update"
alias prune='docker system prune -a -f --volumes; brew cleanup -s'

Nothing too exciting or interesting here, but I’m including it for completeness. I like to keep Homebrew and tldr pages up to date. Likewise, I work with Docker a lot and my work machine doesn’t have a lot of free harddrive space. These two aliases give me quick access to updating everything and then freeing up a good bit of space when I need to. I only run this once a week or so, but it’s nice not to have to remember all the specific commands I need to run.

Helping my Stupid Old Brain

echo "src to reload, extract to unzip"
echo "Helpers: copyfile, copydir, loanlist --sql --perl --mem"
echo "\t scotty upload <file path> --env prod"
echo "\t shasum -a 256 file.txt"

If you haven’t caught on yet, most of my Z Shell customizations are to help me do things that I wouldn’t necessarily remember off the top of my head. Further, I was finding that even when I did use an alias or plug-in from time to time I would totally forget it existed during a stressful production outage. Sometimes I’d even forget about helper utilities I myself had written to make life easier!

To remedy this, I just echo out some short-hand reminders of plug-ins and utilities that I have installed. It seems silly, but having a list of little utilities printed off at the start of each new session has really improved my productivity. Having these tools top of mind, means I’m using them more. It’s especially helpful during stressful situations. It’s been nice have the answer sitting right in front of me when I needed it.