__fish_paginate: move the cursor to end of recalled commandline

When pressing \ep on an empty commandline, the cursor would stay at the
beginning of the commandline. Move it to the end of the previous command,
this feels a bit more natural.
This commit is contained in:
Johannes Altmanninger 2020-09-16 23:20:31 +02:00
parent 07c8608034
commit 6ec0b583f5

View File

@ -6,11 +6,10 @@ function __fish_paginate -d "Paginate the current command using the users defaul
end end
if test -z (commandline -j | string join '') if test -z (commandline -j | string join '')
commandline -a $history[1] commandline -i $history[1]
end end
if commandline -j | string match -q -r -v "$cmd *\$" if commandline -j | not string match -q -r "$cmd *\$"
commandline -aj " &| $cmd;" commandline -aj " &| $cmd;"
end end