2021-03-29 19:10:02 +00:00
|
|
|
# $HOME/.config/zsh/.zshrc
|
|
|
|
# Note: Install zsh-completions package
|
|
|
|
|
|
|
|
setopt hist_find_no_dups
|
|
|
|
setopt extended_history
|
2022-04-17 14:55:01 +00:00
|
|
|
setopt share_history
|
2021-03-29 19:10:02 +00:00
|
|
|
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
|
|
|
|
|
2021-04-08 18:29:28 +00:00
|
|
|
zstyle ':completion:*' completer _complete _ignored _match _prefix
|
2021-03-29 19:10:02 +00:00
|
|
|
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
|
2021-04-03 12:44:58 +00:00
|
|
|
# TODO: fuzzy search broken
|
2021-03-29 19:10:02 +00:00
|
|
|
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
|
2020-06-26 12:19:50 +00:00
|
|
|
|
2021-03-29 19:10:02 +00:00
|
|
|
# Vim keymap
|
|
|
|
bindkey -v
|
|
|
|
bindkey '^w' backward-kill-word
|
2021-04-03 12:44:58 +00:00
|
|
|
bindkey '^r' history-incremental-search-backward
|
2020-06-26 12:19:50 +00:00
|
|
|
|
2020-07-01 09:51:53 +00:00
|
|
|
# Other aliases
|
2021-04-08 14:06:02 +00:00
|
|
|
alias be="bundle exec"
|
|
|
|
alias berc="bundle exec rails console"
|
|
|
|
alias bers="bundle exec rails server"
|
2021-07-27 18:20:23 +00:00
|
|
|
alias berspec="bundle exec rspec --format=progress --no-profile"
|
2022-05-17 06:32:51 +00:00
|
|
|
alias bj="bat -l json"
|
|
|
|
alias by="bat -l yaml"
|
2022-03-22 07:10:44 +00:00
|
|
|
alias c="clear"
|
2022-05-17 06:32:51 +00:00
|
|
|
alias cat="bat"
|
2022-12-13 21:18:34 +00:00
|
|
|
alias cb="cargo build"
|
|
|
|
alias cc="cargo check"
|
2021-03-24 08:16:09 +00:00
|
|
|
alias cdg=cdgit
|
2021-03-29 19:10:02 +00:00
|
|
|
alias cdgit='cd $(git rev-parse --show-toplevel)'
|
|
|
|
alias clp="tmux kill-pane"
|
|
|
|
alias clw="tmux kill-window"
|
2022-12-13 21:19:03 +00:00
|
|
|
alias d="docker"
|
2021-03-29 19:10:02 +00:00
|
|
|
alias dc="docker-compose -f docker-compose.yml"
|
|
|
|
alias dcd="docker-compose -f docker-compose.yml -f docker-compose.development.yml"
|
2021-06-28 11:08:41 +00:00
|
|
|
alias dockdown="sudo systemctl stop docker"
|
2022-12-26 06:29:39 +00:00
|
|
|
alias dockup="sudo systemctl start docker"
|
2021-03-29 19:10:02 +00:00
|
|
|
alias gb="go build"
|
2021-04-10 19:43:09 +00:00
|
|
|
alias gba="go build ./..."
|
2021-04-28 08:33:33 +00:00
|
|
|
alias gbat="go build ./... && go test ./..."
|
2021-03-29 19:10:02 +00:00
|
|
|
alias gc="git commit"
|
|
|
|
alias gd="git diff"
|
2021-03-26 16:24:46 +00:00
|
|
|
alias gg="go get"
|
2021-04-03 08:46:29 +00:00
|
|
|
alias gl="git pull"
|
2021-03-29 19:10:02 +00:00
|
|
|
alias gp="git push"
|
|
|
|
alias gst="git status"
|
2021-03-26 16:24:46 +00:00
|
|
|
alias gt="go test"
|
2021-04-08 10:31:16 +00:00
|
|
|
alias gta="go test ./..."
|
2022-04-17 14:55:01 +00:00
|
|
|
alias h="helm"
|
2021-07-21 09:12:56 +00:00
|
|
|
alias ji="jira -b"
|
2022-12-26 06:29:39 +00:00
|
|
|
alias k9="kill -9"
|
2022-03-22 07:10:44 +00:00
|
|
|
alias k="kubectl"
|
2022-04-17 19:28:35 +00:00
|
|
|
alias kcc="kubectl config current-context"
|
2022-05-17 06:32:51 +00:00
|
|
|
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"
|
2022-12-26 06:29:39 +00:00
|
|
|
alias kgrpcurl="kubectl run grpcurl --image networld/grpcurl --image-pull-policy=Always -it --rm -- sh"
|
2022-05-17 06:32:51 +00:00
|
|
|
alias kgs="kubectl get svc -o wide"
|
2022-12-13 21:19:03 +00:00
|
|
|
alias kmplayer="kubectl run mplayer --image olmesm/mplayer-docker:latest --image-pull-policy=Always -it --rm -- sh"
|
2022-06-09 03:49:10 +00:00
|
|
|
alias kw="kubectl get events -w"
|
2021-03-15 15:29:40 +00:00
|
|
|
alias ll="exa -l --group-directories-first --git"
|
2021-03-29 19:10:02 +00:00
|
|
|
alias ls="exa --color=auto"
|
2023-01-11 06:27:45 +00:00
|
|
|
alias lsoftcpl="sudo lsof -nP -iTCP -sTCP:LISTEN"
|
2022-12-26 06:29:04 +00:00
|
|
|
alias mc="make check"
|
2021-04-03 09:51:04 +00:00
|
|
|
alias ng="noglob"
|
2023-05-30 21:58:44 +00:00
|
|
|
alias open="xdg-open"
|
2021-03-15 15:29:40 +00:00
|
|
|
alias pg="pgrep -fa"
|
2021-03-29 19:10:02 +00:00
|
|
|
alias pk="pkill -fc"
|
2021-03-31 09:14:51 +00:00
|
|
|
alias rez="source $HOME/.zshenv && source $ZDOTDIR/.zshrc"
|
2022-12-26 06:29:39 +00:00
|
|
|
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/'"
|
2021-03-29 19:10:02 +00:00
|
|
|
alias sc="systemctl"
|
2021-04-03 09:51:04 +00:00
|
|
|
alias sk="setkeys"
|
2021-04-08 18:37:14 +00:00
|
|
|
alias ssc="sudo systemctl"
|
2021-03-29 19:10:02 +00:00
|
|
|
alias sysc="systemctl"
|
2021-04-06 10:18:53 +00:00
|
|
|
alias tm="tmux attach"
|
2021-04-28 07:47:35 +00:00
|
|
|
alias tmd="tmux new -s default -c $HOME || tmux attach -t default"
|
2021-04-06 10:18:53 +00:00
|
|
|
alias tms="tmuxsess"
|
2022-12-26 06:29:39 +00:00
|
|
|
alias to="tea open"
|
|
|
|
alias tp="telepresence"
|
|
|
|
alias tpl="telepresence list"
|
2021-06-22 04:24:37 +00:00
|
|
|
alias vim="nvim"
|
2021-03-31 19:34:50 +00:00
|
|
|
alias wg="sudo wg"
|
|
|
|
alias wgdown="sudo wgdown"
|
|
|
|
alias wgup="sudo wgup"
|
2021-03-29 19:10:02 +00:00
|
|
|
alias zzz="sudo systemctl hibernate"
|
2022-12-26 06:29:39 +00:00
|
|
|
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" $* }
|
2020-07-01 09:51:53 +00:00
|
|
|
|
2020-06-26 12:19:50 +00:00
|
|
|
# On boot, power on bluetooth and start xfce
|
|
|
|
if [ $(tty) = "/dev/tty1" ]; then
|
|
|
|
bluetoothctl power on
|
|
|
|
startx
|
|
|
|
fi
|
2020-07-12 16:01:24 +00:00
|
|
|
|
2021-04-06 15:35:06 +00:00
|
|
|
# For Linux, disable Caps-Lock:
|
|
|
|
if [ -x "setxkbmap" ]; then
|
|
|
|
setxkbmap -option caps:none
|
|
|
|
fi
|
2021-01-06 13:34:33 +00:00
|
|
|
|
2021-03-29 19:10:02 +00:00
|
|
|
# Set zshfunctions dir as per https://github.com/alacritty/alacritty/blob/master/INSTALL.md#shell-completions
|
2021-03-31 12:15:08 +00:00
|
|
|
fpath+=${ZDOTDIR:-~}/functions
|
2021-01-25 08:24:13 +00:00
|
|
|
|
2021-03-10 13:22:17 +00:00
|
|
|
# fzf configuration
|
2021-01-06 13:34:33 +00:00
|
|
|
export KEYTIMEOUT=2
|
2021-03-10 13:22:17 +00:00
|
|
|
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
2021-03-29 19:10:02 +00:00
|
|
|
|
2021-04-06 15:35:06 +00:00
|
|
|
# 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
|
|
|
|
|
2021-05-03 08:25:24 +00:00
|
|
|
export VIMPLUGIN="$HOME/.vim/pack/git-plugins"
|
|
|
|
|
2021-04-08 18:17:57 +00:00
|
|
|
# source local zshrc, if it exists (not: not in git)
|
|
|
|
if [ -f $ZDOTDIR/.zshrc.local ]; then
|
|
|
|
. $ZDOTDIR/.zshrc.local
|
|
|
|
fi
|
2021-04-08 08:53:27 +00:00
|
|
|
|
2021-03-29 19:10:02 +00:00
|
|
|
# set up asdf
|
2021-04-08 18:17:57 +00:00
|
|
|
if [ -f $HOME/.asdf/asdf.sh ]; then
|
|
|
|
. $HOME/.asdf/asdf.sh
|
|
|
|
else
|
|
|
|
echo "Warning: asdf not found, skipping"
|
|
|
|
fi
|
2023-09-16 20:30:20 +00:00
|
|
|
|
|
|
|
# pnpm
|
|
|
|
export PNPM_HOME="/home/rob/.local/share/pnpm"
|
|
|
|
case ":$PATH:" in
|
|
|
|
*":$PNPM_HOME:"*) ;;
|
|
|
|
*) export PATH="$PNPM_HOME:$PATH" ;;
|
|
|
|
esac
|
|
|
|
# pnpm end
|