One of the things that annoys me about pagers such as less, more, most, etc. is that they are dumb in the sense that they cannot detect the format of the text file they are displaying. For example, all of a sudden I find myself reading lots of markdown-formatted files, and I find myself using most to display it – never remembering that it is mdv I want.
As it happens, when I invoke a pager at the shell prompt, I typically use an alias (page or pg) to invoke a preferred pager, and by extending this functionality into a function I can start to approach what I want :-
function extension { printf "%s\n" ${${argv/*\./}:l} } function page { if [[ -z $argv ]] then $PAGER else case $(extension $argv) in "md") mdv -A $argv | $PAGER ;; "man") groff -m mandoc -Tutf8 $argv | $PAGER ;; *) $PAGER $argv ;; esac fi }
(the function “extension” has had a quick bug fix applied to smash the filename extension to lowercase)
Of course there are undoubtedly umpteen errors in that, and probably better ways to do it too. And it won’t work properly on its own ($PAGER hasn’t been set).
But it’s the start of something I can use to display all sorts of text files in a terminal window without having to remember all those commands. But as for ‘intelligent’, nope it’s not that – just a bit smarter than the average pager.