diff options
author | Marvin Borner | 2020-03-16 23:33:42 +0100 |
---|---|---|
committer | Marvin Borner | 2020-03-16 23:33:42 +0100 |
commit | 0e9ddbb0bf0cd34500155ea4b03de2e2a38d8ab2 (patch) | |
tree | 719da1c7fe5dabb872fe9ff1582c39b55ccd488e /.oh-my-zsh/plugins/sudo | |
parent | e5d38956336ab1be954bdbd12808c5f98f8bd925 (diff) |
Well I'm using Arch again
Diffstat (limited to '.oh-my-zsh/plugins/sudo')
-rw-r--r-- | .oh-my-zsh/plugins/sudo/README.md | 57 | ||||
-rw-r--r-- | .oh-my-zsh/plugins/sudo/sudo.plugin.zsh | 31 |
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 |