fix(man.vim): filetype=man is too eager #15489

Problem:
"set filetype=man" assumes the user wants :Man features, this does extra
stuff like renaming the buffer as "man://".

Solution:
- old entrypoint was ":set filetype=man", but this is too presumptuous #15487
- make the entrypoints more explicit:
  1. when the ":Man" command is run
  2. when a "man://" buffer is opened
- remove the tricky b:man_sect checks in ftplugin/man.vim and syntax/man.vim
- MANPAGER is supported via ":Man!", as documented.

fixes #15487
This commit is contained in:
Justin M. Keyes
2021-08-26 02:50:30 -07:00
committed by GitHub
parent 502a56867d
commit b6b12ea7c3
4 changed files with 17 additions and 23 deletions

View File

@@ -27,11 +27,7 @@ if &filetype != 'man'
finish
endif
if !exists('b:man_sect')
call man#init_pager()
endif
if b:man_sect =~# '^[023]'
if get(b:, 'man_sect', '') =~# '^[023]'
syntax case match
syntax include @c $VIMRUNTIME/syntax/c.vim
syntax match manCFuncDefinition display '\<\h\w*\>\ze\(\s\|\n\)*(' contained