From 1ae109d7abae11a327f362bfdfb623ac0ac770e0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 22 Aug 2015 03:51:52 -0400 Subject: Clean up bash configuration, and bash-emacs integration --- .config/bash/rc.sh | 65 ++---------------------------------------------------- 1 file changed, 2 insertions(+), 63 deletions(-) (limited to '.config/bash/rc.sh') diff --git a/.config/bash/rc.sh b/.config/bash/rc.sh index 70f1ce4..8512d84 100644 --- a/.config/bash/rc.sh +++ b/.config/bash/rc.sh @@ -5,74 +5,13 @@ # they are login shells or not. # If not running interactively, don't do anything -[[ $- != *i* ]] && return +# This line is probably not nescessary, but whatevs. +[[ $- == *i* ]] || return # GDM failsafe ignores profile (login) settings, but I use XDG stuff # here. . "${XDG_CONFIG_HOME:-$HOME/.config}"/login.d/??_xdg.sh -# Why is this not on by default? -# "We have a cached value, but it isn't valid anymore. Should we trash it?" -# "Duh, yes!" -shopt -s checkhash - -################################################################################ - -# History settings -# don't overwrite GNU Midnight Commander's setting of `ignorespace'. -HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups -HISTFILE=${XDG_CACHE_HOME}/bash/history -HISTTIMEFORMAT='[%Y-%m-%d %H:%M] ' -HISTSIZE=5000 -shopt -s histappend # append to the history file, don't overwrite it -mkdir -p "${HISTFILE%/*}" - -# General settings -shopt -s checkwinsize # update the values of LINES and COLUMNS -shopt -s globstar # Let ** recursively scan directories - -################################################################################ -# Overly complicated setting of PS1 # -################################################################################ - -# Belongs in aliases, but I use it here -term-title() { - local fmt='' - case "$TERM" in - screen|tmux) fmt='\ek%s\e\\';; - xterm*|rxvt*) fmt='\e]0;%s\a';; - esac - printf "$fmt" "$*" -} -PROMPT_COMMAND='' - -make_prompt() { - echo "${BOLD}${GREEN}\u@\h${BLUE}:\w${RESET}" -} - -if tput setaf 1 &>/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - RESET="$(tput sgr0)" - BOLD="$(tput bold)" - RED="$(tput setaf 1)" - GREEN="$(tput setaf 2)" - BLUE="$(tput setaf 4)" - - _STATUS="${BOLD}[" - _STATUS+="\$(v=\$?; [[ \$v = 0 ]] && c='${GREEN}' || c='${RED}'; printf %s%03i \$c \$v)" - _STATUS+="${RESET}${BOLD}]${RESET}" -else - _STATUS='[$(printf "%03i" $?)]' -fi -PS1="${_STATUS} $(make_prompt)"'\n\$ ' -unset RESET BOLD RED GREEN BLUE _STATUS -PS1="$(term-title $(make_prompt))$PS1" -unset make_prompt - -################################################################################ - # Include modular config files if [[ -d ${XDG_CONFIG_HOME}/bash/rc.d ]]; then for file in "${XDG_CONFIG_HOME}/bash/rc.d"/*.sh; do -- cgit v1.2.3-54-g00ecf