ranger: Use bat to preview text files (WIP)
wrap_plaintext_previews has to be disabled, otherwise bats output is completely messed up. On the other hand I'd like to have it turned on since it is useful when the usually pretty long file type classification is used as preview.
This commit is contained in:
@@ -129,7 +129,7 @@ set preview_directories true
|
||||
set collapse_preview true
|
||||
|
||||
# Wrap long lines in plain text previews?
|
||||
set wrap_plaintext_previews true
|
||||
set wrap_plaintext_previews false
|
||||
|
||||
# Save the console history on exit?
|
||||
set save_console_history true
|
||||
|
||||
@@ -296,6 +296,8 @@ handle_mime() {
|
||||
|
||||
## Text
|
||||
text/* | */xml)
|
||||
bat --decorations=always --color=always --paging=never \
|
||||
--terminal-width="$PV_WIDTH" -- "${FILE_PATH}" && exit 0
|
||||
## Syntax highlight
|
||||
if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
|
||||
exit 2
|
||||
|
||||
Reference in New Issue
Block a user