Added pygmentize to less output
This commit is contained in:
parent
7de7d5cbd0
commit
c8ebe83dbe
2 changed files with 39 additions and 0 deletions
|
@ -15,3 +15,7 @@ export LESS_TERMCAP_ue=$'\e[0m' # end underline
|
||||||
|
|
||||||
#export LESS_TERMCAP_mr=$(tput rev)
|
#export LESS_TERMCAP_mr=$(tput rev)
|
||||||
#export LESS_TERMCAP_mh=$(tput dim)
|
#export LESS_TERMCAP_mh=$(tput dim)
|
||||||
|
|
||||||
|
export LESS="-R"
|
||||||
|
export LESSOPEN="|~/bin/lessfilter %s"
|
||||||
|
|
||||||
|
|
35
bin/lessfilter
Executable file
35
bin/lessfilter
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
filename=$(basename "$1")
|
||||||
|
|
||||||
|
case "$filename" in
|
||||||
|
*.awk|*.groff|*.java|*.js|*.m4|*.php|*.pl|*.pm|*.pod|*.sh|\
|
||||||
|
*.ad[asb]|*.asm|*.inc|*.[ch]|*.[ch]pp|*.[ch]xx|*.cc|*.hh|\
|
||||||
|
*.lsp|*.l|*.pas|*.p|*.xml|*.xps|*.xsl|*.axp|*.ppd|*.pov|\
|
||||||
|
*.diff|*.patch|*.py|*.rb|*.sql|*.ebuild|*.eclass)
|
||||||
|
if type -p pygmentize > /dev/null; then
|
||||||
|
pygmentize -f 256 "$1"
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
.bashrc|.bash_aliases|.bash_environment|.zshrc|.zimrc|.zlogin)
|
||||||
|
if type -p pygmentize > /dev/null; then
|
||||||
|
pygmentize -f 256 -l sh "$1"
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if grep -q "#\!/bin/bash" "$1" 2>/dev/null; then
|
||||||
|
if type -p pygmentize > /dev/null; then
|
||||||
|
pygmentize -f 256 -l sh "$1"
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
Loading…
Reference in a new issue