fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerProvide functions to toggle commandline prefix/suffix7c2dd694e

master
544 B15 linesraw
1function fish_commandline_append --description "Append the given string to the command-line, or remove the suffix if already there"
2    if not commandline | string length -q
3        commandline -r $history[1]
4    end
5
6    set -l escaped (string escape --style=regex -- $argv[1])
7    set -l job (commandline -j | string collect)
8    if set job (string replace -r -- $escaped\$ "" $job)
9        set -l cursor (commandline -C)
10        commandline -rj -- $job
11        commandline -C $cursor
12    else
13        commandline -aj -- $argv[1]
14    end
15end