commit 79dff962a65a1359327ed6a77a527aaf7ec01b04
parent a582f4193ab689347a1e89c4bfb7c1c32423b2e0
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Tue, 3 Nov 2020 11:27:39 +0100
bat: dynamic theme
Former-commit-id: a6e3db51a74780d27822fb0b2cc43ddbe1e04363
Diffstat:
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lf/preview b/lf/preview
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
case "$(printf "%s" "$1" | tr '[:upper:]' '[:lower:]')" in
*.tgz|*.tar.gz) tar tzf "$1";;
*.tar.bz2|*.tbz2) tar tjf "$1";;
@@ -12,7 +12,9 @@ case "$(printf "%s" "$1" | tr '[:upper:]' '[:lower:]')" in
# *.torrent) transmission-show "$1";;
# *.iso) iso-info --no-header -l "$1";;
*.epub|*.rtf|*.doc|*.docx|*.otd|*.ods|*.odp|*.sxw)
- pandoc -s -t markdown -- "$1" | bat --color=always --theme=base16
+ { [ -f ~/.config/dark-theme ] && theme=1337; } || theme=GitHub
+ bat --color=always --theme="$theme" "$1"
+ pandoc -s -t markdown -- "$1" | bat --color=always --theme="$theme"
exit 1
;;
*.csv) sed s/,/\\n/g "$1";;
@@ -35,7 +37,8 @@ case "$(printf "%s" "$1" | tr '[:upper:]' '[:lower:]')" in
rm "$CACHE"
;;
*)
- bat --color=always --theme=base16 "$1"
+ { [ -f ~/.config/dark-theme ] && theme=1337; } || theme=GitHub
+ bat --color=always --theme="$theme" "$1"
;;
esac
diff --git a/shell/aliases b/shell/aliases
@@ -28,3 +28,4 @@ alias scim="sc-im"
alias mbsync='mbsync -c $HOME/.config/mbsync/mbsyncrc'
alias mutt='BW_SESSION="$(bw unlock --raw)" neomutt'
[ -n "$VIM_TERMINAL" ] && alias vim=vimsend
+{ [ -f ~/.config/dark-theme ] && alias bat="bat --theme=1337"; } || alias bat="bat --theme=GitHub"