-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdot_zshrc
More file actions
133 lines (107 loc) · 3.6 KB
/
dot_zshrc
File metadata and controls
133 lines (107 loc) · 3.6 KB
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
# vim:ft=zsh:
ZIM_HOME=${XDG_CACHE_HOME:-$HOME/.cache}/zim
# Download zimfw plugin manager if missing.
if [ ! -s ${ZIM_HOME}/zimfw.zsh ]; then
curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh \
https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
fi
# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-$HOME}/.zimrc ]]; then
source ${ZIM_HOME}/zimfw.zsh init
fi
stty -ixon
stty -ixoff
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Options
setopt correct
unsetopt correctall
setopt no_nomatch
setopt rm_star_silent
platform=$(uname)
# add a couple homebrew paths for macos systems
if [ $platform = Darwin ]; then
export PATH=/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/make/libexec/gnubin${PATH:+:${PATH}}
fi
export FZF_BASE=$HOME/.local/share/nvim/lazy/fzf
export PATH=~/.local/bin:/usr/local/bin${PATH:+:${PATH}}
# set the ssh agent socket path for linux
if [ $platform = Linux -a ! -S "$SSH_AUTH_SOCK" ]; then
export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket
fi
# Plugins
VI_MODE_SET_CURSOR=true
ZSH_TMUX_AUTOREFRESH=true
source ${ZIM_HOME}/init.zsh
zmodload zsh/complist
# Environment variables
export LANG=en_US.utf-8
export LC_ALL="$LANG"
export LESS=-MIRXF
export NINJA_STATUS="[0m[[31m%u[0m/[33m%r[0m/[32m%f[36m %o/s [35m%e[0m] "
export COLORTERM=truecolor
if hash nvim 2>/dev/null; then
export EDITOR=nvim
else
export EDITOR=vim
fi
# Set up bindings
bindkey -M viins 'jk' vi-cmd-mode
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
bindkey -M menuselect '[Z' reverse-menu-complete
bindkey -M vicmd 'v' visual-mode
bindkey -M vicmd 'V' visual-line-mode
autoload -U select-bracketed
zle -N select-bracketed
for m in visual viopp; do
for c in {a,i}${(s..)^:-'()[]{}<>bB'}; do
bindkey -M $m $c select-bracketed
done
done
autoload -U select-quoted
zle -N select-quoted
for m in visual viopp; do
for c in {a,i}{\',\",\`}; do
bindkey -M $m $c select-quoted
done
done
# aliases
alias glom="git log HEAD..origin/\$(git_main_branch)"
alias git_current_branch="git rev-parse --abbrev-ref HEAD"
# set some history options
setopt hist_expire_dups_first
#setopt hist_ignore_all_dups
setopt hist_reduce_blanks
# set some more options
setopt clobber # allow > redirection to truncate existing files
# Keep a ton of history.
HISTSIZE=200000
SAVEHIST=100000
HISTFILE=~/.zsh_history
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
# Completion
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")';
# Make it easy to append your own customizations that override the above by
# loading all files from .zshrc.d directory. Also load all files in
# subdirectories of .zshrc.other.d to make it easy to symlink other castles
function source_dir {
for dotfile in $1/*.zsh; do
if [ -r "${dotfile}" ]; then
source "${dotfile}"
fi
done
}
source_dir ~/.zshrc.d
for dir in ~/.zshrc.other.d/*; do
source_dir $dir
done
# Dedupe the PATH environment variable
typeset -U PATH path
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh