-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.zshrc
155 lines (116 loc) · 3.64 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
# Fig pre block. Keep at the top of this file.
. "$HOME/.fig/shell/zshrc.pre.zsh"
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
source ~/.profile
export ZPLUG_HOME=/opt/homebrew/opt/zplug
source $ZPLUG_HOME/init.zsh
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"
# Load all of the config files in ~/.zsh/lib that end in .zsh
# TIP: Add files you don't want in git to .gitignore
for config_file ($ZSH/lib/*.zsh); do
source $config_file
done
fpath=($ZSH/functions $fpath)
autoload -U $ZSH/functions/*(:t)
# predictive typing (`man zshcontrib`)
#autoload -U predict-on
#zle-line-init(){ predict-on }
#zle -N zle-line-init
#zstyle ':predict' toggle true
##zstyle ':predict' verbose true
# zstyle ':completion:*:*:git:*' script $ZSH/.git-completion.sh
# Hooks
typeset -ga precmd_functions
typeset -ga preexec_functions
HISTFILE=~/.histfile
HISTSIZE=5000
SAVEHIST=5000
# zsh options; man zshoptions
setopt sharehistory
setopt histignoredups
setopt histignorealldups
setopt histfindnodups
setopt histignorespace
setopt extendedglob
setopt notify
# setopt correct
setopt interactivecomments
setopt multios
setopt autocd
setopt autopushd
setopt pushdignoredups
setopt pushdsilent
setopt autolist
unsetopt listambiguous
setopt listpacked
setopt listtypes
unsetopt beep
# ---[ Plugins ]---------------------------------------------------------
plugins=(git gibo django pure web_search gpg-crypt)
is_plugin() {
local base_dir=$1
local name=$2
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|| test -f $base_dir/plugins/$name/_$name
}
# Add all defined plugins to fpath. This must be done
# before running compinit.
for plugin ($plugins); do
if is_plugin $ZSH $plugin; then
fpath=($ZSH/plugins/$plugin $fpath)
fi
done
# Figure out the SHORT hostname
if [ -n "$commands[scutil]" ]; then
# OS X
SHORT_HOST=$(scutil --get ComputerName)
else
SHORT_HOST=${HOST/.*/}
fi
# Save the location of the current completion dump file.
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
# Load and run compinit
autoload -U compinit
compinit -i -d "${ZSH_COMPDUMP}"
# Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do
source $ZSH/plugins/$plugin/$plugin.plugin.zsh
done
# Section: zplug
zplug "supercrabtree/k", as:command
# https://github.com/sindresorhus/pure
zplug "mafredri/zsh-async", from:github
zplug "sindresorhus/pure", use:pure.zsh, from:github, as:theme
zplug "zsh-users/zsh-history-substring-search", from:github
zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug "zsh-users/zsh-completions"
zplug "plugins/git", from:oh-my-zsh
zplug "plugins/gh", from:oh-my-zsh
zplug "plugins/fig", from:oh-my-zsh
zplug load
precmd() {
# send a visual bell to awesome
echo -ne '\a'
}
# Title
precmd_functions=( "${precmd_functions[@]:#_title_precmd}" _title_precmd )
preexec_functions=( "${preexec_functions[@]:#_title_preexec}" _title_preexec )
# ---[ Modules ]--------------------------------------------------------
zmodload zsh/terminfo
# Use Alt-Arrows to skip words
bindkey -e
bindkey '^[^[[C' forward-word
bindkey '^[^[[D' backward-word
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
precmd_functions=( "${precmd_functions[@]:#_z_precmd}" _z_precmd )
## smart urls
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
eval "$(zoxide init zsh --cmd j)"