Last active
November 8, 2024 14:46
-
-
Save krzyzanowskim/c15905757afc1ae3d1bec61c6a2faf82 to your computer and use it in GitHub Desktop.
less command with markdown highlighting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# SETUP | |
# | |
# create executable file ~/.lessfilter with the content of this file | |
# chmod u+x ~/.lessfilter | |
# | |
# setup less by adding lines below to ~/.zshrc | |
# ``` | |
# export LESSOPEN="| ~/.lessfilter %s" | |
# export LESS='-F -R -S -X' | |
# ``` | |
# | |
# DEPENDENCY | |
# brew install glow | |
# | |
case "$1" in | |
*.md) | |
CLICOLOR_FORCE=1 glow --style dark "$1" | |
;; | |
*) | |
# We don't handle this format. | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment