From 8b3617318822a14dc5c18454a46e32831be7962c Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Wed, 10 Jul 2024 13:41:46 +0200 Subject: [PATCH] zsh: test file before editing in whed() --- .config/zsh/configs/1-functions | 4 ++++ .config/zsh/configs/aliases | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.config/zsh/configs/1-functions b/.config/zsh/configs/1-functions index 8a8217794..e18586938 100644 --- a/.config/zsh/configs/1-functions +++ b/.config/zsh/configs/1-functions @@ -82,3 +82,7 @@ function togglefg () { zle accept-line -w } zle -N togglefg + +function whed() { + [ -e "$1" ] && $EDITOR $(which "$1") +} diff --git a/.config/zsh/configs/aliases b/.config/zsh/configs/aliases index a108f7fbb..422f46443 100644 --- a/.config/zsh/configs/aliases +++ b/.config/zsh/configs/aliases @@ -41,7 +41,6 @@ alias \ # Quasi functions alias \ xgetkeys="xev | sed -ne '/^KeyPress/,/^$/p'" \ - whed='() { $EDITOR $(which "$1") }' \ xpick="xprop | awk ' /^WM_CLASS/{sub(/.* =/, \"instance:\"); sub(/,/, \"\nclass:\"); print} /^WM_NAME/{sub(/.* =/, \"title:\"); print}'"