mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
man.vim: doc, UX tweaks
s:error: Convention is to highlight the entire message, so stick to that.
This commit is contained in:
parent
42e9606c23
commit
66ceb5a487
@ -27,7 +27,7 @@ function! man#open_page_command(...) abort
|
|||||||
call s:error('too many arguments')
|
call s:error('too many arguments')
|
||||||
return
|
return
|
||||||
elseif a:0 ==# 0
|
elseif a:0 ==# 0
|
||||||
call s:error('what manual page do you want?')
|
call s:error('missing argument')
|
||||||
return
|
return
|
||||||
elseif a:0 ==# 1
|
elseif a:0 ==# 1
|
||||||
let ref = a:000[0]
|
let ref = a:000[0]
|
||||||
@ -221,9 +221,8 @@ endfunction
|
|||||||
|
|
||||||
function! s:error(msg) abort
|
function! s:error(msg) abort
|
||||||
redraw
|
redraw
|
||||||
echon 'man.vim: '
|
|
||||||
echohl ErrorMsg
|
echohl ErrorMsg
|
||||||
echon a:msg
|
echon 'man.vim: ' a:msg
|
||||||
echohl None
|
echohl None
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -512,44 +512,36 @@ Local mappings:
|
|||||||
|
|
||||||
MAN *ft-man-plugin* *:Man* *man.vim*
|
MAN *ft-man-plugin* *:Man* *man.vim*
|
||||||
|
|
||||||
View manpages from the comfort of vim. Features include syntax highlighting,
|
View manpages in Nvim. Supports highlighting, autocompletion, locales, and
|
||||||
smart autocompletion, multilingual support, and manpage jumping.
|
navigation. See also |find-manpage|.
|
||||||
Also see |find-manpage|.
|
|
||||||
|
|
||||||
You can use neovim as a manpager with >
|
To use Nvim as a manpager:
|
||||||
|
|
||||||
export MANPAGER="nvim -c 'set ft=man' -"
|
export MANPAGER="nvim -c 'set ft=man' -"
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
Man {name} Display the manpage for {name} in a new tab.
|
Man {name} Display the manpage for {name} in a window.
|
||||||
Man {sect} {name} Same as above except specify the section.
|
Man {sect} {name} Display the manpage for {name} and section {sect}.
|
||||||
Man {name}({sect}) Alternate syntax to above. Exists so that you can see
|
Man {name}({sect}) Alternate syntax which auto-completes the section.
|
||||||
the section of the manpage you are completing.
|
Man {sect} {name}({sect}) Used during completion to show the real section of
|
||||||
Man {sect} {name}({sect}) This is used during completion to show the real section
|
when the provided section is a prefix, e.g. 1m vs 1.
|
||||||
of a manpage when the provided section is a prefix.
|
Man {path} Open the manpage specified by path. Use "./" if it
|
||||||
E.g. section 1m vs 1.
|
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:
|
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 as the manpage
|
cursor in a new tab. Takes a count for the section.
|
||||||
section.
|
|
||||||
|
|
||||||
Local mappings:
|
Local mappings:
|
||||||
CTRL-] Jump to the manpage for the <cWORD> under the cursor. Takes a count
|
K
|
||||||
as the manpage section.
|
CTRL-] Jump to the manpage for the <cWORD> under the
|
||||||
K Same as CTRL-].
|
cursor. Takes a count for the section.
|
||||||
CTRL-T Jump back to the previous manpage.
|
CTRL-T Jump back to the previous manpage.
|
||||||
q Close the window.
|
q Close the window.
|
||||||
|
|
||||||
Variables:
|
Variables:
|
||||||
g:no_man_maps
|
g:no_man_maps Do not create mappings in manpage buffers.
|
||||||
If set, no mappings are created in man buffers.
|
g:ft_man_folding_enable Fold manpages with foldmethod=indent foldnestmax=1.
|
||||||
|
|
||||||
g:ft_man_folding_enable
|
|
||||||
If set to 1, manpages are folded with foldmethod=indent and
|
|
||||||
foldnestmax=1.
|
|
||||||
|
|
||||||
If you do not like the default folding, use an autocommand to add your desired
|
If you do not like the default folding, use an autocommand to add your desired
|
||||||
folding style instead. For example: >
|
folding style instead. For example: >
|
||||||
|
@ -237,19 +237,8 @@ simple way: Move the cursor to the word you want to find help on and press >
|
|||||||
|
|
||||||
K
|
K
|
||||||
|
|
||||||
Vim will run the external "man" program on the word. If the man page is
|
Nvim will run |:Man| on the word. If the man page is found, it is displayed.
|
||||||
found, it is displayed. This uses the normal pager to scroll through the text
|
You can also use the |:Man| command to open a window on a man page: >
|
||||||
(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: >
|
|
||||||
|
|
||||||
:Man csh
|
:Man csh
|
||||||
|
|
||||||
@ -267,7 +256,7 @@ window.
|
|||||||
|
|
||||||
To display a man page for the word under the cursor, use this: >
|
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).
|
(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
|
||||||
@ -275,7 +264,7 @@ this line:
|
|||||||
|
|
||||||
if ( strstr (input, "aap") == ) ~
|
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().
|
to display the man page for strstr().
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
@ -96,6 +96,7 @@ Options:
|
|||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
|:CheckHealth|
|
|:CheckHealth|
|
||||||
|
|:Man| has many improvements, including auto-completion
|
||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
|execute()| works with |:redir|
|
|execute()| works with |:redir|
|
||||||
|
Loading…
Reference in New Issue
Block a user