From 0ee45d5f6e7db16c3cbfecd463452de6749b97de Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 27 Jun 2022 13:01:19 +0200 Subject: [PATCH] config/shell/functions: support emacstty path in edshell --- .config/shell/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index 33776f2..859fa31 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -64,7 +64,7 @@ xtrace() { # Shows source code for command, resolving nested aliases wh() { - res=$(which "$@") + res=$(which "$@") || return $? if expr "$res" : "${@:$#}: aliased to" >/dev/null && ! expr "$res" : ".*builtin" >/dev/null then echo "$res" | bat --style=plain --language=sh && tool="$(echo "$res" | head -1 | cut -d' ' -f$(expr 5 '&' "$res" : ".*to \(sudo\|noglob\) " '|' 4) | cut -d'(' -f2)" @@ -105,7 +105,7 @@ edshell() { (*) file="$(find $CONFIG_SHELLS -name "$1*" | head -1 | grep . || echo "$CONFIG_SHELLS/$1")";; esac test -f "$file" && checksum="$(md5sum "$file")" - $EDITOR "$(test "$line" && case "$EDITOR" in (nvim) echo "+normal! ${line}ggzx";; (*vi*) echo "+$line";; (emacs*) echo "+${line}";; esac || echo "--")" "${file%:*}" + $EDITOR "$(test "$line" && case "$EDITOR" in (nvim) echo "+normal! ${line}ggzx";; (*vi*) echo "+$line";; (emacs*|*/emacs*) echo "+${line}";; esac || echo "--")" "${file%:*}" test -s "$file" || return 1 test "$checksum" != "$(md5sum $file)" && rs }