441595d036cb88555793806cd2a77744dc849de3

Author
Griko Nibras <grikomsn@gmail.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

sudo: add README file (#7177)

Diff

 1diff --git a/plugins/sudo/README.md b/plugins/sudo/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..ebfdfd10d50b8108b8394bdb548cd23a942b98fb
 4--- /dev/null
 5+++ b/plugins/sudo/README.md
 6@@ -0,0 +1,57 @@
 7+# sudo
 8+
 9+Easily prefix your current or previous commands with `sudo` by pressing <kbd>esc</kbd> twice
10+
11+## Enabling the plugin
12+
13+1.  Open your `.zshrc` file and add `sudo` in the plugins section:
14+
15+    ```zsh
16+    plugins=(
17+        # all your enabled plugins
18+        sudo
19+    )
20+    ```
21+
22+2.  Reload the source file or restart your Terminal session:
23+
24+    ```console
25+    $ source ~/.zshrc
26+    $
27+    ```
28+
29+## Usage examples
30+
31+### Current typed commands
32+
33+Say you have typed a long command and forgot to add `sudo` in front:
34+
35+```console
36+$ apt-get install build-essential
37+```
38+
39+By pressing the <kbd>esc</kbd> key twice, you will have the same command with `sudo` prefixed without typing:
40+
41+```console
42+$ sudo apt-get install build-essential
43+```
44+
45+### Previous executed commands
46+
47+Say you want to delete a system file and denied:
48+
49+```console
50+$ rm some-system-file.txt
51+-su: some-system-file.txt: Permission denied
52+$
53+```
54+
55+By pressing the <kbd>esc</kbd> key twice, you will have the same command with `sudo` prefixed without typing:
56+
57+```console
58+$ rm some-system-file.txt
59+-su: some-system-file.txt: Permission denied
60+$ sudo rm some-system-file.txt
61+Password:
62+$
63+```