22 lines
550 B
Fish
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"
|