]> git.sev.monster Git - dotfiles.git/commitdiff
zsh: replace some ifs with short ifs
authorsev <git@sev.monster>
Sat, 14 Dec 2024 22:20:06 +0000 (16:20 -0600)
committersev <git@sev.monster>
Sun, 22 Dec 2024 17:38:41 +0000 (11:38 -0600)
etc/zsh/.zprofile
etc/zsh/.zshrc
etc/zsh/functions/Prompts/prompt_arrows_setup

index c66bfb567044654cffa0659689d241e69f43f011..5b5870f14d35d9931557369167f4d638994a4dc6 100644 (file)
@@ -179,11 +179,11 @@ if [[ ! -v _sev_setup_ssh ]] {
         if [[ -f $e ]] {
             IFS=$'\0' read -r sock pid <$e
         }
         if [[ -f $e ]] {
             IFS=$'\0' read -r sock pid <$e
         }
-        if [[ -S $sock && $pid > 0 ]] && kill -0 $pid >/dev/null 2>&1; then
+        if ([[ -S $sock && $pid > 0 ]] && kill -0 $pid >/dev/null 2>&1) {
             [[ -o interactive ]] && print -P "Reusing agent PID $pid%f"
             export SSH_AUTH_SOCK=$sock
             export SSH_AGENT_PID=$pid
             [[ -o interactive ]] && print -P "Reusing agent PID $pid%f"
             export SSH_AUTH_SOCK=$sock
             export SSH_AGENT_PID=$pid
-        else
+        } else {
             # TODO: ensure ssh-agent path looks legit to avoid unsafe eval?
             # XXX: doesn't appear to be any other way to handle redirection.
             #      because eval needs to write to current scope environment
             # TODO: ensure ssh-agent path looks legit to avoid unsafe eval?
             # XXX: doesn't appear to be any other way to handle redirection.
             #      because eval needs to write to current scope environment
@@ -198,7 +198,7 @@ if [[ ! -v _sev_setup_ssh ]] {
             }
             echo -En - $SSH_AUTH_SOCK$'\0'$SSH_AGENT_PID >!$e
             unset c
             }
             echo -En - $SSH_AUTH_SOCK$'\0'$SSH_AGENT_PID >!$e
             unset c
-        fi
+        }
         unset okc e sock pid
     } elif [[ ! -v SSH_AUTH_SOCK && -v commands[gpg] ]] {
         # since gpg should have been started above, just export and notify
         unset okc e sock pid
     } elif [[ ! -v SSH_AUTH_SOCK && -v commands[gpg] ]] {
         # since gpg should have been started above, just export and notify
index 0b72a56cbcb47ac93af4114a4d12479286a22a8a..d2d08705be1feca11f020ba5e723d0ba70fc2a7e 100644 (file)
@@ -143,12 +143,12 @@ if [[ ! -v _sev_force_zkbd && ( -v terminfo || -v termcap ) ]] {
     }
     find_keymap
     if [[ -z $keymap ]] {
     }
     find_keymap
     if [[ -z $keymap ]] {
-        if read -q "?Can't read terminfo. Add new zkbd keymap? [y/N]"; then
+        if (read -q "?Can't read terminfo. Add new zkbd keymap? [y/N]") {
             echo
             autoload -Uz zkbd && zkbd
             unfunction zkbd
             find_keymap
             echo
             autoload -Uz zkbd && zkbd
             unfunction zkbd
             find_keymap
-        fi
+        }
         echo
     }
     if [[ -n $keymap ]] {
         echo
     }
     if [[ -n $keymap ]] {
index 9c59b8fa4131911cdd9cc45426a067892aa07e52..991332dd7df9138c3f036c725e7000fb18909727 100644 (file)
@@ -105,15 +105,15 @@ function prompt_arrows_precmd {
 }
 
 function prompt_arrows_preview {
 }
 
 function prompt_arrows_preview {
-  if (( ! $#* )); then
-    prompt_preview_theme arrows 2line
-    print '\n'
-    prompt_preview_theme arrows right
-    print
-  else
-    prompt_preview_theme arrows "$@"
-    print
-  fi
+    if (( ! $#* )) {
+        prompt_preview_theme arrows 2line
+        print '\n'
+        prompt_preview_theme arrows right
+        print
+    } else {
+        prompt_preview_theme arrows "$@"
+        print
+    }
 }
 
 function +vi-prompt_arrows_revertfix() {
 }
 
 function +vi-prompt_arrows_revertfix() {
This page took 0.045981 seconds and 4 git commands to generate.