Update .config/fish/conf.d/30-bat.fish
This commit is contained in:
parent
57f9ddd422
commit
e9f020b0e3
1 changed files with 9 additions and 15 deletions
|
@ -1,22 +1,16 @@
|
||||||
#!/usr/bin/env 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
|
set -gx BATDIFF_USE_DELTA true
|
||||||
|
|
||||||
set -g batcmd
|
|
||||||
|
|
||||||
if command -v bat &>/dev/null
|
|
||||||
set batcmd bat
|
|
||||||
else if command -v batcat &>/dev/null
|
|
||||||
set batcmd batcat
|
|
||||||
end
|
|
||||||
|
|
||||||
function cat --wraps bat
|
function cat --wraps bat
|
||||||
if command -v bat &>/dev/null
|
{{ $batcmd }} $argv
|
||||||
bat $argv
|
|
||||||
else if command -v batcat &>/dev/null
|
|
||||||
batcat $argv
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
abbr -a B --position anywhere --set-cursor "% | $batcmd"
|
abbr -a B --position anywhere --set-cursor "% | {{ $batcmd }}"
|
||||||
abbr -a --position anywhere -- -h "-h 2>&1 | $batcmd --plain --language=help"
|
abbr -a --position anywhere -- -h "-h 2>&1 | {{ $batcmd }} --plain --language=help"
|
||||||
|
|
Loading…
Reference in a new issue