diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..d6e2e4b --- /dev/null +++ b/.zshrc @@ -0,0 +1,36 @@ +eval "$(~/.local/bin/mise activate zsh)" +export AWS_VAULT_KEYCHAIN_NAME="aws-vault.keychain-db" + +PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH" +PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH" + +# homebrew completions must be in fpath BEFORE compinit runs +fpath=(/opt/homebrew/share/zsh/site-functions $fpath) +autoload -U compinit; compinit + +alias kubectl=kubecolor + +# mise completions +eval "$(mise completion zsh)" + +export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' +# fzf key bindings: ctrl+r history, alt+c cd +# ctrl+t conflicts with zellij tab mode — remapped to ctrl+f (find files) +eval "$(fzf --zsh)" +bindkey -M emacs -r '^T' +bindkey -M viins -r '^T' +bindkey -M vicmd -r '^T' +bindkey -M emacs '^F' fzf-file-widget +bindkey -M viins '^F' fzf-file-widget +bindkey -M vicmd '^F' fzf-file-widget + +source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/opt/homebrew/share/zsh-syntax-highlighting/highlighters + +[ -d $HOME/.zshrc.d ] && for file in $HOME/.zshrc.d/*.zsh; do source $file; done +# compdef must run after _kubectl is defined in .zshrc.d/kubectl_comp.sh +compdef kubecolor=kubectl +source ~/.local/share/fzf-tab/fzf-tab.plugin.zsh +source ~/.config/themes/fzf-challengerdeep.sh + +eval "$(starship init zsh)" diff --git a/.zshrc.d/_cht b/.zshrc.d/_cht new file mode 100644 index 0000000..e1a4230 --- /dev/null +++ b/.zshrc.d/_cht @@ -0,0 +1,21 @@ +#compdef cht.sh + +__CHTSH_LANGS=($(curl -s cheat.sh/:list)) +_arguments -C \ + '--help[show this help message and exit]: :->noargs' \ + '--shell[enter shell repl]: :->noargs' \ + '1:Cheat Sheet:->lang' \ + '*::: :->noargs' && return 0 + +if [[ CURRENT -ge 1 ]]; then + case $state in + noargs) + _message "nothing to complete";; + lang) + compadd -X "Cheat Sheets" ${__CHTSH_LANGS[@]};; + *) + _message "Unknown state, error in autocomplete";; + esac + + return +fi diff --git a/.zshrc.d/aliases.zsh b/.zshrc.d/aliases.zsh new file mode 100644 index 0000000..f543cfd --- /dev/null +++ b/.zshrc.d/aliases.zsh @@ -0,0 +1,177 @@ +#=================================== +# DIRECTORY MANAGEMENT +#=================================== +alias ..='cd ..' +alias .1='cd ..' +alias .2='cd ../../' +alias .3='cd ../../../' +alias .4='../../../../' +alias .5='cd ../../../../../' +alias APPS='cd ${HOME}/GIT_REPOS/APPLICATION-DEPLOYMENTS' +alias INFRA='cd ${HOME}/GIT_REPOS/CLOUD-INFRASTRUCTURE-TERRAFORM' +alias EKS-BASE='cd ${HOME}/GIT_REPOS/EKS-BASE-DEPLOY' +alias K8S-BASE='cd ${HOME}/GIT_REPOS/K8S-BASE-DEPLOY' +alias config='/usr/bin/git --git-dir=$HOME/.cfg/.git/ --work-tree=$HOME' + + +#=================================== +# COMMAND MODIFICATIONS & REMAPS +#=================================== +alias l='lsd' +alias la='lsd -aF' +alias vi='nvim' +alias dog='cat' +alias grep='grep --color=auto' +alias Grep='grep' +alias Gerp='grep' +alias gerp='grep' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' +alias nano='nvim' +alias emacs='nvim' +alias notepad.exe='nvim' +alias diff='colordiff --side-by-side --suppress-common-lines' +alias header='curl -I' +alias headerc='curl -I --compress' + +#=================================== +# AWS & INFRA-TOOLS +#=================================== +#AWS +alias ac='aws-cred' +alias av='aws-vault' +alias tg='terragrunt' + +#Terraform / Terragrun +alias tgp="terragrunt plan" +alias tgps="terragrunt plan --terragrunt-source-update" +alias tglo="terragrunt providers lock -platform=linux_arm64 -platform=linux_amd64 -platform=darwin_amd64 -platform=darwin_arm6" +alias tga="terragrunt apply" +alias tgaA="terragrunt apply -auto-approve" +alias tgas="terragrunt apply --terragrunt-source-update" +alias tgasA="terragrunt apply --terragrunt-source-update -auto-approve" +alias tgi="terragrunt init" +alias tgis="terragrunt init --terragrunt-source-update" +alias tgo="terragrunt output" + +#Kuberenetes +alias kx='kubectx' +alias kn='kubens' +alias ku='kustomize' +alias kub='kustomize build --enable-alpha-plugins --load-restrictor LoadRestrictionsNone' +alias k='kubectl' +alias kg='kubectl get' +alias kd='kubectl describe' +alias kge='kubectl get events' +alias kgp='kubectl get pods' +alias kgprca="kubectl get pods --all-namespaces --sort-by='.status.containerStatuses[0].restartCount'" +alias kgprc="kubectl get pods --sort-by='.status.containerStatuses[0].restartCount'" +#alias kgn='kubectl get nodes' +alias kgn='kubectl get nodes --sort-by=.metadata.creationTimestamp' +alias kgic='kubectl get ingressclass' +alias kdic='kubectl describe ingressclass' +alias kgpv='kubectl get pv' +alias kdpv='kubectl describe pv' +alias klt='kubectl logs -f' +alias kbug='kubectl run -i --tty --rm debug --image=ubuntu --restart=Never -- /bin/bash' +alias kgsec='kubectl get secret' +alias kgj='kubectl get job' +alias fqdn="kubectl get ingress -o json | jq '.items[] | .metadata.namespace + \": \" + .metadata.annotations.\"external-dns.alpha.kubernetes.io/hostname\"'" +alias fqdna="kubectl get ingress --all-namespaces -o json | jq '.items[] | .metadata.namespace + \": \" + .metadata.annotations.\"external-dns.alpha.kubernetes.io/hostname\"'" +#Kubernetes + Teleport +alias tkl='tsh kube ls' +kutil () { + for host in $(kubectl get nodes --no-headers | cut -d' ' -f1) + do + echo "$host - $(kubectl get nodes -o jsonpath='{.metadata.labels.topology\.kubernetes\.io/zone}' $host)" + kubectl describe node "$host" | grep --color Allocated -A 5 | grep --color -ve Event -ve Allocated -ve percent -ve -- + echo + done +} +#=================================== +# USEFUL / CONVIENENCE +#=================================== +alias untar='tar -zxvf' +alias lstar='tar -tvf' +alias perms='stat -f "%A %Sp -> owner=%SHp group=%SMp other=%SLp"' +#alias pydocs="elinks https://docs.python.org/$(python --version | awk '{print $2}' | sed 's/\.[0-9]*$//')/py-modindex.html" +alias pydocs="open https://docs.python.org/$(python3 --version | awk '{print $2}' | sed 's/\.[0-9]*$//')/py-modindex.html" +alias hr='printf $(printf "\e[$(shuf -i 91-97 -n 1);1m%%%ds\e[0m\n" $(tput cols)) | tr " " =' +alias iac='cd $HOME/projects/IAC' + + +#=================================== +# DO THE SAFETY DANCE +#=================================== +alias cp='cp -i' +alias rm='rm -i' +alias ln='ln -i' +alias mv='mv -i' + +#=================================== +# MAC +#=================================== +alias fudns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder' + +#=================================== +# MISC +#=================================== +if [ $UID -ne 0 ]; then + alias reboot='sudo reboot' + if [[ $OSTYPE != 'darwin'* ]]; then + alias upgradeall='sudo apt-get update && sudo apt-get upgrade' + fi +fi + +#=================================== +# FUNCS +#=================================== +#exa deprecated, replacing with lsd (github.com/lsd-rs/lsd) +#alias ls ='lsd' +#i use exa and have ls muscle memory, current version of exa does not take -t and will error out#this is a fair work around; https://github.com/ogham/exa/issues/519#issuecomment-560608534 +#function ls { +# if [ "$1" = "-ltr" ]; then +# exa -lsnew "${@:2}" -l -F --color=auto --icons +# elif [ "$1" = "-lrt" ]; then +# exa -lsnew "${@:2}" -l -F --color=auto --icons +# elif [ "$1" = "-latr" ]; then +# exa -lsnew "${@:2}" -la -F --color=auto --icons +# elif [ "$1" = "-lahtr" ]; then +# exa -lsnew "${@:2}" -lah -F --color=auto --icons +# elif [ "$1" = "-alhtr" ]; then +# exa -lsnew "${@:2}" -lah -F --color=auto --icons +# elif [ "$1" = "latr" ]; then +# exa -lsnew "${@:3}" -lah -F --color=auto --icons +# elif [ "$1" = "altr" ]; then +# exa -lsnew "${@:3}" -lah -F --color=auto --icons +# elif [ "$1" = "lahtr" ]; then +# exa -lsnew "${@:3}" -lah -F --color=auto --icons +# elif [ "$1" = "-altr" ]; then +# exa -lsnew "${@:2}" -lah -F --color=auto --icons +# elif [ "$1" = "a-ltr" ]; then +# exa -lsnew "${@:2}" -lah -F --color=auto --icons +# else +# exa "$@" -a +# fi +#} + +function urlencode { + python -c "import sys; from urllib.parse import quote_plus; print(quote_plus(sys.stdin.read()))" +} + +function urldecode { + python -c "import sys; from urllib.parse import unquote; print(unquote(sys.stdin.read()), end='')" +} + +function tfdocs { + open "https://registry.terraform.io/search/providers?q=`echo "${@}" | urlencode`" +} + +function google { + open "https://www.google.com/search?q=`echo "${@}" | urlencode`" +} + +function hred () { + [ $# -ge 1 -a -f "$1" ] && input="$1" || input="-" + cat $input | grep --color -E -v '^\s*$|^\s*#.*$' +} diff --git a/.zshrc.d/fr.zsh b/.zshrc.d/fr.zsh new file mode 100644 index 0000000..6a43acf --- /dev/null +++ b/.zshrc.d/fr.zsh @@ -0,0 +1,28 @@ +#!/bin/bash +fr () { + FIND="$1" + REPLACE="$2" + FILTER="$3" + if [ -z "${FIND}" ] || [ -z "${REPLACE}" ] + then + echo "ERR: must include two parameters for find and replace" >&2 + fr_usage + return 1 + fi + if command -v rg 2>&1 > /dev/null + then + if [ -z "${FILTER}" ] + then + rg --hidden --glob '!.git/' -l "$FIND" | xargs sed -i "s/${FIND}/${REPLACE}/g" + else + rg --hidden --glob '!.git/' -l "$FIND" | rg --hidden --glob '!.git/' -i "$FILTER" | xargs sed -i "s/${FIND}/${REPLACE}/g" + fi + else + if [ -z "${FILTER}" ] + then + grep --color -l "$FIND" | xargs sed -i "s/${FIND}/${REPLACE}/g" + else + grep --color -l "$FIND" | grep --color -i "$FILTER" | xargs sed -i "s/${FIND}/${REPLACE}/g" + fi + fi +} diff --git a/.zshrc.d/gopath.zsh b/.zshrc.d/gopath.zsh new file mode 100644 index 0000000..c5e37e2 --- /dev/null +++ b/.zshrc.d/gopath.zsh @@ -0,0 +1,6 @@ +# GoPath stuff +export PATH="$PATH:${HOME}/.bin" +export GOPATH="${HOME}/go" +export GOBIN="${HOME}/go/bin/" +export PATH=$PATH:$GOROOT/bin:$GOBIN +export HISTCONTROL=ignorespace:ignoredups diff --git a/.zshrc.d/hred.zsh b/.zshrc.d/hred.zsh new file mode 100644 index 0000000..b1a341d --- /dev/null +++ b/.zshrc.d/hred.zsh @@ -0,0 +1,5 @@ + +hred() { + [ $# -ge 1 -a -f "$1" ] && input="$1" || input="-" + cat $input | grep -E -v '^\s*$|^\s*#.*$' +} diff --git a/.zshrc.d/kubectl_comp.zsh b/.zshrc.d/kubectl_comp.zsh new file mode 100644 index 0000000..f944199 --- /dev/null +++ b/.zshrc.d/kubectl_comp.zsh @@ -0,0 +1,228 @@ +#compdef kubectl +compdef _kubectl kubectl + +# Copyright 2016 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#compdef kubectl +compdef _kubectl kubectl + +# zsh completion for kubectl -*- shell-script -*- + +__kubectl_debug() +{ + local file="$BASH_COMP_DEBUG_FILE" + if [[ -n ${file} ]]; then + echo "$*" >> "${file}" + fi +} + +_kubectl() +{ + local shellCompDirectiveError=1 + local shellCompDirectiveNoSpace=2 + local shellCompDirectiveNoFileComp=4 + local shellCompDirectiveFilterFileExt=8 + local shellCompDirectiveFilterDirs=16 + local shellCompDirectiveKeepOrder=32 + + local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder + local -a completions + + __kubectl_debug "\n========= starting completion logic ==========" + __kubectl_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" + + # The user could have moved the cursor backwards on the command-line. + # We need to trigger completion from the $CURRENT location, so we need + # to truncate the command-line ($words) up to the $CURRENT location. + # (We cannot use $CURSOR as its value does not work when a command is an alias.) + words=("${=words[1,CURRENT]}") + __kubectl_debug "Truncated words[*]: ${words[*]}," + + lastParam=${words[-1]} + lastChar=${lastParam[-1]} + __kubectl_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" + + # For zsh, when completing a flag with an = (e.g., kubectl -n=) + # completions must be prefixed with the flag + setopt local_options BASH_REMATCH + if [[ "${lastParam}" =~ '-.*=' ]]; then + # We are dealing with a flag with an = + flagPrefix="-P ${BASH_REMATCH}" + fi + + # Prepare the command to obtain completions + requestComp="${words[1]} __complete ${words[2,-1]}" + if [ "${lastChar}" = "" ]; then + # If the last parameter is complete (there is a space following it) + # We add an extra empty parameter so we can indicate this to the go completion code. + __kubectl_debug "Adding extra empty parameter" + requestComp="${requestComp} \"\"" + fi + + __kubectl_debug "About to call: eval ${requestComp}" + + # Use eval to handle any environment variables and such + out=$(eval ${requestComp} 2>/dev/null) + __kubectl_debug "completion output: ${out}" + + # Extract the directive integer following a : from the last line + local lastLine + while IFS='\n' read -r line; do + lastLine=${line} + done < <(printf "%s\n" "${out[@]}") + __kubectl_debug "last line: ${lastLine}" + + if [ "${lastLine[1]}" = : ]; then + directive=${lastLine[2,-1]} + # Remove the directive including the : and the newline + local suffix + (( suffix=${#lastLine}+2)) + out=${out[1,-$suffix]} + else + # There is no directive specified. Leave $out as is. + __kubectl_debug "No directive found. Setting do default" + directive=0 + fi + + __kubectl_debug "directive: ${directive}" + __kubectl_debug "completions: ${out}" + __kubectl_debug "flagPrefix: ${flagPrefix}" + + if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then + __kubectl_debug "Completion received error. Ignoring completions." + return + fi + + local activeHelpMarker="_activeHelp_ " + local endIndex=${#activeHelpMarker} + local startIndex=$((${#activeHelpMarker}+1)) + local hasActiveHelp=0 + while IFS='\n' read -r comp; do + # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) + if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then + __kubectl_debug "ActiveHelp found: $comp" + comp="${comp[$startIndex,-1]}" + if [ -n "$comp" ]; then + compadd -x "${comp}" + __kubectl_debug "ActiveHelp will need delimiter" + hasActiveHelp=1 + fi + + continue + fi + + if [ -n "$comp" ]; then + # If requested, completions are returned with a description. + # The description is preceded by a TAB character. + # For zsh's _describe, we need to use a : instead of a TAB. + # We first need to escape any : as part of the completion itself. + comp=${comp//:/\\:} + + local tab="$(printf '\t')" + comp=${comp//$tab/:} + + __kubectl_debug "Adding completion: ${comp}" + completions+=${comp} + lastComp=$comp + fi + done < <(printf "%s\n" "${out[@]}") + + # Add a delimiter after the activeHelp statements, but only if: + # - there are completions following the activeHelp statements, or + # - file completion will be performed (so there will be choices after the activeHelp) + if [ $hasActiveHelp -eq 1 ]; then + if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then + __kubectl_debug "Adding activeHelp delimiter" + compadd -x "--" + hasActiveHelp=0 + fi + fi + + if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then + __kubectl_debug "Activating nospace." + noSpace="-S ''" + fi + + if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then + __kubectl_debug "Activating keep order." + keepOrder="-V" + fi + + if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then + # File extension filtering + local filteringCmd + filteringCmd='_files' + for filter in ${completions[@]}; do + if [ ${filter[1]} != '*' ]; then + # zsh requires a glob pattern to do file filtering + filter="\*.$filter" + fi + filteringCmd+=" -g $filter" + done + filteringCmd+=" ${flagPrefix}" + + __kubectl_debug "File filtering command: $filteringCmd" + _arguments '*:filename:'"$filteringCmd" + elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then + # File completion for directories only + local subdir + subdir="${completions[1]}" + if [ -n "$subdir" ]; then + __kubectl_debug "Listing directories in $subdir" + pushd "${subdir}" >/dev/null 2>&1 + else + __kubectl_debug "Listing directories in ." + fi + + local result + _arguments '*:dirname:_files -/'" ${flagPrefix}" + result=$? + if [ -n "$subdir" ]; then + popd >/dev/null 2>&1 + fi + return $result + else + __kubectl_debug "Calling _describe" + if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then + __kubectl_debug "_describe found some completions" + + # Return the success of having called _describe + return 0 + else + __kubectl_debug "_describe did not find completions." + __kubectl_debug "Checking if we should do file completion." + if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then + __kubectl_debug "deactivating file completion" + + # We must return an error code here to let zsh know that there were no + # completions found by _describe; this is what will trigger other + # matching algorithms to attempt to find completions. + # For example zsh can match letters in the middle of words. + return 1 + else + # Perform file completion + __kubectl_debug "Activating file completion" + + # We must return the result of this command, so it must be the + # last command, or else we must store its result to return it. + _arguments '*:filename:_files'" ${flagPrefix}" + fi + fi + fi +} + +# don't run the completion function when being source-ed or eval-ed +if [ "$funcstack[1]" = "_kubectl" ]; then + _kubectl +fi diff --git a/.zshrc.d/starship_init.sh b/.zshrc.d/starship_init.sh new file mode 100644 index 0000000..4ea4807 --- /dev/null +++ b/.zshrc.d/starship_init.sh @@ -0,0 +1,102 @@ +# ZSH has a quirk where `preexec` is only run if a command is actually run (i.e +# pressing ENTER at an empty command line will not cause preexec to fire). This +# can cause timing issues, as a user who presses "ENTER" without running a command +# will see the time to the start of the last command, which may be very large. + +# To fix this, we create STARSHIP_START_TIME upon preexec() firing, and destroy it +# after drawing the prompt. This ensures that the timing for one command is only +# ever drawn once (for the prompt immediately after it is run). + +zmodload zsh/parameter # Needed to access jobstates variable for STARSHIP_JOBS_COUNT + +# Defines a function `__starship_get_time` that sets the time since epoch in millis in STARSHIP_CAPTURED_TIME. +if [[ $ZSH_VERSION == ([1-4]*) ]]; then + # ZSH <= 5; Does not have a built-in variable so we will rely on Starship's inbuilt time function. + __starship_get_time() { + STARSHIP_CAPTURED_TIME=$(/Users/steve.briggs/.local/share/mise/installs/starship/latest/starship time) + } +else + zmodload zsh/datetime + zmodload zsh/mathfunc + __starship_get_time() { + (( STARSHIP_CAPTURED_TIME = int(rint(EPOCHREALTIME * 1000)) )) + } +fi + +# The two functions below follow the naming convention `prompt__` +# for compatibility with Zsh's prompt system. See +# https://github.com/zsh-users/zsh/blob/2876c25a28b8052d6683027998cc118fc9b50157/Functions/Prompts/promptinit#L155 + +# Runs before each new command line. +prompt_starship_precmd() { + # Save the status, because subsequent commands in this function will change $? + STARSHIP_CMD_STATUS=$? STARSHIP_PIPE_STATUS=(${pipestatus[@]}) + + # Calculate duration if a command was executed + if (( ${+STARSHIP_START_TIME} )); then + # If an arithmetic expression evaluates to 0, its exit status is 1: + # "The return status is 0 if the arithmetic value of the expression is non-zero, 1 if it is zero, and 2 if an error occurred." + # In rare cases, the subtraction below can result in an int 0 result (yes, really), + # which would then kill the shell if 'set -e' is in effect. + # We therefore have to assign the result outside the expression (using 'STARSHIP_DURATION=$((...))'), + # because unlike '(())', '$(())' gets a return status of 0 even if the expression evaluates to int 0 + # (but it still surfaces a potential error, normally status 2, as status 1). + __starship_get_time && STARSHIP_DURATION=$(( STARSHIP_CAPTURED_TIME - STARSHIP_START_TIME )) + unset STARSHIP_START_TIME + # Drop status and duration otherwise + else + unset STARSHIP_DURATION STARSHIP_CMD_STATUS STARSHIP_PIPE_STATUS + fi + + # Use length of jobstates array as number of jobs. Expansion fails inside + # quotes so we set it here and then use the value later on. + STARSHIP_JOBS_COUNT="${#jobstates[*]}" +} + +# Runs after the user submits the command line, but before it is executed and +# only if there's an actual command to run +prompt_starship_preexec() { + __starship_get_time && STARSHIP_START_TIME=$STARSHIP_CAPTURED_TIME +} + +# Add hook functions +autoload -Uz add-zsh-hook +add-zsh-hook precmd prompt_starship_precmd +add-zsh-hook preexec prompt_starship_preexec + +# Set up a function to redraw the prompt if the user switches vi modes +starship_zle-keymap-select() { + zle reset-prompt +} + +## Check for existing keymap-select widget. +if [[ -v widgets[zle-keymap-select] ]]; then + # zle-keymap-select is a special widget so it'll be "user:fnName" or nothing. Let's get fnName only. + __starship_preserved_zle_keymap_select=${widgets[zle-keymap-select]#user:} +fi + +if [[ -z ${__starship_preserved_zle_keymap_select:-} ]]; then + zle -N zle-keymap-select starship_zle-keymap-select; +else + # Define a wrapper fn to call the original widget fn and then Starship's. + starship_zle-keymap-select-wrapped() { + $__starship_preserved_zle_keymap_select "$@"; + starship_zle-keymap-select "$@"; + } + zle -N zle-keymap-select starship_zle-keymap-select-wrapped; +fi + +export STARSHIP_SHELL="zsh" + +# Set up the session key that will be used to store logs +STARSHIP_SESSION_KEY="$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM"; # Random generates a number b/w 0 - 32767 +STARSHIP_SESSION_KEY="${STARSHIP_SESSION_KEY}0000000000000000" # Pad it to 16+ chars. +export STARSHIP_SESSION_KEY=${STARSHIP_SESSION_KEY:0:16}; # Trim to 16-digits if excess. + +VIRTUAL_ENV_DISABLE_PROMPT=1 + +setopt promptsubst + +PROMPT='$('/Users/steve.briggs/.local/share/mise/installs/starship/latest/starship' prompt --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="${STARSHIP_CMD_STATUS:-}" --pipestatus="${STARSHIP_PIPE_STATUS[*]:-}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")' +RPROMPT='$('/Users/steve.briggs/.local/share/mise/installs/starship/latest/starship' prompt --right --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="${STARSHIP_CMD_STATUS:-}" --pipestatus="${STARSHIP_PIPE_STATUS[*]:-}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")' +PROMPT2="$(/Users/steve.briggs/.local/share/mise/installs/starship/latest/starship prompt --continuation)" diff --git a/.zshrc.d/teleport.zsh b/.zshrc.d/teleport.zsh new file mode 100644 index 0000000..bc9e753 --- /dev/null +++ b/.zshrc.d/teleport.zsh @@ -0,0 +1,3 @@ +export TELEPORT_PROXY=transporter.ic-ops.com:443 +export TELEPORT_CLUSTER=transporter.ic-ops.com +export TELEPORT_USER=steve.briggs@immuta.com diff --git a/.zshrc.d/vscodepath.ksh b/.zshrc.d/vscodepath.ksh new file mode 100644 index 0000000..8ecfd67 --- /dev/null +++ b/.zshrc.d/vscodepath.ksh @@ -0,0 +1 @@ +export PATH=$PATH:/usr/local/bin/code diff --git a/.zshrc.d/work-immuta.zsh b/.zshrc.d/work-immuta.zsh new file mode 100644 index 0000000..d20b2a8 --- /dev/null +++ b/.zshrc.d/work-immuta.zsh @@ -0,0 +1,11 @@ +export VAULT_ADDR=https://vault.immuta.io:8200 +#export VAULT_ADDR=https://vault.infrastructure.immuta.io:8200 +export VAULT_TOKEN=$(cat ~/.vault-token) + +export AWS_VAULT_BACKEND=keychain +export AWS_VAULT_KEYCHAIN_NAME="aws-vault" +export AWS_LOGIN_BROWSER="firefox" + +#export KUBECONFIG=/Users/steve.briggs/.kube/config:/Users/steve.briggs/.kube/minikube +export KUBECONFIG="${HOME}/.kube/teleport-kubeconfig:${HOME}/.kube/config:${HOME}/.kube/minikube" +export PATH=$PATH:/private/var/folders/ky/m6p32md91_n2q6z94fdn8fsw0000gq/T/AppTranslocation/F252CD76-5A71-4D7F-8826-12175DB43E32/d/Visual\ Studio\ Code.app/Contents/Resources/app/bin