Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/anatolykopyl/doas-zsh-plugin

Binds double escape to add doas before the command
https://github.com/anatolykopyl/doas-zsh-plugin

doas doas-zsh-plugin oh-my-zsh oh-my-zsh-plugin zsh zsh-plugin

Last synced: about 1 month ago
JSON representation

Binds double escape to add doas before the command

Awesome Lists containing this project

README

        

# doas-zsh-plugin

Easily prefix your current or previous commands with `doas` by pressing esc twice

To use it, run the following command:

```console
$ git clone https://github.com/anatolykopyl/doas-zsh-plugin.git $HOME/.oh-my-zsh/custom/plugins/doas
```

## Usage

### Current typed commands

Say you have typed a long command and forgot to add `doas` in front:

```console
$ apt-get install build-essential
```

By pressing the esc key twice, you will have the same command with `doas` prefixed without typing:

```console
$ doas 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 esc key twice, you will have the same command with `doas` prefixed without typing:

```console
$ rm some-system-file.txt
-su: some-system-file.txt: Permission denied
$ doas rm some-system-file.txt
Password:
$
```

Plugin inspired by sudo plugin by [Dongweiming](https://github.com/dongweiming)