man.vim: doc fixes #5171

- Weird tab+space combination used for alignment. All spaces now
- Added back <C-T> mapping (somehow we missed that completely)
- Fixed mistake that <Plug>(Man) opens in a new tab. Also added note at
  top on how the window is chosen/opened.
- Clarified q local mapping
- Removed section that shows an example autocmd to add desired folding
  style.
- Removed random line in `usr_12.txt` about `<Leader>` and backslash.
- :Man supports completion, not auto-completion.

Closes #5171
This commit is contained in:
Anmol Sethi
2016-08-07 23:17:56 -04:00
committed by Justin M. Keyes
parent c10fe010f1
commit 79ef4b72d7
4 changed files with 26 additions and 25 deletions

View File

@@ -512,40 +512,41 @@ Local mappings:
MAN *ft-man-plugin* *:Man* *man.vim* MAN *ft-man-plugin* *:Man* *man.vim*
View manpages in Nvim. Supports highlighting, autocompletion, locales, and View manpages in Nvim. Supports highlighting, completion, locales, and
navigation. See also |find-manpage|. navigation. Also see |find-manpage|.
To use Nvim as a manpager:
To use Nvim as a manpager: >
export MANPAGER="nvim -c 'set ft=man' -" export MANPAGER="nvim -c 'set ft=man' -"
man.vim will always attempt to reuse the closest man window (above/left) but
otherwise create a split.
Commands: Commands:
Man {name} Display the manpage for {name} in a window. Man {name} Display the manpage for {name}.
Man {sect} {name} Display the manpage for {name} and section {sect}. Man {sect} {name} Display the manpage for {name} and section {sect}.
Man {name}({sect}) Alternate syntax which auto-completes the section. Man {name}({sect}) Alternate syntax which completes the section.
Man {sect} {name}({sect}) Used during completion to show the real section of Man {sect} {name}({sect}) Used during completion to show the real section of
when the provided section is a prefix, e.g. 1m vs 1. when the provided section is a prefix, e.g. 1m vs 1.
Man {path} Open the manpage specified by path. Use "./" if it Man {path} Open the manpage specified by path. Prepend "./" if
is in the current directory. page is in the current directory.
|:Man| accepts command modifiers. For example, to use a vertical split: >
:vertical Man printf
Global Mappings: Global Mappings:
<Plug>(Man) Jump to the manpage for the <cWORD> under the <Plug>(Man) Jump to the manpage for the <cWORD> under the
cursor in a new tab. Takes a count for the section. cursor. Takes a count for the section.
Local mappings: Local mappings:
K K or CTRL-] Jump to the manpage for the <cWORD> under the
CTRL-] Jump to the manpage for the <cWORD> under the
cursor. Takes a count for the section. cursor. Takes a count for the section.
CTRL-T Jump back to the previous manpage. CTRL-T Jump back to the location that the manpage was
q Close the window. opened from.
q :quit if invoked as $MANPAGER, otherwise :close.
Variables: Variables:
g:no_man_maps Do not create mappings in manpage buffers. *g:no_man_maps* Do not create mappings in manpage buffers.
g:ft_man_folding_enable Fold manpages with foldmethod=indent foldnestmax=1. *g:ft_man_folding_enable* Fold manpages with foldmethod=indent foldnestmax=1.
If you do not like the default folding, use an autocommand to add your desired
folding style instead. For example: >
:autocmd FileType man setlocal foldmethod=indent foldenable
PDF *ft-pdf-plugin* PDF *ft-pdf-plugin*

View File

@@ -258,7 +258,6 @@ To display a man page for the word under the cursor, use this: >
K K
(If you redefined the <Leader>, use it instead of the backslash).
For example, you want to know the return value of "strstr()" while editing For example, you want to know the return value of "strstr()" while editing
this line: this line:

View File

@@ -96,7 +96,7 @@ Options:
Commands: Commands:
|:CheckHealth| |:CheckHealth|
|:Man| has many improvements, including auto-completion |:Man| is available by default, with many improvements such as completion
Functions: Functions:
|execute()| works with |:redir| |execute()| works with |:redir|

View File

@@ -41,8 +41,9 @@ setlocal nolist
setlocal nofoldenable setlocal nofoldenable
if !exists('g:no_plugin_maps') && !exists('g:no_man_maps') if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
nmap <silent> <buffer> <C-]> <Plug>(Man) nmap <silent> <buffer> <C-]> <Plug>(Man)
nmap <silent> <buffer> K <Plug>(Man) nmap <silent> <buffer> K <Plug>(Man)
nnoremap <silent> <buffer> <C-T> :call man#pop_tag()<CR>
if s:pager if s:pager
nnoremap <silent> <buffer> <nowait> q :q<CR> nnoremap <silent> <buffer> <nowait> q :q<CR>
else else