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