From 2d18fe1da0ca30fca5d6d2a6724e2ce84fb5c8e9 Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Mon, 21 Oct 2019 22:53:35 +0100 Subject: [PATCH 1/2] Add kubernetes section --- autoload/promptline/slices.vim | 7 +++++++ autoload/promptline/slices/kubernetes.sh | 5 +++++ 2 files changed, 12 insertions(+) create mode 100755 autoload/promptline/slices/kubernetes.sh 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..629acc4 --- /dev/null +++ b/autoload/promptline/slices/kubernetes.sh @@ -0,0 +1,5 @@ +function __promptline_kubernetes { + if [ -x "$(command -v kubectl)" ]; then + printf "\u2388 %s" "$(kubectl config current-context)" + fi +} From 731a1c9164aca35755cb67e05fab1f87563e625d Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Thu, 24 Oct 2019 21:04:26 +0100 Subject: [PATCH 2/2] Use emoji instead of unicode sequence --- autoload/promptline/slices/kubernetes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/promptline/slices/kubernetes.sh b/autoload/promptline/slices/kubernetes.sh index 629acc4..6c71afa 100755 --- a/autoload/promptline/slices/kubernetes.sh +++ b/autoload/promptline/slices/kubernetes.sh @@ -1,5 +1,5 @@ function __promptline_kubernetes { if [ -x "$(command -v kubectl)" ]; then - printf "\u2388 %s" "$(kubectl config current-context)" + printf "⎈ %s" "$(kubectl config current-context)" fi }