-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
187 lines (155 loc) · 5.71 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
case `uname` in
Darwin)
if [ "$TERM_PROGRAM" = "iTerm.app" ]
then
images=()
while IFS= read -r -d $'\0'; do
images+=("$REPLY")
done < <(find ~/Dropbox/Pokemon-Terminal/pokemonterminal/Images/ -name "*.jpg" -print0)
num_images=${#images[*]}
myfilename="`echo ${images[$((RANDOM%$num_images + 1))]}`"
rand_img="/tmp/wppr$(($RANDOM%10)).jpg"
rm -f "$rand_img" &> /dev/null
ln -s "$myfilename" "$rand_img"
base64filename=`echo "$rand_img"| base64`;
echo "\033]1337;SetBackgroundImageFile=${base64filename}\a";
fi
;;
Linux)
# commands for Linux go here
;;
FreeBSD)
# commands for FreeBSD go here
;;
esac
# 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
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
if [ -n "${commands[fzf-share]}" ]; then
source "$(fzf-share)/key-bindings.zsh"
source "$(fzf-share)/completion.zsh"
fi
export ZPLUG_HOME=${ZPLUG_HOME:-"$HOME/.zplug"}
source $ZPLUG_HOME/init.zsh
zplug "b4b4r07/enhancd", use:init.sh
zplug "rupa/z", use:z.sh
zplug "zsh-users/zsh-syntax-highlighting"
zplug "zsh-users/zsh-completions"
zplug "zsh-users/zsh-autosuggestions"
zplug "djui/alias-tips"
zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug "MichaelAquilina/zsh-auto-notify", defer:3
export AUTO_NOTIFY_THRESHOLD=60
export AUTO_NOTIFY_IGNORE=("docker" "man" "sleep" "emacs" "java" "k9s" "kubectl" "brew")
ENHANCD_FILTER="fzf --preview 'exa -al --tree --level 1 --group-directories-first --git-ignore --header --git --no-user --no-time --no-filesize --no-permissions {}' --preview-window right,50% --height 35% --reverse --ansi:fzy:peco"
zplug load
# export PATH="$HOME/.fastlane/bin:$PATH"
export VISUAL=nvim
export EDITOR="$VISUAL"
[ -s "/Users/$USERNAME/.jabba/jabba.sh" ] && source "/Users/$USERNAME/.jabba/jabba.sh"
# encrypt using ssh key
sage() {
age -a -R ~/.ssh/id_ed25519.pub <<< "$1"
}
# age decrypt using ssh key
saged() {
age -d -i ~/.ssh/id_ed25519 <<< "$1"
}
#config clone --bare https://github.com/WonderBeat/dotfiles.git ~/.myconf
# git@github.com:WonderBeat/dotfiles.git
#config checkout
alias config="$(which git) --git-dir=$HOME/.myconf/ --work-tree=$HOME"
alias mvn=mvn -T4
alias python=python3
alias vim='nvim'
alias make='make -s --no-print-directory'
alias wakeup='ssh router ether-wake -i br0 -b 00:11:32:CA:FE:69'
alias nix-shell="nix-shell --command zsh"
alias update="sudo nixos-rebuild switch"
alias update-home="home-manager switch"
eval "$(direnv hook zsh)"
if [[ ${INSIDE_EMACS:-no_emacs_here} != 'no_emacs_here' ]]; then
export EDITOR=emacsclient
export VISUAL=emacsclient
export PAGER=less
alias magit="emacsclient -ne '(magit-status)'"
function man() { emacsclient -ne "(man \"$1\")"; }
fi
# vterm function required to integrate zsh and vterm-emacs
vterm_printf(){
if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ] ); then
# Tell tmux to pass the escape sequences through
printf "\ePtmux;\e\e]%s\007\e\\" "$1"
elif [ "${TERM%%-*}" = "screen" ]; then
# GNU screen (screen, screen-256color, screen-256color-bce)
printf "\eP\e]%s\007\e\\" "$1"
else
printf "\e]%s\e\\" "$1"
fi
}
if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
alias clear='vterm_printf "51;Evterm-clear-scrollback";tput clear'
fi
#vterm directory tracking
vterm_prompt_end() {
vterm_printf "51;A$(whoami)@$(hostname):$(pwd)";
}
setopt PROMPT_SUBST
PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'
#vterm command passing
vterm_cmd() {
local vterm_elisp
vterm_elisp=""
while [ $# -gt 0 ]; do
vterm_elisp="$vterm_elisp""$(printf '"%s" ' "$(printf "%s" "$1" | sed -e 's|\\|\\\\|g' -e 's|"|\\"|g')")"
shift
done
vterm_printf "51;E$vterm_elisp"
}
if [[ -s "$HOME/.config/broot/launcher/bash/br" ]]; then
source "$HOME/.config/broot/launcher/bash/br"
fi
test -e "${HOME}/Library/Application Support/org.dystroy.broot/launcher/bash/br" && source "${HOME}/Library/Application Support/org.dystroy.broot/launcher/bash/br"
# export PATH="/usr/local/opt/python@3.10/bin:$PATH"
# export PATH="/usr/local/opt/avr-gcc@8/bin:$PATH"
# export PATH="/usr/local/opt/avr-gcc@8/bin:$PATH"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
if command -v jj &> /dev/null
then
source <(jj debug completion --zsh | sed '$d')
fi
if command -v carapace &> /dev/null
then
zstyle ':completion:*' format $'\e[2;37mCompleting %d\e[m'
source <(carapace _carapace)
fi
# An emacs 'alias' with the ability to read from stdin
function em
{
# If the argument is - then write stdin to a tempfile and open the
# tempfile.
if [[ $# -ge 1 ]] && [[ "$1" == - ]]; then
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
cat - >! "$tempfile"
emacsclient -n --eval "(find-file \"$tempfile\")" \
--eval '(set-visited-file-name nil)' \
--eval '(rename-buffer "*stdin*" t))'
else
emacsclient -n "$@"
fi
}
if [ "$(whoami)" = "coder" ]; then
eval "$(devbox global shellenv)"
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
fi
source ~/.bash_aliases