-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.zshrc
61 lines (52 loc) · 1.67 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
# instant prompt
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-$USER.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-$USER.zsh"
fi
# options
setopt autocd
bindkey -e
# history
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# completion
autoload -Uz compinit
compinit
zstyle :compinstall filename '/home/sejjy/.zshrc'
# theme
source ~/powerlevel10k/powerlevel10k.zsh-theme
# plugins
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
# binds
bindkey "^[[C" autosuggest-accept
bindkey "\e[C" forward-char
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5C" forward-word
bindkey '^H' backward-kill-word
# aliases
alias mkdir="mkdir -p"
alias c="clear"
alias e="exit"
alias discord="discord --ozone-platform-hint=auto"
alias np="playerctl metadata --all-players --format '{{ title }} - {{ artist }}'"
# In case a command is not found, try to find the package that has it
function command_not_found_handler {
printf 'zsh: command not found: %s\n' "$1"
local purple='\e[1;35m' bright='\e[0;1m' green='\e[1;32m' reset='\e[0m'
local entries=( ${(f)"$(/usr/bin/pacman -F --machinereadable -- "/usr/bin/$1")"} )
if (( ${#entries[@]} )) ; then
printf "${bright}$1${reset} may be found in the following packages:\n"
local pkg
for entry in "${entries[@]}" ; do
local fields=( ${(0)entry} )
if [[ "$pkg" != "${fields[2]}" ]]; then
printf "${purple}%s/${bright}%s ${green}%s${reset}\n" "${fields[1]}" "${fields[2]}" "${fields[3]}"
fi
printf ' /%s\n' "${fields[4]}"
pkg="${fields[2]}"
done
fi
return 127
}
# configure powerlevel10k
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh