summaryrefslogtreecommitdiff
path: root/plugins/sudo
diff options
context:
space:
mode:
authorKozlov Alexander <badryke@gmail.com>2018-11-16 13:38:43 +0300
committerGitHub <noreply@github.com>2018-11-16 13:38:43 +0300
commit8c95c52353118643ac3dbd9b0c185a3129b84bf8 (patch)
treeee7497251b7a541480ae5c6a97b63b14381ed5ee /plugins/sudo
parentdd30cf104c9ca42d89d26a134382ca421869ce7e (diff)
parent3d8f2bda599c8c6d160dc448e5ab28aaf2d5e90d (diff)
downloadzsh-8c95c52353118643ac3dbd9b0c185a3129b84bf8.tar.gz
zsh-8c95c52353118643ac3dbd9b0c185a3129b84bf8.tar.bz2
zsh-8c95c52353118643ac3dbd9b0c185a3129b84bf8.zip
Merge branch 'master' into master
Diffstat (limited to 'plugins/sudo')
-rw-r--r--plugins/sudo/README.md57
1 files changed, 57 insertions, 0 deletions
diff --git a/plugins/sudo/README.md b/plugins/sudo/README.md
new file mode 100644
index 000000000..ebfdfd10d
--- /dev/null
+++ b/plugins/sudo/README.md
@@ -0,0 +1,57 @@
+# 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:
+$
+```