.dotfiles/.config/zsh/custom/plugins/doas
2021-01-31 14:42:35 +01:00
..
doas.plugin.zsh Add doas config stuff 2021-01-31 14:42:35 +01:00
README.md Add doas config stuff 2021-01-31 14:42:35 +01:00

doas-zsh-plugin

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

To use it, add the following to your zshrc:

plugins=(doas)

Usage

Current typed commands

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

$ apt-get install build-essential

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

$ doas apt-get install build-essential

Previous executed commands

Say you want to delete a system file and denied:

$ 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:

$ 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