-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
162 lines (130 loc) · 3.98 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# append various stuff to PATH
append_to_path() {
if [ -d "$1" ] ; then
export PATH="$1:$PATH"
fi
}
append_to_path "$HOME/.bin"
append_to_path "$HOME/.cargo/bin"
append_to_path "$HOME/.config/emacs/bin"
append_to_path "$HOME/.fzf/bin"
append_to_path "$HOME/.scripts"
append_to_path "$HOME/bin"
# Set the list of directories that Zsh searches for programs.
path=(
/usr/local/{bin,sbin}
$path
)
# Load antigen from somewhere
if [ -f /usr/local/share/antigen/antigen.zsh ]; then
source /usr/local/share/antigen/antigen.zsh
elif [ -f /usr/share/zsh-antigen/antigen.zsh ]; then
source /usr/share/zsh-antigen/antigen.zsh
else
if [ ! -f $HOME/antigen.zsh ]; then
curl -L git.io/antigen > $HOME/antigen.zsh
fi
source $HOME/antigen.zsh
fi
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles from the default repo (robbyrussell's oh-my-zsh).
case `uname` in
Linux)
antigen bundle fasd
antigen bundle zsh-users/zsh-autosuggestions
;;
esac
antigen bundle git
antigen bundle pip
antigen bundle python
antigen bundle command-not-found
#antigen bundle common-aliases
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle mafredri/zsh-async
# antigen bundle jeffreytse/zsh-vi-mode
case `uname` in
Darwin)
antigen bundle brew
antigen bundle brew-cask
antigen bundle osx
;;
esac
# Tell Antigen that you're done.
antigen apply
# FZF
#export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"'
export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden'
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Environment
if [ -z "$USER" ]; then
USER=$LOGNAME
fi
# Functions
fvim () {
vim $(find -type f -and -not -path "*_build*" -name "$1*")
}
gvim () {
vim -q <(git grep $1)
}
rgvim() {
vim -q <(rg --line-number --column --no-heading --fixed-strings --ignore-case --no-ignore --hidden $1)
}
if type ssh-wrapper > /dev/null 2>&1; then
ssh() {
ssh-wrapper "$@"
}
fi
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
case `uname` in
Linux)
# FASD
eval "$(fasd --init posix-alias zsh-hook)"
# Aliases
alias a='fasd -a' # any
alias s='fasd -si' # show / search / select
alias d='fasd -d' # directory
alias f='fasd -f' # file
alias sd='fasd -sid' # interactive directory selection
alias sf='fasd -sif' # interactive file selection
alias z='fasd_cd -d' # cd, same functionality as j in autojump
alias zz='fasd_cd -d -i' # cd with interactive selection
;;
esac
case `uname` in
Darwin)
eval "$(zoxide init zsh)"
;;
esac
alias rm='rm -i'
alias fuck='sudo $(fc -ln -1)'
alias vim="nvim"
alias vi="nvim"
if [ -d "$HOME/.config/doom" ]; then
alias em="emacs --with-profile=doom -nw"
else
alias em="emacsclient -nw"
fi
alias asu="adb shell su root"
reboot() { echo "I'm pretty sure you screwed up..."; }
# Misc zsh setup
zstyle ':completion:*' special-dirs true
zstyle ':completion:*:*' ignored-patterns '*ORIG_HEAD'
DISABLE_AUTO_TITLE="true"
## History command configuration
setopt extended_history # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_all_dups # ignore even more dups
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
#setopt share_history # share command history data
export EDITOR='emacs -nw'
export RIPGREP_CONFIG_PATH=$HOME/.ripgreprc
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#696969"
# Append a command directly
zvm_after_init_commands+=('[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh')
eval "$(starship init zsh)"
# Any local stuff
[[ ! -f ~/.zshrc-local.zsh ]] || source ~/.zshrc-local.zsh
[ -f ~/.local_shell_stuff ] && source ~/.local_shell_stuff