Configuring Oh My Zsh through Git Bash on Windows
Jun 01. 2024

Summary
RyanAI
Loading.
This content is generated based on the article and is only used for explanation and summary of the article content.

Oh My Zsh enhances terminal usability in Unix environments. Here’s a guide to configure it on Windows with Git Bash.

graph TD
    A[Install Git Bash] --> B[Download zsh]
    B --> C[Extract zsh]
    C --> D[Set zsh as default shell]
    D --> E[Download install.sh for Oh-My-Zsh]
    E --> F[Modify installation source in install.sh]
    F --> G[Execute install.sh]
    G --> H[Configure Oh-My-Zsh]
    H --> I[Set theme in .zshrc]
    H --> J[Download syntax highlighting plugin]
    H --> K[Download autosuggestions plugin]
    I --> L[Configure plugins in .zshrc]
    L --> M[Apply configuration with source ~/.zshrc]
    H --> N[Install Windows Terminal]
    N --> O[Set Git Bash as default terminal in Windows Terminal]
    H --> P[Configure IDE to use Git Bash]

Step 1: Install Git Bash

Download and install from the Git website.

Step 2: Install zsh

1. Download zsh

2. Install zsh

Extract zsh and copy etc and usr directories to the Git installation directory (e.g., C:\Program Files\Git).

3. Set zsh as the Default Shell

Run chsh -s $(which zsh) or add the following to ~/.bashrc:

if [ -t 1 ]; then
  exec zsh
fi

Step 3: Install Oh-My-Zsh

1. Download install.sh

Run:

curl -# -O https://mirror.ghproxy.com/https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh

2. Modify Installation Source

Edit install.sh:

REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://mirror.ghproxy.com/https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master}

3. Execute the Script

Run:

sh install.sh

Step 4: Configure Oh-My-Zsh

1. Set Theme

Edit ~/.zshrc to change ZSH_THEME="robbyrussell" to ZSH_THEME="ys".

2. Install Plugins

Run:

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

3. Configure Plugins

Edit ~/.zshrc:

plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

4. Apply Configuration

Run:

source ~/.zshrc

Step 5: Configure Windows Terminal

Installation

Install from the Microsoft Store or official documentation.

Configuration

Set Windows Terminal to default to Git Bash.

Step 6: Configure IDEs (e.g., IDEA, VSCode)

Set the default terminal to Git Bash in the IDE settings.

> comment on / twitter
>
CC BY-NC-SA 4.0 2021-PRESENT © Ryan uo