Skip to content

Instantly share code, notes, and snippets.

@dineshba
Created March 23, 2019 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dineshba/019fade746dbdae20b3d27a1b0792a06 to your computer and use it in GitHub Desktop.
Save dineshba/019fade746dbdae20b3d27a1b0792a06 to your computer and use it in GitHub Desktop.
### custom shell prompt ###
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1='\[\e[31;47m\]$(kubectl config current-context)\[\e[m\]\[\e[36;47m\]$(kubectl config view --minify --output 'jsonpath={..namespace}')\[\e[m\]\w\[\033[32m\]$(parse_git_branch)\[\033[00m\] \$ '
### cd dir interactively ###
alias godir='cd $(find ~/projects -type d -maxdepth 2 | fzf)'
### load tmux session interactively ###
alias ktx='tmuxp load $(ls ~/.tmuxp/*.yaml | rg ".*/.tmuxp/" -r "" | rg "\.yaml" -r "" | fzf) --yes'
### kill tmux session interactively ###
alias tkill="for s in \$(tmux list-sessions | awk '{print \$1}' | rg ':' -r '' | fzf -m); do tmux kill-session -t \$s; done;"
### list git objects and its type ###
alias list_objects='for a in $(find .git/objects -type f -depth 2 | rg -v "pack|info" | rg ".git/objects/|/" -r ""); do echo -n $a; echo -n " "; echo $(git cat-file -t $a); done;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment