Skip to content

Instantly share code, notes, and snippets.

@azmarifdev
Last active October 15, 2025 19:37
Show Gist options
  • Select an option

  • Save azmarifdev/550f16ba8722b3e256610025b96a4693 to your computer and use it in GitHub Desktop.

Select an option

Save azmarifdev/550f16ba8722b3e256610025b96a4693 to your computer and use it in GitHub Desktop.
zsh with oh my zsh configuration
# =========================================
# 🌟 Advanced Zsh Configuration by A.Z.M. Arif
# =========================================
# --- Basic Environment Settings ---
export ZSH="$HOME/.oh-my-zsh"
export EDITOR="nvim"
export TERMINAL="kitty"
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
# --- Theme (Starship overrides this visually) ---
ZSH_THEME="gnzh"
# --- Oh My Zsh Core Plugins ---
plugins=(
git
fzf
sudo
history-substring-search
colored-man-pages
)
# --- Load Oh My Zsh ---
if [ -s "$ZSH/oh-my-zsh.sh" ]; then
source "$ZSH/oh-my-zsh.sh"
else
echo "⚠️ Oh My Zsh not found at $ZSH"
fi
# --- Disable unwanted ZLE widgets (prevents syntax-highlighting warnings) ---
zle -D menu-search 2>/dev/null || true
zle -D recent-paths 2>/dev/null || true
# =========================================
# 🧠 Starship Prompt
# =========================================
if command -v starship >/dev/null 2>&1; then
export STARSHIP_CONFIG="$HOME/.config/starship.toml"
eval "$(command starship init zsh)"
else
echo "⚠️ Starship not installed. Install via: sudo pacman -S starship"
fi
# =========================================
# ⚑ Performance Tweaks
# =========================================
zmodload zsh/complist
autoload -Uz compinit && compinit -C
zstyle ':completion:*' rehash true
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
setopt no_beep noclobber prompt_subst nomatch extended_glob
# =========================================
# πŸ–₯️ Aliases
# =========================================
alias ls='exa --icons --color=always'
alias ll='exa -lah --icons --color=always'
alias tree='exa --tree --level=2 --icons'
alias c='clear'
alias v='nvim'
alias gs='git status'
alias gl='git log --oneline --graph --decorate'
alias update='sudo pacman -Syu'
alias ports='sudo lsof -i -P -n | grep LISTEN'
alias ..='cd ..'
alias ...='cd ../..'
alias nf='neofetch'
# =========================================
# πŸͺ„ Functions
# =========================================
mkcd() { mkdir -p "$1" && cd "$1"; }
extract() {
if [ -f "$1" ]; then
case "$1" in
*.tar.bz2) tar xjf "$1" ;;
*.tar.gz) tar xzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.tar) tar xf "$1" ;;
*.tbz2) tar xjf "$1" ;;
*.tgz) tar xzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*.7z) 7z x "$1" ;;
*) echo "❌ '$1' cannot be extracted" ;;
esac
else
echo "❌ '$1' is not a valid file"
fi
}
# =========================================
# πŸ’‘ History Settings
# =========================================
HISTFILE=~/.zsh_history
HISTSIZE=20000
SAVEHIST=20000
setopt share_history hist_ignore_dups hist_reduce_blanks
# =========================================
# 🧠 Key Bindings
# =========================================
bindkey '^P' up-line-or-history
bindkey '^N' down-line-or-history
# =========================================
# βœ… Final Touch
# =========================================
# No random echo message at startup, only clean prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment