runtime(man): improve :Man completion for man-db
On man-db systems, complete with actual man sections and pages, instead of shell commands. I tried to come up with a portable solution for multiple man implementations in https://github.com/vim/vim/discussions/16794 but I think the differences between implementations were too large to do that without overly complicated code. So instead, I implemented it for man-db (which I think is common on Linux) and hopefully left it easier for other people to implement it on other systems in the future if they want to. closes: #16843 Signed-off-by: David Mandelberg <david@mandelberg.org> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
969e11a18b
commit
c2623824a7
@ -1,4 +1,4 @@
|
||||
*filetype.txt* For Vim version 9.1. Last change: 2025 Mar 09
|
||||
*filetype.txt* For Vim version 9.1. Last change: 2025 Mar 10
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -776,7 +776,7 @@ Local mappings:
|
||||
to the end of the file in Normal mode. This means "> " is inserted in
|
||||
each line.
|
||||
|
||||
MAN *ft-man-plugin* *:Man* *man.vim*
|
||||
MAN *ft-man-plugin* *:Man* *:ManReload* *man.vim*
|
||||
|
||||
This plugin displays a manual page in a nice way. See |find-manpage| in the
|
||||
user manual for more information.
|
||||
@ -793,6 +793,8 @@ Commands:
|
||||
Man {name} Display the manual page for {name} in a window.
|
||||
Man {number} {name}
|
||||
Display the manual page for {name} in a section {number}.
|
||||
ManReload Reload the cache of available man pages used for |:Man| argument
|
||||
completion.
|
||||
|
||||
Global mapping:
|
||||
<Leader>K Displays the manual page for the word under the cursor.
|
||||
@ -823,6 +825,14 @@ desired folding style instead. For example: >
|
||||
If you would like :Man {number} {name} to behave like man {number} {name} by
|
||||
not running man {name} if no page is found, then use this: >
|
||||
let g:ft_man_no_sect_fallback = 1
|
||||
<
|
||||
*g:ft_man_implementation*
|
||||
The completion for the :Man command tries to guess which implementation of man
|
||||
the system has. If it guesses wrong, you can set g:ft_man_implementation to
|
||||
one of these values:
|
||||
'man-db' https://man-db.nongnu.org/
|
||||
'' Unknown, fall back to completing shell commands
|
||||
instead of man pages.
|
||||
|
||||
You may also want to set 'keywordprg' to make the |K| command open a manual
|
||||
page in a Vim window: >
|
||||
|
||||
Reference in New Issue
Block a user