man.vim: doc, UX tweaks

s:error: Convention is to highlight the entire message, so stick to that.
This commit is contained in:
Justin M. Keyes 2016-08-04 23:22:51 -04:00
parent 42e9606c23
commit 66ceb5a487
4 changed files with 23 additions and 42 deletions

View File

@ -27,7 +27,7 @@ function! man#open_page_command(...) abort
call s:error('too many arguments')
return
elseif a:0 ==# 0
call s:error('what manual page do you want?')
call s:error('missing argument')
return
elseif a:0 ==# 1
let ref = a:000[0]
@ -221,9 +221,8 @@ endfunction
function! s:error(msg) abort
redraw
echon 'man.vim: '
echohl ErrorMsg
echon a:msg
echon 'man.vim: ' a:msg
echohl None
endfunction

View File

@ -512,44 +512,36 @@ Local mappings:
MAN *ft-man-plugin* *:Man* *man.vim*
View manpages from the comfort of vim. Features include syntax highlighting,
smart autocompletion, multilingual support, and manpage jumping.
Also see |find-manpage|.
View manpages in Nvim. Supports highlighting, autocompletion, locales, and
navigation. See also |find-manpage|.
You can use neovim as a manpager with >
To use Nvim as a manpager:
export MANPAGER="nvim -c 'set ft=man' -"
Commands:
Man {name} Display the manpage for {name} in a new tab.
Man {sect} {name} Same as above except specify the section.
Man {name}({sect}) Alternate syntax to above. Exists so that you can see
the section of the manpage you are completing.
Man {sect} {name}({sect}) This is used during completion to show the real section
of a manpage when the provided section is a prefix.
E.g. section 1m vs 1.
Man {name} Display the manpage for {name} in a window.
Man {sect} {name} Display the manpage for {name} and section {sect}.
Man {name}({sect}) Alternate syntax which auto-completes the section.
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.
Man {path} Open the manpage specified by path. Use "./" if it
is in the current directory.
Man {path} Open the manpage specified by path, if it's in the current
directory, specify the leading ./
Global Mappings:
<Plug>(Man) Jump to the manpage for the <cWORD> under the
cursor in a new tab. Takes a count as the manpage
section.
cursor in a new tab. Takes a count for the section.
Local mappings:
CTRL-] Jump to the manpage for the <cWORD> under the cursor. Takes a count
as the manpage section.
K Same as CTRL-].
K
CTRL-] Jump to the manpage for the <cWORD> under the
cursor. Takes a count for the section.
CTRL-T Jump back to the previous manpage.
q Close the window.
Variables:
g:no_man_maps
If set, no mappings are created in man buffers.
g:ft_man_folding_enable
If set to 1, manpages are folded with foldmethod=indent and
foldnestmax=1.
g:no_man_maps Do not create mappings in manpage buffers.
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: >

View File

@ -237,19 +237,8 @@ simple way: Move the cursor to the word you want to find help on and press >
K
Vim will run the external "man" program on the word. If the man page is
found, it is displayed. This uses the normal pager to scroll through the text
(mostly the "more" program). When you get to the end pressing <Enter> will
get you back into Vim.
A disadvantage is that you can't see the man page and the text you are working
on at the same time. There is a trick to make the man page appear in a Vim
window. First, load the man filetype plugin: >
:runtime! ftplugin/man.vim
Put this command in your vimrc file if you intend to do this often. Now you
can use the ":Man" command to open a window on a man page: >
Nvim will run |:Man| on the word. If the man page is found, it is displayed.
You can also use the |:Man| command to open a window on a man page: >
:Man csh
@ -267,7 +256,7 @@ window.
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
@ -275,7 +264,7 @@ this line:
if ( strstr (input, "aap") == ) ~
Move the cursor to somewhere on "strstr" and type "\K". A window will open
Move the cursor to somewhere on "strstr" and type "K". A window will open
to display the man page for strstr().
==============================================================================

View File

@ -96,6 +96,7 @@ Options:
Commands:
|:CheckHealth|
|:Man| has many improvements, including auto-completion
Functions:
|execute()| works with |:redir|