Boosting up your terminal for development — Productivity [updated]

Allan Ramos
5 min readJul 23, 2022

--

One tool which is always with you as a Software developer is The Terminal (or Console, as you prefer). So we can use some plugins/extensions to get it “smarter” and then improve your productivity.

First things

First things first. This article (to make this one light) it covers macOS and Linux Users, so for Windows Users I will write another one covering setup, customization and improvements.

What Will I get?

I choose some plugins that help me at work like: In line auto-complete command, common suggestions, Git Icons indicators and Project path indicators, Colorful semantics and so on.

The Tools

To get these features on your terminal you don’t need another Terminal app itself. You can get one without problem, like iTerm for macOS or DeepinConsole or something else, but it isn’t a requirement.
All you’ll need is:

- zsh: a shell (like bash) built-in on macOS Catalina and Later;
- ohmyzsh: to be able attach plugins, like zinit;
- zinit installer and its plugins to do things;
-
themimg: theme and fonts for custom icons for Languages/frameworks etc;

Let’s Start

So, if you are on macOS Catalina or Later you have the zsh shell built in on your terminal. In another hand you must to install it and make it your default shell.

on Linux
brew install zsh or
sudo apt install zsh

Make it default:
chsh -s $(which zsh)

on macOS
brew install zsh

make it default: on newest macOS versions.
chsh -s /usr/local/bin/zsh

on HighSierra and older:
chsh -s /bin/zsh

Doing this you should be able to run zsh on your machine. To check if works fine run zsh —-version or /bin/zsh --version

Now we will install OhMyZsh you can install it using three methods, curl, wget and fetch:

curl (recommended):

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

wget:

sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

fetch:

sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Now let’s download the theming and fonts/icons. To the theme you can choose anyone you like, I got Dracula cos’ I do like it.
So check Dracula’s website and pick a theme for your terminal. There are some terminals on Compactibility List: Gnome, iTerm, Terminal.app(that is my current on this example) etc. Next, follow the steps to download it and activate:

https://draculatheme.com/

The fonts and icons we’ll use FiraCode and Spaceship Theme. With FiraCode we can use a free monospaced font with programming ligatures. SpaceShip make some icons from git, languages version, Docker and path be displayed on terminal. So just follow the Github Release link, download and install the font format you prefer.
Then select FiraCode on your terminal profile, as the image bellow:
Terminal > Preferences > Profile > Font

For Spaceship you just need a couple of command to download, link and set it on zsh profile file.

Download Spaceship:

git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"

Then link it:

ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

So now inside the file ~/.zshrc replace the default theme on ZSH_THEME variable like this: ZSH_THEME=”spaceship” then restart the terminal.

Now we will set the spaceship settings. At the botton of ~/.zshrc paste the following code:

SPACESHIP_PROMPT_ORDER=(
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
exec_time # Execution time
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)

SPACESHIP_USER_SHOW=always
SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_CHAR_SYMBOL=”$_❯”
SPACESHIP_CHAR_SUFFIX=” “

these fields SPACESHIP_CHAR_SYMBOL and SPACESHIP_CHAR_SUFFIX You can use any String you want to customize the first and second line on input terminal. So Mine looks like that:

Final touch

Finally let’s adds the plugins and finish the boost. First install zinit installer:

bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"

When it ends restart the terminal and if some installation is needed it will run by itself, so wait the end of instalation and go to next step.
Now open again the ~/.zshrc file and adds the following code bellow the last line on the file:

zinit light zdharma-continuum/fast-syntax-highlighting
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-completions

The file will looks like that:

Conclusion

So! Now you have a terminal with thousands of add-ons for common tools like Yarn, Homebrew, Node etc (you just need to press TAB to complete commands); commands based on run history; syntax highlighting with missing command indicator and so on!

I hope you enjoy it and these tips save some seconds by day and hours by weeks or by year on your job (😁😅🤣).
seeya!

--

--

Allan Ramos

Specialist Flutter Developer; Operating System Enthusiast; Developer community organizer, speaker, and Opensource contributor;