Merge remote-tracking branch 'krobelus/fix-man-jump'

This commit is contained in:
Maxime Coste 2022-10-19 20:37:19 +11:00
commit b42cb090ee

View File

@ -107,7 +107,7 @@ declare-option -hidden regex man_link2 \
# Define a useful command sequence for searching a given regex
# and a given sequence of search keys.
define-command man-search -params 2 %{
define-command -hidden man-search -params 2 %{
set-register / %arg[1]
try %{
execute-keys %arg[2]
@ -122,19 +122,9 @@ man-link-next %{ man-search %opt[man_link2] n }
define-command -docstring 'Go to previous man page link' \
man-link-prev %{ man-search %opt[man_link2] <a-n> }
# Expand backward and forward, and then try to search for a man page link
define-command man-link-here %{ evaluate-commands -save-regs / %{
man-search %opt[man_link2] '<a-?>\b\w<ret><a-;>?\)<ret>'
}} -hidden
# Search current selection for a man page link
define-command man-link %{ evaluate-commands -save-regs / %{
man-search %opt[man_link1] s<ret>
}} -hidden
define-command -docstring 'Try to jump to a man page' \
man-jump %{
try %{ man-link } catch %{ man-link-here } catch %{ fail 'Not a valid man page link' }
try %{ execute-keys <a-a><a-w> s %opt[man_link1] <ret> } catch %{ fail 'Not a valid man page link' }
try %{ man } catch %{ fail 'No man page link to follow' }
}