# $HOME/.config/zsh/.zshrc # Note: Install zsh-completions package setopt hist_find_no_dups setopt extended_history setopt share_history setopt auto_pushd setopt pushd_ignore_dups setopt pushd_silent setopt pushd_minus setopt pushd_to_home setopt prompt_subst # Prompt prompt_git_info () { bn=$(git bn 2>/dev/null) if [[ $? -eq 0 ]]; then echo " %F{#aaaaaa}(%F{green}$bn%F{#aaaaaa})" fi } PROMPT='%F{#666666}[%F{#AAAAAA}%n%F{#aaaaaa}@%F{red}%m %F{blue}%1~$(prompt_git_info)%F{white}%F{#666666}]%F{white}%# %f' RPROMPT='%(?.%F{green}√%f.%F{red}%?%f) %F{#666666}%*%f' # Completion # The following lines were added by compinstall zstyle ':completion:*' completer _complete _ignored _match _prefix zstyle ':completion:*' expand prefix suffix zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*' menu select=1 zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s zstyle :compinstall filename '/home/rob/.config/zsh/.zshrc' autoload -Uz compinit compinit # End of lines added by compinstall # Search using up/down cursors # https://unix.stackexchange.com/a/285151/185944 # TODO: fuzzy search broken autoload -U up-line-or-beginning-search autoload -U down-line-or-beginning-search zle -N up-line-or-beginning-search zle -N down-line-or-beginning-search bindkey "^[[A" up-line-or-beginning-search # up bindkey "^[[B" down-line-or-beginning-search # down # Vim keymap bindkey -v bindkey '^w' backward-kill-word bindkey '^r' history-incremental-search-backward # Other aliases alias be="bundle exec" alias berc="bundle exec rails console" alias bers="bundle exec rails server" alias berspec="bundle exec rspec --format=progress --no-profile" alias bj="bat -l json" alias by="bat -l yaml" alias c="clear" alias cat="bat" alias cb="cargo build" alias cc="cargo check" alias cdg=cdgit alias cdgit='cd $(git rev-parse --show-toplevel)' alias clp="tmux kill-pane" alias clw="tmux kill-window" alias d="docker" alias dc="docker-compose -f docker-compose.yml" alias dcd="docker-compose -f docker-compose.yml -f docker-compose.development.yml" alias dockdown="sudo systemctl stop docker" alias dockup="sudo systemctl start docker" alias gb="go build" alias gba="go build ./..." alias gbat="go build ./... && go test ./..." alias gc="git commit" alias gd="git diff" alias gg="go get" alias gl="git pull" alias gmt="go mod tidy" alias gp="git push" alias gst="git status" alias gt="go test" alias gta="go test ./..." alias h="helm" alias ji="jira -b" alias k9="kill -9" alias k="kubectl" alias kcc="kubectl config current-context" alias kcurl="kubectl run curl --image curlimages/curl --image-pull-policy=Always -it --rm -- sh" alias kd="kubectl describe" alias kdel="kubectl delete" alias kg="kubectl get" alias kgp="kubectl get pod -o wide" alias kgrpcurl="kubectl run grpcurl --image networld/grpcurl --image-pull-policy=Always -it --rm -- sh" alias kgs="kubectl get svc -o wide" alias kmplayer="kubectl run mplayer --image olmesm/mplayer-docker:latest --image-pull-policy=Always -it --rm -- sh" alias kw="kubectl get events -w" alias ll="eza -l --group-directories-first --git" alias ls="eza --color=auto" alias lsoftcpl="sudo lsof -nP -iTCP -sTCP:LISTEN" alias mc="make check" alias ng="noglob" alias open="xdg-open" alias opin='eval $(op signin)' alias pg="pgrep -fa" alias pk="pkill -fc" alias rez="source $HOME/.zshenv && source $ZDOTDIR/.zshrc" alias rgo="rg -g '*.go' -g '!vendor/'" alias rgs="rg -g '*.go' -g '*.rb' -g '!vendor/' -g '!*_test.go' -g '!*_spec.rb'" alias rgt="rg -g '*_test.go' -g '*_spec.rb' -g '!vendor/'" alias sc="systemctl" alias shc="shellcheck" alias sk="setkeys" alias ssc="sudo systemctl" alias sysc="systemctl" alias tm="tmux attach" alias tmd="tmux new -s default -c $HOME || tmux attach -t default" alias tms="tmuxsess" alias to="tea open" alias tp="telepresence" alias tpl="telepresence list" alias vim="nvim" alias wg="sudo wg" alias wgdown="sudo wgdown" alias wgup="sudo wgup" alias zzz="sudo systemctl hibernate" ksecd() { kubectl get secret "$1" -o go-template='{{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}' } rgw() { SEARCH_TERM=$1; shift; rg -g '!vendor/' "\b$SEARCH_TERM\b" $* } if [ "$(uname -s)" = "Linux" ]; then alias pbcopy="xclip -selection clipboard -i" alias pbpaste="xclip -selection clipboard -o" fi # On boot, power on bluetooth and start xfce if [ $(tty) = "/dev/tty1" ]; then bluetoothctl power on startx fi # For Linux, disable Caps-Lock: if [ -x "setxkbmap" ]; then setxkbmap -option caps:none fi # Set zshfunctions dir as per https://github.com/alacritty/alacritty/blob/master/INSTALL.md#shell-completions fpath+=${ZDOTDIR:-~}/functions # fzf configuration export KEYTIMEOUT=2 [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh # set PATHs (highest priority last) export PATH=$HOME/go/bin:$PATH export PATH=$HOME/local/sbin:$PATH export PATH=$HOME/local/bin:$PATH export PATH=$HOME/bin:$PATH export PATH=$HOME/.local/bin:$PATH export PATH=$HOME/script:$PATH export VIMPLUGIN="$HOME/.vim/pack/git-plugins" # source local zshrc, if it exists (not: not in git) if [ -f $ZDOTDIR/.zshrc.local ]; then . $ZDOTDIR/.zshrc.local fi # set up mise eval "$(~/.local/bin/mise activate zsh)" # pnpm export PNPM_HOME="/home/rob/.local/share/pnpm" case ":$PATH:" in *":$PNPM_HOME:"*) ;; *) export PATH="$PNPM_HOME:$PATH" ;; esac # pnpm end