Newer
Older
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# .bashrc
# Source other bash files
# global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Add git branch to prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\] $(parse_git_branch)\[\033[00m\]\$ '
#export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
# Pager
## We don't want systemd to use a pager. We can pipe it if we want to.
export SYSTEMD_PAGER=
export PAGER=vimpager
export VIMPAGER_VIM=nvim
# Miscellaneous one-off variables
## Diff is hard to read. Colors help.
alias diff=colordiff
alias kittydiff="kitty +kitten diff"
alias icat="kitty +kitten icat"
if [ -z DISPLAY ]; then
# Add kitty and bcvi to our ssh sessions
alias ssh="kitty +kitten ssh"
# Set keyboard repeat rate. After 300 ms, repeat 20 times per second. I
# think just putting this in .xinitrc should be sufficient, but apparently
# that isn't the case.
xset r rate 300 20
fi
# GIT
source ~/src/infra/bin/git-completion.bash
alias gitdiff="git difftool --no-symlinks --dir-diff"
# Colorize man pages
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
# Fix ls colors
export LS_COLORS="di=34;40:ln=36:so=32:pi=33:ex=31:bd=35;40:cd=35;40:su=35;40:sg=35;40:tw=34;40:ow=34;40"
# User specific aliases and functions
alias ls="ls --color"
# Help latex find our custom latex files
export TEXMFHOME=~/.latex
# This is a mac command, but it's useful here too
alias pbcopy='xclip -selection clipboard'
# Path Fiddling
alias mc='. /usr/lib/mc/mc-wrapper.sh'
function ccd
{
if [ $# -eq 0 ]; then
pushd ~ > /dev/null
elif [ " $1" = " -" ]; then
pushd "$OLDPWD" > /dev/null
else
pushd "$@" > /dev/null
fi
}
# Add roswell bin to path
export PATH=~/.roswell/bin:$PATH
# Add infra/bin and others to path
export PATH=/home/james/src/infra/bin:~/src/3p/git-scripts:~/.local/bin:$PATH
export PATH=~/Python/venv/general/bin:$PATH
# Set GOPATH for golang
export GOPATH=/usr/local/src/golang
export PATH=$GOPATH/bin:/snap/bin:$PATH
#export ANDROID_HOME=/opt/android-studio
# export ANDROID_HOME=/home/james/Android
# export ANDROID_SDK_ROOT=/home/james/Android
# export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
# Rust and cargo
export PATH=~/.cargo/bin:$PATH
. "$HOME/.cargo/env"
# Passwords
# Standard Linux Password Manager
export PASSWORD_STORE_ENABLE_EXTENSIONS=true
export PASSWORD_STORE_EXTENSIONS_DIR=/usr/lib/password-store/extensions
# Sudo security now depends on gpg security. Instead of prompting me
# for a password, sudo runs a script that pulls the password from our
# password store. That works because I've already authenticated to
# keychain.
which gp > /dev/null && export SUDO_ASKPASS=`which gp` && alias sudo="sudo -A"
eval `keychain --quiet --agents gpg,ssh --eval id_rsa`
if [ -f "${HOME}/.gpg-agent-info" ]; then
. "${HOME}/.gpg-agent-info"
export GPG_AGENT_INFO
export SSH_AUTH_SOCK
export SSH_AGENT_PID
else
export GPG_AGENT_INFO=""
fi
# Keyboard/Mouse fiddling
# if [ ! -z "$DISPLAY" ]; then
# xkeysnail is like xmodmap but python-based
#xhost +SI:localuser:root
#pgrep xkeysnail || sudo xkeysnail /home/james/.config/xkeysnail/config.py -q --watch --devices /dev/input/event0 "ThinkPad Compact Bluetooth Keyboard with TrackPoint" &
# ~/.config/barrier/barrierc.sh &
# fi
# OTS
export OTS_DIR=~/OTS
export OTSREPO=https://svn.opentechstrategies.com/repos/ots/trunk
export OTS_TOOLS_DIR=~/OTS/ext/ots-tools
export OTS_DOCTOOLS_DIR=~/OTS/ext/ots-doctools
export OTS_BOOKKEEPING_DIR=~/OTS/ext/ots-bookkeeping
export OTS_OPASS_STORE_DIR=~/.ots-password-store
alias otspass="PASSWORD_STORE_DIR=~/.ots-password-store pass"
alias opass="PASSWORD_STORE_DIR=~/.ots-password-store ~/OTS/ext/ots-tools/opass"
alias fpass="PASSWORD_STORE_DIR=~/Sync/family/.password-store pass"
alias pass="EDITOR=vim pass"
export SVN_ASKPASS="pass myots/svn"
#alias opass="PASSWORD_STORE_DIR=~/.ots-password-store ~/OTS/utils/opass"
export EDITOR=~/src/infra/bin/edit-in-nvim
export EDITOR=/usr/bin/nvim
# Fix compose key. See https://emacs.stackexchange.com/questions/3650/compose-key-in-emacs-multi-key-is-undefined
export XMODIFIERS=@im=none
# Open in vim
alias e="~/src/infra/bin/edit-in-nvim"
alias e="emacsclient --no-wait -alternate-editor=''"
## Open In Emacs
#function e {
# # if [ ! -f $1 ]; then
# # touch $1
# # fi
# fname=`realpath "$1"`
# emacsclient -e "(emux-find-file \"$fname\")" &
# wmctrl -a "Emacs Editor"
#}
# #export PAGER="e_blocking"
# #alias less="e_blocking"
## Python
##
# export PYTHONPATH="/usr/local/src/"
# If we have miniconda setup on this box, source conda.sh
if [ -f "/usr/local/stow/miniconda/opt/etc/profile.d/conda.sh" ]; then
. /usr/local/stow/miniconda/opt/etc/profile.d/conda.sh
fi
# Setup direnv, which we use to handle python virtual environments
eval "$(direnv hook bash)"
#export PATH=~/.pyenv/shims:~/.pyenv/bin:~/bin:$PATH
#eval "$(pyenv virtualenv-init -)"
# Give user systemd scripts my env
systemctl --user import-environment &> /dev/null
# Chinese Input
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
export GLFW_IM_MODULE=ibus # Kitty needs this
# Guix
export GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale
export PATH=~/.guix-profile/bin:$PATH
#export EMACSLOADPATH="/home/james/.guix-profile/share/emacs/site-lisp"
export INFOPATH="/home/james/.guix-profile/share/info"
GUIX_PROFILE="/home/james/.config/guix/current"
. "$GUIX_PROFILE/etc/profile"
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# Update just one repo
update-repo() {
sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/$1.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
}
# change to home if we started at root, which is a weird thing Kitty does since
# we moved to KDE Plasma
if [ "$PWD" = "/" ]; then
cd ~
fi
# Flutter
alias webdev="flutter packages pub global run webdev"
export CHROME_EXECUTABLE=`which chromium` # tell flutter where chrome is
# This seems to be necessary for snap
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
eval "$(zoxide init bash)"
## START-BCVI
echo $PATH | grep -q /home/james/bin || PATH="/home/james/bin:$PATH"
test -n "$(which bcvi)" && eval "$(bcvi --unpack-term)"
test -n "${BCVI_CONF}" && alias vi="bcvi"
test -n "${BCVI_CONF}" && alias suvi="EDITOR='bcvi -c viwait' sudoedit"
test -n "${BCVI_CONF}" && alias bcp="bcvi -c scpd"
## END-BCVI
# Use emacs-style bindings on the command line. Can also set to 'vi' but not to 'vim'
set -o emacs
# Emacs Modeline
# Local Variables:
# mode: shell-script
# End: