-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdot_zshrc.tmpl
More file actions
119 lines (95 loc) · 2.9 KB
/
dot_zshrc.tmpl
File metadata and controls
119 lines (95 loc) · 2.9 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
{{- $remote := or (env "CODESPACES" | not | not) (env "SSH_CONNECTION" | not | not) (env "KUBERNETES_SERVICE_HOST" | not | not) (env "container" | not | not) (env "REMOTE_CONTAINERS" | not | not) (stat "/.dockerenv" | not | not) -}}
# enable zsh history
HISTFILE="$HOME/.zsh_history"
HISTSIZE=60000
SAVEHIST=50000
setopt HIST_IGNORE_SPACE # do not save a command if it starts with a space
setopt HIST_IGNORE_DUPS # do not save duplicate commands
# solve weird extra character issues when auto completing
export LANG="en_US.UTF-8"
# add user local completion folder to fpath
fpath+=(~/.zsh/completion)
if [[ -d $HOME/.local/bin ]] ; then
export PATH=$HOME/.local/bin:$PATH
fi
if [[ -d $HOME/.krew ]] ; then
export PATH=$HOME/.krew/bin:$PATH
fi
# edit PATH
{{ if and .chezmoi.osRelease (eq .chezmoi.osRelease.id "bazzite") -}}
export PATH=$HOME/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:$PATH
{{- end}}
{{if not .remote -}}
# setup gpg-agent ssh
if command -v gpgconf >/dev/null 2>&1; then
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
fi
{{- end}}
# enable brew if found on linux
if [ -f /home/linuxbrew/.linuxbrew/bin/brew ] ; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
if command -v mise > /dev/null ; then
eval "$(mise activate zsh)"
fi
autoload -Uz compinit && compinit
# (neo)vim
if command -v nvim > /dev/null ; then
export EDITOR="nvim"
export VISUAL="nvim"
elif command -v vim > /dev/null ; then
export EDITOR="vim"
export VISUAL="vim"
fi
if command -v lsd > /dev/null ; then
alias ls="lsd"
alias ll="ls -lgh"
alias la='ls -a'
alias lla='ls -lgha'
alias lt='ls --tree'
fi
# enable zsh vi-mode
bindkey -v
export KEYTIMEOUT=1 # make switching between modes faster
# enable the starship prompt
if command -v starship > /dev/null ; then
eval "$(starship init zsh)"
fi
# enable fzf autocompletion and key-bindings if found
if command -v fzf > /dev/null ; then
source <(fzf --zsh)
fi
if command -v kubectl > /dev/null ; then
source <(kubectl completion zsh)
alias k="kubectl"
fi
if command -v flux > /dev/null ; then
source <(flux completion zsh)
fi
# if zoxide is installed, enable it
if command -v zoxide > /dev/null ; then
eval "$(zoxide init zsh)"
alias cd="z"
fi
# some nice functions and aliases
## use bat instead of cat
if command -v bat > /dev/null ; then
alias cat="bat"
fi
## bat on debian based systems is batcat. Fix that.
if command -v batcat > /dev/null ; then
alias cat="batcat"
fi
if command -v dagger > /dev/null ; then
export DAGGER_NO_NAG=1
fi
if [[ -d .zsh/zsh-autosuggestions ]] ; then
source .zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
fi
# syntax highlighting needs to be at the end because of reasons
if [[ -d .zsh/zsh-syntax-highlighting ]] ; then
source .zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi