nu: Add sudo toggling key
Toggle sudo prefix for command line with <alt-s>. Not sure if I will keep this binding in the long run but it is a good example of command execution using nushell through a key binding. From: https://github.com/nushell/nushell/discussions/16043
This commit is contained in:
parent
56916f90d1
commit
c1eb686cd3
1 changed files with 10 additions and 0 deletions
|
|
@ -70,6 +70,16 @@ $env.config.keybindings = [
|
|||
send: OpenEditor
|
||||
}
|
||||
}
|
||||
{
|
||||
name: toggle_sudo
|
||||
modifier: alt
|
||||
keycode: char_s
|
||||
mode: [emacs vi_insert vi_normal]
|
||||
event: {
|
||||
send: executehostcommand
|
||||
cmd: "let cmd = (commandline); commandline edit (if $cmd starts-with sudo { $cmd | str replace -r '^sudo ' '' } else { 'sudo ' ++ $cmd });"
|
||||
}
|
||||
}
|
||||
{
|
||||
name: run_zoxide
|
||||
modifier: alt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue