aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bash/bashrc50
-rw-r--r--bash/bashrc.d/completion.bash8
2 files changed, 30 insertions, 28 deletions
diff --git a/bash/bashrc b/bash/bashrc
index 16669adf..b456d966 100644
--- a/bash/bashrc
+++ b/bash/bashrc
@@ -9,9 +9,9 @@ esac
# shellcheck disable=SC2128
[ -n "$BASH_VERSINFO" ] && shopt -q restricted_shell && return
-# Clear away all aliases; we do this here rather than in $ENV because the ksh
-# family of shells relies on aliases to implement certain POSIX utilities like
-# fc(1) and type(1)
+# Clear away all aliases; we do this here rather than in the $ENV file shared
+# between POSIX shells, because ksh relies on aliases to implement certain
+# POSIX utilities, like fc(1) and type(1)
unalias -a
# If ENV is set, source it to get all the POSIX-compatible interactive stuff;
@@ -30,61 +30,63 @@ unalias -a
# Keep around 32K lines of history in file
HISTFILESIZE=$((1 << 15))
-# Ignore duplicate commands and whitespace in history
-HISTCONTROL=ignoreboth
+# Ignore duplicate commands
+HISTCONTROL=ignoredups
# Keep the times of the commands in history
HISTTIMEFORMAT='%F %T '
-# Use a more compact format for the time builtin's output
+# Use a more compact format for the `time` builtin's output
TIMEFORMAT='real:%lR user:%lU sys:%lS'
-# Autocorrect fudged paths in cd calls
+# Correct small errors in directory names given to the `cd` buildtin
shopt -s cdspell
-# Update the hash table properly
+# Check that hashed commands still exist before running them
shopt -s checkhash
-# Update columns and rows if window size changes
+# Update LINES and COLUMNS after each command if necessary
shopt -s checkwinsize
-# Put multi-line commands onto one line of history
+# Put multi-line commands into one history entry
shopt -s cmdhist
-# Include dotfiles in pattern matching
+# Include filenames with leading dots in pattern matching
shopt -s dotglob
-# Enable advanced pattern matching
+# Enable extended globbing: !(foo), ?(bar|baz)...
shopt -s extglob
-# Append rather than overwrite Bash history
+# Append history to $HISTFILE rather than overwriting it
shopt -s histappend
-# Repeat the line on failed history expansion
+# If history expansion fails, reload the command to try again
shopt -s histreedit
-# Repeat the expanded line on successful history expansion
+# Load history expansion result as the next command, don't run them directly
shopt -s histverify
-# Use Bash's builtin host completion
+# Use Bash's builtin hostname completion
shopt -s hostcomplete
# Don't change newlines to semicolons in history
shopt -s lithist
-# Don't warn me about new mail all the time
+# Don't try to tell me when my mail is read
shopt -u mailwarn
-# Ignore me if I try to complete an empty line
+# Don't complete a Tab press on an empty line with every possible command
shopt -s no_empty_cmd_completion
# Use programmable completion, if available
shopt -s progcomp
-# Warn me if I try to shift when there's nothing there
+# Warn me if I try to shift nonexistent values off an array
shopt -s shift_verbose
-# Don't use PATH to find files to source
+# Don't search $PATH to find files for the `source` builtin
shopt -u sourcepath
# These options only exist since Bash 4.0-alpha
if ((BASH_VERSINFO[0] >= 4)) ; then
- # Autocorrect fudged paths during completion
+ # Correct small errors in directory names during completion
shopt -s dirspell
- # Enable double-starring paths
+ # Allow double-star globs to match files and recursive paths
shopt -s globstar
- # Warn me about stopped jobs when exiting; only if >=4.1 due to bug
+ # Warn me about stopped jobs when exiting
+ # Available since 4.0, but only set it if >=4.1 due to bug:
# <https://lists.gnu.org/archive/html/bug-bash/2009-02/msg00176.html>
((BASH_VERSINFO[1] >= 1)) && shopt -s checkjobs
- # Expand variables in directory completion; only available since 4.3
+ # Expand variables in directory completion
+ # Only available since 4.3
((BASH_VERSINFO[1] >= 3)) && shopt -s direxpand
fi
diff --git a/bash/bashrc.d/completion.bash b/bash/bashrc.d/completion.bash
index c77f8844..ed938950 100644
--- a/bash/bashrc.d/completion.bash
+++ b/bash/bashrc.d/completion.bash
@@ -1,9 +1,9 @@
-# Various easy completions for Bash builtins; more specific stuff goes in
-# ~/.bash_completion.d
+# Simple completions for Bash builtins and POSIX utilities; more specific or
+# complex stuff goes in ~/.bash_completion.d, for possible dynamic loading
# If COMP_WORDBREAKS has a value, strip all colons from it; this allows
-# completing filenames correctly, since an unquoted colon is not a syntactic
-# character: <http://tiswww.case.edu/php/chet/bash/FAQ> (E13)
+# completing filenames correctly, since a colon is not a shell metacharacter:
+# <http://tiswww.case.edu/php/chet/bash/FAQ> (E13)
[[ -n $COMP_WORDBREAKS ]] && COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
# If ~/.hosts exists, use that as the host completion file rather than