Certainly! Here’s a detailed procedural guide that includes the steps to be performed within a zsh
shell, including GitHub commands and any additional setup.
Setting Up Zsh with Oh My Zsh, Plugins, and Custom Theme
1. Update Package Lists
- Open your terminal.
- Run the following command to update your package lists:
sudo apt update
2. Install Zsh
- Install
zsh
using the following command:sudo apt install -y zsh
3. Install Oh My Zsh
- Install Oh My Zsh, a framework for managing zsh configuration:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
4. Install Zsh Plugins
-
Open a new
zsh
session to perform the following commands. -
Clone
zsh-syntax-highlighting
Plugin:git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
-
Clone
zsh-autosuggestions
Plugin:git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
-
Clone
zsh-completions
Plugin:git clone https://github.com/zsh-users/zsh-completions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-completions
5. Update .zshrc
Configuration
-
Add Plugins to
.zshrc
:- Run the following command to add plugins to your
.zshrc
file:sed -i '/^plugins=(/c\plugins=(git zsh-syntax-highlighting zsh-autosuggestions zsh-completions)' ~/.zshrc
- Run the following command to add plugins to your
-
Set Custom Prompt:
- Update the
PROMPT
variable in.zshrc
:sed -i '/^PROMPT=/c\PROMPT="%n@%m %~ %# "' ~/.zshrc
- Update the
6. Create and Apply Custom Theme
-
Define and Create Custom Theme:
- Create a new theme file with colors:
THEME_NAME="username-host-colored" mkdir -p ~/.oh-my-zsh/custom/themes cat <<EOF > ~/.oh-my-zsh/custom/themes/$THEME_NAME.zsh-theme # Define colors autoload -U colors && colors # Custom prompt PROMPT='%F{green}%n%f@%F{cyan}%m%f %F{yellow}%~%f %# ' EOF
- Create a new theme file with colors:
-
Update
.zshrc
to Use Custom Theme:- Set the theme in
.zshrc
:sed -i "s/^ZSH_THEME=.*/ZSH_THEME=\"$THEME_NAME\"/" ~/.zshrc
- Set the theme in
7. Apply Changes
- Source
.zshrc
:- Apply the changes made to
.zshrc
:source ~/.zshrc
- Apply the changes made to
8. (Optional) Set Zsh as Default Shell
- Change Default Shell to Zsh:
- Set zsh as your default shell:
chsh -s $(which zsh)
- Set zsh as your default shell:
9. Additional Setup in Zsh
-
Verify Plugin Installation:
- Open a new
zsh
session or source the.zshrc
file again:source ~/.zshrc
- Check if the plugins are working by testing their functionality (e.g., syntax highlighting, auto-suggestions).
- Open a new
-
Update Plugin Repositories (Optional):
- To update the plugins from their repositories, run the following commands:
cd ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting git pull cd ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions git pull cd ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-completions git pull
- To update the plugins from their repositories, run the following commands:
By following these steps, you’ll have zsh
installed, configured with Oh My Zsh, plugins, a custom colored prompt, and any additional setup needed for the plugins.