4 ms·
I have the following in my zshrc for sudo. It adds sudo at the beginning of the current line or writes sudo !! if the current line is empty. I've aliased it to
by gommm 15y ago
I have the following in my zshrc for sudo. It adds sudo at the beginning of the current line or writes sudo !! if the current line is empty. I've aliased it to alt+s
run-with-sudo() {
if [[ -z $LBUFFER ]]; then
LBUFFER="sudo !!";
else
LBUFFER="sudo $LBUFFER";
fi
};
zle -N run-with-sudo;
bindkey '\es' run-with-sudo
- arckiearc 15y agoNice little timesaver for such a common task, I'd just been doing the following (with vi editing on) but yours is much easier: esc-0-i-sudo