aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/home/.config/sh/envrc
blob: 64d85d73dd366b83a811a81e270b4ff1d73545b0 (plain) (blame)
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
197
198
199
200
201
#! /bin/sh

if [ -z "$ENV_SOURCED" ]; then
    export ENV_SOURCED="$0"
fi

safesource() {
    # shellcheck source=/dev/null
    [ -r "$1" ] && . "$1"
}

exists() {
    command -v "$1" >/dev/null 2>&1
}

ifexists() {
    exists "$1" && "$@"
}

export PATH="$HOME"/.local/bin:"$PATH"

case $TERM in
    *256color|*truecolor)
        export COLORTERM=24bit
        ;;
esac

# tell gpg which tty one is using so that it can prompt for pw
GPG_TTY=$(tty)
export GPG_TTY
export GPG_AGENT_INFO=1
# set XDG env vars
export XDG_CONFIG_HOME="$HOME"/.config
export XDG_DATA_HOME="$HOME"/.local/share
export XDG_STATE_HOME="$HOME"/.local/state
export XDG_CACHE_HOME="$HOME"/.cache
# set ENV var to tell sh shell where its config file is
export ENV="$XDG_CONFIG_HOME"/sh/shinit
export EDITOR='nvim'
export DIFFPROG='nvim -d'
export VISUAL="$EDITOR"
export MANPAGER='nvim +Man!'
export MANWIDTH=999

# # Get color support for 'less'
[ -r /usr/bin/source-highlight-esc.sh ] && export LESSOPEN="| /usr/bin/source-highlight-esc.sh %s"
export LESS="--RAW-CONTROL-CHARS"
LESS_TERMCAP_mb="$(
    tput bold
    tput setaf 2
)" # green
export LESS_TERMCAP_mb
LESS_TERMCAP_md="$(
    tput bold
    tput setaf 6
)" # cyan
export LESS_TERMCAP_md
LESS_TERMCAP_me="$(tput sgr0)"
export LESS_TERMCAP_me
LESS_TERMCAP_so="$(
    tput bold
    tput setaf 3
    tput setab 4
)" # yellow on blue
export LESS_TERMCAP_so
LESS_TERMCAP_se="$(
    tput rmso
    tput sgr0
)"
export LESS_TERMCAP_se
LESS_TERMCAP_us="$(
    tput smul
    tput bold
    tput setaf 7
)" # white
export LESS_TERMCAP_us
LESS_TERMCAP_ue="$(
    tput rmul
    tput sgr0
)"
export LESS_TERMCAP_ue
LESS_TERMCAP_mr="$(tput rev)"
export LESS_TERMCAP_mr
LESS_TERMCAP_mh="$(tput dim)"
export LESS_TERMCAP_mh
LESS_TERMCAP_ZN="$(tput ssubm)"
export LESS_TERMCAP_ZN
LESS_TERMCAP_ZV="$(tput rsubm)"
export LESS_TERMCAP_ZV
LESS_TERMCAP_ZO="$(tput ssupm)"
export LESS_TERMCAP_ZO
LESS_TERMCAP_ZW="$(tput rsupm)"
export LESS_TERMCAP_ZW

export LESS="-F -X $LESS"

export LANG=en_US.UTF-8
export OPENER='xdg-open'
export FZF_DEFAULT_COMMAND="fd --type file --follow --hidden --exclude .git"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_DIRS_COMMAND="fd --type d --follow --hidden --exclude .git"
export FZF_DEFAULT_OPTS="--layout=reverse --inline-info --cycle --color=dark --color=fg:-1,bg:-1,hl:#5fff87,fg+:-1,bg+:-1,hl+:#ffaf5f --color=info:#af87ff,prompt:#5fff87,pointer:#ff87d7,marker:#ff87d7,spinner:#ff87d7"
export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200' --select-1 --exit-0"
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview' --sort --exact"
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"

if [ "$TMUX" ]; then
    export FZF_TMUX=1
fi

export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
export BROWSER='linkhandler'
export TERMINAL='alacritty'
# Suppress Gnome Accessibility bus warnings in gtk apps
export NO_AT_BRIDGE=1
# Enable Webrender in firefox for video decode hw acceleration
export MOZ_WEBRENDER=1
export MOZ_X11_EGL=1
# set in new intel iris HD driver for VA-API video hw decoding
if [ "$(uname -n)" = "halley2" ]; then
    export LIBVA_DRIVER_NAME="iHD"
    export MESA_LOADER_DRIVER_OVERRIDE="iris"
    export VAAPI_MPEG4_ENABLED=true
fi

# set sxhkd shell to sh for faster response times
export SXHKD_SHELL="sh"
# Java: use system anti-aliased fonts and make swing use the GTK look and feel:
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java -Djdk.gtk.version=2"
# https://wiki.archlinux.org/title/Java#Gray_window,_applications_not_resizing_with_WM,_menus_immediately_closing
export _JAVA_AWT_WM_NONREPARENTING=1
export AWT_TOOLKIT=MToolkit

export QT_QPA_PLATFORMTHEME=qt5ct

# always prevent vsync
export vblank_mode=0

# detailed git PS1
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM="auto"

# only set XAUTHORITY when not logging from ssh, since it breaks xauth
[ "$XDG_RUNTIME_DIR" ] && export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"

export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock"

if [ "$(uname -n)" = "hercules" ]; then
    export OCL_ICD_VENDORS=nvidia
    # shellcheck source=/dev/null
    [ -r  ~/.config/sh/envrc ] && . ~/.config/sh/work-envrc
fi

# https://github.com/sparrowwallet/sparrow/issues/170#issuecomment-896866817
export GDK_DISPLAY=1

# cleanup ~
export GTK_RC_FILES="$XDG_CONFIG_HOME/gtk-1.0/gtkrc"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0"
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
export INPUTRC="$XDG_CONFIG_HOME/sh/inputrc"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store"
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export LESSHISTFILE="-"
export BASH_COMPLETION_USER_FILE="$XDG_CONFIG_HOME/bash-completion/bash_completion"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv"
export LESSKEY="$XDG_CONFIG_HOME/less/lesskey"
export TERMINFO_DIRS="$XDG_DATA_HOME/terminfo":/usr/share/terminfo
export IPYTHONDIR="$XDG_CONFIG_HOME/ipython"
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
export PYTHON_EGG_CACHE="$XDG_CACHE_HOME/python-eggs"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export TMUX_TMPDIR="$XDG_RUNTIME_DIR"
export WINEPREFIX="$XDG_DATA_HOME/wineprefixes/default"
export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
export XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc"
export CCACHE_CONFIGPATH="$XDG_CONFIG_HOME/ccache.config"
export CCACHE_DIR="$XDG_CACHE_HOME/ccache"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export RIPGREP_CONFIG_PATH="$XDG_CONFIG_HOME/ripgrep/ripgreprc"
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
export MACHINE_STORAGE_PATH="$XDG_DATA_HOME/docker-machine"
export GOPATH="$XDG_DATA_HOME/go"
export GRADLE_USER_HOME="$XDG_DATA_HOME/gradle"
export XCOMPOSEFILE="$XDG_CONFIG_HOME/X11/xcompose"
export XCOMPOSECACHE="$XDG_CACHE_HOME/X11/xcompose"
export NODE_REPL_HISTORY="$XDG_DATA_HOME/node_repl_history"
export NVM_DIR="$XDG_DATA_HOME/nvm"
export WORKON_HOME="$XDG_DATA_HOME/virtualenvs"
export USERXSESSION="$XDG_CACHE_HOME/x11/xsession"
export USERXSESSIONRC="$XDG_CACHE_HOME/x11/xsessionrc"
export ALTUSERXSESSION="$XDG_CACHE_HOME/x11/Xsession"
export ERRFILE="$XDG_CACHE_HOME/x11/xsession-errors"

unset SSH_AGENT_PID
SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
export SSH_AUTH_SOCK