fish-shell/share/functions/__fish_paginate.fish
Johannes Altmanninger 6ec0b583f5 __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.
2020-09-17 18:44:54 +02:00

16 lines
374 B
Fish

function __fish_paginate -d "Paginate the current command using the users default pager"
set -l cmd less
if set -q PAGER
echo $PAGER | read -at cmd
end
if test -z (commandline -j | string join '')
commandline -i $history[1]
end
if commandline -j | not string match -q -r "$cmd *\$"
commandline -aj " &| $cmd;"
end
end