Skip to content

Instantly share code, notes, and snippets.

@jaygooby
jaygooby / src-hilite-lesspipe.sh
Last active January 21, 2025 14:02
A modified version of gnu source-highlight's src-hilite-lesspipe.sh that also works with piped files and files with no extensions. It uses the file command to guess the language. This means you can use source-highlight in conjunction with commands like "git show"
#! /bin/bash
#
# Based on http://git.savannah.gnu.org/cgit/src-highlite.git/tree/src/src-hilite-lesspipe.sh.in
# by Lorenzo Bettini
#
# Modified by Jay Caines-Gooby to support piped files
# [email protected]
# @jaygooby
#
# Typically called by setting: