-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc.tmpl
131 lines (108 loc) · 4.23 KB
/
dot_zshrc.tmpl
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
# init zinit
ZINIT_HOME="${HOME}/.local/share/zinit/zinit.git"
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
source "${ZINIT_HOME}/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
zinit light NICHOLAS85/z-a-eval
zi ice pick"spaceship.zsh" as"theme" depth"1"
zi light spaceship-prompt/spaceship-prompt
SPACESHIP_PROMPT_ORDER=(
user
dir
git
venv
exec_time
line_sep
jobs
exit_code
char
)
SPACESHIP_RPROMPT_ORDER=(
time
)
SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_TIME_SHOW=true
SPACESHIP_EXIT_CODE_SHOW=true
SPACESHIP_EXIT_CODE_COLOR=red
# spaceship git
SPACESHIP_GIT_BRANCH_SHOW=true
SPACESHIP_GIT_BRANCH_ASYNC=true
SPACESHIP_GIT_BRANCH_COLOR="magenta"
SPACESHIP_GIT_STATUS_SHOW=false
spaceship_git_branch () {
if [[ -d .jj ]]; then
jj_branch=$(jj log -n 1 --ignore-working-copy --no-graph --color always -r @ -T 'surround(" ", " ", branches.join(", "))')
jj_changes=$(jj log -n 1 --ignore-working-copy --no-graph --color always -r @ -T 'surround("(", ")", change_id.shortest(6) ++ " " ++ commit_id.shortest(6))')
spaceship::section --color "$SPACESHIP_GIT_BRANCH_COLOR" "$jj_branch$jj_changes"
else
[[ $SPACESHIP_GIT_BRANCH_SHOW == false ]] && return
vcs_info
local git_current_branch="$vcs_info_msg_0_"
[[ -z "$git_current_branch" ]] && return
[[ "$git_current_branch" == branchless/* ]] && git_current_branch="(detached)"
git_current_branch="${git_current_branch#heads/}"
git_current_branch="${git_current_branch/.../}"
spaceship::section --color "$SPACESHIP_GIT_BRANCH_COLOR" "$SPACESHIP_GIT_BRANCH_PREFIX$git_current_branch$SPACESHIP_GIT_BRANCH_SUFFIX"
fi
}
zi ice wait lucid atload'zstyle ":completion:*" fast-theme -q clean' atinit'zpcompinit; zpcdreplay'
zi wait lucid for \
atinit'ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay' \
zdharma-continuum/fast-syntax-highlighting \
atload"fast-theme -q clean" \
blockf \
zsh-users/zsh-completions \
atload'!_zsh_autosuggest_start' \
zsh-users/zsh-autosuggestions \
zdharma-continuum/history-search-multi-word
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
zinit ice atclone"/opt/homebrew/bin/gdircolors -b LS_COLORS > clrs.zsh" \
atpull'%atclone' pick"clrs.zsh" nocompile'!' \
atload'zstyle ":completion:*" list-colors “${(s.:.)LS_COLORS}”'
zinit light trapd00r/LS_COLORS
# z / fzf (ctrl-g)
zinit ice wait lucid
zinit light andrewferrier/fzf-z
# direnv
zinit light ptavares/zsh-direnv
# omz libraries
zi snippet OMZL::clipboard.zsh
zi snippet OMZL::history.zsh
# omz plugins
zi snippet OMZP::brew/brew.plugin.zsh
zi snippet OMZP::command-not-found/command-not-found.plugin.zsh
zi snippet OMZP::git-extras/git-extras.plugin.zsh
zi snippet OMZP::kubectl/kubectl.plugin.zsh
zi snippet OMZP::sudo/sudo.plugin.zsh
# presto
zi snippet PZTM::osx
# history settings
HISTSIZE=50000 #How many lines of history to keep in memory
HISTFILE=~/.zsh_history #Where to save history to disk
SAVEHIST=99999999 #Number of history entries to save to disk
setopt appendhistory #Append history to the history file (no overwriting)
setopt sharehistory #Share history across terminals
setopt incappendhistory #Immediately append to the history file, not just when a term is killed
setopt histignorespace #Prefix command with space for it not to show in zsh history
# automatically escape characters in URL paste
autoload -U url-quote-magic bracketed-paste-magic
zle -N self-insert url-quote-magic
zle -N bracketed-paste bracketed-paste-magic
# EDITOR
EDITOR=vim
export ASDF_FORCE_PREPEND=no
zi ice lucid wait="0" pick="asdf.sh"
zi light $(brew --prefix asdf)/libexec
eval "$(zoxide init --cmd cd zsh)"
# aliases / custom config etc
for file in ~/.zsh/*.zsh; do
source "$file"
done
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH=$HOME/.krew/bin:/usr/local/bin:$PATH
export HOMEBREW_NO_ENV_HINTS=true
# set custom ssh agent (for things that don't respect ~/.ssh/config)
export SSH_AUTH_SOCK=$HOME/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock