diff options
-rw-r--r-- | runtime/doc/filetype.txt | 12 | ||||
-rw-r--r-- | runtime/doc/news.txt | 2 | ||||
-rw-r--r-- | runtime/lua/man.lua | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 071a45c9c3..7b576be929 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -626,8 +626,10 @@ Man Open the manpage for the <cWORD> (man buffers) or <cword> (non-man buffers) under the cursor. Man! Display the current buffer contents as a manpage. -|:Man| accepts command modifiers. For example, to use a vertical split: > +|:Man| accepts command modifiers. For example, to use a vertical split: >vim :vertical Man printf +To reuse the current window: >vim + :hide Man printf Local mappings: K or CTRL-] Jump to the manpage for the <cWORD> under the @@ -647,14 +649,14 @@ Variables: empty. Enabled by default. Set |FALSE| to enable soft wrapping. -To use Nvim as a manpager: > +To use Nvim as a manpager: >sh export MANPAGER='nvim +Man!' Note that when running `man` from the shell and with that `MANPAGER` in your environment, `man` will pre-format the manpage using `groff`. Thus, Nvim 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 -soft wrapped as with `g:man_hardwrap=0`. You can set in your environment: > +soft wrapped as with `g:man_hardwrap=0`. You can set in your environment: >sh export MANWIDTH=999 So `groff`'s pre-formatting output will be the same as with `g:man_hardwrap=0` i.e soft-wrapped. @@ -662,6 +664,10 @@ So `groff`'s pre-formatting output will be the same as with `g:man_hardwrap=0` i To disable bold highlighting: > :highlight link manBold Normal +An alternative to using `MANPAGER` in shell can be redefined `man`, for example: >sh + man() { + nvim "+hide Man $1" + } MARKDOWN *ft-markdown-plugin* diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 0402a63cb8..0222d547b0 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -254,6 +254,8 @@ The following new APIs and features were added. node emit a hyperlink. Hyperlinks are UI specific: in the TUI, the OSC 8 control sequence is used. +• |:Man| now supports `:hide` modifier to open page in the current window. + • |vim.ui.open()| opens URIs using the system default handler (macOS `open`, Windows `explorer`, Linux `xdg-open`, etc.) diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index ac15aff60c..a9004db3f4 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -716,7 +716,7 @@ function M.open_page(count, smods, args) local target = ('%s(%s)'):format(name, sect) local ok, ret = pcall(function() - if smods.tab == -1 and find_man() then + if smods.hide or (smods.tab == -1 and find_man()) then vim.cmd.tag({ target, mods = { silent = true, keepalt = true } }) else smods.silent = true |