#
# Zle config
#

# autoescape specials chars with urls
autoload -U url-quote-magic
zle -N self-insert url-quote-magic

# insert sudo at beggining of current command
insert-sudo-prefix () {
    local prefix
    prefix='sudo'
    if [ "${BUFFER:0:${#prefix}}" != "$prefix" ]; then
        BUFFER="$prefix $BUFFER"
        CURSOR=$(($CURSOR + $#prefix + 1))
    fi
}
zle -N insert-sudo-prefix
bindkey "^b" insert-sudo-prefix
