5 Developer Environment Hacks to Increase Productivity
Simple but effective environment improvements to make your life as a developer more efficient and effective
Below are some of the most useful workspace productivity hacks I’ve utilized and found to be a boon for efficiency and effectiveness. Some of them are simple organizational practices while others are tools, frameworks, or utilities to make your work more efficient overall. Enjoy!
1. Terminal Git Branch Status
First up, we have a very simple improvement, one that is so popular it has recently been incorporated into iTerm2 as a core feature.
When working in a Git repository, it is helpful to be able to see which branch you’re working on and its current status. Up until recently, this could be accomplished with a simple Bash or zsh profile edit to display the branch in your prompt.
If you are interested in the specifics of setting up a basic Bash profile for this, I highly recommend Elizabeth Zagroba’s great write-up on this. If you are interested in the iTerm2-way, follow these short steps to enable this in your terminal now:
- Open iTerm2 and select Preferences > Profiles.
- Navigate to the Sessions tab and scroll to the bottom to enable the Status Bar.
- Configure the status bar and choose the branch component.
Whether or not you choose to incorporate the branch status into your shell prompt or your terminal window is entirely up to you. Personally, I use both, simply because I became used to my shell prompt and I think it looks weird without it. Try it out and decide for yourself!
2. Use Tmux
If you aren’t familiar with tmux, I would suggest installing it and giving it a try. What seems like a relatively simple window/session manager at first is actually an incredibly complex and feature-packed productivity powerhouse.
Tmux lets you manage multiple window splits with fast shortcuts and hot-keys. One of the handiest benefits is similar to that of screen which lets you suspend sessions and return to them later.
This can be especially helpful if you have it installed on remote machines you access. You could begin a session, kick off a long-running script or process, then detach from the session and get a cup of coffee.
Once you’ve successfully acquired coffee, your session will be running right where you left it.
Another amazing benefit is that tmux will suspend your session automatically and gracefully if you lose your SSH connection to the remote machine.
If you connect to the remote machine, open a new tmux session and then open your file in Vim. Within that session, it will be safe from
.swp file hell if you’re disconnected.
Tmux has saved my ass more times than I can count and is worth the learning curve.
3. Setup Shell Aliases
The less you have to type the more efficient you are. Open up
~/.bash_aliases in your favorite text editor and start entering some aliases. Be sure to source the
.bash_aliases file in your actual shell profile first (this is by default, depending on your distro).
If you aren’t familiar with creating shell aliases, it’s very simple and quick. You can come up with shorthand versions of commands you enter repeatedly.
When you log in, do you change directories and start a process? Make an alias.
Do you find yourself backing in and out of complex directory structures? Make an alias.
Can you never quite remember the syntax for that tedious command? Yup, alias.
An alias entry is as simple as this:
alias mydir='cd /some/long/directory/path'
4. Organize Code Directories
This one sounds simple and that’s because it is. You should take some time (a few minutes even) and layout the directory structure for storing your code. Think of it as cleaning up and organizing your desk.
I like to keep any cloned repositories in a separate directory called
checkout. This helps differentiate between cloned repositories and something you might be tinkering with locally.
For any other code I like to keep it in a directory organized by language. For example:
code ---> python ---> <my_cool_project> ---> <source_files>
5. Use ripgrep
Can’t remember what file that function was in? Forgot where you stored that variable? Ripgrep to the rescue!
Have you used git-grep to search through a repository before? Ripgrep is similar with one key exception, it rips! Ripgrep is way faster than git-grep and can blaze through lines and lines of code to find what you’re looking for quickly.
The next time you forget where something is or don’t know where to start looking, try ripgrep. It’s as simple as:
rg 'search term'
Hopefully, you’ve found some of these improvements useful and apply them to your own environment the next time you’re working on a project.