From a7b975ae71de7695bd53a57783a96523a3b15172 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Tue, 17 Jan 2023 00:33:19 +0100 Subject: [PATCH] zsh:keys:cmd-on-enter: Check PREBUFFER as well When typing a multi-line input (e.g. `echo foo\`) BUFFER can be empty, even though the entire input is not. Fix this by checking if PREBUFFER and BUFFER are empty. --- .config/zsh/zshrc.d/60-keys.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/zsh/zshrc.d/60-keys.zsh b/.config/zsh/zshrc.d/60-keys.zsh index dfda9ca..83faa65 100644 --- a/.config/zsh/zshrc.d/60-keys.zsh +++ b/.config/zsh/zshrc.d/60-keys.zsh @@ -177,7 +177,7 @@ bindkey '^[[46;5u' default_dot CMDS_ON_ENTER=(ll gs) REQUIREMENTS_CMDS_ON_ENTER=(true "git rev-parse") function cmd-on-enter { - if [[ -z $BUFFER ]]; then + if [[ -z "${PREBUFFER}${BUFFER}" ]]; then # Overwrite BUFFER and default to ll BUFFER=" ${CMDS_ON_ENTER[${cmd_on_enter_idx:=1}]}"