-
Notifications
You must be signed in to change notification settings - Fork 1
/
.profile
202 lines (162 loc) · 4.63 KB
/
.profile
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
202
#------------------------------
# .dotfiles operations
#------------------------------
alias dfc='cd ~/.dotfiles'
alias dfi='echo "Initializing dotfiles" && workdir=$(pwd) && cd ~/.dotfiles && bash ./init.sh && cd $workdir'
alias dfu='echo "Updating dotfiles" && workdir=$(pwd) && cd ~/.dotfiles && git pull && cd $workdir'
alias dfuu='echo "Updating dotfiles" && workdir=$(pwd) && cd ~/.dotfiles && git pull --recurse-submodules && cd $workdir'
#------------------------------
# User scripts
#------------------------------
export PATH="$(du "$HOME/.local/bin/scripts/" --exclude ".local/bin/scripts/external" | cut -f2 | tr '\n' ':' | sed 's|:*$||' | sed 's|\/$||'):$PATH"
#------------------------------
# Subalias function
#------------------------------
subalias() {
local cmd body name
name="${1%%=*}"
cmd="${name%_*}"
body="${1#*=}"
eval "$cmd"'() {
local cmd='"$cmd"' subcmd="$1"
if type "${cmd}_${subcmd}" >/dev/null 2>&1; then
shift
"${cmd}_${subcmd}" "$@"
elif type "${cmd}_${subcmd}_subalias" >/dev/null 2>&1; then
shift
"${cmd}_${subcmd}_subalias" "$@"
elif type "${cmd}_subalias" >/dev/null 2>&1; then
"${cmd}_subalias" "$@"
else
command "$cmd" "$@"
fi
}'
if test "$body" != "$1"; then
eval "${name}_subalias"'() { '"$body"'; }'
fi
}
#------------------------------
# Aliases
#------------------------------
[[ -f $HOME/.shell_aliases ]] && source $HOME/.shell_aliases
alias x='startx'
alias ssh='TERM=xterm-256color ssh'
alias ddd='sudo dd status=progress bs=64k'
alias sc='sudo systemctl'
alias p='sudo pacman'
alias pp='paru'
alias v='vim'
alias V='sudo vim'
alias gvim='term vim'
alias diff='diff -u --color=always'
alias dk='docker'
alias pm='podman'
alias ccl='sudo crictl'
alias zkc='zkcluster'
alias kc='kubectl'
alias mkc='minikube kubectl'
alias kkc='k3s kubectl'
alias kn='kubens'
alias kx='kubectx'
alias ydl='youtube-dl'
alias share='quickshare default'
alias xz='xz --verbose'
subalias git_gud="echo Already gud!"
#------------------------------
# exp(ort)i(f)i(nstalled) function by Gerivian
#------------------------------
expii() {
j="$1"; shift
for i in "$@"; do
command -v "${i%% *}" >/dev/null 2>&1 &&
export "$j"="$i" && break
done
}
#------------------------------
# Variables
#------------------------------
expii TERMINAL alacritty xterm
expii EDITOR vim nvim vim.tiny vi
expii FILEMANAGER nnn pcmanfm
expii MAILER neomutt mutt
expii BROWSER iceweasel firefox
expii LAUNCHER rofi dmenu
#------------------------------
# Window title
#------------------------------
case $TERM in
termite|*xterm*|rxvt|rxvt-unicode|rxvt-256color|rxvt-unicode-256color|(dt|k|E)term)
precmd () {
print -Pn "\e]0;[%n@%M][%~]%#\a"
}
preexec () {
print -Pn "\e]0;[%n@%M][%~]%# ($1)\a"
}
;;
screen|screen-256color)
precmd () {
print -Pn "\e]83;title \"$1\"\a"
print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~]\a"
}
preexec () {
print -Pn "\e]83;title \"$1\"\a"
print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($1)\a"
}
;;
esac
#------------------------------
# Additional autocompletion
#------------------------------
kubectl() {
command kubectl $*
if [[ -z $KUBECTL_COMPLETE ]]
then
source <(command kubectl completion zsh)
KUBECTL_COMPLETE=true
fi
}
#------------------------------
# Program configuration
#------------------------------
# pass
export PASSWORD_STORE_DIR="$HOME/.pass"
# nnn
NNN_CONFIG_FILE="$HOME/.config/nnn/config"
[ -f "$NNN_CONFIG_FILE" ] && \
source "$NNN_CONFIG_FILE"
# GTK
export GTK_THEME=numix-black:dark
# Qt
export QT_PLATFORMTHEME=qt5ct
export QT_PLATFORM_PLUGIN=qt5ct
export QT_QPA_PLATFORMTHEME=qt5ct
# xz
export XZ_OPT="-T 0"
# Mozilla
export MOZ_X11_EGL=1
export MOZ_ENABLE_WAYLAND=0
export MOZ_WEBRENDER=1
# Java
export JAVA_HOME="/usr/lib/jvm/default"
# Gradle
export GRADLE_HOME="$HOME/.local/share/gradle"
# Android
export ANDROID_HOME="/opt/android-sdk"
export ANDROID_SDK_ROOT="$ANDROID_HOME"
export PATH=$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools
# Kubernetes
export KUBECONFIG=$HOME/.kube/config
# Vagrant
export VAGRANT_DEFAULT_PROVIDER=libvirt
# Node
export PATH=$PATH:$HOME/.npm-packages/bin
# vedutils
export PATH=$PATH:$HOME/.local/bin/scripts/external/vedutils/vedutils
export PATH=$PATH:$HOME/.local/bin/scripts/external/vedutils/contrib
#------------------------------
# Start Xorg
#------------------------------
if [[ -z "$DISPLAY" ]] && [[ $(tty) = "/dev/tty1" ]]; then
startx
logout
fi