News for hackers. Stuff that matters.
Re:Bash Shortcuts For Maximum Productivity by gommm on Sunday September 11, 2011 @04:35AM (#2983482)
I have the following in my zshrc for sudo. It adds sudo at the beginning of the current line or writes sudo !! if the current line is empty. I've aliased it to alt+s

    run-with-sudo() {
      if [[ -z $LBUFFER ]]; then
        LBUFFER="sudo !!";
      else
        LBUFFER="sudo $LBUFFER";
      fi
    };
    zle -N run-with-sudo;
    bindkey '\es' run-with-sudo
Re:Bash Shortcuts For Maximum Productivity by arckiearc on Sunday September 11, 2011 @08:20AM (#2983668)
Nice little timesaver for such a common task, I'd just been doing the following (with vi editing on) but yours is much easier:

  esc-0-i-sudo
Re:Bash Shortcuts For Maximum Productivity by woogley on Sunday September 11, 2011 @08:57AM (#2983714)
It may not be less keystrokes, but for what it's worth, I find using shift+i is easier than 0-i
Re:Bash Shortcuts For Maximum Productivity by arckiearc on Sunday September 11, 2011 @07:36PM (#2985201)
Didn't know about that one, thanks!