ohmyzsh/plugins/sudo/sudo.plugin.zsh
lumbric b58b996b40 fix name schema for sudo plugin
Plugin won't load automatically if added to variable $plugins, if name schema different than $name/$name.plugin.zsh is used (see is_plugin() in oh-my-zsh.sh).
2013-12-21 19:49:44 +01:00

23 lines
601 B
Bash

# ------------------------------------------------------------------------------
# Description
# -----------
#
# sudo will be inserted before the command
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Dongweiming <ciici123@gmail.com>
#
# ------------------------------------------------------------------------------
sudo-command-line() {
[[ -z $BUFFER ]] && zle up-history
[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
zle end-of-line
}
zle -N sudo-command-line
# Defined shortcut keys: [Esc] [Esc]
bindkey "\e\e" sudo-command-line