diff --git a/functions/config_help.fish b/functions/config_help.fish index a25bd27..7bbf085 100644 --- a/functions/config_help.fish +++ b/functions/config_help.fish @@ -51,27 +51,25 @@ function config_help --description 'Open the offline fish shell configuration ma # 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. + # psub creates a seekable temp file so --jump-target works on bat output. 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]" + if test $start_line -gt 1 + set -a ov_args --jump-target $start_line end - bat --color=always --style=plain --language=markdown "$doc_file" \ - | ov $ov_args + ov $ov_args (bat --color=always --style=plain --language=markdown "$doc_file" | psub) # ov alone: section navigation on raw Markdown; no code highlighting. else if type -q ov set -l ov_args \ --section-delimiter "^#" \ - --section-header \ - "$doc_file" - if test -n "$argv[1]" - set -a ov_args --pattern "$argv[1]" + --section-header + if test $start_line -gt 1 + set -a ov_args --jump-target $start_line end - ov $ov_args + ov $ov_args "$doc_file" # bat alone: syntax highlighting with built-in paging; no line jump. else if type -q bat