mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-27 08:48:56 +01:00
b58b996b40
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).
23 lines
601 B
Bash
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
|