aboutsummaryrefslogtreecommitdiff
path: root/.oh-my-zsh/plugins/sudo
diff options
context:
space:
mode:
Diffstat (limited to '.oh-my-zsh/plugins/sudo')
-rw-r--r--.oh-my-zsh/plugins/sudo/README.md57
-rw-r--r--.oh-my-zsh/plugins/sudo/sudo.plugin.zsh31
2 files changed, 0 insertions, 88 deletions
diff --git a/.oh-my-zsh/plugins/sudo/README.md b/.oh-my-zsh/plugins/sudo/README.md
deleted file mode 100644
index ebfdfd1..0000000
--- a/.oh-my-zsh/plugins/sudo/README.md
+++ /dev/null
@@ -1,57 +0,0 @@
-# sudo
-
-Easily prefix your current or previous commands with `sudo` by pressing <kbd>esc</kbd> twice
-
-## Enabling the plugin
-
-1. Open your `.zshrc` file and add `sudo` in the plugins section:
-
- ```zsh
- plugins=(
- # all your enabled plugins
- sudo
- )
- ```
-
-2. Reload the source file or restart your Terminal session:
-
- ```console
- $ source ~/.zshrc
- $
- ```
-
-## Usage examples
-
-### Current typed commands
-
-Say you have typed a long command and forgot to add `sudo` in front:
-
-```console
-$ apt-get install build-essential
-```
-
-By pressing the <kbd>esc</kbd> key twice, you will have the same command with `sudo` prefixed without typing:
-
-```console
-$ sudo apt-get install build-essential
-```
-
-### Previous executed commands
-
-Say you want to delete a system file and denied:
-
-```console
-$ rm some-system-file.txt
--su: some-system-file.txt: Permission denied
-$
-```
-
-By pressing the <kbd>esc</kbd> key twice, you will have the same command with `sudo` prefixed without typing:
-
-```console
-$ rm some-system-file.txt
--su: some-system-file.txt: Permission denied
-$ sudo rm some-system-file.txt
-Password:
-$
-```
diff --git a/.oh-my-zsh/plugins/sudo/sudo.plugin.zsh b/.oh-my-zsh/plugins/sudo/sudo.plugin.zsh
deleted file mode 100644
index 0b84382..0000000
--- a/.oh-my-zsh/plugins/sudo/sudo.plugin.zsh
+++ /dev/null
@@ -1,31 +0,0 @@
-# ------------------------------------------------------------------------------
-# Description
-# -----------
-#
-# sudo or sudoedit 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 }"
- elif [[ $BUFFER == $EDITOR\ * ]]; then
- LBUFFER="${LBUFFER#$EDITOR }"
- LBUFFER="sudoedit $LBUFFER"
- elif [[ $BUFFER == sudoedit\ * ]]; then
- LBUFFER="${LBUFFER#sudoedit }"
- LBUFFER="$EDITOR $LBUFFER"
- else
- LBUFFER="sudo $LBUFFER"
- fi
-}
-zle -N sudo-command-line
-# Defined shortcut keys: [Esc] [Esc]
-bindkey "\e\e" sudo-command-line