diff --git a/docs/fish-config.md b/docs/fish-config.md index e736255..1c7dd42 100644 --- a/docs/fish-config.md +++ b/docs/fish-config.md @@ -1216,7 +1216,16 @@ calls fisher update as its first step. config_help ov renders the Markdown with syntax highlighting and section-based -navigation. Use , and . to jump between sections. Press / to search. +navigation. + + Space next section + ^ previous section + Alt+u toggle section list sidebar + / search forward + n / N next / previous search match + g go to line number + j interactive jump target (line, %, or 'section') + q quit ## With bat diff --git a/functions/config_help.fish b/functions/config_help.fish index 093b7a3..a25bd27 100644 --- a/functions/config_help.fish +++ b/functions/config_help.fish @@ -47,23 +47,31 @@ function config_help --description 'Open the offline fish shell configuration ma end # ── Viewer fallback chain ──────────────────────────────────── - # Best case: bat colors the output; ov matches headers in the ANSI stream - # via a regex that skips the escape codes preceding each '#'. - # bat emits headers as: ESC[m# ... so we match ^(ESC\[[0-9;]*m)+# - # This is theme-agnostic (works for any 8/24-bit color sequence) and - # gives us both syntax highlighting AND section navigation (,/.). + # bat colors the output; ov matches headers via an ANSI-aware regex. + # bat emits: ESC[m# ... so delimiter ^(\x1b\[[0-9;]*m)+# matches + # any 8/24-bit color sequence before a '#', theme-agnostic. + # Section nav: Space (next), ^ (previous), Alt+u (section list sidebar). + # Keyword jump uses --pattern which positions at the first search match. if type -q ov; and type -q bat + set -l ov_args \ + --section-delimiter "^(\x1b\[[0-9;]*m)+#" \ + --section-header + if test -n "$argv[1]" + set -a ov_args --pattern "$argv[1]" + end bat --color=always --style=plain --language=markdown "$doc_file" \ - | ov --section-delimiter "^(\x1b\[[0-9;]*m)+#" \ - --section-header \ - --jump-target "$start_line" + | ov $ov_args # ov alone: section navigation on raw Markdown; no code highlighting. else if type -q ov - ov --section-delimiter "^#" \ - --section-header \ - --jump-target "$start_line" \ - "$doc_file" + set -l ov_args \ + --section-delimiter "^#" \ + --section-header \ + "$doc_file" + if test -n "$argv[1]" + set -a ov_args --pattern "$argv[1]" + end + ov $ov_args # bat alone: syntax highlighting with built-in paging; no line jump. else if type -q bat