News for hackers. Stuff that matters.
Re:Sudo Replacement by arp242 on Saturday January 21, 2023 @12:21PM (#34468021)
I mapped ^S in zsh to toggle "doas" at the start of the line:

  # Toggle "doas" at the start.
  toggle-doas() {
      [[ "${BUFFER:0:4}" = "doas" ]] &&
          {CURSOR+=-5; BUFFER="${BUFFER:5}";} ||
          {BUFFER="doas $BUFFER"; CURSOR+=5;}
  }
  zle -N toggle-doas toggle-doas && bindkey '^s' toggle-doas
Even less typing!

There are no comments on this comment yet.