-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
71 lines (63 loc) · 3.3 KB
/
.bashrc
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
# Debian installations come with a preconfigured /etc/skel/.bashrc file, see:
# - https://askubuntu.com/a/1045951
# I prefer distinguishing between the default configuration and my additions.
# (Though, maybe in the future, one of my additions will conflict with the
# default configuration, requiring me to pick and choose from the default.)
if [ -f /etc/skel/.bashrc ]; then
. /etc/skel/.bashrc
fi
# Define any environment-variable based secrets in a separate file, that way
# they don't get accidentally committed to my dotfiles repo
if [ -f ~/.bash_secrets ]; then
. ~/.bash_secrets
fi
# Display git branch/tag in shell prompt
# Source: Unclear! (This function has been floating around the internet for at
# least a decade...)
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d; s/* \(.*\)/\1/; s/(//; s/)//; s/ /-/'g
}
format_git_branch() {
if [ ! -z "$(parse_git_branch)" ]
then
echo "\[\e[91m\]\$(parse_git_branch)\[\e[00m\]|"
else
echo ""
fi
}
export PS1="$(format_git_branch)$PS1"
# HSTR configuration - add this to ~/.bashrc
export HSTR_CONFIG=hicolor # get more colors
shopt -s histappend # append new history items to .bash_history
shopt -s cmdhist # Multiple commands on one line show up as a single line
export HISTCONTROL=ignoredups # ignore duplicate commands in history
export HISTFILESIZE=2000000 # increase history file size (default is 500)
export HISTSIZE=10000 # increase history size (default is 500)
export HISTIGNORE='ls:ll:la:pwd:clear:history'
export HISTTIMEFORMAT='%F %T '
# ensure synchronization between bash memory and history file
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi
# if this is interactive shell, then bind 'kill last command' to Ctrl-x k
if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi
# if this is interactive shell, then bind history quicknav to up/down arrows
if [[ $- =~ .*i.* ]]; then bind '"\e[A": history-search-backward'; fi
if [[ $- =~ .*i.* ]]; then bind '"\e[B": history-search-forward'; fi
# SPINALCORDTOOLBOX (installed on 2023-01-05 14:02:02)
export PATH="/home/joshua/repos/spinalcordtoolbox/bin:$PATH"
export SCT_DIR=/home/joshua/repos/spinalcordtoolbox
# Add ~/.local/bin to the path
export PATH="/home/joshua/.local/bin:$PATH"
# Disable middle click in touchpad (may not work for laptops other than Thinkpad T470)
# Source: https://www.reddit.com/r/linuxmint/comments/bm0zex/comment/emvtrhw/
# xinput only works for X11, not Wayland
# export TRACKPAD_ID=$(xinput list | grep "SynPS/2 Synaptics TouchPad" | cut -d "=" -f 2 | cut -d "[" -f 1 | xargs)
# xinput set-button-map $TRACKPAD_ID 1 1 3 4 5 6 7
# Disable middle click in trackpoint, too
# export TRACKPOINT_ID=$(xinput list | grep "TPPS/2 IBM TrackPoint" | cut -d "=" -f 2 | cut -d "[" -f 1 | xargs)
# xinput set-button-map $TRACKPOINT_ID 1 3 3 4 5 6 7
# Switch from trackpoint acceleration to flat accel profile
# (combined with increased sens in /etc/udev/rulds.d/10-trackpoint.rules)
# xinput --set-prop "TPPS/2 IBM TrackPoint" "libinput Accel Profile Enabled" 0, 1
# xinput --set-prop "TPPS/2 IBM TrackPoint" "libinput Accel Speed" 1