Lcd wrote: > On 10 October 2017, LCD 47 <[email protected]> wrote: > > On 10 October 2017, Bram Moolenaar <[email protected]> wrote: > > > > > > lcd wrote: > > > > > > > Per title: if MANPAGER is set to "env MAN_PN=1 vim -M +MANPAGER -", > > > > running "man Xorg" results in a message "Cannot find a 'xorg'.". > > > > > > > > The culprit is a "tolower()" in plugin/manpager.vim. Man page names > > > > are case-sensitive on most UNIX systems. The patch below seems to fix > > > > the problem. > > > > > > > > /lcd > > > > > > > > > > > > diff --git a/runtime/plugin/manpager.vim b/runtime/plugin/manpager.vim > > > > index be6e30b70..9d30fab2f 100644 > > > > --- a/runtime/plugin/manpager.vim > > > > +++ b/runtime/plugin/manpager.vim > > > > @@ -20,7 +20,7 @@ function! s:MANPAGER() > > > > let manpage = expand('$MAN_PN') > > > > endif > > > > > > > > - let page_sec = matchlist(tolower(manpage), '^' . pagesec_pattern . > > > > '$') > > > > + let page_sec = matchlist(manpage, '^' . pagesec_pattern . '$') > > > > > > > > bwipe! > > > > > > Can you try this instead: > > > let page_sec = matchlist(tolower(manpage), '^' . > > > tolower(pagesec_pattern) . '$') > > > > It doesn't help, "Xorg" still gets converted to "xorg". > > > > As I understand it, what's going on is something like this: Vim > > receives the formatted man page via MANPAGER, but this is not directly > > usable, so Vim needs to run "man" again. However at that point the > > original "man" options are not available, so Vim tries to infer them > > from the first line in the formatted man page. > > > > Now, some man pages preserve the case of the name of the utility > > they document (such as "Xorg(1)"), others uppercase it (f.i. "LS(1)"). > > That's why Vim calls tolower(). This works for most man pages, > > because the names are all lower-case, but fails for things like "Xorg" > > and "Net::DNS". Please note that the ":Man" command is not affected, > > it's only the MANPAGER mechanism that has this problem. > [...] > > I'm attaching a better partial fix. > > The patch to plugin/manpager.vim fixes two issues: > > (1) man pages with ":" in names (such as Net::DNS) are not recognized; > (2) man pages with upper case letters in names (f.i. "Xorg") are not > recognized. > > The fix is partial because it only addresses (2) when MAN_PN is > set. Sadly BSD "man" and "man" on most commercial UNIX systems don't do > that, only "man-db" on Linux does. On systems where "man" doesn't set > MAN_PN the patch falls back to reading the first line in the formatted > man page. On these systems it's possible to write a wrapper script for > "man" that sets MAN_PN before actually running "man", but the details > are necessarily OS-dependent. > > The other patch, to ftplugin/man.vim, is unrelated, and is a minor > optimisation. There is no need for "col -b", a simple %s/.\b//g does > the exact same thing inside Vim.
I would appreciate a few people trying this out on various systems. -- "My particular problem is with registry entries, which seem to just accumulate like plastic coffee cups..." -- Paul Moore /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
