[feature] replace highlight with bat

This commit is contained in:
Klesh Wong 2020-11-19 17:29:17 +08:00
parent ac47877ada
commit cb3667ff8f
3 changed files with 12 additions and 11 deletions

View File

@ -21,9 +21,8 @@ if status is-interactive
# change OTHER-WRITABLE color for `ls` command
set -gx LS_COLORS 'ow=34;42;40'
# === ranger configuration
# ranger highlighting color theme
set -gx HIGHLIGHT_OPTIONS --style=solarized-dark
# === bat configuration
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
# === dict.sh configuration
set -gx D_SELECTOR 'plainsel'

View File

@ -10,12 +10,13 @@ case "$PM" in
! command -v pip3 && "$PDIR/python/install.sh"
sudo add-apt-repository ppa:fish-shell/release-3 -y
sudo apt update
sudo apt install fish libnotify-bin xdotool silversearcher-ag dash -y
sudo apt install fish libnotify-bin xdotool silversearcher-ag dash bat -y
[ ! -d ~/.fzf ] && git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
~/.fzf/install --all
lnsf /usr/bin/batcat "$HOME/.local/bin/bat"
;;
pacman)
sudo pacman -S --needed --needed fish xdotool fzf the_silver_searcher dash
sudo pacman -S --needed --needed fish xdotool fzf the_silver_searcher dash bat
# prevent bash upgradation relink /bin/sh
sudo mkdir -p /etc/pacman.d/hooks
cat <<' EOT' | sed 's/^ *//' | sudo tee /etc/pacman.d/sh-is-dash.hook

View File

@ -306,14 +306,15 @@ handle_mime() {
fi
if [[ "$( tput colors )" -ge 256 ]]; then
local pygmentize_format='terminal256'
local highlight_format='xterm256'
#local highlight_format='xterm256'
else
local pygmentize_format='terminal'
local highlight_format='ansi'
#local highlight_format='ansi'
fi
env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \
--out-format="${highlight_format}" \
--force -- "${FILE_PATH}" && exit 5
#env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \
#--out-format="${highlight_format}" \
#--force -- "${FILE_PATH}" && exit 5
bat "${FILE_PATH}" --paging=never --color=always --style=numbers && exit 5
env COLORTERM=8bit bat --color=always --style="plain" \
-- "${FILE_PATH}" && exit 5
pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\