mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 20:54:04 +08:00
37e0fbb5e4
Often, I want to paginate the command I just ran. Easy enough to <up><alt-p>, but this patch saves a keystroke.
18 lines
348 B
Fish
18 lines
348 B
Fish
function __fish_paginate -d "Paginate the current command using the users default pager"
|
|
|
|
set -l cmd less
|
|
if set -q PAGER
|
|
set cmd $PAGER
|
|
end
|
|
|
|
if test -z (commandline -j)
|
|
commandline -a $history[1]
|
|
end
|
|
|
|
if commandline -j | string match -q -r -v "$cmd *\$"
|
|
|
|
commandline -aj " ^&1 | $cmd;"
|
|
end
|
|
|
|
end
|