But Better

A lot of my workflow tips focus on cutting down time for small annoyances, such as navigation or tasks that don’t contribute to productive work. It’s true, I probably spend more time thinking about these things than they actually save me. But, the value for me is the mindset – when I leverage these improvements, I feel faster and more productive. I run into less obstacles in my workflow, allowing me to capitalize on my focus and get things done more effectively.

This is a quick rundown of some of the tools that I use in my development workflow. I’ve made it versatile and adaptable to many different projects and environments. It helps me speed up my work and focus on what’s important.

bat

Viewing a file in the CLI is a quick way to verify the contents without opening in an app. The standard way to view the contents of a file is cat, but now there is a better version called bat. It has syntax highlighting, integrates with git diff, and adds pagination. I simply aliased cat to run bat and it has been a sublime experience.

Using bat to view a file, aliased as cat
Using bat to view a file, aliased as cat

exa

ls is an essential part of viewing your current directory, but exa adds more color and information at the same speed. I simply replaced ls with exa as it works exactly the same way but provides more information. It also has a tree view, for which I aliased lst = exa -T.

Using lst in a project directory
Using lst in a project directory

zoxide

A smart cd, zoxide is a powerful tool to help you navigate directories quickly and based on usage. Instead of having to navigate to the directory manually, zoxide will automatically determine where you intended to go and jump there automatically, skipping the intermediate directories.

Using zoxide to jump to adjacent directory
Using zoxide to jump to adjacent directory

Working Fast

gh

Before GitHub came out with their CLI tool gh, I used hub. I made the transition to gh because of its official support from GitHub. Although I don’t use many of its features (such as listing issues and reviewing PRs), I do enjoy a lot of its functionality. For example, you can automatically create a new repository based on the contents of your current directory, or create a PR from your current branch. These small things help me stay in the CLI and not have to navigate to GitHub on my browser.

Create new repository from directory
Create new repository from directory

trash

I used to run rm -rf when I needed to delete something in the terminal, which is extremely unsafe. trash is a great tool to move things to the macOS Trash so that they’re recoverable in case you need them again. It’s a much less destructive way of deleting files and directories on your computer, and gives me peace of mind when I delete things in my command line.

Aliasing

One of the features that I leverage the most is the aliasing commands. Although this isn’t special to zsh, I appreciate the ability to type just a couple of letters to run long commands.

Open and Code

I aliased o for open . to open the directory in Finder, and c for code . to open the directory in VSCode. These are super handy because I use these a lot, and I save a few keystrokes.It makes things feel a lot quicker and like I can move around faster.

DS Store

A major annoyance in development are .DSStore files that pop out of nowhere. I have no idea what they do or what purpose they serve, but even when I put it in the .gitignore they still somehow appear everywhere. To deal with this, I found a recursive solution to delete them all in a given directory, just by typing ds.

1
alias ds="find . -name '.DS_Store' -type f -delete"

This makes it easy – whenever I see one of them appear again, I run ds and they all disappear.

Removing Local Git Branches

Another annoyance is that git doesn’t have a command to delete old local branches that don’t exist on origin anymore. So, I created an alias prune that will do this.

1
alias prune="git branch --merged master --no-color | grep -v master | grep -v stable | xargs git branch -d"

This will remove all old local branches and clean up your local git directory.

Resetting Git Project

I move in and out of a lot of different projects, and I like to work knowing that I’m on the latest version. I created a command, grp (git reset please), to “reset” the project I’m working on to the latest on origin. All this does is git fetch, git checkout master, git pull origin master, prune. When I haven’t worked on a project in a while, this is a good way to reset the entire project into the latest state.

1
alias grp="gcm && gf && ggl && prune"

Useless

pipes-rs

I don’t think any developer needs a screensaver for their terminal. Most probably don’t even want one. But when I came across pipes.sh I figured it would be fun to have. I looked around a bit more, and found a newer version built in rust, pipes-rs. I aliased it to ss for “screensaver”. I have rarely used it, but I think it’s neat that I could use it if I wanted to.

Using pipes-rs
Using pipes-rs