diff --git a/dot_bashrc b/dot_bashrc new file mode 100644 index 0000000..d9ac650 --- /dev/null +++ b/dot_bashrc @@ -0,0 +1,22 @@ +#!/bin/bash + +# Ensure XDG locations are defined +export XDG_CONFIG_HOME="$HOME"/.config +export XDG_CACHE_HOME="$HOME"/.cache +export XDG_DATA_HOME="$HOME"/.local/share +export XDG_STATE_HOME="$HOME"/.local/state + +export HISTFILE="$XDG_STATE_HOME"/bash/history + +export VIMINIT="set nocp | source ${XDG_CONFIG_HOME}/vim/vimrc" + + +# Load default system settings +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + +# Load custom bash settings +if [ -f "$XDG_CONFIG_HOME/bash/bashrc" ]; then + . "$XDG_CONFIG_HOME/bash/bashrc" +fi diff --git a/dot_config/bash/bashrc b/dot_config/bash/bashrc new file mode 100644 index 0000000..ea6ac51 --- /dev/null +++ b/dot_config/bash/bashrc @@ -0,0 +1,28 @@ +shopt -s cdspell # correct spelling for directories +shopt -s checkwinsize # Check columns and lines window size after every run +shopt -s extglob # +shopt -s nocaseglob; # Case-insensitive globbing (used in pathname expansion) +shopt -s histverify # Don't run history substitution immediately (!!), require confirmation + +shopt -s cmdhist # Save multi-line commands as one command +shopt -s histappend # Append history across shells +export HISTCONTROL=ignoreboth:erasedups # Ignore duplicates in the history and commands starting with space +export HISTSIZE=500000 +export HISTFILESIZE=100000 +export HISTTIMEFORMAT='%F %T - ' + +# Simple prompt coloring +PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;32m\]\u@\h'; fi)\[\033[01;34m\] \w \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \")\\$\[\033[00m\] " + +if [[ "$(set -o | grep 'emacs\|\bvi\b' | cut -f2 | tr '\n' ':')" != 'off:off:' ]]; +then + bind Space:magic-space # Enable history expansion with space e.g. !! will replace the !! with your last command + bind 'set completion-ignore-case on' # Perform file completion in a case insensitive fashion + bind 'set completion-map-case on' # Treat hyphens and underscores as equivalent + + # The following allows partial searching (e.g. ss will autocomplete ssh 4.2.2.2) + bind '"\e[A": history-search-backward' + bind '"\e[B": history-search-forward' + bind '"\e[C": forward-char' + bind '"\e[D": backward-char' +fi diff --git a/dot_local/state/bash/.keep b/dot_local/state/bash/.keep new file mode 100644 index 0000000..e69de29