aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/history.fish
diff options
context:
space:
mode:
authorGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2014-10-26 17:19:29 +0800
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2014-10-26 17:19:29 +0800
commita580d04dbc950d0907597f111f3e0fe5d5bbd66e (patch)
treedc9d9e8f56d038668773fc854906262c6164cce6 /share/functions/history.fish
parentc84cdcd00ceeebd7907416d997b91a6eb984ee00 (diff)
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.
Diffstat (limited to 'share/functions/history.fish')
-rw-r--r--share/functions/history.fish11
1 files changed, 10 insertions, 1 deletions
diff --git a/share/functions/history.fish b/share/functions/history.fish
index b943719e..fd2b91fa 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