-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
43 lines (37 loc) · 1.04 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
#!/usr/bin/zsh
# $ZDOTDIR/.zshrc
#
# Executes user's commands whenever ZSH is stared as an interactive
# shell.
# Enable completion
autoload -Uz compinit
case "$TERM" in
"dumb")
# Prevents Emacs TRAMP from choking
# https://stackoverflow.com/a/8363532
PS1="> "
;;
xterm*|rxvt*|eterm*|screen*|alacritty)
PS1="[%n@%M %~]%# "
;;
*)
PS1="> "
;;
esac
# `fish`-like syntax highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Auto-rehash whenever pacman installs something
# See: https://wiki.archlinux.org/index.php/Zsh#On-demand_rehash
zshcache_time="$(date +%s%N)"
autoload -Uz add-zsh-hook
rehash_precmd() {
if [[ -a /var/cache/zsh/pacman ]]; then
local paccache_time="$(date -r /var/cache/zsh/pacman +%s%N)"
if (( zshcache_time < paccache_time )); then
rehash
zshcache_time="$paccache_time"
fi
fi
}
add-zsh-hook -Uz precmd rehash_precmd
zstyle ':completion:*:*:git:*' script "$HOME/.config/git-completion.zsh"