fix(config_help): replace invalid --syntax flag with bat|ov pipeline
ov does not support --syntax/--syntax-name. Use bat --color=always piped into ov --jump-target for syntax highlighting + line positioning. Fall back to ov alone (section nav via --section-delimiter) when bat is absent.
This commit is contained in:
@@ -47,23 +47,31 @@ function config_help --description 'Open the offline fish shell configuration ma
|
||||
end
|
||||
|
||||
# ── Viewer fallback chain ────────────────────────────────────
|
||||
if type -q ov
|
||||
ov --syntax --syntax-name markdown \
|
||||
--section-delimiter "^#" \
|
||||
--section-header \
|
||||
+"$start_line" "$doc_file"
|
||||
# Best case: bat provides syntax color, ov provides paging + line jump.
|
||||
# Section nav (,/.) is sacrificed when piping bat output because ANSI
|
||||
# escape codes prevent ^# matching; use / to search instead.
|
||||
if type -q ov; and type -q bat
|
||||
bat --color=always --style=plain --language=markdown "$doc_file" \
|
||||
| ov --jump-target "$start_line"
|
||||
|
||||
# ov alone: full section navigation with ,/. keys; no code highlighting.
|
||||
else if type -q ov
|
||||
ov --section-delimiter "^#" \
|
||||
--section-header \
|
||||
--jump-target "$start_line" \
|
||||
"$doc_file"
|
||||
|
||||
# bat alone: syntax highlighting with built-in paging; no line jump.
|
||||
else if type -q bat
|
||||
if test $start_line -gt 1
|
||||
# bat can't jump to a line in paging mode; show a hint instead
|
||||
set_color brblack
|
||||
echo "note: bat pager active — use / to search for your section" >&2
|
||||
echo "note: bat pager — use / to search for your section" >&2
|
||||
set_color normal
|
||||
end
|
||||
bat --language=markdown --paging=always "$doc_file"
|
||||
|
||||
# Pre-compiled man page (generated by CI after merge).
|
||||
else if test -f "$man_file"
|
||||
# Pre-compiled man page as a pager-independent fallback
|
||||
man -l "$man_file"
|
||||
|
||||
else if type -q less
|
||||
|
||||
Reference in New Issue
Block a user