From 29bc648d2b259d434c46f3eb28d3513d2a4aef11 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 16 Sep 2021 21:51:26 +0800 Subject: [PATCH] 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 " 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 --- runtime/autoload/man.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 8bf95651b7..4f132b6121 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -58,6 +58,7 @@ function! man#open_page(count, mods, ...) abort else execute 'silent keepalt' a:mods 'stag' l:target endif + call s:set_options(v:false) finally call setbufvar(l:buf, '&tagfunc', l:save_tfu) endtry