From ca968c4e5040f1ff4b5b5e12d9312360d807dcc1 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 3 Jun 2024 19:56:39 +0800 Subject: added submodules, change . -> dot (see man stow --dotfiles) --- dot-oh-my-zsh/plugins/sudo/sudo.plugin.zsh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 dot-oh-my-zsh/plugins/sudo/sudo.plugin.zsh (limited to 'dot-oh-my-zsh/plugins/sudo/sudo.plugin.zsh') diff --git a/dot-oh-my-zsh/plugins/sudo/sudo.plugin.zsh b/dot-oh-my-zsh/plugins/sudo/sudo.plugin.zsh new file mode 100644 index 00000000..0ba8bed5 --- /dev/null +++ b/dot-oh-my-zsh/plugins/sudo/sudo.plugin.zsh @@ -0,0 +1,25 @@ +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# sudo will be inserted before the command +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Dongweiming +# +# ------------------------------------------------------------------------------ + +sudo-command-line() { + [[ -z $BUFFER ]] && zle up-history + if [[ $BUFFER == sudo\ * ]]; then + LBUFFER="${LBUFFER#sudo }" + else + LBUFFER="sudo $LBUFFER" + fi +} +zle -N sudo-command-line +# Defined shortcut keys: [Esc] [Esc] +bindkey "\e\e" sudo-command-line -- cgit v1.2.3