diff --git a/autoload/promptline/slices.vim b/autoload/promptline/slices.vim index 23f5340..8d393a8 100644 --- a/autoload/promptline/slices.vim +++ b/autoload/promptline/slices.vim @@ -56,6 +56,12 @@ fun! promptline#slices#git_status(...) \'function_body': readfile(globpath(&rtp, "autoload/promptline/slices/git_status.sh"))} endfun +fun! promptline#slices#kubernetes(...) + return { + \'function_name': '__promptline_kubernetes', + \'function_body': readfile(globpath(&rtp, "autoload/promptline/slices/kubernetes.sh"))} +endfun + " internally used to wrap any string, like \w, \h, $(command) with the given colors / separators fun! promptline#slices#wrapper(...) return { @@ -69,3 +75,4 @@ fun! promptline#slices#wrapper(...) \' printf "%s" "${2}${1}${3}"', \'}']} endfun + diff --git a/autoload/promptline/slices/kubernetes.sh b/autoload/promptline/slices/kubernetes.sh new file mode 100755 index 0000000..6c71afa --- /dev/null +++ b/autoload/promptline/slices/kubernetes.sh @@ -0,0 +1,5 @@ +function __promptline_kubernetes { + if [ -x "$(command -v kubectl)" ]; then + printf "⎈ %s" "$(kubectl config current-context)" + fi +}