zsh feature, if command line empty, on enter show current dir content

This commit is contained in:
thek4n 2024-11-28 13:58:47 +03:00
parent fc232c4f80
commit 3a4ff6b5b9

View File

@ -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
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