1
0
Fork 0
dotfiles/.bashrc

75 lines
2 KiB
Bash
Raw Normal View History

#!/bin/bash
# `bash`-specific configurations
# Load configuration files common to all kinds of shells,
# if not already done by a `bash` login shell
[ -z "$PROFILE_LOADED" ] && [ -f "$HOME/.profile" ] && . "$HOME/.profile"
# Ensure `bash` is running interactively
case $- in
*i*) ;;
*) return;;
esac
# Configure the `history`
# Set these environment variables here
# to avoid conflict/overlap with `zsh`
export HISTFILE="$XDG_STATE_HOME/bash/history"
export HISTSIZE=999999 # Number of lines kept in memory
export HISTFILESIZE=999999 # Number of lines kept in the `$HISTFILE`
# Ignore commands prefixed with a space
# and ones entered identically just before
export HISTCONTROL=ignoreboth
shopt -s cmdhist # Remember multi-line commands as just one line
shopt -s histappend # Do not overwrite the `$HISTFILE`
shopt -s histreedit # Allow editing failed history substitutions
shopt -s lithist # Store multi-line commands in history without `;`
# Make `bash` feel a bit more like `zsh`
shopt -s autocd # Just type the directory to `cd` into it
shopt -s cdspell # Correct minor spelling mistakes with `cd`
shopt -s checkjobs # Show number of running jobs when exiting `bash`
shopt -s checkwinsize # Update `$ROWS` and `$COLUMNS` after commands
shopt -s globstar # Expand ** into recursive directories
stty -ixon # Prevent Ctrl+S from freezing `bash`
# Make `bash` show `chroot`s
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# Make `bash` more colorful
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
fi
# Enable tab completion
if ! shopt -oq posix; then
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
fi