mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
parent
8a7b15cf35
commit
728d582333
@ -26,7 +26,7 @@ endtry
|
|||||||
" by the user. count defaults to 0 which is a valid section and
|
" by the user. count defaults to 0 which is a valid section and
|
||||||
" count1 defaults to 1 which is also a valid section. Only when they
|
" count1 defaults to 1 which is also a valid section. Only when they
|
||||||
" are equal was the count explicitly set.
|
" are equal was the count explicitly set.
|
||||||
function! man#open_page(count, count1, ...) abort
|
function! man#open_page(count, count1, mods, ...) abort
|
||||||
if a:0 > 2
|
if a:0 > 2
|
||||||
call s:error('too many arguments')
|
call s:error('too many arguments')
|
||||||
return
|
return
|
||||||
@ -56,20 +56,20 @@ function! man#open_page(count, count1, ...) abort
|
|||||||
endtry
|
endtry
|
||||||
call s:push_tag()
|
call s:push_tag()
|
||||||
let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')')
|
let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')')
|
||||||
let found_man = s:find_man()
|
if a:mods !~# 'tab' && s:find_man()
|
||||||
if getbufvar(bufname, 'manwidth') ==# s:manwidth()
|
if s:manwidth() ==# getbufvar(bufname, 'manwidth')
|
||||||
if found_man
|
silent execute 'buf' bufname
|
||||||
silent execute 'buf' bufnr(bufname)
|
keepjumps 1
|
||||||
else
|
return
|
||||||
execute 'split' bufname
|
|
||||||
endif
|
endif
|
||||||
keepjumps 1
|
noautocmd execute 'edit' bufname
|
||||||
|
call s:read_page(sect, name)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
if found_man
|
noautocmd execute a:mods 'split' bufname
|
||||||
noautocmd execute 'edit' bufname
|
if s:manwidth() ==# get(b:, 'manwidth')
|
||||||
else
|
keepjumps 1
|
||||||
noautocmd execute 'split' bufname
|
return
|
||||||
endif
|
endif
|
||||||
call s:read_page(sect, name)
|
call s:read_page(sect, name)
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -5,9 +5,9 @@ if exists('g:loaded_man')
|
|||||||
endif
|
endif
|
||||||
let g:loaded_man = 1
|
let g:loaded_man = 1
|
||||||
|
|
||||||
command! -range=0 -complete=customlist,man#complete -nargs=+ Man call man#open_page(v:count, v:count1, <f-args>)
|
command! -range=0 -complete=customlist,man#complete -nargs=+ Man call man#open_page(v:count, v:count1, <q-mods>, <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>
|
||||||
|
|
||||||
augroup man
|
augroup man
|
||||||
autocmd!
|
autocmd!
|
||||||
|
Loading…
Reference in New Issue
Block a user