Merge pull request #13417 from shade-of-noon/man_count.13411

runtime: Fix man.vim count handling.
This commit is contained in:
James McCoy
2020-12-04 18:36:54 -05:00
committed by GitHub
2 changed files with 4 additions and 6 deletions

View File

@@ -18,7 +18,7 @@ function! man#init() abort
endtry endtry
endfunction endfunction
function! man#open_page(count, count1, mods, ...) abort function! man#open_page(count, mods, ...) abort
if a:0 > 2 if a:0 > 2
call s:error('too many arguments') call s:error('too many arguments')
return return
@@ -39,9 +39,7 @@ function! man#open_page(count, count1, mods, ...) abort
endif endif
try try
let [sect, name] = s:extract_sect_and_name_ref(ref) let [sect, name] = s:extract_sect_and_name_ref(ref)
if a:count ==# a:count1 if a:count >= 0
" v:count defaults to 0 which is a valid section, and v:count1 defaults to
" 1, also a valid section. If they are equal, count explicitly set.
let sect = string(a:count) let sect = string(a:count)
endif endif
let path = s:verify_exists(sect, name) let path = s:verify_exists(sect, name)

View File

@@ -5,9 +5,9 @@ if exists('g:loaded_man')
endif endif
let g:loaded_man = 1 let g:loaded_man = 1
command! -bang -bar -range=0 -complete=customlist,man#complete -nargs=* Man command! -bang -bar -range=-1 -complete=customlist,man#complete -nargs=* Man
\ if <bang>0 | set ft=man | \ if <bang>0 | set ft=man |
\ else | call man#open_page(v:count, v:count1, <q-mods>, <f-args>) | endif \ else | call man#open_page(<count>, <q-mods>, <f-args>) | endif
augroup man augroup man
autocmd! autocmd!