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
# This is a file of shell source meant to be sourced from .bash_rc and .zshrc
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# change to home if we started at root, which is a weird thing Kitty
# does on KDE Plasma
if [ "$PWD" = "/" ]; then
cd ~
fi
## This sometimes does output, so do it before powershell prompt
if [ "$TERM" != "linux" ]; then
xmodmap ~/.xmodmap &
fi
# include Mycroft commands
source ~/.profile_mycroft
# 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
# GIT
source ~/src/infra/bin/git-completion.bash
alias gitdiff="git difftool --no-symlinks --dir-diff"
########################
##
## Path Fiddling
##
dedupe_path() {
# Remove duplicate pathnames from the path environment variable
export PATH=$(~/src/infra/bin/deduped_path)
}
show_path() {
echo $PATH | perl -lne 'BEGIN{$/ = ":"} print "$.) $_"'
}
ccd() {
if [ $# -eq 0 ]; then
pushd ~ > /dev/null
elif [ " $1" = " -" ]; then
pushd "$OLDPWD" > /dev/null
else
pushd "$@" > /dev/null
fi
}
# Set GOPATH for golang
export GOPATH=/usr/local/src/golang
export PATH="$GOPATH/bin:$PATH"
export PATH="/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:$PATH"
# export PATH="$ANDROID_HOME/platform-tools:$PATH"
# Rust and cargo
export PATH="~/.cargo/bin:$PATH"
. "$HOME/.cargo/env"
# Add to path
export PATH="~/src/3p/git-scripts:$PATH"
export PATH="~/.roswell/bin:$PATH"
export PATH="~/Python/venv/general/bin:$PATH"
export PATH="~/.local/bin:$PATH"
export PATH="~/bin:$PATH"
########################
## COLORS (and diff)
##
# Miscellaneous one-off variables
## Diff is hard to read. Colors help.
alias diff=colordiff
alias kittydiff="kitty +kitten diff"
alias icat="kitty +kitten icat"
alias gitdiff="git difftool --no-symlinks --dir-diff"
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
# 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'
################################################################################
##
## App-Specific Aliases and Functions
##
# 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"
# Nix Package Manager
export PATH="~/.nix-profile/bin:$PATH"
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
197
198
199
200
201
202
203
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
################################################################################
##
## EDITING
##
# 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'
# Open in vim
alias e="~/src/infra/bin/edit-in-nvim"
# Open in emacs
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"
# }
# Find a running nvim and open it there
export EDITOR=~/src/infra/bin/edit-in-nvim
# Just pop open a new nvim, now that we're doing most things in emacs.
# For transient things that care about EDITOR, nvim works pretty well.
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
################################################################################
##
## PERL
##
export PATH="$PATH:~/perl5/bin" # add to end of path
PERL5LIB="/home/james/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="/home/james/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"/home/james/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/home/james/perl5"; export PERL_MM_OPT;
################################################################################
##
## 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
################################################################################
##
## OTS AND PASSWORDS
##
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"
# 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
echo "`date` - sourced ~/.shellrc by $SHELL" >> /tmp/profile_run_flag.txt
# Emacs Modeline
# Local Variables:
# mode: shell-script
# End: