summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2022-10-17 11:39:36 +0200
committerAlan Pearce2022-10-17 11:39:36 +0200
commit10731104d210e82a20d337eeebc636d9fe59456f (patch)
treec3ed567e9bb3a2d144fcc632a51f4e6a65dc5d66
parent5cf09238e543ef0c153d9a0dbe639b049090a12c (diff)
downloadnixfiles-10731104d210e82a20d337eeebc636d9fe59456f.tar.lz
nixfiles-10731104d210e82a20d337eeebc636d9fe59456f.tar.zst
nixfiles-10731104d210e82a20d337eeebc636d9fe59456f.zip
Reformat zsh files
-rw-r--r--user/zsh/zshrc57
-rw-r--r--user/zsh/zshrc.darwin44
2 files changed, 48 insertions, 53 deletions
diff --git a/user/zsh/zshrc b/user/zsh/zshrc
index c63dace2..d843ce2f 100644
--- a/user/zsh/zshrc
+++ b/user/zsh/zshrc
@@ -56,13 +56,13 @@ ds () {
   du -hd1 "$@" | $sort -h
 }
 zle-upify() {
-    buf="$(echo "$BUFFER" | sed 's/[ |]*$//')"
-    tmp="$(mktemp)"
-    eval "$buf |& up -o '$tmp' 2>/dev/null"
-    cmd="$(tail -n +2 "$tmp")"
-    rm -f "$tmp"
-    BUFFER="$BUFFER | $cmd"
-    zle end-of-line
+  buf="$(echo "$BUFFER" | sed 's/[ |]*$//')"
+  tmp="$(mktemp)"
+  eval "$buf |& up -o '$tmp' 2>/dev/null"
+  cmd="$(tail -n +2 "$tmp")"
+  rm -f "$tmp"
+  BUFFER="$BUFFER | $cmd"
+  zle end-of-line
 }
 zle -N zle-upify
 
@@ -100,34 +100,31 @@ else
   AGKOZAK_PROMPT_DIRTRIM=0
   AGKOZAK_LEFT_PROMPT_ONLY=${+SSH_CLIENT}
 
-  if [[ -z $SSH_CLIENT ]]
-  then
-    check_kubectl_context () {
-      if [[ "$PWD" =~ satoshipay ]]
+  check_kubectl_context () {
+    if [[ "$PWD" =~ satoshipay ]]
+    then
+      kubectl_context=$(kubectl config current-context)
+      kubectl_namespace=$(kubectl config view -o jsonpath="{.contexts[?(@.name==\"${kubectl_context}\")].context.namespace}")
+      if [[ $kubectl_context =~ production ]]
       then
-        kubectl_context=$(kubectl config current-context)
-        kubectl_namespace=$(kubectl config view -o jsonpath="{.contexts[?(@.name==\"${kubectl_context}\")].context.namespace}")
-        if [[ $kubectl_context =~ production ]]
+        kubectl_colour=red
+        kubectl_release=satoshipay-${kubectl_namespace}
+      else
+        kubectl_colour=yellow
+        if [[ -z $mr ]]
         then
-          kubectl_colour=red
-          kubectl_release=satoshipay-${kubectl_namespace}
+          kubectl_release=satoshipay-${kubectl_namespace}-staging
         else
-          kubectl_colour=yellow
-          if [[ -z $mr ]]
-          then
-            kubectl_release=satoshipay-${kubectl_namespace}-staging
-          else
-            kubectl_release=story-${mr}-${kubectl_namespace}
-          fi
+          kubectl_release=story-${mr}-${kubectl_namespace}
         fi
-        prompt_context="%F{$kubectl_colour}[${kubectl_context}:${kubectl_namespace}]%f"
-      else
-        prompt_context=
       fi
-    }
-    precmd_functions+=(check_kubectl_context)
-    AGKOZAK_CUSTOM_RPROMPT='${prompt_context}%(3V.%F{${AGKOZAK_COLORS_BRANCH_STATUS}%3v%f.)'
-  fi
+      prompt_context="%F{$kubectl_colour}[${kubectl_context}:${kubectl_namespace}]%f"
+    else
+      prompt_context=
+    fi
+  }
+  precmd_functions+=(check_kubectl_context)
+  AGKOZAK_CUSTOM_RPROMPT='${prompt_context}%(3V.%F{${AGKOZAK_COLORS_BRANCH_STATUS}%3v%f.)'
 fi
 
 export FZF_CTRL_T_COMMAND='(fd --hidden --follow --exclude ".git" .) 2> /dev/null'
diff --git a/user/zsh/zshrc.darwin b/user/zsh/zshrc.darwin
index 1b702022..1b4ecc9b 100644
--- a/user/zsh/zshrc.darwin
+++ b/user/zsh/zshrc.darwin
@@ -1,26 +1,24 @@
-set_title () {
-  print -Pn "\e]0;$1\7\n"
+# -*- mode: sh; -*-
+set_title() {
+	print -Pn "\e]0;$1\7\n"
 }
-ssh () {
-  local arg server retval
-  for arg
-  do
-    if [[ "${arg#-}" == "$arg" ]]
-    then
-      server=$arg
-      break
-    fi
-  done
-  set_title "file://${server}/"
-  command ssh "$@"
-  retval=$?
-  set_title
-  return $retval
+ssh() {
+	local arg server retval
+	for arg; do
+		if [[ "${arg#-}" == "$arg" ]]; then
+			server=$arg
+			break
+		fi
+	done
+	set_title "file://${server}/"
+	command ssh "$@"
+	retval=$?
+	set_title
+	return $retval
 }
-mosh () {
-  command mosh "$@"
-  retval=$?
-  set_title
-  return $retval
+mosh() {
+	command mosh "$@"
+	retval=$?
+	set_title
+	return $retval
 }
-