zsh refactor

This commit is contained in:
thek4n 2024-11-28 14:16:10 +03:00
parent 3a4ff6b5b9
commit 639c7a456d

View File

@ -29,7 +29,12 @@ insert-sudo() {
if [ -z "${LBUFFER}${RBUFFER}" ]; then
zle up-history
if [ ! "${LBUFFER::$template_len}" = "$sudo_template" ]; then
LBUFFER="${sudo_template}${LBUFFER}"
fi
return
fi
if [ "${LBUFFER::$template_len}" = "$sudo_template" ]; then
LBUFFER="${LBUFFER:$template_len}"
else
@ -79,14 +84,15 @@ bindkey -M vicmd "^O" cddotdot
accept-line-or-list-dir() {
if [ -z "${LBUFFER}${RBUFFER}" ]; then
echo
ls
echo
zle reset-prompt
else
if [ -n "${LBUFFER}${RBUFFER}" ]; then
zle .accept-line
return
fi
echo
ls
echo
zle reset-prompt
}
zle -N accept-line-or-list-dir