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

23 lines
550 B
Cheetah
Raw Normal View History

2024-04-14 18:41:15 -07:00
#!/usr/bin/env fish
2024-04-21 14:36:59 -07:00
{{- $batcmd := "cat" -}}
{{- if lookPath "bat" -}}
{{- $batcmd = "bat" -}}
{{- else if lookPath "batcat" -}}
{{- $batcmd = "batcat" -}}
{{- end }}
2024-04-14 18:41:15 -07:00
set -gx BATDIFF_USE_DELTA true
2024-04-21 14:32:58 -07:00
2024-04-14 18:41:15 -07:00
function cat --wraps bat
2024-04-21 14:36:59 -07:00
{{ $batcmd }} $argv
2024-04-14 18:41:15 -07:00
end
2024-04-18 18:40:30 -07:00
2024-04-27 18:45:43 -07:00
function cath --wraps bat
{{ $batcmd }} --plain --language=help $argv
end
2024-04-21 14:36:59 -07:00
abbr -a B --position anywhere --set-cursor "% | {{ $batcmd }}"
2024-04-27 18:52:45 -07:00
abbr -a --position anywhere -- -h "-h | cath"
abbr -a --position anywhere -- --help "--help | cath"
abbr -a help --position anywhere -- "help | cath"