Skip to content

Instantly share code, notes, and snippets.

@harshv5094
Created December 9, 2025 07:57
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
# Getting Proper Colors
export TERM="xterm-256color"
# append to the history file, don't overwrite it
shopt -s histappend
# 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
export FZF_DEFAULT_OPTS="\
--style full --layout=reverse \
--bind 'alt-j:down,alt-k:up' \
--color 'fg:#ebdbb2,hl:#fabd2f' \
--color 'border:#fabd2f,label:#fabd2f' \
--color 'preview-border:#d79921,preview-label:#fabd2f' \
--color 'list-border:#d79921,list-label:#fabd2f' \
--color 'input-border:#d65d0e,input-label:#fabd2f' \
--color 'header-border:#b57614,header-label:#fabd2f' \
--ansi \
"
# Adding doom emacs export path
export PATH="$PATH:$HOME/.config/emacs/bin"
# Adding home binary path
export PATH="$HOME/.local/bin:$HOME/bin:$HOME/.bun/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"
# 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!"
fi
# Bash Completion Check
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
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
# Basic Aliases
alias ls="ls --color=auto"
alias ll='ls -alF --color=auto'
alias la='ls -A --color=auto'
alias l='ls -CF --color=auto'
alias ..='cd ..'
alias .2='cd ../..'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
if command -v eza >/dev/null; then
alias ll="eza -l -g --icons --header"
alias lla="eza -l -g -a --icons --header"
fi
if command -v lazygit >/dev/null; then
alias lg="lazygit"
fi
if command -v bat >/dev/null; then
alias os-info="bat /etc/os-release"
else
alias os-info="cat /etc/os-release"
fi
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
# Install vim-plug if not available
if [ ! -f "$HOME/.vim/autoload/plug.vim" ]; then
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
# Initialize zoxide
if command -v zoxide &>/dev/null; then
eval "$(zoxide init --cmd cd bash)"
fi
# 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
# Fortune + cowsay banner
if command -v cowsay &>/dev/null; then
if command -v fortune &>/dev/null; then
fortune -s | cowsay
else
echo "Hello, Harsh!" | cowsay
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment