148 lines
4.5 KiB
Bash
Executable file
148 lines
4.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# ================ Basic Settings ================
|
|
# Disable auto title (not applicable to Bash directly, but can be handled through prompts)
|
|
DISABLE_AUTO_TITLE="true"
|
|
|
|
# Miscellaneous settings (uncomment as needed)
|
|
# DISABLE_LS_COLORS="true"
|
|
# ENABLE_CORRECTION="true"
|
|
# COMPLETION_WAITING_DOTS="true"
|
|
|
|
# ================ Path Optimizations ================
|
|
# Ensure no duplicates in PATH
|
|
typeset -U PATH
|
|
|
|
# ================ Bash Completion Settings ================
|
|
# Enable Bash completions (assuming Bash-completion is installed)
|
|
if command -v "$PACKAGE_MANAGER" &>/dev/null; then
|
|
# Install bash-completion if not already installed
|
|
if ! command -v bash-completion &>/dev/null; then
|
|
echo "Installing bash-completion..."
|
|
"$PACKAGE_MANAGER" install bash-completion
|
|
fi
|
|
# Source bash-completion if installed
|
|
if [ -f "/usr/local/etc/bash_completion" ]; then
|
|
. "/usr/local/etc/bash_completion"
|
|
fi
|
|
fi
|
|
|
|
# ================ Plugin Manager (Bash-it) ================
|
|
# Setup and initialize Bash-it, a Bash plugin manager
|
|
if [ -z "$BASH_IT" ]; then
|
|
export BASH_IT="$HOME/.bash_it"
|
|
fi
|
|
|
|
# Install Bash-it if it's not already installed
|
|
if [ ! -d "$BASH_IT" ]; then
|
|
git clone --depth=1 https://github.com/Bash-it/bash-it.git "$BASH_IT"
|
|
"$BASH_IT/install.sh"
|
|
fi
|
|
|
|
# Source the Bash-it script to enable plugin management
|
|
. "$BASH_IT/bash_it.sh"
|
|
|
|
# ================ Bash-it Plugin Configuration ================
|
|
# Enable essential plugins using Bash-it (it will handle checks internally)
|
|
bash-it enable plugin git
|
|
bash-it enable plugin history
|
|
bash-it enable plugin fasd
|
|
bash-it enable plugin autojump
|
|
|
|
# Enable themes
|
|
bash-it enable theme bobby
|
|
|
|
# ================ Docker Completions ================
|
|
# Check for Docker completion file and source it if exists
|
|
if [ -f "$HOME/.docker-completion.bash" ]; then
|
|
. "$HOME/.docker-completion.bash"
|
|
fi
|
|
|
|
# ================ zoxide Plugin ================
|
|
# Install zoxide (navigation tool for frequently used directories)
|
|
if ! command -v zoxide &>/dev/null; then
|
|
echo "zoxide is not installed. Installing..."
|
|
if ! command -v "$PACKAGE_MANAGER" &>/dev/null; then
|
|
echo "Package manager is not available!"
|
|
else
|
|
"$PACKAGE_MANAGER" install zoxide
|
|
fi
|
|
fi
|
|
|
|
# Initialize zoxide
|
|
eval "$(zoxide init bash)"
|
|
|
|
# ================ fzf Plugin ================
|
|
# Install fzf, a command-line fuzzy finder
|
|
if ! command -v fzf &>/dev/null; then
|
|
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
|
~/.fzf/install --no-key-bindings --no-completion --no-update-rc
|
|
fi
|
|
|
|
# Load fzf shell integration if available
|
|
if [ -f "$HOME/.fzf.bash" ]; then
|
|
. "$HOME/.fzf.bash"
|
|
fi
|
|
|
|
# ================ eza Installation ================
|
|
# Install eza (enhanced 'ls' command)
|
|
if ! command -v eza &>/dev/null; then
|
|
echo "eza is not installed. Installing..."
|
|
if ! command -v "$PACKAGE_MANAGER" &>/dev/null; then
|
|
echo "Package manager is not available!"
|
|
else
|
|
"$PACKAGE_MANAGER" install eza
|
|
fi
|
|
fi
|
|
|
|
# ================ Additional Programs Initialization ================
|
|
# Initialize direnv (uncomment if needed)
|
|
# eval "$(direnv hook bash)"
|
|
|
|
# Initialize Starship prompt
|
|
if ! command -v starship &>/dev/null; then
|
|
curl -fsSL https://starship.rs/install.sh | bash
|
|
fi
|
|
eval "$(starship init bash)"
|
|
export STARSHIP_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/starship.toml"
|
|
|
|
# ================ Conda Initialization ================
|
|
# Initialize Conda (uncomment if you use Conda)
|
|
# eval "$(conda init bash)"
|
|
|
|
# ================ Pyenv Setup ================
|
|
# Initialize Pyenv if installed
|
|
if command -v pyenv &>/dev/null; then
|
|
export PYENV_ROOT="$HOME/.pyenv"
|
|
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
|
eval "$(pyenv init --path)"
|
|
fi
|
|
|
|
# ================ Custom Aliases ================
|
|
# Define commonly used aliases
|
|
alias grep="grep --color=auto"
|
|
alias ..="cd .."
|
|
alias ...="cd ../.."
|
|
alias ....="cd ../../.."
|
|
alias .....="cd ../../../.."
|
|
alias v='nvim'
|
|
|
|
# Use eza for enhanced 'ls' command
|
|
alias ls='eza'
|
|
alias ll='eza -lh --group-directories-first'
|
|
alias la='eza -a'
|
|
alias lla='eza -la --group-directories-first'
|
|
alias l='eza --classify'
|
|
|
|
# Source additional alias checks if available
|
|
if [[ -f ~/.local/bin/scripts/check_aliases ]]; then
|
|
. ~/.local/bin/scripts/check_aliases.sh
|
|
fi
|
|
|
|
# ================ Conditional Settings ================
|
|
# Set the editor to vim if using SSH
|
|
[[ -n ${SSH_CONNECTION} ]] && export EDITOR='vim'
|
|
|
|
# ================ Profiling (Optional) ================
|
|
# Uncomment to enable profiling (useful for debugging)
|
|
# bash-profiler # Comment out if profiling is not needed
|