Its not essential but it bugs me a bit, here is the fragment from my .zshrc
a function/widget called add_sudo, that will go at the beginning of line, writes sudo there and then should go at the end of the line.
Its bind to ctrl+f
But it does not go at the end of the line, it ignores last command and sits there after it wrote sudo.
add_sudo() {
zle beginning-of-line;
zle -U "sudo ";
zle end-of-line;
}
zle -N add_sudo
bindkey "^f" add_sudo
any solution to this?
$BUFFER
directly (i.e.,BUFFER="sudo $BUFFER"
), then move$CURSOR
(i.e.,(( CURSOR += 5 ))
). Pushing into the input stack is, as you see, totally unintuitive. – Nonproductive