From 3a4ff6b5b950b72ce7035d7beeca544c4d4836f7 Mon Sep 17 00:00:00 2001 From: thek4n Date: Thu, 28 Nov 2024 13:58:47 +0300 Subject: [PATCH] zsh feature, if command line empty, on enter show current dir content --- home/user/.config/zsh/mappings | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/home/user/.config/zsh/mappings b/home/user/.config/zsh/mappings index 779fedd..99c7267 100644 --- a/home/user/.config/zsh/mappings +++ b/home/user/.config/zsh/mappings @@ -49,17 +49,6 @@ bindkey '^W' backward-delete-word bindkey -M vicmd '^H' backward-delete-char -listdirquiet() { - echo - ls - echo - zle reset-prompt -} -zle -N listdirquiet -bindkey "^L" listdirquiet -bindkey -M vicmd "^L" listdirquiet - - gitstatusquiet() { echo git status @@ -67,8 +56,8 @@ gitstatusquiet() { zle reset-prompt } zle -N gitstatusquiet -bindkey "^N" gitstatusquiet -bindkey -M vicmd "^N" gitstatusquiet +bindkey "^L" gitstatusquiet +bindkey -M vicmd "^L" gitstatusquiet popdquiet() { @@ -86,4 +75,20 @@ cddotdot() { } zle -N cddotdot bindkey "^O" cddotdot -bindkey -M vicmd "^O" cddotdot \ No newline at end of file +bindkey -M vicmd "^O" cddotdot + + +accept-line-or-list-dir() { + if [ -z "${LBUFFER}${RBUFFER}" ]; then + echo + ls + echo + zle reset-prompt + else + zle .accept-line + fi +} + +zle -N accept-line-or-list-dir +bindkey "^M" accept-line-or-list-dir +bindkey -M vicmd "^M" accept-line-or-list-dir \ No newline at end of file