Repository navigation
Expand file tree
/
Copy path.bashrc
More file actions
120 lines (94 loc) · 3.4 KB
/
Copy path.bashrc
File metadata and controls
120 lines (94 loc) · 3.4 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/env bash
# shellcheck disable=SC1091
############################### prelude ###############################
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
############################### history ###############################
# {{{
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=9999
HISTFILESIZE=9999
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# Failed history substitution (e.g. `!ls`) gets a second chance:
shopt -s histreedit
# Verify history substitution before running:
shopt -s histverify
# }}}
################################ window ################################
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
########################### quality of life ###########################
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# enable color support via dircolors
if command -v dircolors &> /dev/null; then
# shellcheck disable=SC2015
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi
############################## Completion ##############################
# 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
source /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
fi
############################## navigation ##############################
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
shopt -s globstar
# Enhance cd
shopt -s autocd
# Expand dir to explicit path (like ZSH)
shopt -s direxpand
################################ Prompt ################################
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# If this is an xterm set the title to user@host:dir
case "${TERM}" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+(${debian_chroot})}\u@\h: \w\a\]${PS1}"
;;
*)
;;
esac
# Enable fancy prompt
if command -v starship &> /dev/null; then
eval "$(starship init bash)"
fi
############################### globals ###############################
export TRUE_SHELL_ENV='bash' # ShellCheck disable=2034
###################### Source all .shellrc files ######################
# {{{
SHELLRC_DIR="${HOME}/.shellrc"
if [[ -d "${SHELLRC_DIR}" ]]; then
for shellrc_file in "${SHELLRC_DIR}"/*; do
# shellcheck source=/dev/null
source "${shellrc_file}"
done
else
echo "${SHELLRC_DIR} is missing"
fi
# }}}
############################## Local env ##############################
# File to source for the user's local environemnt.
# {{{
SHELL_ENV_FILE=~/.shellrc/env
if [[ -f ${SHELL_ENV_FILE} ]]; then
# shellcheck source=/dev/null
source "${SHELL_ENV_FILE}"
fi
# }}}