mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-24 18:53:51 +08:00
7c2dd694e0
This introduces two functions to - toggle a process prefix, used for adding "sudo" - add a job suffix, used for adding "&| less" Not sure if they are very useful; we'll see. Closes #7905
16 lines
544 B
Fish
16 lines
544 B
Fish
function fish_commandline_append --description "Append the given string to the command-line, or remove the suffix if already there"
|
|
if not commandline | string length -q
|
|
commandline -r $history[1]
|
|
end
|
|
|
|
set -l escaped (string escape --style=regex -- $argv[1])
|
|
set -l job (commandline -j | string collect)
|
|
if set job (string replace -r -- $escaped\$ "" $job)
|
|
set -l cursor (commandline -C)
|
|
commandline -rj -- $job
|
|
commandline -C $cursor
|
|
else
|
|
commandline -aj -- $argv[1]
|
|
end
|
|
end
|