aboutsummaryrefslogtreecommitdiff
path: root/conf.d/04pager.fish
diff options
context:
space:
mode:
Diffstat (limited to 'conf.d/04pager.fish')
-rw-r--r--conf.d/04pager.fish53
1 files changed, 53 insertions, 0 deletions
diff --git a/conf.d/04pager.fish b/conf.d/04pager.fish
new file mode 100644
index 0000000..688747b
--- /dev/null
+++ b/conf.d/04pager.fish
@@ -0,0 +1,53 @@
+if status is-interactive
+
+# Pagers to look for by order of preference
+set -f pagers 'moar' 'less' 'most' 'more'
+
+# Find a suitable pager
+set -f found_pager (find_prog $pagers)
+
+if test -n "$found_pager"
+
+ switch $found_pager
+ case 'moar'
+ set -x MOAR '--colors=auto --no-linenumbers'
+ alias less 'moar'
+ alias most 'moar'
+ alias more 'moar'
+ alias pager 'moar'
+ alias rawpager 'moar'
+ case 'less'
+ if test -z "$LESSHISTFILE"
+ set -x LESSHISTFILE '-'
+ end
+ alias most 'less'
+ alias more 'less'
+ alias pager 'less'
+ alias rawpager 'less -r'
+ case 'most'
+ if test -z "$MOST_INITFILE"
+ set -x MOST_INITFILE "$HOME/.config/most/config"
+ end
+ alias more 'most'
+ alias less 'most'
+ alias pager 'most'
+ alias rawpager 'most'
+ case 'more'
+ alias less 'more'
+ alias most 'more'
+ alias pager 'more'
+ alias rawpager 'more'
+ end
+
+ if command -sq 'bat'
+ set -x MANROFFOPT '-c'
+ set -x MANPAGER 'fish -c "col -bx | bat -l man -p"'
+ end
+
+ # If $PAGER is unset, set it
+ if test -z "$PAGER"
+ set -x PAGER $found_pager
+ end
+end
+
+end