-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathdot_zshrc.tmpl
150 lines (125 loc) · 4.21 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# 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
# If you come from bash you might have to change your $PATH.
{{- $paths := list }}
{{- $homeDir := .chezmoi.homeDir }}
{{- range $_, $relPath := list "bin" "go/bin" ".cargo/bin" ".local/bin" }}
{{ $path := joinPath $homeDir $relPath }}
{{- if stat $path }}
{{- $paths = mustAppend $paths $path }}
{{- end }}
{{- end }}
{{- if $paths }}
export PATH={{ toStrings $paths | join ":" }}:$PATH
{{- end }}
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"
# Uncomment the following line to use case-sensitive completion.
CASE_SENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="yyyy-mm-dd"
ZSH_DISABLE_COMPFIX=true
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
per-directory-history
vi-mode
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# User configuration
PROMPT="%{$fg[white]%}%n@%{$fg[green]%}%m%{$reset_color%} ${PROMPT}"
setopt autocd
setopt histignorespace
setopt rm_star_silent
alias g=git
alias gnp="git --no-pager"
{{- if lookPath "bat" }}
alias cat=bat
{{- else if lookPath "batcat" }}
alias cat=batcat
{{- end }}
{{- if lookPath "fdfind" }}
alias fd=fdfind
{{- end }}
{{- if lookPath "exa" }}
alias ls=exa
{{- end }}
{{ if eq .osid "linux-ubuntu" -}}
export EDITOR=$HOME/.local/bin/nvim
{{ else -}}
export EDITOR=nvim
{{ end -}}
export GOPATH=$HOME
export GO111MODULE=on
{{- if eq .chezmoi.os "darwin" }}
export HOMEBREW_NO_AUTO_UPDATE=1
{{- end }}
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export RIPGREP_CONFIG_PATH=~/.config/ripgrep/config
{{- if .personal }}
export CHEZMOI_GITHUB_ACCESS_TOKEN={{ onepasswordRead "op://Personal/chezmoi GitHub API Token/credential" .onepasswordAccount | trim }}
{{- if eq .chezmoi.os "darwin" }}
export HOMEBREW_GITHUB_API_TOKEN={{ onepasswordRead "op://Personal/Homebrew GitHub API Token/credential" .onepasswordAccount | trim }}
{{- end }}
{{- end }}
{{- if .flarm }}
export OBSTACLE_ENV=${HOME}/src/obstacle/obstacle_toolchain
export KEY_PATH="${HOME}/Development Secrets and Keys/current"
export TOOLCHAIN_PATH=${HOME}/toolchain_bin
export IDF_TOOLS_PATH=${TOOLCHAIN_PATH}/esp32
{{- end }}
{{- if lookPath "direnv" }}
{{ output "direnv" "hook" "zsh" | trim }}
{{- end }}
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
github-cd() {
local dir="${HOME}/src/github.com/$1"
cd "${dir}"
}
github-clone-cd() {
local prefix=https://github.com/
if [ "$1" = "--ssh" ]; then
shift
fi
local dir="${HOME}/src/github.com/$1"
if [ ! -d "${dir}" ]; then
git clone "${prefix}$1.git" "${dir}"
fi
cd "${dir}"
}
github-clone-code() {
local prefix=https://github.com/
if [ "$1" = "--ssh" ]; then
shift
fi
local dir="${HOME}/src/github.com/$1"
if [ ! -d "${dir}" ]; then
git clone "${prefix}$1.git" "${dir}"
fi
code "${dir}"
}
{{ if stat (joinPath .chezmoi.homeDir ".nvm") }}
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
{{ end }}
{{- /* vim: set filetype=zsh: */}}