-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
151 lines (119 loc) · 3.92 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
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' menu select
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle :compinstall filename '/home/bonnee/.zshrc'
zstyle ':completion::complete:*' gain-privileges 1
zstyle ':completion:*' completer _expand_alias _complete _ignored
zmodload zsh/complist
setopt autocd extendedglob nomatch notify no_share_history
# Use vim keys in tab complete menu:
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char
# 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
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
# Rehash on USR1
catch_signal_usr1() {
trap catch_signal_usr1 USR1
rehash
}
trap catch_signal_usr1 USR1
# Use nearcolor if not on a 24bit terminal
[[ "$COLORTERM" == (24bit|truecolor) || "${terminfo[colors]}" -eq '16777216' ]] || zmodload zsh/nearcolor
if [ -d /usr/share/oh-my-zsh ]; then
export ZSH=/usr/share/oh-my-zsh
elif [ -d ~/.oh-my-zsh ]; then
export ZSH=~/.oh-my-zsh
fi
plugins=(git-prompt common-aliases colorize colored-man-pages command-not-found fzf-tab zsh-autosuggestions zsh-syntax-highlighting vi-mode)
ZSH_CACHE_DIR=$XDG_CACHE_HOME/oh-my-zsh
if [[ ! -d $ZSH_CACHE_DIR ]]; then
mkdir $ZSH_CACHE_DIR
fi
if [ -n "${ZSH}" ]; then
source "$ZSH/oh-my-zsh.sh"
fi
ZSH_THEME_GIT_PROMPT_PREFIX="["
ZSH_THEME_GIT_PROMPT_SUFFIX="] "
hcolor="blue"
if [[ ${SSH_TTY} ]] ; then
hcolor="green"
fi
PROMPT='%F{$hcolor}%m%f %F{yellow}%4~%f '
if type git_super_status &> /dev/null; then
RPROMPT='$(git_super_status)'
fi
RPROMPT="${RPROMPT}[%F{green}%?%f]"
# ALIASES
autoload -Uz compinit promptinit
promptinit
# xdg-ninja
mkdir -p $XDG_CACHE_HOME/zsh
compinit -d "$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION" # xdg-ninja
# https://unix.stackexchange.com/a/583743
# don't expand aliases _before_ completion has finished
# like: git comm-[tab]
unsetopt completealiases
unsetopt complete_aliases
alias wget=wget --hsts-file="$XDG_DATA_HOME/wget-hsts"
# https://medium.com/@alexcg1/using-sudo-with-user-dotfiles-and-aliases-db76813007e
alias sudo='nocorrect sudo -E '
# https://github.com/rushsteve1/trash-d
if command -v trash > /dev/null; then
alias rm='trash'
fi
alias vim="$EDITOR -p"
alias v="$EDITOR -p"
if command -v git > /dev/null; then
_dots="git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME"
alias dots=$_dots
compdef '$_dots'=git
fi
if command -v paru > /dev/null; then
alias yay="paru"
compdef yay=paru
alias yeet='paru -Rsn'
compdef yeet=paru
fi
alias s=systemctl
compdef s=systemctl
if type docker > /dev/null 2>&1; then
alias d="docker"
if docker compose > /dev/null 2>&1; then
alias dc="docker compose"
alias dcup="docker compose pull; docker compose up -d"
elif type docker-compose > /dev/null 2>&1; then
alias dc="docker-compose"
alias dcup="docker-compose pull; docker-compose up -d"
fi
fi
alias ts=tailscale
alias ll='ls -lh'
# pywal
if [ -d ~/.cache/wal ]; then
if [ -f ~/.config/wpg/sequences ]; then
(cat ~/.config/wpg/sequences &)
else
(cat ~/.cache/wal/sequences &)
fi
source ~/.cache/wal/colors-tty.sh
source ~/.cache/wal/colors.sh
fi