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

AI Summary
This AI-generated content is derived from the source article.

Analysis fai

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

Install Git Bash
Download zsh
Extract zsh
Set zsh as default shell
Download install.sh for Oh-My-Zsh
Modify installation source in install.sh
Execute install.sh
Configure Oh-My-Zsh
Set theme in .zshrc
Download syntax highlighting plugin
Download autosuggestions plugin
Configure plugins in .zshrc
Apply configuration with source ~/.zshrc
Install Windows Terminal
Set Git Bash as default terminal in Windows Terminal
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
> cd ..
CC BY-NC-SA 4.0 2021-PRESENT © RYANUO