Guest User

Untitled

a guest
Apr 26th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ###
  4. ### Add the following to your .bashrc:
  5. # export LESS='-FRX'
  6. # export LESSOPEN='|~/.lessfilter %s'
  7. ## And if you want to alias cat aswell;
  8. # alias cat='~/.lessfilter'
  9.  
  10. pygm_opts="-f terminal16m -O style=monokai"
  11.  
  12. case `basename $1` in
  13. *.awk|*.groff|*.java|*.js|*.m4|*.pl|*.pm|*.pod|*.sh|\
  14. *.ad[asb]|*.asm|*.inc|*.[ch]|*.[ch]pp|*.[ch]xx|*.cc|*.hh|\
  15. *.lsp|*.l|*.pas|*.p|*.xps|*.xsl|*.axp|*.ppd|*.pov|\
  16. Makefile|\
  17. *.diff|*.patch|*.py|*.rb|*.sql|*.ebuild|*.eclass)
  18. pygmentize $pygm_opts "$1";;
  19. *.php|*.inc|*.module|*.install)
  20. pygmentize $pygm_opts -l php -O style=native "$1";;
  21. *.md)
  22. pygmentize $pygm_opts "$1";;
  23. *.xml)
  24. xmllint --format --nonet --nowarning --nocatalogs --nsclean --recover "$1" | pygmentize $pygm_opts -O style=native -O nowrap=true -l xml 2>/dev/null;;
  25. *.info)
  26. pygmentize $pygm_opts -l ini 2>/dev/null "$1";;
  27. .gitconfig|.gitignore)
  28. pygmentize $pygm_opts -l kconfig 2>/dev/null "$1";;
  29. *.json)
  30. cat "$1" | jq -M . | pygmentize $pygm_opts -O style=paraiso-dark -l json 2>/dev/null;;
  31. .bashrc|.bash_aliases|.bash_environment)
  32. pygmentize $pygm_opts -O style=rrt -l sh "$1"
  33. ;;
  34. *)
  35. egrep "#\!\/bin\/(bash|sh)" "$1" > /dev/null
  36. if [ "$?" -eq "0" ]; then
  37. pygmentize $pygm_opts -O style=native -l sh "$1"
  38. else
  39. exit 1
  40. fi
  41. esac
  42. exit 0
Add Comment
Please, Sign In to add comment