X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=lib%2Fpython%2Finit.py;h=7ef24db2a9b9ce34c289300e31d1beff1aaf5dc8;hb=7f5eb416029fbcd33bb4e1b2dd78c43ac279456f;hp=a5e63231b5cf4fa4445a60f71d9e8f924a2649e6;hpb=058002bd47ad258567d8027e645ac60d59b2bda8;p=dotfiles.git diff --git a/lib/python/init.py b/lib/python/init.py index a5e6323..7ef24db 100644 --- a/lib/python/init.py +++ b/lib/python/init.py @@ -117,11 +117,20 @@ def init(): except (ImportError, locale.Error): pass # no locale support or unsupported locale - # set displayhook + # set displayhook and excepthook from pprint import pprint pager = os.environ.get("PAGER") or 'more' + # if your pager is 'less', options '-F' and '-R' must be passed to it, + # and option '-X' is very much recommended + if pager == 'less': + less = os.environ.get("LESS") or '' + for opt in 'X', 'R', 'F': + if opt not in less: + less = opt + less + os.environ["LESS"] = less + class BasePager: def write(self, value): self.stdin.write(value)