-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_bash.sh
More file actions
55 lines (47 loc) · 1.82 KB
/
Copy pathconfig_bash.sh
File metadata and controls
55 lines (47 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# If this shell supports line editing, bind settings. (If interactive shell)
if [[ "$(set -o | grep 'emacs\|\bvi\b' | cut -f2 | tr '\n' ':')" != 'off:off:' ]]
then
# Enable some of my favorite shell options.
# See available options with shopt -p.
set -o noclobber # do not clobber files with redirection without prompt
shopt -s histappend # append to history file, not overwrite
shopt -s histverify # verify history commands before running them
shopt -s cdspell # automatically correct small errors in names with cd
shopt -s interactive_comments # allow comments in interactive shell
# Smarter Tab Completion
bind "set completion-ignore-case on"
bind "set show-all-if-ambiguous on"
# Menu Tab Completion (supported on bash 4+)
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
bind "TAB:menu-complete"
bind "set menu-complete-display-prefix on"
fi
# History Search
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# Fix some common keybinds.
# To see keys, run cat, press enter, then hit key combo to see output.
bind '"\e\e[C": forward-word'
bind '"\e\e[D": backward-word'
# No history if space.
export HISTCONTROL=ignorespace
# Control history line count in memory for session.
export HISTSIZE=10000
# Control history line count on disk for persistence.
export HISTFILESIZE=10000
# Source custom completion scripts.
for c in "$BFG_SHELL_HOME"/completions/bash/*; do
source "$c"
done
# Source any local completion scripts, if present.
while IFS= read -r -d '' c; do
source "$c"
done < <(\
find "$BFG_SHELL_HOME"/local/completions/bash \
-mindepth 1 \
-type f \
-not -name .gitkeep \
-print0 \
)
fi