Skip to content

Instantly share code, notes, and snippets.

@santospatrick
Last active June 14, 2024 18:14
Show Gist options
  • Save santospatrick/119ad6db081127ceff83182213d67586 to your computer and use it in GitHub Desktop.
Save santospatrick/119ad6db081127ceff83182213d67586 to your computer and use it in GitHub Desktop.
Terminal with oh-my-zsh (Linux/Windows/MacOSX)

Terminal with oh-my-zsh (Linux/Windows/MacOSX)

Every step in this tutorial is required for making terminal look as the image below.

ZSH & OH-MY-ZSH

sudo apt-get install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

OH-MY-ZSH Plugins

git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

Spaceship

git clone https://github.com/spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

~/.zshrc

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# For linux:
# export ZSH=/home/$(whoami)/.oh-my-zsh

# Defaults
export PATH=$HOME/bin:/usr/local/bin:$PATH
export DEFAULT_USER="$(whoami)"
export EDITOR="code --reuse-window"

# React Native
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools

# Fast edit config files aliases
alias ez="$EDITOR ~/.zshrc"
alias eb="$EDITOR ~/.bashrc"
alias eg="$EDITOR ~/.gitconfig"
alias eh="$EDITOR ~/.hyper.js"

# Spaceship
SPACESHIP_PROMPT_ADD_NEWLINE="false"

# ZSH theme & plugins
ZSH_THEME="spaceship"

# Load correct Node.js version based in .nvmrc file
autoload -U add-zsh-hook
load-nvmrc() {
  local nvmrc_path="$(nvm_find_nvmrc)"

  if [ -n "$nvmrc_path" ]; then
    local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")

    if [ "$nvmrc_node_version" = "N/A" ]; then
      nvm install
    elif [ "$nvmrc_node_version" != "$(nvm version)" ]; then
      nvm use
    fi
  elif [ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ] && [ "$(nvm version)" != "$(nvm version default)" ]; then
    echo "Reverting to nvm default version"
    nvm use default
  fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc

# Plugins
plugins=(git z zsh-autosuggestions zsh-syntax-highlighting nvm)

# Initialize oh-my-zsh
source $ZSH/oh-my-zsh.sh

Git

git config --global pager.branch "false"
git config --global core.editor "nano"
git config --global user.name "Patrick Santos"
git config --global user.email "[email protected]"
git config --global pull.rebase false

NVM (Node.js Version Manager)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install --lts
nvm alias default node

Change default terminal

chsh -s /bin/zsh
# then log out and log in from linux

Hyper Terminal

  1. Download Hyper:
  1. Download Fonts:
  1. Install plugins:
hyper i hyper-dracula hypercwd hyper-active-tab

~/.hyper.js

https://gist.github.com/santospatrick/303642eab7152a77a398ccf8710255da

// .hyper.js
// See https://hyper.is#cfg for all currently supported options.
// After installing hyper, run the following:
// hyper i hyper-dracula hypercwd hyper-active-tab

module.exports = {
  config: {
    fontSize: 18,
    fontFamily: '"Meslo LG M for Powerline", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
    fontWeight: 'normal',
    fontWeightBold: 'bold',
    shell: '/bin/zsh',
    shellArgs: ['--login'],
    env: {},
    bell: 'SOUND',
    copyOnSelect: false,
    defaultSSHApp: true,
    quickEdit: false,
    macOptionSelectionMode: 'vertical',
    webGLRenderer: true,
    activeTab: '🚀',
  },
  plugins: [
    "hyper-dracula",
    "hypercwd",
    "hyper-active-tab"
  ],
  localPlugins: [],
  keymaps: {
    // Example
    // 'window:devtools': 'cmd+alt+o',
  },
};

Features

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment