I removed the SunOS stuff since no one uses SunOS and I've never tested
it on there.
I removed the section_flag init as we can just use -S instead of -s
and -S is used by every implementation as far as I know.
This brings man#init's time from 50-70ms to 15-20ms for me.
Closes#12318
Related #6766
Related #6815
Also, kudos to @zsugabubus for fixing a related issue in #12417
This also prevents any sorting of the paths from man. We need to
respect the order we get from it otherwise you end up loading
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man/man1/ls.1
on MacOS instead of /usr/share/man/man1/ls.1
Also cleaned it up a little and made it faster.
Closes#9159 and #9271
Also changes man#extract_sect_and_name_ref to only return a single
section at a time. This fixes a bug in its usage in man#goto_tag
where get_paths would be called with multiple sections and it does
not support that.
I noticed that our tagfunc doesn't obey b:man_default_sects and
I'll fix that next.
The old `:Man` implementation would take either the word under
the cursor, or the argument passed in, and load that as a man page.
Since we now use 'tagfunc' and look for all relevant man-pages, if
your system has several (i.e. same name, different sections), we return
several, giving the user an option.
This works for most tag commands except `:tjump`, which will
fail if there's multiple tags to choose from. This just happens to
be what the cscope code uses (it actually attempts to prompt the
user, but this fails).
This addresses a minor quality problem with the recent `'tagfunc'`
changes for `man.vim` (see [link]).
Currently, with the cursor on a parenthese, hitting `K` will jump us to
the man page of the next mentioned entry, instead of the one to which
the parenthese (or section number) belongs.
```
pcrepattern(3), terminfo(5), glob(7), regex(7).
e.g. ^ e.g. ^
```
Adding the parentheses to `'iskeyword'` means we correctly handle these cases too.
[link]: https://github.com/neovim/neovim/pull/11280#discussion_r348342357
In order to find if there was already an open man page, the :Man command
would cycle through each window to see if &ft=='man'. This triggers
autocmds, e.g. BufEnter, unnecessarily and can have unexpected
side-effects.
Change the logic to check each window's ft without switching to it
unless it is actually a man window.
Signed-off-by: Joshua Rubin <me@jawa.dev>
man#init_pager() guesses the ref by the heading, which is usually
uppercase, so we don't know the correct casing. But lowercase is more
common, so use that for the buffer name instead of uppercase.
ref #9156
Before this commit, man#init_pager() always tries to scrape the manpage
name and set the buffer name. That's much less important than avoiding
duplicate buffers and E95. And it doesn't seem to be necessary, usually.
Steps to reproduce:
$ export MANPAGER="nvim -c 'set ft=man' -"
$ man sleep
:Man sleep
Error detected while processing function man#init_pager:
line 15:
E95: Buffer with this name already exists
:ls!
1 h- "man://SLEEP(1)" line 4
2 %a- "man://sleep(1)" line 1
When nroff justifies a line, it fills the line with whitespace to meet
$MANWIDTH. With $MANWIDTH=9999, that of course results in nonsense (and
behaves poorly with 'cursorline' option).
To work around that, instead of trying to hard-justify the lines, just
replace the mega-whitespace with a fixed size of 10 spaces.
Perhaps N/Vim needs a "soft justify" feature?
OpenBSD's man returns all candidates when searching with -w instead of
the first one it finds. So this patch takes the first one if multiple
entries are found.
closes#8372closes#8341
The argument expansion for :Man depends on the number of arguments given to it
starting at the command itself. But user completion functions always provide the
entire command-line which can include modifier commands like :tab, :vert, etc.
leading to a wrong number of arguments.
Prune all arguments up to :Man.
Fixes#7872.
The comment is incorrect, s:error does need to be called. I thought the
call was unnecessary because it didn't show any message for me but I had
shortmess+=F which was hiding the message.
- Improves compatibility with shell=tcsh.
- man.vim: split read_page into get_page, put_page. Do not split the
window until we know there is going to be output.