Hacker Timesnew | past | comments | ask | show | jobs | submitlogin



Wonderful!

I made a slight variation (and also posted it there):

      function .runsudo --description 'Run current command line as root'
        set cursor_pos (echo (commandline -C) + 5 | bc)
        commandline -C 0
        commandline -i 'sudo '
        commandline -C "$cursor_pos"
      end
      bind \es ".runsudo"
Instead of outright `execute`ing the command, the above would save the cursor position. You can (theoretically) bind `\cs` so control-s adds the sudo (instead of option-s), but I couldn't get it to work.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: