mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
man.vim: handle empty identifier from mapping (#5187)
Regression from #5168. Also changed the Man command's nargs to '+' so that man#open_page does not need to handle 0 arguments, because that will never occur.
This commit is contained in:
parent
6da7d6890c
commit
abb0928dfb
@ -30,10 +30,11 @@ function! man#open_page(count, count1, ...) abort
|
|||||||
if a:0 > 2
|
if a:0 > 2
|
||||||
call s:error('too many arguments')
|
call s:error('too many arguments')
|
||||||
return
|
return
|
||||||
elseif a:0 ==# 0
|
|
||||||
call s:error('missing argument')
|
|
||||||
return
|
|
||||||
elseif a:0 ==# 1
|
elseif a:0 ==# 1
|
||||||
|
if empty(a:1)
|
||||||
|
call s:error('no identifier under cursor')
|
||||||
|
return
|
||||||
|
endif
|
||||||
let ref = a:1
|
let ref = a:1
|
||||||
else
|
else
|
||||||
" We combine the name and sect into a manpage reference so that all
|
" We combine the name and sect into a manpage reference so that all
|
||||||
|
@ -5,7 +5,7 @@ if exists('g:loaded_man')
|
|||||||
endif
|
endif
|
||||||
let g:loaded_man = 1
|
let g:loaded_man = 1
|
||||||
|
|
||||||
command! -count=0 -complete=customlist,man#complete -nargs=* Man call man#open_page(v:count, v:count1, <f-args>)
|
command! -count=0 -complete=customlist,man#complete -nargs=+ Man call man#open_page(v:count, v:count1, <f-args>)
|
||||||
|
|
||||||
nnoremap <silent> <Plug>(Man) :<C-U>call man#open_page(v:count, v:count1, &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>'))<CR>
|
nnoremap <silent> <Plug>(Man) :<C-U>call man#open_page(v:count, v:count1, &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>'))<CR>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user