diff options
author | Kozlov Alexander <badryke@gmail.com> | 2018-11-16 13:38:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-16 13:38:43 +0300 |
commit | 8c95c52353118643ac3dbd9b0c185a3129b84bf8 (patch) | |
tree | ee7497251b7a541480ae5c6a97b63b14381ed5ee /plugins/sudo | |
parent | dd30cf104c9ca42d89d26a134382ca421869ce7e (diff) | |
parent | 3d8f2bda599c8c6d160dc448e5ab28aaf2d5e90d (diff) | |
download | zsh-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.md | 57 |
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: +$ +``` |