/
dot-bashrc
98 lines (78 loc) · 2.4 KB
/
dot-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
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
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
if which exa &> /dev/null ; then
alias ls=exa
alias tree="exa --tree"
else
alias ls="ls --color=auto"
fi
if which xsel &> /dev/null ; then
# pipe into/out of the X clipboard
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
fi
# don't ring the terminal bell for tab completion
bind "set bell-style none"
# case-insensitive tab completion
bind "set completion-ignore-case on"
# windows CMD-style tab completion: tab/shift-tab cycle forward/backward through completions
bind "TAB:menu-complete"
bind '"\e[Z":menu-complete-backward'
# always show tab-complete list if more than one is available
bind "set show-all-if-ambiguous on"
# if you've used pushd to create a dir stack, this command cycles from the bottom
alias rotd='pushd -0'
export VISUAL=vim
export EDITOR=$VISUAL
# read man pages at 100 columns max
export MANWIDTH=100
# color highlighting for man pages; from ArchWiki "man page"
man() {
# if the width of the current term is less than $MANWIDTH, use that instead
width=$(tput cols)
[ "$width" -gt "$MANWIDTH" ] && width=$MANWIDTH
env LESS_TERMCAP_mb=$'\E[01;31m' \
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_so=$'\E[38;5;246m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
MANWIDTH=$width \
man "$@"
}
if [ -d "$HOME/.local/bin" ] ; then
export PATH="$HOME/.local/bin:$PATH"
fi
if [ -d "$HOME/bin" ] ; then
export PATH="$HOME/bin:$PATH"
fi
if [ -d "$HOME/.cargo/bin" ] ; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
if [ -d "$HOME/.cabal/bin" ] ; then
export PATH="$HOME/.cabal/bin:$PATH"
fi
if which gem &> /dev/null ; then
oldifs=$IFS
IFS=:
for p in $(gem env gempath) ; do
if [[ "$p" =~ $HOME ]] ; then
export PATH="$p/bin:$PATH"
fi
done
IFS=$oldifs
fi
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-"$HOME/.config"}
# load extra scripts that have been placed by other dotfiles configurations
bash_scripts="$XDG_CONFIG_HOME/misdreavus/bashrc.d"
if [ -d "$bash_scripts" ] ; then
# source any executable file under the misdreavus scripts folder
while IFS= read -r -d '' f ; do
source "$f"
done < <(find -L "$bash_scripts" -type f -perm -0700 -print0)
fi
# vim: ft=bash