Invert s and sudo to be able to use autocompletion with both.

This commit is contained in:
Jeremy Gardais 2017-12-12 09:07:14 +01:00
parent 323437c2c9
commit dcd19eeb42
1 changed files with 2 additions and 2 deletions

4
zshrc
View File

@ -52,7 +52,7 @@ fi
# Faire en sorte que sudo puisse également utiliser les alias! (c'est l'espace qui fait toute la différence) # Faire en sorte que sudo puisse également utiliser les alias! (c'est l'espace qui fait toute la différence)
# `man zshall` partie Aliasing: "If the text ends with a space, the next word in the shell input is treated as though it were in command position for # `man zshall` partie Aliasing: "If the text ends with a space, the next word in the shell input is treated as though it were in command position for
# purposes of alias expansion. " # purposes of alias expansion. "
alias sudo='sudo ' alias s='sudo '
if [ ${USER} != "root" ]; then if [ ${USER} != "root" ]; then
alias sc='sudo systemctl ' alias sc='sudo systemctl '
alias sd='sudo docker' alias sd='sudo docker'
@ -359,7 +359,7 @@ alias stat_sys="echo ' ' && uname -a && echo ' '&& uptime &&echo ' '&& df && ech
###################################### ######################################
# Sudo # Sudo
function s() { function sudo() {
if alias "${1}" &> /dev/null ; then if alias "${1}" &> /dev/null ; then
#$(type "$1" | sed -E 's/^.*`(.*).$/\1/') "${@:2}" #$(type "$1" | sed -E 's/^.*`(.*).$/\1/') "${@:2}"
command -v "${1}" | \grep -o -P "(?<=\').*(?=')" | xargs sudo -E env "PATH=$PATH" command -v "${1}" | \grep -o -P "(?<=\').*(?=')" | xargs sudo -E env "PATH=$PATH"