-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
60 lines (44 loc) · 1.33 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
function set_win_title() {
echo -ne "\033]0; ⚰️ $(whoami)@$(hostname):$PWD \007"
}
function cmd_exists () {
type $1 &>/dev/null
}
function source_if_exists () {
[ -f $1 ] && source $1
}
function safe_alias () {
[[ $(cmd_exists $2) -eq 0 ]] && alias $1=$2
}
# Load homebrew autocompletions
if `cmd_exists brew`; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$(brew --prefix)/share/zsh-completions:$FPATH
fi
autoload -U +X bashcompinit && bashcompinit
autoload -Uz compinit && compinit
# Terraform autocompletions
complete -o nospace -C /opt/homebrew/bin/terraform terraform
# Init asdf
. /opt/homebrew/opt/asdf/libexec/asdf.sh
# Setup zsh autocomplete
source_if_exists /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# Setup fzf integrations
source_if_exists ~/.fzf.zsh
# Setup asdf integration
source_if_exists /usr/local/opt/asdf/asdf.sh
if `cmd_exists zoxide`; then
eval "$(zoxide init zsh)"
fi
# FZF Aliases and exports
if `cmd_exists fzf` && `cmd_exists fd`; then
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi
safe_alias cat bat
safe_alias ls "exa --icons"
safe_alias du dust
precmd_functions+=(set_win_title)
# Initialize starship as prompt, must be last
if `cmd_exists starship`; then
eval "$(starship init zsh)"
fi