walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
676 stars 19 forks source link

filetype colorization #178

Closed rwmitchell closed 10 months ago

rwmitchell commented 11 months ago

moar will colorize a file with the name foo.zsh, however, files zsh auto functions typically (in my understanding) are only named 'foo'. moar doesn't colorize foo.

Is there a method to tell moar the filetype is zsh?

rwmitchell commented 10 months ago

Thanks!

walles commented 10 months ago

Just released v1.21.0 where you can use the -lang option for telling the highlighter about the input file language.

rwmitchell commented 10 months ago

thanks again!

FWIW, I'm using this zsh script to use moar to display multiple files from the command line:

`

 mm () {

local i=1
local -a files
local -a args=($@)
for entry in $args
do
    if [[ -e $entry ]]
    then
        args[$i]=()
        files+=($entry)
    else
        ((i+=1))
    fi
done
local MOAR="-colors=16M"
if [[ $#files -eq 0 ]]
then
    moar $args < /dev/stdin
else
    for file in $files
    do
        moar $args $file
    done
fi
}

`