From e5b61becc69de2f7cdfa8a5b39fe580b22e05dc8 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 24 Mar 2017 03:18:16 +0100 Subject: [PATCH] bash tweaks --- .bash_prompt | 2 +- .bashrc | 71 +++++++++++++++++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/.bash_prompt b/.bash_prompt index 35325bb..0202b19 100644 --- a/.bash_prompt +++ b/.bash_prompt @@ -76,7 +76,7 @@ if tput setaf 1 &> /dev/null; then gray=$(tput setaf 242); blue=$(tput setaf 109); green=$(tput setaf 143); - cyan=$(tput setaf 110); + cyan=$(tput setaf 43); orange=$(tput setaf 173); purple=$(tput setaf 125); red=$(tput setaf 167); diff --git a/.bashrc b/.bashrc index bf0390a..fd2681d 100644 --- a/.bashrc +++ b/.bashrc @@ -10,33 +10,64 @@ esac # SHELL OPTIONS # ---------------------------------------------------------------------- -# don't put duplicate lines or lines starting with space in the history. -# See bash(1) for more options -HISTCONTROL=ignoreboth - # Append to the Bash history file, rather than overwriting it shopt -s histappend +# Save multi-line commands as one command +shopt -s cmdhist + +# Avoid duplicate entries +HISTCONTROL="erasedups:ignoreboth" + +# Don't record some commands +export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history:clear" + # fuck that you have new mail shit unset MAILCHECK # Case-insensitive globbing (used in pathname expansion) shopt -s nocaseglob -# Autocorrect typos in path names when using `cd` -shopt -s cdspell +# Turn on recursive globbing (enables ** to recurse all directories) +shopt -s globstar 2> /dev/null -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=1000 -HISTFILESIZE=2000 +# Prepend cd to directory names automatically +shopt -s autocd 2> /dev/null -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. +# Correct spelling errors during tab-completion +shopt -s dirspell 2> /dev/null + +# Correct spelling errors in arguments supplied to cd +shopt -s cdspell 2> /dev/null + +# Update window size after every command shopt -s checkwinsize -# If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -#shopt -s globstar +# Automatically trim long paths in the prompt (requires Bash 4.x) +PROMPT_DIRTRIM=4 + +# Perform file completion in a case insensitive fashion +bind "set completion-ignore-case on" + +# Treat hyphens and underscores as equivalent +bind "set completion-map-case on" + +# Display matches for ambiguous patterns at first tab press +bind "set show-all-if-ambiguous on" + +# Immediately add a trailing slash when autocompleting symlinks to directories +bind "set mark-symlinked-directories on" + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +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 # LSCOLORS export CLICOLOR=1 @@ -53,15 +84,3 @@ if [ -x /usr/bin/dircolors ]; then alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi - - -# enable programmable completion features (you don't need to enable -# this, if it's already enabled in /etc/bash.bashrc and /etc/profile -# sources /etc/bash.bashrc). -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