-
Notifications
You must be signed in to change notification settings - Fork 1
/
.zshrc
executable file
·162 lines (140 loc) · 5.59 KB
/
.zshrc
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
#
# Spydr06's zsh configuration
# https://github.com/spydr06/dotfiles.git
#
# Settings
set threads = $(nproc)
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Backspace]="${terminfo[kbs]}"
key[Delete]="${terminfo[kdch1]}"
key[Up]="${terminfo[kcuu1]}"
key[Down]="${terminfo[kcud1]}"
key[Left]="${terminfo[kcub1]}"
key[Right]="${terminfo[kcuf1]}"
key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"
key[Shift-Tab]="${terminfo[kcbt]}"
# setup key accordingly
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
autoload -Uz add-zle-hook-widget
function zle_application_mode_start { echoti smkx }
function zle_application_mode_stop { echoti rmkx }
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi
# history search
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search
# set titles automatically
preexec () {
local cmd=$2
if [[ "$(pwd)" == "$HOME" ]]; then
printf "\e]0;(~) ${cmd}\a"
else
printf "\e]0;($(basename `pwd`)) ${cmd}\a"
fi
}
precmd () {
if [[ "$(pwd)" == "$HOME" ]]; then
printf "\e]0;(~) >_\a"
else
printf "\e]0;($(basename `pwd`)) >_\a"
fi
}
# Aliases
alias ls="exa -al --color=always --group-directories-first"
alias make="make -j$threads"
alias rm="rm -v"
alias cp="cp -v"
alias mv="mv -v"
alias term="alacritty -e zsh 2>&1 > /dev/null &; disown"
alias q="exit"
alias config="/usr/bin/git --git-dir=/home/spydr/dotfiles --work-tree=/home/spydr"
alias nasmount="sudo mount.cifs //192.168.178.34/FelixNAS/ /mnt/nas/ -o user=\"admin\",pass=\"Di1aNAS\!\",nounix,sec=ntlmssp,vers=\"1.0\""
alias py="python"
alias t="alacritty -e zsh 2>&1 > /dev/null &; disown"
alias fixkblayout="setxkbmap \"de\"; setxkbmap \"de(us)\""
alias cpc="xclip -sel c < "
alias get-idf=". $HOME/dev/esp/esp-idf/export.sh; . $HOME/export-esp.sh"
# Function to extract archives quickly
function ex() {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: ex <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
echo " ex <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
else
for n in "$@"
do
if [ -f "$n" ] ; then
case "${n%,}" in
*.cbt|*.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar) tar xvf "$n" ;;
*.7z|*.arj|*.cab|*.cb7|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.pkg|*.rpm|*.udf|*.wim|*.xar) 7z x ./"$n" ;;
*.lzma) unlzma ./"$n" ;;
*.bz2) bunzip2 ./"$n" ;;
*.cbr|*.rar) unrar x -ad ./"$n" ;;
*.gz) gunzip ./"$n" ;;
*.cbz|*.epub|*.zip) unzip ./"$n" ;;
*.z) uncompress ./"$n" ;;
*.xz) unxz ./"$n" ;;
*.exe) cabextract ./"$n" ;;
*.cpio) cpio -id < ./"$n" ;;
*.cba|*.ace) unace x ./"$n" ;;
*)
echo "extract: '$n' - unknown archive method"
return 1;;
esac
else
echo "'$n' - file does not exist"
return 1
fi
done
fi
}
# title setting
DISABLE_AUTO_TITLE="true"
function title() {
echo -en "\e]2;$@\a"
}
# Misc
export LLVM_TABLEGEN_EXE=/usr/lib/llvm/15/bin/llvm-tblgen
export _JAVA_AWT_WM_NONREPARENTING=1 # fix java GUI applications
# PATH
export PATH="/usr/lib64/qt5/bin:$HOME/.local/bin:$HOME/.emacs.d/bin:/home/spydr/.deno/bin$PATH"
export LD_LIBRARY_PATH="/lib64:/usr/lib64:/usr/local/lib64:$LD_LIBRARY_PATH"
# Disable DotNet Telemetry
export DOTNET_CLI_TELEMETRY_OPTOUT="1"
# Get color support for 'less'
export LESS="--RAW-CONTROL-CHARS"
# Use colors for less, man, etc.
[[ -f ~/.LESS_TERMCAP ]] && . ~/.LESS_TERMCAP
eval "$(starship init zsh)"
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# esp rust dev env
. $HOME/export-esp.sh
# ghcup-env
[ -f "/home/spydr/.ghcup/env" ] && source "/home/spydr/.ghcup/env"
# Autostart
export PF_INFO="ascii title os host kernel uptime memory shell palette"
pfetch