Replies: 4 comments 3 replies
-
macos has some interesting differences. Notably,
|
Beta Was this translation helpful? Give feedback.
-
Why not complete with Just a proof of concept: diff --git a/runtime/autoload/dist/man.vim b/runtime/autoload/dist/man.vim
index 281b75158..91396747b 100644
--- a/runtime/autoload/dist/man.vim
+++ b/runtime/autoload/dist/man.vim
@@ -117,8 +117,9 @@ func dist#man#GetPage(cmdmods, ...)
let sect = a:1
let page = a:2
elseif a:0 >= 1
- let sect = ""
- let page = a:1
+ let file = split(a:1, '\.')
+ let sect = get(file, 1, '')
+ let page = get(file, 0, a:1)
else
return
endif
diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index 45c2bb239..309a1993b 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -60,7 +60,8 @@ if &filetype == "man"
endif
if exists(":Man") != 2
- com -nargs=+ -complete=shellcmd Man call dist#man#GetPage(<q-mods>, <f-args>)
+ let &path = join(map(range(1, 8), '"/usr/share/man/man" . v:val'), ',') . ',' . substitute($MANPATH, ':', ',', 'g')
+ com -nargs=+ -complete=file_in_path Man call dist#man#GetPage(<q-mods>, <f-args>)
nnoremap <Leader>K :call dist#man#PreGetPage(0)<CR>
nnoremap <Plug>ManPreGetPage :call dist#man#PreGetPage(0)<CR>
endif |
Beta Was this translation helpful? Give feedback.
-
NetBSD doesn't seem to list all manpages with Between that and the other differences between platforms, I'm leaning towards using |
Beta Was this translation helpful? Give feedback.
-
Some timing on Apple systems with
Yikes! That would be unusable on the second system without caching. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Background: The
:Man
command currently completes its args as commands instead of manpages:vim/runtime/ftplugin/man.vim
Line 63 in a95085e
I'm about to start working on a PR to use the command
man -k .
to get a list of actual manpages for:Man
completion, but https://pubs.opengroup.org/onlinepubs/9799919799/utilities/man.html is very underspecified about the format that command will output.On Debian testing, I get output that looks like this:
On FreeBSD 14.2, it looks a bit different, with multiple manpages per line sometimes (I think):
If
man -k .
outputs a different format on your computer and you want to help me parse that for:Man
completion, please share examples of what that format looks like.Additionally,
time man -k . > /dev/null
shows 0m0,086s real time on my Debian desktop which is fast enough that I don't think it's worth caching results. If it's significantly slower for you, please let me know that too.Beta Was this translation helpful? Give feedback.
All reactions