plugin-sudope icon indicating copy to clipboard operation
plugin-sudope copied to clipboard

ToggleMode

Open pykong opened this issue 6 years ago • 3 comments

I find that often times the next command after a sudo command also requires sudo privileges. A classic example for a sequence of sudoed commands is: adding a new repo to apt-get, update the cache and finally install a package:

sudo add-apt-repository "deb http://some/repo"
sudo apt-get update
sudo apt-get install my_awesome_package

Every line of command prefixed with sudo takes five additional chars of input. Maybe someone can relate that this can be a point of annoyance. It is a pebble in the shoe which may go unnoticed when one is just taking a walk around the block, but will be a real pain when you want to go for a marathon.

Hence, whenever a sequence of sudo commands is to be executed a toggle mode would be a real advantage.

Such mode would when activated prefix any prompt with sudo until deactivated. It would upon being activated also prefix the current line with sudo if not present and respectively remove sudo upon deactivation if present.

As an addition: This may be well beyond the scope of this plugin. But maybe a visual marker for sudo mode could be added. This may prevent a possible reduction of awareness of operating in sudo mode caused by the automatic prefixing. A visual marker could be in the simplest case a particular highlighting of the keyword sudo or even a change in background color.

Please consider adding such mode.

EDITED AND EXPANDED

pykong avatar Mar 24 '18 13:03 pykong

That's a nice idea. I will explore what it takes to make this work and if it's not to crazy, why not.

oranja avatar May 01 '18 16:05 oranja

Nice idea

BarbzYHOOL avatar Jun 09 '18 13:06 BarbzYHOOL

@oranja @BarbzYHOOL I am grateful for your positive resonance. I am under the impression fish folks have something for sane usability.

pykong avatar Jun 10 '18 00:06 pykong