Terminal Oh My Zsh + Spaceship

Wednesday, February 22, 20232 min read

Installing Zsh

Before we can get started with any configuration we need to install zsh.

As there are several ways to install depending on the operating system you are on read this guide.

If zsh correctly installed you should be able to run:

1zsh --version

Installing Oh My Zsh

To install Oh My Zsh you need to run the command below (you must have curl installed):

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

From now on all the settings you want to do like adding environment variables or configuring your terminal in any way use the ~/.zshrc file and no longer the ~/.bash_profile.

Spaceship

Now let's install the Spaceship theme that will slightly modify the information that is displayed in the terminal, with it we can show the version of the current Node, NPM, etc.

Let's start by cloning the Spaceship repository into our Oh My Zsh themes folder:

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

Now let's create a symbolic link to the Spaceship theme file in the Oh My Zsh themes folder:

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

Now inside the ~/.zshrc file, let's change the ZSH_THEME variable to look like this:

1ZSH_THEME="spaceship"

Configuring Spaceship

As much as it is very interesting to show the versions of Node, Docker and other items in our terminal, this usually consumes processing and can slow down the loading of folders, so I like to disable most of these options.

At the end of the ~/.zshrc file I add the following content:

1SPACESHIP_PROMPT_ORDER=(
2 user # Username section
3 dir # Current directory section
4 host # Hostname section
5 git # Git section (git_branch + git_status)
6 exec_time # Execution time
7 line_sep # Line break
8 jobs # Background jobs indicator
9 exit_code # Exit code section
10 char # Prompt character
11)
12SPACESHIP_USER_SHOW=always
13SPACESHIP_PROMPT_ADD_NEWLINE=false
14SPACESHIP_CHAR_SYMBOL=""
15SPACESHIP_CHAR_SUFFIX=" "

Tuesday, May 30, 2023

Sublime Text - Unleashing Productivity

Advantages of using Sublime Text and discover how it can revolutionize your coding experience.


Tuesday, April 16, 2019

Sublime Text 3 Tips

I've been using Sublime Text 3 for probably four years now and in that time I've discovered tons of useful tricks. I figured I should start writing them down for anyone who might be interested. I'll try to explain the bits that seem esoteric because there are a lot of cool commands which only work in certain contexts.