rice

personal dot files and scripts for linux and macOS
Log | Files | Refs | README | LICENSE

commit ae1266f36bd5a74363fff301407a91d0dc0d1044
parent e359de3037c41b367a1d83e5a406cca85b2b47ec
Author: Mark Feller <mfeller@squareup.com>
Date:   Mon, 15 Aug 2022 14:20:58 -0600

cleanup zsh configuration based on square info

Diffstat:
Mdots/.config/zsh/.zprofile | 15++++++---------
Mdots/.config/zsh/.zshrc | 25+++++++++++++++++--------
Mdots/.config/zsh/kubernetes.zsh | 14++++++++++++++
Mdots/.zshenv | 4++++
4 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/dots/.config/zsh/.zprofile b/dots/.config/zsh/.zprofile @@ -5,13 +5,9 @@ export XDG_CONFIG_HOME=$HOME/.config export XDG_DATA_HOME=$HOME/.local/share export XDG_CACHE_HOME=$HOME/.cache -export XDG_DOWNLOADS_DIR=$HOME/downloads -export XDG_DOCUMENTS_DIR=$HOME/documents -export XDG_CODE_DIR=$HOME/prog -export PATH=$PATH:/usr/local/bin -export PATH=$PATH:/usr/local/sbin -export PATH=$PATH:$HOME/.local/bin +export PATH=/usr/local/bin:$PATH +export PATH=$HOME/.local/bin/:$PATH export EDITOR=vim export SHELL=zsh @@ -30,6 +26,7 @@ export ZSH=$XDG_CONFIG_HOME/oh-my-zsh export GOPATH=$HOME/prog/go export PATH=$PATH:$GOPATH/bin +export PATH=$PATH:$HOME/.cargo/bin export LS_COLORS="rs=0:di=36;36:ln=36;51:mh=00:pi=40;36;11:so=36;13:do=36;5:bd=48;236;36;11:cd=48;236;36;3:or=48;236;36;9:mi=01;36;41:su=48;196;36;15:sg=48;11;36;16:ca=48;196;36;226:tw=48;10;36;16:ow=48;10;36;21:st=48;21;36;15:ex=1:*.tar=36;9:*.tgz=36;9:*.arc=36;9:*.arj=36;9:*.taz=36;9:*.lha=36;9:*.lz4=36;9:*.lzh=36;9:*.lzma=36;9:*.tlz=36;9:*.txz=36;9:*.tzo=36;9:*.t7z=36;9:*.zip=36;9:*.z=36;9:*.dz=36;9:*.gz=36;9:*.lrz=36;9:*.lz=36;9:*.lzo=36;9:*.xz=36;9:*.zst=36;9:*.tzst=36;9:*.bz2=36;9:*.bz=36;9:*.tbz=36;9:*.tbz2=36;9:*.tz=36;9:*.deb=36;9:*.rpm=36;9:*.jar=36;9:*.war=36;9:*.ear=36;9:*.sar=36;9:*.rar=36;9:*.alz=36;9:*.ace=36;9:*.zoo=36;9:*.cpio=36;9:*.7z=36;9:*.rz=36;9:*.cab=36;9:*.wim=36;9:*.swm=36;9:*.dwm=36;9:*.esd=36;9:*.jpg=36;13:*.jpeg=36;13:*.mjpg=36;13:*.mjpeg=36;13:*.gif=36;13:*.bmp=36;13:*.pbm=36;13:*.pgm=36;13:*.ppm=36;13:*.tga=36;13:*.xbm=36;13:*.xpm=36;13:*.tif=36;13:*.tiff=36;13:*.png=36;13:*.svg=36;13:*.svgz=36;13:*.mng=36;13:*.pcx=36;13:*.mov=36;13:*.mpg=36;13:*.mpeg=36;13:*.m2v=36;13:*.mkv=36;13:*.webm=36;13:*.ogm=36;13:*.mp4=36;13:*.m4v=36;13:*.mp4v=36;13:*.vob=36;13:*.qt=36;13:*.nuv=36;13:*.wmv=36;13:*.asf=36;13:*.rm=36;13:*.rmvb=36;13:*.flc=36;13:*.avi=36;13:*.fli=36;13:*.flv=36;13:*.gl=36;13:*.dl=36;13:*.xcf=36;13:*.xwd=36;13:*.yuv=36;13:*.cgm=36;13:*.emf=36;13:*.ogv=36;13:*.ogx=36;13:*.aac=36;45:*.au=36;45:*.flac=36;45:*.m4a=36;45:*.mid=36;45:*.midi=36;45:*.mka=36;45:*.mp3=36;45:*.mpc=36;45:*.ogg=36;45:*.ra=36;45:*.wav=36;45:*.oga=36;45:*.opus=36;45:*.spx=36;45:*.xspf=36;45:" @@ -38,8 +35,8 @@ export LC_ALL=C export PASH_CLIP='xclip -i -selection clipboard' export PASH_TIMEOUT=off -export GNUPGHOME=$XDG_DATA_HOME/gnupg +export GNUPGHOME=$HOME/.local/share/gnupg -export NOTMUCH_CONFIG=$XDG_CONFIG_HOME/notmuch/config +export NOTMUCH_CONFIG=$HOME/.config/notmuch/config -export BOTO_CONFIG=$XDG_CONFIG_HOME/gcloud/boto +export BOTO_CONFIG=$HOME/.config/gcloud/boto diff --git a/dots/.config/zsh/.zshrc b/dots/.config/zsh/.zshrc @@ -1,9 +1,9 @@ -source $HOME/.config/oh-my-zsh/oh-my-zsh.sh -source $HOME/.config/zsh/fzf.zsh -source $HOME/.config/zsh/kubernetes.zsh -source $HOME/.config/zsh/terraform.zsh -source $HOME/.config/zsh/gcloud.zsh -source $HOME/.config/aliasrc +source $XDG_CONFIG_HOME/oh-my-zsh/oh-my-zsh.sh +source $XDG_CONFIG_HOME/zsh/fzf.zsh +source $XDG_CONFIG_HOME/zsh/kubernetes.zsh +source $XDG_CONFIG_HOME/zsh/terraform.zsh +source $XDG_CONFIG_HOME/zsh/gcloud.zsh +source $XDG_CONFIG_HOME/aliasrc # oh my zsh plugins plugins=( @@ -12,6 +12,7 @@ plugins=( git ) + # setup prompt git_prompt() { ref=$(git_current_branch) @@ -19,10 +20,14 @@ git_prompt() { } kube_prompt() { ctx=$([ -z "$KUBECTX" ] && [ -d $HOME/.kube ] && { grep -m1 "current-context" $HOME/.kube/config | cut -d' ' -f2 2> /dev/null; } || echo "$KUBECTX" ) + ns=$KUBENS [ -z "$ctx" ] || echo -n "%F{green}$ctx%f " - [ -z "$KUBENS" ] || echo -n "%F{blue}$KUBENS%f " + [ -z "$ns" ] || echo -n "%F{blue}$ns%f " } -PROMPT='%F{241}%2~%f $(kube_prompt)$(git_prompt)%B%F{241}$%b%f ' +setopt prompt_subst +setopt transient_rprompt +RPROMPT='$(kube_prompt)' +PROMPT='%F{241}#%b%f ' # history in cache directory HISTSIZE=10000 @@ -45,3 +50,7 @@ venv() { source venv/bin/activate fi } + +if [[ "$INSIDE_EMACS" = 'vterm' ]]; then + alias clear='vterm_printf "51;Evterm-clear-scrollback";tput clear' +fi diff --git a/dots/.config/zsh/kubernetes.zsh b/dots/.config/zsh/kubernetes.zsh @@ -29,11 +29,25 @@ kn() { [ -z "$1" ] && unset KUBENS || export KUBENS=$1 } +knn() { + ns=$(kubectl get namespaces -o name | sed 's/^namespace\///' | fzf) + [ -z "$ns" ] || kn $ns +} + kge() { # Grab a list of all active generic environments kubectl --context=dev get ns -l sunday-env=generic --show-labels=true } +kw() { + # Override the kubectl command to automatically apply flags based on + # environment variables. + command watch kubectl \ + $([ -z "$KUBENS" ] || printf "--namespace=$KUBENS") \ + $([ -z "$KUBECTX" ] || printf "--context=$KUBECTX") \ + $@ +} + kubectl() { # Override the kubectl command to automatically apply flags based on # environment variables. diff --git a/dots/.zshenv b/dots/.zshenv @@ -44,3 +44,7 @@ export GNUPGHOME=$XDG_DATA_HOME/gnupg export NOTMUCH_CONFIG=$XDG_CONFIG_HOME/notmuch/config export BOTO_CONFIG=$XDG_CONFIG_HOME/gcloud/boto + +export NVM_DIR=$XDG_CONFIG_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