Merge #11451 'man.vim: Fixes'

This commit is contained in:
Justin M. Keyes 2019-11-24 17:37:47 -08:00 committed by GitHub
commit 544eeeb0d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 6 deletions

View File

@ -139,7 +139,7 @@ function! s:get_page(path) abort
" Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065). " Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065).
" Soft-wrap: ftplugin/man.vim sets wrap/breakindent/…. " Soft-wrap: ftplugin/man.vim sets wrap/breakindent/….
" Hard-wrap: driven by `man`. " Hard-wrap: driven by `man`.
let manwidth = !get(g:,'man_hardwrap') ? 999 : (empty($MANWIDTH) ? winwidth(0) : $MANWIDTH) let manwidth = !get(g:,'man_hardwrap', 1) ? 999 : (empty($MANWIDTH) ? winwidth(0) : $MANWIDTH)
" Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db). " Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
" http://comments.gmane.org/gmane.editors.vim.devel/29085 " http://comments.gmane.org/gmane.editors.vim.devel/29085
" Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces. " Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces.

View File

@ -549,7 +549,9 @@ Variables:
*b:man_default_sects* Comma-separated, ordered list of preferred sections. *b:man_default_sects* Comma-separated, ordered list of preferred sections.
For example in C one usually wants section 3 or 2: > For example in C one usually wants section 3 or 2: >
:let b:man_default_sections = '3,2' :let b:man_default_sections = '3,2'
*g:man_hardwrap* Hard-wrap to $MANWIDTH. May improve layout. *g:man_hardwrap* Hard-wrap to $MANWIDTH or window width if $MANWIDTH is
empty. Enabled by default. Set |FALSE| to enable soft
wrapping.
To use Nvim as a manpager: > To use Nvim as a manpager: >
export MANPAGER='nvim +Man!' export MANPAGER='nvim +Man!'
@ -558,10 +560,13 @@ Note that when running `man` from the shell and with that `MANPAGER` in your
environment, `man` will pre-format the manpage using `groff`. Thus, Neovim environment, `man` will pre-format the manpage using `groff`. Thus, Neovim
will inevitably display the manual page as it was passed to it from stdin. One will inevitably display the manual page as it was passed to it from stdin. One
of the caveats of this is that the width will _always_ be hard-wrapped and not of the caveats of this is that the width will _always_ be hard-wrapped and not
soft wrapped as with `:Man`. You can set in your environment: > soft wrapped as with `g:man_hardwrap=0`. You can set in your environment: >
export MANWIDTH=999 export MANWIDTH=999
So `groff`'s pre-formatting output will be the same as with `:Man` i.e soft-wrapped. So `groff`'s pre-formatting output will be the same as with `g:man_hardwrap=0` i.e soft-wrapped.
To disable bold highlighting: >
:highlight link manBold Normal
PDF *ft-pdf-plugin* PDF *ft-pdf-plugin*

View File

@ -1,4 +1,4 @@
" Maintainer: Anmol Sethi <anmol@aubble.com> " Maintainer: Anmol Sethi <hi@nhooyr.io>
" Previous Maintainer: SungHyun Nam <goweol@gmail.com> " Previous Maintainer: SungHyun Nam <goweol@gmail.com>
if exists('b:did_ftplugin') || &filetype !=# 'man' if exists('b:did_ftplugin') || &filetype !=# 'man'

View File

@ -1,4 +1,4 @@
" Maintainer: Anmol Sethi <anmol@aubble.com> " Maintainer: Anmol Sethi <hi@nhooyr.io>
if exists('g:loaded_man') if exists('g:loaded_man')
finish finish