.zshrc config file

Published on Jun 13, 2024


 1# Enable extended globbing, ignore duplicates in history, and enable prompt substitutions
 2setopt extended_glob hist_ignore_all_dups prompt_subst
 3
 4
 5# Aliases
 6alias ll='ls -alF'
 7alias la='ls -A'
 8alias l='ls -CF'
 9
10# Prompt configuration
11autoload -Uz vcs_info
12precmd() { vcs_info }
13zstyle ':vcs_info:*' enable git
14zstyle ':vcs_info:*' formats '%b'
15PROMPT='%{$fg_bold[cyan]%}%n@%m%{$reset_color%}:%{$fg_bold[green]%}%c%{$reset_color%} $(git_prompt_info)%{$reset_color%}$ '
16git_prompt_info() { [[ -n "$vcs_info_msg_0_" ]] && echo " [%{$fg[yellow]%}$vcs_info_msg_0_%{$reset_color%}]"; }
17
18# Tab completion
19autoload -Uz compinit && compinit
20
21# History settings
22HISTSIZE=10000
23SAVEHIST=10000
24HISTIGNORE="ls:cd:exit"
25
26plugins=(
27    zsh-autosuggestions
28    git
29    history
30    sudo
31    web-search
32    copyfile
33    copybuffer
34    dirhistory
35)
36
37# Editor
38export EDITOR='vim'
39
40# Load oh-my-zsh if available
41[[ -d "$HOME/.oh-my-zsh" ]] && source "$HOME/.oh-my-zsh/oh-my-zsh.sh"
42
43# Load additional plugins if available
44[[ -f "$HOME/.local/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]] && source "$HOME/.local/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
45
46# Load custom aliases if available
47[[ -f "$HOME/.my_aliases.txt" ]] && source "$HOME/.my_aliases.txt"
48
49# Load ZSH profile if available
50[[ -f "$HOME/.zsh_profile" ]] && source "$HOME/.zsh_profile"
51
52# Custom functions
53# function example_function() {
54#     echo "This is an example function."
55# }