diff options
-rw-r--r-- | runtime/autoload/man.vim | 24 | ||||
-rw-r--r-- | runtime/plugin/man.vim | 4 |
2 files changed, 14 insertions, 14 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 6c2d4eae8e..072b8a2cd9 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -26,7 +26,7 @@ endtry " 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 " 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 call s:error('too many arguments') return @@ -56,20 +56,20 @@ function! man#open_page(count, count1, ...) abort endtry call s:push_tag() let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')') - let found_man = s:find_man() - if getbufvar(bufname, 'manwidth') ==# s:manwidth() - if found_man - silent execute 'buf' bufnr(bufname) - else - execute 'split' bufname + if a:mods !~# 'tab' && s:find_man() + if s:manwidth() ==# getbufvar(bufname, 'manwidth') + silent execute 'buf' bufname + keepjumps 1 + return endif - keepjumps 1 + noautocmd execute 'edit' bufname + call s:read_page(sect, name) return endif - if found_man - noautocmd execute 'edit' bufname - else - noautocmd execute 'split' bufname + noautocmd execute a:mods 'split' bufname + if s:manwidth() ==# get(b:, 'manwidth') + keepjumps 1 + return endif call s:read_page(sect, name) endfunction diff --git a/runtime/plugin/man.vim b/runtime/plugin/man.vim index d49276047f..f3fe7151ca 100644 --- a/runtime/plugin/man.vim +++ b/runtime/plugin/man.vim @@ -5,9 +5,9 @@ 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, <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 autocmd! |