mirror of
https://github.com/theniceboy/.config.git
synced 2025-12-26 22:54:59 +08:00
highlight > ccat
This commit is contained in:
parent
49afb96134
commit
0e5c935855
1 changed files with 3 additions and 13 deletions
|
|
@ -217,20 +217,10 @@ handle_mime() {
|
|||
case "${mimetype}" in
|
||||
# Text
|
||||
text/* | */xml)
|
||||
# Syntax highlight
|
||||
if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
|
||||
exit 2
|
||||
if command -v ccat 2>/dev/null; then
|
||||
ccat --color=always ${FILE_PATH}
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$( tput colors )" -ge 256 ]]; then
|
||||
local pygmentize_format='terminal256'
|
||||
local highlight_format='xterm256'
|
||||
else
|
||||
local pygmentize_format='terminal'
|
||||
local highlight_format='ansi'
|
||||
fi
|
||||
highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
|
||||
--style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}" && exit 5
|
||||
# pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "${FILE_PATH}" && exit 5
|
||||
exit 2;;
|
||||
|
||||
# DjVu
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue