-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzshrc
72 lines (56 loc) · 1.29 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
# Force usage of the Kitty terminal.
if [ "$TERM" = "xterm-256color" ]; then
open -a "Kitty"
killall "Terminal"
fi
# Completion.
autoload -U compinit
compinit -D
# Automatically enter directories without `cd`.
setopt auto_cd
# Aliases.
if [ -e "$HOME/.aliases" ]; then
source "$HOME/.aliases"
fi
# Ensure the environemtn variables are loaded.
if [ -f "$HOME/.zshenv" ]; then
source "$HOME/.zshenv"
fi
# Use vi mode.
bindkey -v
# Use incremental search.
bindkey ^R history-incremental-search-backward
# Expand functions in the prompt.
setopt prompt_subst
# Ignore duplicate history entries.
setopt histignoredups
# Homebrew doctors orders.
if [ -f "/opt/homebrew/bin/brew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# Enable auto-complete for Homebrew.
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
fi
# Load private shell configuration.
if [ -f "$HOME/.zshrc.private" ]; then
source "$HOME/.zshrc.private"
fi
# Fix CMD+S shortcut.
stty -ixon
# Automatically set the window title with a hook executed before each prompt.
precmd() {
local name=$PWD
if [[ $name/ = $HOME/ ]]; then
name="~"
else
name=$(basename $name)
fi
printf "\e]0;$name\a"
}
git() {
if [[ $1 == "d" || $1 == "dc" ]]; then
clear
fi
command git "$@"
}