fish-cat-highlighted

Fish script that adds automatic syntax highlighting to cat

Usage no npm install needed!

<script type="module">
  import fishCatHighlighted from 'https://cdn.skypack.dev/fish-cat-highlighted';
</script>

README

fish-cat-highlighted

Fish script that adds automatic syntax highlighting for files being printed with cat.

/t/demo ❩  cat sort.hs
sort :: Ord a => [a] -> [a]
sort [] = []
sort (pivot : rest) = sort lessEqual ++ [pivot] ++ sort greater
                      where lessEqual = filter (<= pivot) rest
                            greater = filter (pivot <) rest

If standard input or output stream is redirected or file type not recognized, regular cat fires instead.

/t/demo ❩  cat sort.hs |cat
sort :: Ord a => [a] -> [a]
sort [] = []
sort (pivot : rest) = sort lessEqual ++ [pivot] ++ sort greater
                      where lessEqual = filter (<= pivot) rest
                            greater = filter (pivot <) rest
/t/demo ❩  cat (printf "Hello!\n" |psub)
Hello!

Prerequisites

Supported languages

source-highlight --lang-list

Install

npm

or simply put the script to your ~/.config/fish/functions/ or source it elsewise.

License

MIT