summaryrefslogtreecommitdiff
path: root/bashrc/.wit
blob: c0f5ccce18ac5b8a0f4eaa6f2dd8e448959ced65 (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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# wit default bash settings

case "$-" in
*i*)	echo This shell is interactive ;;
*)	return ;;
esac

# set -x

# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

# Set Bash history file location to ~/.cache/bash_history
export HISTFILE=~/.cache/bash_history

# Set LESSHISTFILE to ~/.cache/.lesshst
export LESSHISTFILE=~/.cache/.lesshst

# Set history size (optional, customize as needed)
export HISTSIZE=10000
export HISTFILESIZE=20000

# Avoid duplicate entries in history
export HISTCONTROL=ignoredups:erasedups

# Ensure ~/.cache/ exists
mkdir -p ~/.cache

export WIT_BASH=true
export WIT_USER=$LC_USER
if [ "x$WIT_USER" == "x" ]; then
	export WIT_USER=$USER
fi


# export PS1='\h:\w\$ '
umask 022
export LESS="-XR"
# export LESS="-XFR"
# -F makes less exit if the file is short

unset PAGER
set +o ignoreeof
export LS_OPTIONS='--color=auto'
eval `dircolors`
alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -lh'
alias ll='ls $LS_OPTIONS -aCF -al'
alias lf='ls $LS_OPTIONS -aCF'
alias l='ls $LS_OPTIONS -lA'

umask 022
export LESS="-XFR"
# -F makes less exit if the file is short

# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

alias pa='ps auxw -L kstart_time'
alias paa='ps auxwH -L kstart_time'
alias psc='ps xawf -eo pid,user,cgroup,args'
alias lstree='lsusb --tree -v'
alias last='last -a'
alias vi='vim -u ~/.config/wit/vimrc'
alias vim='vim -u ~/.config/wit/vimrc'

# added 2024/09/03
alias df='df -h -x tmpfs -x devtmpfs -x efivarfs'
alias dff='/usr/bin/df'
alias dmesg='dmesg -wT'
alias grep='grep -I -d skip'
alias lsof='lsof -n -P'

alias apt-find="apt-file search"

# added 2024/12
alias apps="cd ~/go/src/go.wit.com/apps"
alias proto="cd ~/go/src/go.wit.com/lib/protobuf"
alias toolkits="cd ~/go/src/go.wit.com/toolkits"

# added 2025/08
alias ddd="dd status=progress oflag=dsync bs=1M" # alias to show dd progress. this should probably be the default for dd

# this is neat. how does it work?
# todo: make it work with go-args
complete -C gocomplete go

export LANG=C
export LANGUAGE=C
export LC_ALL=C

# setterm -blength 0

if [ $DISPLAY ] ; then
        xset b off
fi

export PATH=~/.local/bin/:~/go/bin/:/sbin:/usr/sbin:~/go/bin:/usr/games:$PATH

export EDITOR=vim
unset VIMINIT

stty -echoctl

# this magic makes less work with .gz files
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

if [ -d ~/.config/wit/ ]; then
	echo -n "git.wit.org/wit/bash "
fi

if [ $? == 0 ]; then
	# neofetch --cpu_temp C --battery_display infobar
	echo
	gofetch
fi


# read in custom bash settings if you want
case "$WIT_USER" in
jcarr2)
        . ~/.jcarr
        ;;
*)
	if [ -f ~/$WIT_USER/bashrc/.$WIT_USER ] && ! shopt -oq posix; then
	        . ~/$WIT_USER/bashrc/.$WIT_USER
	fi
        ;;
esac

if [[ $(type -t _git_wit) == function ]]; then
	# echo "wit bash completion already exists"
	true
else
	echo "should add wit bash completion here"
fi

# load tools bashrc if it exists
if [ -f ~/tools/.toolsrc ] && ! shopt -oq posix; then
    . ~/tools/.toolsrc
fi