mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 18:03:37 +08:00
__fish_prepend_sudo: Don't move the relative position of the cursor
At the moment the "prepend sudo" functionality always sets the cursor to the end of the line. This changes it to restore the relative position of the cursor.
This commit is contained in:
parent
376529a46d
commit
8e8a3846fb
|
@ -1,8 +1,9 @@
|
||||||
function __fish_prepend_sudo -d "Prepend 'sudo ' to the beginning of the current commandline"
|
function __fish_prepend_sudo -d "Prepend 'sudo ' to the beginning of the current commandline"
|
||||||
set -l cmd (commandline -poc)
|
set -l cmd (commandline -poc)
|
||||||
if test "$cmd[1]" != "sudo"
|
if test "$cmd[1]" != "sudo"
|
||||||
|
set -l cursor (commandline -C)
|
||||||
commandline -C 0
|
commandline -C 0
|
||||||
commandline -i "sudo "
|
commandline -i "sudo "
|
||||||
commandline -f end-of-line
|
commandline -C (math $cursor + 5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user