Skip to content

Commit

Permalink
chore: zshrc cleanup, lots of small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jmreicha committed Dec 2, 2024
1 parent de736ca commit 5965dcb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 70 deletions.
94 changes: 25 additions & 69 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
#########
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
#############
Expand Down Expand Up @@ -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)

Expand All @@ -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/*"'
Expand Down
2 changes: 2 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ brew "iann0036/iamlive/iamlive"
brew "jesseduffield/lazygit/lazygit"
brew "jq"
brew "k9s"
brew "kind"
brew "kubectl"
brew "kubectx"
brew "lazydocker"
Expand Down Expand Up @@ -71,6 +72,7 @@ brew "tflint"
brew "tfsort"
brew "tgenv"
brew "thefuck"
brew "tldr"
brew "tree"
brew "trivy"
brew "steampipe"
Expand Down
5 changes: 4 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 5965dcb

Please sign in to comment.