config/shell/functions: support emacstty path in edshell
This commit is contained in:
parent
8c2c5c49ca
commit
0ee45d5f6e
|
@ -64,7 +64,7 @@ xtrace() {
|
||||||
|
|
||||||
# Shows source code for command, resolving nested aliases
|
# Shows source code for command, resolving nested aliases
|
||||||
wh() {
|
wh() {
|
||||||
res=$(which "$@")
|
res=$(which "$@") || return $?
|
||||||
if expr "$res" : "${@:$#}: aliased to" >/dev/null && ! expr "$res" : ".*builtin" >/dev/null
|
if expr "$res" : "${@:$#}: aliased to" >/dev/null && ! expr "$res" : ".*builtin" >/dev/null
|
||||||
then echo "$res" | bat --style=plain --language=sh &&
|
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)"
|
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")";;
|
(*) file="$(find $CONFIG_SHELLS -name "$1*" | head -1 | grep . || echo "$CONFIG_SHELLS/$1")";;
|
||||||
esac
|
esac
|
||||||
test -f "$file" && checksum="$(md5sum "$file")"
|
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 -s "$file" || return 1
|
||||||
test "$checksum" != "$(md5sum $file)" && rs
|
test "$checksum" != "$(md5sum $file)" && rs
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue