walles / moar

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

filetype colorization #178

Closed rwmitchell closed 6 months ago

rwmitchell commented 6 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 6 months ago

Thanks!

walles commented 6 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 6 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
}

`