You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.8 KiB
Bash
75 lines
1.8 KiB
Bash
# If not running interactively, don't do anything
|
|
[ -z "$PS1" ] && return
|
|
|
|
function source-file {
|
|
local file
|
|
file="$1"
|
|
if [[ -f "$file" ]]; then
|
|
# shellcheck disable=SC1090
|
|
source "$file"
|
|
fi
|
|
}
|
|
|
|
if [[ ! "${BASH_VERSION}" = "3.2*" ]]; then
|
|
shopt -s autocd
|
|
fi
|
|
|
|
CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/bash"
|
|
|
|
source-file /etc/bash_completion
|
|
source-file "${CONFIG}/environment.sh"
|
|
source-file "${CONFIG}/aliases.sh"
|
|
source-file "${CONFIG}/functions.sh"
|
|
source-file "${CONFIG}/path.sh"
|
|
source-file "${CONFIG}/prompt.sh"
|
|
source-file "${CONFIG}/completion.sh"
|
|
source-file ~/opt/bash/env
|
|
|
|
unset -f source-file
|
|
|
|
# append to the history file, don't overwrite it
|
|
shopt -s histappend
|
|
|
|
# check the window size after each command and, if necessary,
|
|
# update the values of LINES and COLUMNS.
|
|
shopt -s checkwinsize
|
|
|
|
# Disable capslock
|
|
if [[ -x $(which setxkbmap) ]]; then
|
|
if [[ $(uname) == Linux ]]; then
|
|
setxkbmap -option ctrl:nocaps
|
|
fi
|
|
fi
|
|
|
|
# make less more friendly for non-text input files, see lesspipe(1)
|
|
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
|
|
|
# enable color support of ls and also add handy aliases
|
|
if [ -x /usr/bin/dircolors ]; then
|
|
test -r ~/.dircolors && (eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)")
|
|
fi
|
|
|
|
if [ "$TERM" == xterm ]; then
|
|
export TERM=xterm-256color
|
|
fi
|
|
|
|
if [ -d "${XDG_CONFIG_HOME}"/bash/bashrc.d ]; then
|
|
for file in "${XDG_CONFIG_HOME}"/bash/bashrc.d/*.sh; do
|
|
if [ -r "$file" ]; then
|
|
#shellcheck disable=1090
|
|
. "$file"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if [[ -d "${XDG_CONFIG_HOME}/bash/env.d" ]]; then
|
|
for file in "${XDG_CONFIG_HOME}"/bash/env.d/*.env; do
|
|
eval "$(
|
|
grep -v '^\s*\#' "${file}" |
|
|
grep -v '^\s*$' |
|
|
sed 's/^\s*export//g' |
|
|
sed 's/^/export /g'
|
|
)"
|
|
done
|
|
fi
|