Skip to content

Instantly share code, notes, and snippets.

@harshv5094
Created February 15, 2026 14:06
Show Gist options
  • Select an option

  • Save harshv5094/57062f0c24ac3e0f9ef838665b20b16f to your computer and use it in GitHub Desktop.

Select an option

Save harshv5094/57062f0c24ac3e0f9ef838665b20b16f to your computer and use it in GitHub Desktop.
This is my zshrc config
# History settings
export HISTFILE="$HOME/.zsh_history"
export HISTSIZE=5000
export SAVEHIST=$HISTSIZE
export HISTFILESIZE=10000
export HISTTIMEFORMAT="%F %T " # add timestamp to history
# Zsh specific history options
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space # ignore commands that start with a space
setopt hist_ignore_all_dups # if a new command is a duplicate, remove the older one
setopt hist_save_no_dups # don't save duplicate entries
setopt hist_find_no_dups # when searching history, don't show duplicates
# Setting fzf default options
export FZF_DEFAULT_OPTS="\
--style default --reverse --border \
--bind 'alt-j:down,alt-k:up' \
--ansi \
"
# Adding home binary path
export PATH="$HOME/.local/bin:$HOME/bin:$HOME/.bun/bin:$HOME/.config/emacs/bin:$PATH"
# set up XDG folders
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_CACHE_HOME="$HOME/.cache"
# If user is mac
if [[ "$OSTYPE" == "darwin"* ]]; then
# Add homebrew to path if it exists, this is faster than `eval`
if [ -x "/opt/homebrew/bin/brew" ]; then
export HOMEBREW_PREFIX="/opt/homebrew"
export HOMEBREW_CELLAR="/opt/homebrew/Cellar"
export HOMEBREW_REPOSITORY="/opt/homebrew"
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}"
export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}"
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}"
fi
fi
# Set the directory we want to store zinit and plugins
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
# Download Zinit, if it's not there yet
if [ ! -d "$ZINIT_HOME" ]; then
mkdir -p "$(dirname $ZINIT_HOME)"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
# Source/Load zinit
source "${ZINIT_HOME}/zinit.zsh"
# Add in zsh plugins
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit light Aloxaf/fzf-tab
# Add in snippets
zinit snippet OMZL::git.zsh
zinit snippet OMZL::completion.zsh
zinit snippet OMZP::git
zinit snippet OMZP::sudo
zinit snippet OMZP::nvm
zinit snippet OMZP::archlinux
zinit snippet OMZP::command-not-found
# Install Macos Plugin if macos is present
if [[ "$OSTYPE" == "darwin"* ]]; then
zinit snippet OMZP::macos
fi
autoload -Uz compinit && compinit
zinit cdreplay -q
# Keybindings
bindkey -e
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
bindkey '^[w' kill-region
# Completion styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
# Open buffer line in editor
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey '^x^e' edit-command-line
# Bind Magic space command
bindkey " " magic-space
# Alias for pacman
if command -v pacman &>/dev/null; then
alias unlock='sudo rm /var/lib/pacman/db.lck' # remove pacman lock
alias orphan='sudo pacman -Rns $(pacman -Qtdq)' # remove orphaned packages (DANGEROUS!)
fi
# Changing default editor also setting up default man pager
if command -v nvim >/dev/null; then
export EDITOR=nvim
export VISUAL=nvim
export MANPAGER="nvim +Man!"
# My custom nvim config
if [ -d "$HOME/.config/mnvim/" ]; then
alias mnvim="NVIM_APPNAME=mnvim nvim"
fi
fi
# Basic Aliases
alias ls="ls -F --color=auto"
alias la='ls -AF --color=auto'
alias l='ls -CF --color=auto'
alias ..='cd ..'
alias .2='cd ../..'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
# Curl based aliases
if command -v curl &>/dev/null; then
if command -v linutil &>/dev/null; then
alias lutil="curl -fsSL https://christitus.com/linux | sh"
else
alias linutil="curl -fsSL https://christitus.com/linux | sh"
fi
alias linutil-dev="curl -fsSL https://christitus.com/linuxdev | sh"
fi
# Fastfetch aliases
if command -v fastfetch &>/dev/null; then
alias neofetch="fastfetch -c examples/13"
fi
# Eza aliases
if command -v eza &>/dev/null; then
alias ll="eza -l -g --icons"
alias lla="eza -l -g -a --icons"
fi
# Lazygit aliases
if command -v lazygit &>/dev/null; then
alias lg="lazygit"
fi
# Changing default editor also setting up default man pager
if command -v nvim &>/dev/null; then
export EDITOR=nvim
export VISUAL=nvim
export MANPAGER="nvim +Man!"
# My custom nvim config
if [ -d "$HOME/.config/mnvim/" ]; then
alias mnvim="NVIM_APPNAME=mnvim nvim"
fi
fi
# fzf integration
if command -v zsh &>/dev/null; then
eval "$(fzf --zsh)"
fi
# Initialize Starship prompt theme
if command -v starship >/dev/null; then
eval "$(starship init zsh)"
else
# A simple fallback prompt
PROMPT='%F{blue}%n@%m%f:%F{green}%~%f$ '
fi
# Initialize zoxide
if command -v zoxide >/dev/null; then
eval "$(zoxide init --cmd cd zsh)"
fi
# Set nvm directory (used by OMZP::nvm plugin)
export NVM_DIR="$HOME/.config/nvm"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment