diff --git a/plugins/available/less-pretty-cat.plugin.bash b/plugins/available/less-pretty-cat.plugin.bash index 841122ca..b6b9d1f0 100644 --- a/plugins/available/less-pretty-cat.plugin.bash +++ b/plugins/available/less-pretty-cat.plugin.bash @@ -5,6 +5,8 @@ if $(command -v pygmentize &> /dev/null) ; then # get the full paths to binaries CAT_BIN=$(which cat) LESS_BIN=$(which less) + BASH_IT_CCAT_STYLE="${BASH_IT_CCAT_STYLE:=default}" + BASH_IT_CLESS_STYLE="${BASH_IT_CLESS_STYLE:=default}" # pigmentize cat and less outputs - call them ccat and cless to avoid that # especially cat'ed output in scripts gets mangled with pygemtized meta characters @@ -15,7 +17,7 @@ if $(command -v pygmentize &> /dev/null) ; then example 'cat mysite/manage.py dir/text-file.txt' for var; do - pygmentize "$var" 2>/dev/null || "$CAT_BIN" "$var"; + pygmentize -f 256 -O style="$BASH_IT_CCAT_STYLE" -g "$var" 2>/dev/null || "$CAT_BIN" "$var"; done } @@ -24,6 +26,6 @@ if $(command -v pygmentize &> /dev/null) ; then about 'it pigments the file passed in and passes it to less for pagination' param '$1: the file to paginate with less' example 'less mysite/manage.py' - pygmentize -g $* | "$LESS_BIN" -R + pygmentize -f 256 -O style="$BASH_IT_CLESS_STYLE" -g $* | "$LESS_BIN" -R } fi