fix(man.vim): ensure buftype=nofile after :tag or :stag #15675

Problem:
`buftype=help` occasionally propagates from help to man buffer. As a result the
next time you open help it opens in the man window, replacing the manpage.

Test case:
    nvim -u NORC
    :Man man
    :set bt?            " should print `buftype=nofile`
    :help
    <C-W><C-W><C-W>c    " go back to :Man window and close it
    :help               " focus help window
    :Man man            " open window with manpage again
    :set bt?            " prints `buftype=help`

Solution:
- call s:set_options()
    - man#read_page() (called by autocmd BufReadCmd man://*) should already do
      this. But BufReadCmd doesn't fire for already-existing man:// buffers.

Fix #15650
This commit is contained in:
zeertzjq 2021-09-16 21:51:26 +08:00 committed by GitHub
parent 685cf39813
commit 29bc648d2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,6 +58,7 @@ function! man#open_page(count, mods, ...) abort
else else
execute 'silent keepalt' a:mods 'stag' l:target execute 'silent keepalt' a:mods 'stag' l:target
endif endif
call s:set_options(v:false)
finally finally
call setbufvar(l:buf, '&tagfunc', l:save_tfu) call setbufvar(l:buf, '&tagfunc', l:save_tfu)
endtry endtry