Skip to content

Instantly share code, notes, and snippets.

@harshv5094
Last active February 15, 2026 14:05
Show Gist options
  • Select an option

  • Save harshv5094/20cf9a8d292da25b42f50cdaa19d1776 to your computer and use it in GitHub Desktop.

Select an option

Save harshv5094/20cf9a8d292da25b42f50cdaa19d1776 to your computer and use it in GitHub Desktop.
bashrc
# 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"
# Setting up history export
export HISTSIZE=5000
export HISTFILESIZE=10000
export HISTTIMEFORMAT="%F %T " # add timestamp to history
# Don't put duplicate lines in the history and do not add lines that start with a space
export HISTCONTROL=ignoredups:erasedups:ignorespaces:ignoreboth
# Save each command history for different terminals
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
export FZF_DEFAULT_OPTS="\
--style default --reverse --border \
--bind 'alt-j:down,alt-k:up' \
--ansi \
"
# Bash shell options
shopt -s autocd # change to named directory
shopt -s cdspell # autocorrects cd misspellings
shopt -s cmdhist # save multi-line commands in history as single line
shopt -s histappend # do not overwrite history
shopt -s expand_aliases # expand aliases
shopt -s checkwinsize # checks term size when bash regains control
# 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
# Basic Aliases
alias ls="ls -F --color=auto"
alias la='ls -AF --color=auto'
alias l='ls -CF --color=auto'
alias grep='grep --color=auto'
alias diff='diff --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
# Initialize Starship prompt theme
if command -v starship &>/dev/null; then
eval "$(starship init bash)"
fi
# Set up fzf key bindings and fuzzy completion
if command -v fzf &>/dev/null; then
eval "$(fzf --bash)"
fi
# Initialize GitHub CLI completion
if command -v gh &>/dev/null; then
eval "$(gh completion -s bash)"
fi
# Initialize zoxide
if command -v zoxide &>/dev/null; then
eval "$(zoxide init --cmd cd bash)"
fi
# Bash Completion Check
# shellcheck disable=SC1091
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# shellcheck disable=SC1091
if [ -d "$HOME/.config/nvm" ]; then
export NVM_DIR="$HOME/.config/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
else
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment