diff --git a/zshrc b/zshrc index 3b0cbf1..9b0ec66 100644 --- a/zshrc +++ b/zshrc @@ -49,10 +49,17 @@ else alias lr='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\''' fi -# 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 -# purposes of alias expansion. " +# sudo +## Please consider using "Defaults env_keep+=HOME" configuration in sudoers {{{ +### This is Ubuntu default behaviour. +### This will allow to share user's homedir/dotfiles with root throught sudo commands +## }}} +## Ensure sudo can use aliases (end whitespace) {{{ +### `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. " alias s='sudo ' +## }}} +## sudo aliases {{{ if [ ${USER} != "root" ]; then alias sc='sudo systemctl ' alias sd='sudo docker' @@ -72,6 +79,7 @@ else alias vi='vi -S ~/.vim/vimrc ' alias sv='vi -S ~/.vim/vimrc ' fi +## }}} # Raccourcis pour cat alias ca='cat -n' @@ -405,20 +413,6 @@ alias stat_sys="echo ' ' && uname -a && echo ' '&& uptime &&echo ' '&& df && ech #####FONCTIONS ###################################### -# Sudo -function sudo() { - if [ ${USER} = "root" ]; then - "${@}" - else - if alias "${1}" &> /dev/null ; then - #$(type "$1" | sed -E 's/^.*`(.*).$/\1/') "${@:2}" - command -v "${1}" | \grep -o -P "(?<=\').*(?=')" | xargs sudo -E env "PATH=$PATH" - else - command sudo -E env "PATH=$PATH" "$@" - fi - fi -} - # SSH function clearsshkey() { sed -i "${1}d" ~/.ssh/known_hosts