-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
82 lines (66 loc) · 2.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
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
# Add ~/bin to my path
export PATH="$HOME/bin:$PATH"
if [ -x /opt/homebrew/bin ]; then
# Load Homebrew
eval $(/opt/homebrew/bin/brew shellenv)
# Enable completions
FPATH="$(brew --prefix)/share/zsh/site-functions:$FPATH"
autoload -Uz compinit
compinit
# Set prompt to show current directory and git branch
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
if [ -r $(brew --prefix)/etc/bash_completion.d/git-prompt.sh ]; then
source $(brew --prefix)/etc/bash_completion.d/git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=1
precmd() {
__git_ps1 "%F{244}%1~" " %#%f "
}
else
echo '.zshrc: Could not load git prompt.'
fi
# Load z
if [ -r $(brew --prefix)/etc/profile.d/z.sh ]; then
source $(brew --prefix)/etc/profile.d/z.sh
else
echo '.zshrc: Could not load z.'
fi
# Enable fzf tab completion and key bindings
if [ -f $(brew --prefix)/opt/fzf/shell/completion.zsh ] && [[ $- == *i* ]]; then
source $(brew --prefix)/opt/fzf/shell/completion.zsh
else
echo '.zshrc: Could not load fzf completions.'
fi
if [ -f $(brew --prefix)/opt/fzf/shell/key-bindings.zsh ]; then
source $(brew --prefix)/opt/fzf/shell/key-bindings.zsh
else
echo '.zshrc: Could not load fzf key bindings.'
fi
# Load nvm
if [ -r $(brew --prefix)/opt/nvm/nvm.sh ]; then
export NVM_DIR=~/.nvm
source $(brew --prefix)/opt/nvm/nvm.sh
else
echo '.zshrc: Could not load nvm.'
fi
if [ -r $(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm ]; then
source $(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm
else
echo '.zshrc: Could not load nvm completions.'
fi
else
echo '.zshrc: Could not execute brew.'
fi
# Use nvim as my editor
export EDITOR=nvim
alias vim=nvim
# Make zsh save to .zsh_history immediately
setopt INC_APPEND_HISTORY
# Remove duplicate commands from .zsh_history
setopt HIST_IGNORE_ALL_DUPS
# Increase maximum size of .zsh_history
export HISTSIZE=1000000
export SAVEHIST=1000000
# Configure fzf to, by default, only look at the files that rg indexes
export FZF_DEFAULT_COMMAND='rg --files'
# Configure gpg
export GPG_TTY=$(tty)