blob: f962c4137182cc73d4ee145f1d119acd0e176f57 (
plain)
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
|
# The following lines were added by compinstall
zstyle ':completion:*' completer _complete _ignored _correct _approximate
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' ignore-parents parent pwd
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'l:|=* r:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' original true
zstyle ':completion:*' preserve-prefix '//[^/]##/'
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' verbose true
zstyle :compinstall filename '/home/wazul/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=65536
SAVEHIST=65536
setopt autocd extendedglob
unsetopt beep nomatch notify
bindkey -e
# End of lines configured by zsh-newuser-install
# Dirstack
autoload -Uz add-zsh-hook
DIRSTACKFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/dirs"
if [[ -f "$DIRSTACKFILE" ]] && (( ${#dirstack} == 0 )); then
dirstack=("${(@f)"$(< "$DIRSTACKFILE")"}")
fi
chpwd_dirstack() {
print -l -- "$PWD" "${(u)dirstack[@]}" > "$DIRSTACKFILE"
}
add-zsh-hook -Uz chpwd chpwd_dirstack
DIRSTACKSIZE='20'
setopt AUTO_PUSHD PUSHD_SILENT PUSHD_TO_HOME
## Remove duplicate entries
setopt PUSHD_IGNORE_DUPS
## This reverts the +/- operators.
setopt PUSHD_MINUS
# End of dirstack
# Copied from arch wiki:
# 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]}" history-beginning-search-backward
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" history-beginning-search-forward
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
bindkey "\x1b\x5b\x31\x3b\x33\x44" backward-word # M-Left
bindkey "\x1b\x5b\x31\x3b\x33\x43" forward-word # M-Right
# 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
#
# Custom
#
DEFAULT_PROMPT="%F{green}%n@%m %F{magenta}%~ $ %f"
PROMPT=$DEFAULT_PROMPT
[ -x $HOME/.profile ] && source $HOME/.profile
alias doas='doas '
alias ls='ls --color=auto'
alias tree='tree -C'
alias vim='nvim'
alias mpv='mpv --hwdec=auto'
alias psall='ps aux'
alias linkify='~/git/dotfiles/linkify'
alias mount-ntfs='sudo ntfs-3g /dev/sdc1 /usb'
alias mount-usb='sudo mount -o umask=0,uid=nobody,gid=nobody /dev/sdc1 /usb'
alias fix-chmod='chmod -R ugo-x,u+rwX,go+rX,go-w'
alias reboot-win='sudo efibootmgr -n $(efibootmgr | \grep -m1 -Po "(?<=^Boot)....(?=\* Windows Boot Manager)") && reboot'
alias shu='echo -e ''TURN OFF THE \\e\[1\;31mSPEAKER\\e\[1\;0m NOW!!!''; sleep 3; shutdown now'
alias cal='cal --monday'
alias grep='grep -i --color=always'
alias pwd='pwd -P'
alias gitpullall='~/.selfconfigs/git/git_pull_all'
alias imv-ctl='~/.selfconfigs/imv/imv-ctl'
alias newsboat-recheck='~/.selfconfigs/newsboat/open-nb-unread'
alias denhaag="~/.selfconfigs/etc/denhaag.py"
alias ssh_setup_display='source ~/.selfconfigs/ssh/ssh_setup_display'
alias alawd='swaymsg -- exec alacritty --working-directory \"$(pwd)\"'
alias unfuck-keyboard='echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode > /dev/null'
alias mv='mv -i'
alias susp='swaylock --image ~/.selfconfigs/sway/lock.png &; systemctl suspend'
alias pacman-remove-orphans="pacman -Rsn \$(pacman -Qdtq)"
alias nope='fc -p $HISTFILE; unset HISTFILE; PROMPT="${PROMPT/$/%F{gray\}$}"'
alias yapp='fc -P; PROMPT=$DEFAULT_PROMPT'
alias magick-webp="magick -define webp:lossless=true"
alias git-list-assume-unchanged="git ls-files -v | \grep '^h'"
# Pentest
alias ssh_single='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
alias nmap_full='sudo nmap -sS -A -p- -Pn -vv -oN nmap_scan'
if [ -d $HOME/.selfconfigs/zsh/additional.d ] && [ "$(ls -A $HOME/.selfconfigs/zsh/additional.d)" ]; then
for f in $HOME/.selfconfigs/zsh/additional.d/*; do source $f; done
fi
if [ -d $HOME/.selfconfigs/zsh/functions ] && [ "$(ls -A $HOME/.selfconfigs/zsh/functions)" ]; then
autoload -Uz $HOME/.selfconfigs/zsh/functions/*
fi
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
sway
elif [[ -o login ]] && ! [[ -f $HOME/.selfconfigs/zsh/disable_motd ]]; then
cat $HOME/.selfconfigs/zsh/motd
fi
if [[ $1 == "newsboat" ]]; then
"$HOME"/.selfconfigs/newsboat/open-nb-unread
fi
if [[ $TERM == "screen" ]]; then
echo "Screen terminal started: $STY"
fi
|