tpope / vim-projectionist

projectionist.vim: Granular project configuration
https://www.vim.org/scripts/script.php?script_id=4989
1.06k stars 67 forks source link

Detect() return nil in help buffer #188

Closed jiz4oh closed 8 months ago

jiz4oh commented 8 months ago

Hi @tpope, there is a wired bug maybe caused by vim that if I jump to a help buffer with :help ***, the s:Detect() https://github.com/tpope/vim-projectionist/blob/afc737df8cb62bf630813edb84fd344b025b8b1a/plugin/projectionist.vim#L65 function will return nil by https://github.com/tpope/vim-projectionist/blob/master/plugin/projectionist.vim#L73.

And the s:Detect() is called by https://github.com/tpope/vim-projectionist/blob/master/plugin/projectionist.vim#L149-L152, seems like the &filetype is empty in help buffer with autocmd event.

The s:Detect() works fine in other situations, e.g. directly open help file by:e /opt/homebrew/Cellar/vim/9.1.0100/share/vim/vim91/doc/helphelp.txt.

You can simply reproduce by :help help

tpope commented 8 months ago

This is the intended behavior. Projectionist activates when you edit a file. It doesn't activate for things like help windows, the quickfix list, terminals, popups, etc.

jiz4oh commented 8 months ago

So is there any workaround that let me control the behavior since the ProjectionistDetect() is private? I actually need the projectionist actives at help windows