diff options
| author | 2020-02-14 19:11:04 -0500 | |
|---|---|---|
| committer | 2020-02-14 19:11:04 -0500 | |
| commit | 858a4a31a251d0eab21dffb96776aca007dafb07 (patch) | |
| tree | 54d0b73cab4eb4bc6c023ad4a75a5de0e724ed1f /plugins/sudo | |
Squashed 'dot_local/share/toasty/' content from commit aee4da7
git-subtree-dir: dot_local/share/toasty
git-subtree-split: aee4da752bdb07b0524bb8803ead46d4093fa57f
Diffstat (limited to 'plugins/sudo')
| -rw-r--r-- | plugins/sudo | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/sudo b/plugins/sudo new file mode 100644 index 0000000..0ba8bed --- /dev/null +++ b/plugins/sudo @@ -0,0 +1,25 @@ +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# sudo will be inserted before the command +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Dongweiming <ciici123@gmail.com> +# +# ------------------------------------------------------------------------------ + +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 |
