.zshrc config file

Published on Jun 13, 2024


Installation

1sh -c "$(curl -fsSL https://raw.githubusercontent.com/KazeTachinuu/config/master/installzsh.sh)"

Configuration

 1  # Path to Oh My Zsh installation
 2export ZSH="$HOME/.oh-my-zsh"
 3
 4# Disable Oh My Zsh theme (using custom prompt instead)
 5ZSH_THEME=""
 6
 7# Configure command history
 8HISTSIZE=10000                    # Number of commands to keep in memory
 9SAVEHIST=10000                    # Number of commands to save to history file
10HISTFILE=~/.zsh_history          # History file location
11setopt hist_ignore_all_dups      # Don't store duplicate commands
12setopt extended_glob             # Extended pattern matching
13setopt prompt_subst              # Enable command substitution in prompt
14
15# Load useful Zsh plugins
16plugins=(
17    git                         # Git aliases and functions
18    zsh-autosuggestions        # Fish-like command suggestions
19    zsh-syntax-highlighting    # Command syntax highlighting
20    history                    # History commands and searching
21    web-search                 # Search web from terminal
22)
23
24# Configure Git information in prompt
25autoload -Uz vcs_info           # Load version control info system
26zstyle ':vcs_info:*' enable git # Enable git support
27# Format git branch info: (branch_name)
28zstyle ':vcs_info:git*' formats ' %F{blue}(%F{green}%b%F{blue})%f%F{red}%u%c%f'
29# Format git action info: (branch_name|action)
30zstyle ':vcs_info:git*' actionformats ' %F{blue}(%F{green}%b|%a%F{blue})%f%F{red}%u%c%f'
31zstyle ':vcs_info:*' check-for-changes true  # Check for uncommitted changes
32zstyle ':vcs_info:*' unstagedstr '*'         # Symbol for unstaged changes
33zstyle ':vcs_info:*' stagedstr '+'           # Symbol for staged changes
34precmd() { vcs_info }                        # Update git info before each prompt
35
36# Set up the prompt (PS1)
37# Format: username🍎hostname-[current_directory](git_branch)
38PROMPT=$'%F{blue}┌──(%F{cyan}%B%n%F{magenta}🍎%F{cyan}%m%b%F{blue})-[%F{yellow}%B%(8~|%-4~/.../%3~|%~)%b%F{blue}]%f${vcs_info_msg_0_}\n%F{blue}└─%F{cyan}%B$%b%F{blue}%f '
39
40# Set up right prompt (RPROMPT)
41# Shows error code and background jobs if any
42RPROMPT=$'%(?.. %F{magenta}%?%f %F{red}✘%f)%(1j. %F{cyan}%j%f %F{yellow}⚙%f.)'
43
44# Source Oh My Zsh and additional configuration files
45source $ZSH/oh-my-zsh.sh                                    # Load Oh My Zsh
46[[ -f ~/.my_aliases.txt ]] && source ~/.my_aliases.txt      # Load aliases if exists
47[[ -f ~/.zsh_profile ]] && source ~/.zsh_profile           # Load profile if exists
48source <(fzf --zsh)                                         # Load fuzzy finder integration with CTRL+R
49
50