From 158a1c757dc554468b8238db584b29e0fa2e986a Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Fri, 31 Jul 2020 16:38:38 +0200 Subject: [PATCH] Execute ls when enter is pressed with empty buffer --- .config/zsh/plugins/keys.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.config/zsh/plugins/keys.zsh b/.config/zsh/plugins/keys.zsh index 00ed1f8..737a9f0 100644 --- a/.config/zsh/plugins/keys.zsh +++ b/.config/zsh/plugins/keys.zsh @@ -74,3 +74,17 @@ function _expandDots { zle -N _expandDots bindkey . _expandDots +function ls-on-enter { + if [ -z "$BUFFER" ]; then + echo "ls" + ls + echo "\n" + zle redisplay + else + zle accept-line + fi +} +zle -N ls-on-enter +bindkey "^M" ls-on-enter +ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(ls-on-enter) +