dotfiles/dot_config/fish/conf.d/30-bat.fish.tmpl

22 lines
550 B
Fish

#!/usr/bin/env fish
{{- $batcmd := "cat" -}}
{{- if lookPath "bat" -}}
{{- $batcmd = "bat" -}}
{{- else if lookPath "batcat" -}}
{{- $batcmd = "batcat" -}}
{{- end }}
set -gx BATDIFF_USE_DELTA true
function cat --wraps bat
{{ $batcmd }} $argv
end
function cath --wraps bat
{{ $batcmd }} --plain --language=help $argv
end
abbr -a B --position anywhere --set-cursor "% | {{ $batcmd }}"
abbr -a --position anywhere -- -h "-h | cath"
abbr -a --position anywhere -- --help "--help | cath"
abbr -a help --position anywhere -- "help | cath"