From 5965dcbd35ec89837352efc8348408d8865f9c50 Mon Sep 17 00:00:00 2001 From: Josh Reichardt Date: Sun, 1 Dec 2024 19:05:46 -0600 Subject: [PATCH] chore: zshrc cleanup, lots of small tweaks --- .zshrc | 94 +++++++++++++++--------------------------------------- Brewfile | 2 ++ install.sh | 5 ++- 3 files changed, 31 insertions(+), 70 deletions(-) diff --git a/.zshrc b/.zshrc index 1d6ba20..87b4e22 100644 --- a/.zshrc +++ b/.zshrc @@ -59,7 +59,7 @@ plugins=( ) # Load here to be able to source extra plugins and configurations like zsh-autosuggestions and zsh-syntax-highlighting -source $ZSH/oh-my-zsh.sh +source "$ZSH"/oh-my-zsh.sh # Unlimited history HIST_STAMPS="mm/dd/yyyy" @@ -87,40 +87,25 @@ setopt HIST_IGNORE_ALL_DUPS ######### # Misc -# alias cdr=$(git rev-parse --show-toplevel) -alias vimrc="vim ~/.vimrc" -alias zshrc="vim ~/.zshrc" -alias zz="vim ~/.zshrc" -alias v="vim ~/.vimrc" +alias cat="bat --style=plain --paging=never" alias diff="colordiff -u" -alias python="python3" -alias ccat="highlight $1 --out-format xterm256 --force -s moria --no-trailing-nl" alias e="exit" -alias rg="rg --hidden -g '!.git/'" -alias q="chatblade" alias ff="fzf --preview 'bat {} --color=always --style=numbers --theme=1337'" +alias python="python3" +alias q="chatblade" +alias rg="rg --hidden -g '!.git/'" +alias v="vim ~/.vimrc" +alias vimrc="vim ~/.vimrc" +alias zshrc="vim ~/.zshrc" +alias zz="vim ~/.zshrc" # Docker alias d="docker" alias dc="docker-compose" -alias dm="docker-machine" -alias dp="docker ps" -alias di="docker images" # Kubernetes -alias k="kubectl" -alias kw="watch kubectl get pods" -alias kgpa="kgp --all-namespaces" -alias kgpaw="kgp -o wide --all-namespaces" -alias kgn="kubectl get nodes -o wide" -alias kdn="kubectl describe nodes" -alias ktn="kubectl top nodes" -alias ktp="kubectl top pods --all-namespaces" -alias ktpa="k top pods --all-namespaces" alias kctx="kubectx" alias kns="kubens" -alias kdump="kubectl get all --all-namespaces" -alias klft="klf --tail 100" alias ktop="k9s -n all" # Terraform @@ -140,14 +125,6 @@ alias l='eza -lbGF --git' alias la='eza -lbhHigmuSa --time-style=long-iso --git --color-scale' alias lt='eza --tree --level=2' -# Open specific files types automatically -alias -s tf=$EDITOR -alias -s tfvars=$EDITOR -alias -s hcl=$EDITOR -alias -s md=$EDITOR -alias -s markdown=$EDITOR -alias -s txt=$EDITOR - ######### # Exports ######### @@ -191,11 +168,20 @@ export AWS_PAGER="" # export AWS_ASSUME_ROLE_TTL="1h" # export AWS_SESSION_TTL="12h" # healthline default session duration -# Okta -# AWS_OKTA_SESSION_CACHE_SINGLE_ITEM=true +# Krew k8s package manager +export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" + +# Home user bin directory +export PATH="$HOME/bin:$PATH" + +# Bin +export PATH="/usr/local/bin:$PATH" + +# hstr +export HH_CONFIG=keywords,hicolor,rawhistory,noconfirm # Export SSH key so it doesn't need to be passed in every time. -export SSH_KEY_PATH="~/.ssh/id_rsa" +export SSH_KEY_PATH="$HOME/.ssh/id_rsa" # Set the terraform/terragrunt cache in one place export TF_PLUGIN_CACHE_DIR="$HOME/.terragrunt/plugins" @@ -226,43 +212,16 @@ export LC_ALL=en_US.UTF-8 # Zoxide settings export _ZO_FZF_OPTS="--height 40%" -# Compilation flags -#export ARCHFLAGS="-arch x86_64" - -# Owner -#export USER_NAME="YOUR NAME" - ########### # Functions ########### -aws-ssh() { - aws-vault exec $1 -- aws ssm start-session --target $2 -} - -describe-instances() { - aws-vault exec $1 -- aws ec2 describe-instances | jq -r ".Reservations[].Instances[] | [.InstanceId, .NetworkInterfaces[].PrivateIpAddress, (.Tags[]?|select(.Key==\"Name\")|.Value)]" -} - dclean() { - docker rm $(docker ps -aq --filter status=exited) - docker rmi $(docker images -q --filter dangling=true) - docker volume rm $(docker volume ls -qf dangling=true) + docker rm "$(docker ps -aq --filter status=exited)" + docker rmi "$(docker images -q --filter dangling=true)" + docker volume rm "$(docker volume ls -qf dangling=true)" } -####### -# Paths -####### - -# Krew k8s package manager -export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" - -# Home user bin directory -export PATH="$HOME/bin:$PATH" - -# Bin -export PATH="/usr/local/bin:$PATH" - ############# # OS Specific ############# @@ -346,9 +305,6 @@ bindkey \^U backward-kill-line # alias less='less -m -N -g -i -J --underline-special' # alias more='less' -# hstr -export HH_CONFIG=keywords,hicolor,rawhistory,noconfirm - # kubectx/kubens completions fpath=($ZSH/functions $ZSH/completions $fpath) @@ -360,7 +316,7 @@ fpath=($ZSH/functions $ZSH/completions $fpath) setopt complete_aliases # 1password -source $HOME/.config/op/plugins.sh +source "$HOME"/.config/op/plugins.sh # FZF (assume ripgrep is installed) export FZF_DEFAULT_COMMAND='rg --files --hidden -g "!.git/*"' diff --git a/Brewfile b/Brewfile index b33a286..324ce57 100644 --- a/Brewfile +++ b/Brewfile @@ -43,6 +43,7 @@ brew "iann0036/iamlive/iamlive" brew "jesseduffield/lazygit/lazygit" brew "jq" brew "k9s" +brew "kind" brew "kubectl" brew "kubectx" brew "lazydocker" @@ -71,6 +72,7 @@ brew "tflint" brew "tfsort" brew "tgenv" brew "thefuck" +brew "tldr" brew "tree" brew "trivy" brew "steampipe" diff --git a/install.sh b/install.sh index 5999d7a..c65e65a 100755 --- a/install.sh +++ b/install.sh @@ -153,6 +153,7 @@ _macos() { fi echo "Installing tools from Brewfile" brew bundle install + brew bundle install # AWS CLI if ! command -v aws &>/dev/null; then @@ -255,7 +256,9 @@ install() { echo "Sudo password is required for installing rosetta and homebrew" sudo softwareupdate --install-rosetta --agree-to-license PATH=$PATH:/opt/homebrew/bin - NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" + if ! command -v brew &>/dev/null; then + NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" + fi _macos #_nix