summaryrefslogtreecommitdiff
path: root/.bashrc
blob: 59beeccedd97ef43104e6d26eb00d0e5ab3716ae (plain)
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
# .bashrc

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

# prompt
PROMPT_DIRTRIM=0

prompt_color() {
	case "$1" in
		snail) c=8 ;;
		ubq323.website) c=92 ;;
		joe) c=125 ;;
		woman) c=136 ;;
		*) c=72 ;;
	esac

	PS1='\[\e[38;5;'"$c"'m\][\u@\h \W]\$\[\e[0m\] '
}
prompt_color "$(uname -n)"

# history
shopt -s histappend
HISTCONTROL=ignoreboth
HISTSIZE=1000000
HISTFILESIZE=1000000

# input
bind -s 'set completion-ignore-case on'

# title
set_title () { printf "\e]2;%s\e\\" "$1"; }
_lastcmd () { history 1 | sed -e 's/^ *[0-9]* *//g' ; }
_dirtitle () {
	if [ -n "$SSH_CONNECTION" ]; then
		echo "$(uname -n):"
	fi
	apwd
}
trap 'set_title "$(_lastcmd)"' DEBUG
PROMPT_COMMAND='history -a; set_title "$(_dirtitle)"'

# aliases
. ~/.aliases.bashrc

# environment
export XDG_CONFIG_HOME=$HOME/.config
export EDITOR=kak
export MPD_HOST=192.168.0.17

# paths
export LUA_PATH_5_3="$HOME/.local/lib/lua/5.3/?.lua;$HOME/.local/share/lua/5.3/?.lua;;"
export LUA_PATH_5_1="$HOME/.local/lib/lua/5.1/?.lua;$HOME/.local/share/lua/5.1/?.lua;;"
export LUA_CPATH_5_3="$HOME/.local/lib/lua/5.3/?.so;;"
export LUA_CPATH_5_1="$HOME/.local/lib/lua/5.1/?.so;;"
export MANPATH="$HOME/.local/share/man:"


add_path () {
    case ":$PATH:" in
        *:"$1":*)
            ;;
        *)
            PATH="${PATH:+$PATH:}$1"
    esac
}

add_path ~/.local/bin
add_path ~/.luarocks/bin
add_path ~/bin
add_path ~/perl5/bin

lb=~/."$(uname -n)".bashrc
[ -f "$lb" ] && . "$lb"

# opam configuration
test -r /home/rebecca/.opam/opam-init/init.sh && . /home/rebecca/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true