Created
July 26, 2017 14:28
-
-
Save superbrothers/701f88472520fe3b6a3924ebeb1e18e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function peco-kubectl-context() { | |
| local selected_context=$(kubectl config view -o go-template --template='{{range .contexts}}{{.name}}{{"\n"}}{{end}}' | peco --query "$LBUFFER") | |
| if [ -n "$selected_context" ]; then | |
| BUFFER="kubectl config use-context $selected_context" | |
| zle accept-line | |
| fi | |
| zle clear-screen | |
| } | |
| zle -N peco-kubectl-context | |
| bindkey '^K' peco-kubectl-context |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment