mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
[RFC] man.vim: remove <Plug> mappings (#5290)
- :Man with no arguments opens the manapage for the <cWORD> (man buffers) or <cword> (non-man buffers). - remove now irrelevent comment about -P flag
This commit is contained in:
parent
626065d385
commit
9bba8ba372
@ -9,8 +9,7 @@ endif
|
||||
let s:man_find_arg = "-w"
|
||||
|
||||
" TODO(nhooyr) Completion may work on SunOS; I'm not sure if `man -l` displays
|
||||
" the list of searched directories. I also do not think Solaris supports the
|
||||
" '-P' flag used above and uses only $PAGER.
|
||||
" the list of searched directories.
|
||||
try
|
||||
if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5'
|
||||
let s:man_find_arg = '-l'
|
||||
@ -23,11 +22,13 @@ function! man#open_page(count, count1, mods, ...) abort
|
||||
if a:0 > 2
|
||||
call s:error('too many arguments')
|
||||
return
|
||||
elseif a:0 ==# 1
|
||||
if empty(a:1)
|
||||
elseif a:0 == 0
|
||||
let ref = &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>')
|
||||
if empty(ref)
|
||||
call s:error('no identifier under cursor')
|
||||
return
|
||||
endif
|
||||
elseif a:0 ==# 1
|
||||
let ref = a:1
|
||||
else
|
||||
" Combine the name and sect into a manpage reference so that all
|
||||
|
@ -529,17 +529,12 @@ 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. Prepend "./" if
|
||||
page is in the current directory.
|
||||
Man Open the manpage for the <cWORD> (man buffers)
|
||||
or <cword> (non-man buffers) under the cursor.
|
||||
|
||||
|:Man| accepts command modifiers. For example, to use a vertical split: >
|
||||
:vertical Man printf
|
||||
|
||||
Global Mappings:
|
||||
<Plug>(man) Jump to the manpage for the <cWORD> (man buffers)
|
||||
or <cword> (non-man buffers) under the cursor.
|
||||
Takes a count for the section.
|
||||
<Plug>(man_vsplit) Same as <Plug>(man) but open in a vertical split.
|
||||
<Plug>(man_tab) Same as <Plug>(man) but open in a new tab.
|
||||
|
||||
Local mappings:
|
||||
K or CTRL-] Jump to the manpage for the <cWORD> under the
|
||||
cursor. Takes a count for the section.
|
||||
|
@ -43,8 +43,8 @@ setlocal nolist
|
||||
setlocal nofoldenable
|
||||
|
||||
if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
|
||||
nmap <silent> <buffer> <C-]> <Plug>(man)
|
||||
nmap <silent> <buffer> K <Plug>(man)
|
||||
nmap <silent> <buffer> <C-]> :Man<CR>
|
||||
nmap <silent> <buffer> K :Man<CR>
|
||||
nnoremap <silent> <buffer> <C-T> :call man#pop_tag()<CR>
|
||||
if s:pager
|
||||
nnoremap <silent> <buffer> <nowait> q :q<CR>
|
||||
|
@ -5,15 +5,7 @@ if exists('g:loaded_man')
|
||||
endif
|
||||
let g:loaded_man = 1
|
||||
|
||||
command! -range=0 -complete=customlist,man#complete -nargs=+ Man call man#open_page(v:count, v:count1, <q-mods>, <f-args>)
|
||||
|
||||
function! s:cword() abort
|
||||
return &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>')
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <Plug>(man) :<C-U>execute 'Man ' .<SID>cword()<CR>
|
||||
nnoremap <silent> <Plug>(man_vsplit) :<C-U>execute 'vertical Man '.<SID>cword()<CR>
|
||||
nnoremap <silent> <Plug>(man_tab) :<C-U>execute 'tab Man ' .<SID>cword()<CR>
|
||||
command! -range=0 -complete=customlist,man#complete -nargs=* Man call man#open_page(v:count, v:count1, <q-mods>, <f-args>)
|
||||
|
||||
augroup man
|
||||
autocmd!
|
||||
|
Loading…
Reference in New Issue
Block a user