Oh-my-zsh installation and configuration

 

Installation and configurations of an oh-my-zsh shell with p10k theme.

Installation

Oh-my-zsh gives an installation script:

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

Configurations

Theme

Because I like fancy icons and colors in my shell, I installed the p10k zsh theme. Here are the steps to install it:

  1. Cloning the repository in oh-my-zsh custom themes folder:

     $ git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
    
  2. Setting ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc file and restarting Zsh

  3. Installing Meslo Nerd Font in the OS fonts:

    • see this page for the installation

    • Setting the font as default in the terminal settings (depends on the terminal)

    • If using VSCode, adding this line to the settings.json:

        "terminal.integrated.fontFamily": "MesloLGS NF"
      
  4. Launching p10k theme configuration tool:

     $ p10k configure
    

Plugins

There are loads of plugins for oh-my-zsh.

Here are the plugins configured in my zshrc:

plugins=(
    git
    sudo
    docker
    zsh-autosuggestions
    zsh-syntax-highlighting
)
  • git: Provides aliases (e.g. gst for git status) and a few useful functions
  • sudo: Easily prefix your current or previous commands with sudo by pressing Esc twice
  • docker: Adds auto-completion for docker
  • zsh-autosuggestions: Suggests commands as you type based on history and completions
  • zsh-syntax-highlighting: Highlights the shell commands whilst they are typed

Some plugins need to be installed into the oh-my-zsh custom themes folder:

  • zsh-autosuggestions:

      $ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    
  • zsh-syntax-highlight:

      $ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    

Zshrc

Some configurations I find useful in the zshrc file:

# TODO
alias ll="ls -alhF"