mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 12:28:18 +00:00

With -count, if the first argument is a number, it is made available with <count>. Problem is, there is always a default count it is impossible to tell whether the user set it. Since v:count and v:count1 still work with 'keywordprg', -count is unnecessary. But 'keywordprg' still calls ':Man' with a count prefixed. So it must still accept a count in the line number position, but not consume the first argument. This is done with -range. Fixes #5202.
16 lines
491 B
VimL
16 lines
491 B
VimL
" Maintainer: Anmol Sethi <anmol@aubble.com>
|
|
|
|
if exists('g:loaded_man')
|
|
finish
|
|
endif
|
|
let g:loaded_man = 1
|
|
|
|
command! -range=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>
|
|
|
|
augroup man
|
|
autocmd!
|
|
autocmd BufReadCmd man://* call man#read_page(matchstr(expand('<amatch>'), 'man://\zs.*'))
|
|
augroup END
|