mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
feat(sudo): respect $SUDO_EDITOR and $VISUAL, switch to sudo -e (#10596)
This commit is contained in:
parent
4f2d8b4d4c
commit
540b2200af
2 changed files with 26 additions and 5 deletions
|
|
@ -24,6 +24,20 @@ By pressing the <kbd>esc</kbd> key twice, you will have the same command with `s
|
|||
$ sudo apt-get install build-essential
|
||||
```
|
||||
|
||||
The same happens for editing files with your default editor (defined in `$SUDO_EDITOR`, `$VISUAL` or `$EDITOR`, in that order):
|
||||
|
||||
If the editor defined were `vim`:
|
||||
|
||||
```console
|
||||
$ vim /etc/hosts
|
||||
```
|
||||
|
||||
By pressing the <kbd>esc</kbd> key twice, you will have the same command with `sudo -e` instead of the editor, that would open that editor with root privileges:
|
||||
|
||||
```console
|
||||
$ sudo -e /etc/hosts
|
||||
```
|
||||
|
||||
### Previous executed commands
|
||||
|
||||
Say you want to delete a system file and denied:
|
||||
|
|
@ -44,6 +58,8 @@ Password:
|
|||
$
|
||||
```
|
||||
|
||||
The same happens for file editing, as told before.
|
||||
|
||||
## Key binding
|
||||
|
||||
By default, the `sudo` plugin uses <kbd>Esc</kbd><kbd>Esc</kbd> as the trigger.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue