history: put the output through the pager in interactive mode

(Ideally, the behaviour of git could be implemented: pipe the input
through a pager iff the length is > window size and in interactive
mode).

Closes #1076.
This commit is contained in:
David Adam 2014-10-26 17:19:29 +08:00
parent c84cdcd00c
commit a580d04dbc

View file

@ -12,6 +12,11 @@ function history --description "Deletes an item from history"
set -l search_mode none
set -l pager less
if set -q PAGER
set pager $PAGER
end
if test $argc -gt 0
for i in (seq $argc)
switch $argv[$i]
@ -33,7 +38,11 @@ function history --description "Deletes an item from history"
end
else
#Execute history builtin without any argument
if status --is-interactive
builtin history | eval $pager
else
builtin history
end
return
end