7e3fdf33ec53821e574b8d6df43bec7264c507ee

Author
Bernard Grymonpon <bernard@grymonpon.be>
Committer
GitHub <noreply@github.com>
Date

Message

fix(misc): only set PAGER if `less` or `more` are available (#12060)

Diff

 1diff --git a/lib/misc.zsh b/lib/misc.zsh
 2index 132f335510d4676ad653a8ba1d380a32a8fe2e60..ff201771332e9e8b5dc51d841e7e03e3569cc1dc 100644
 3--- a/lib/misc.zsh
 4+++ b/lib/misc.zsh
 5@@ -19,8 +19,13 @@ setopt multios              # enable redirect to multiple streams: echo >file1 >
 6 setopt long_list_jobs       # show long list format job notifications
 7 setopt interactivecomments  # recognize comments
 8 
 9-env_default 'PAGER' 'less'
10-env_default 'LESS' '-R'
11+# define pager dependant on what is available (less or more)
12+if (( ${+commands[less]} )); then
13+  env_default 'PAGER' 'less'
14+  env_default 'LESS' '-R'
15+elif (( ${+commands[more]} )); then
16+  env_default 'PAGER' 'more'
17+fi
18 
19 ## super user alias
20 alias _='sudo '