From a580d04dbc950d0907597f111f3e0fe5d5bbd66e Mon Sep 17 00:00:00 2001 From: David Adam Date: Sun, 26 Oct 2014 17:19:29 +0800 Subject: [PATCH] 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. --- share/functions/history.fish | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/share/functions/history.fish b/share/functions/history.fish index b943719e5..fd2b91fab 100644 --- a/share/functions/history.fish +++ b/share/functions/history.fish @@ -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 - builtin history + if status --is-interactive + builtin history | eval $pager + else + builtin history + end return end