X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/e45b0db3d66ca9e041622db3d801d026fb4d3724..33230b65afa1076218abff057d0bbcc7486af0a8:/.zsh/zshrc/80-zle_add_sudo diff --git a/.zsh/zshrc/80-zle_add_sudo b/.zsh/zshrc/80-zle_add_sudo new file mode 100644 index 0000000..020edf3 --- /dev/null +++ b/.zsh/zshrc/80-zle_add_sudo @@ -0,0 +1,20 @@ +# +# Provide a means to (re-)run the command with sudo +# +# Copyright © 1994–2017 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: http://git.madduck.net/v/etc/zsh.git +# + +function sudo-command-line () { + [[ -z $BUFFER ]] && zle up-history + if [[ $BUFFER != sudo\ * ]]; then + BUFFER="sudo $BUFFER" + CURSOR=$(( CURSOR+5 )) + fi +} +zle -N sudo-command-line +bindkey '^os' sudo-command-line + +# vim:ft=zsh