ntpeters / vim-better-whitespace

Better whitespace highlighting for Vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to disable this plugin in Fugitive status buffer?

cyrus-and opened this issue · comments

Here's a minimal .vimrc containing my attempt:

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'

Plugin 'ntpeters/vim-better-whitespace'
let g:better_whitespace_filetypes_blacklist = ['fugitive']
let g:better_whitespace_enabled = 1

Plugin 'tpope/vim-fugitive'

call vundle#end()

Reproduce it with the following:

cd $(mktemp -d)
git init
echo >foo
git add foo
git commit -m foo
echo >>foo
vim

Then, inside Vim, :G, <C-N>, =. The outcome is:

Screenshot 2020-07-01 at 3 37 11 PM

What's the &filetype in this buffer?

:set filetype?
filetype=fugitive

OK this happens in VIM 8.1 (macOS) but not on VIM 8.2 (Homebrew).

OK this happens in VIM 8.1 (macOS) but not on VIM 8.2 (Homebrew).

Well, no that's not exactly true, it's sufficient to refresh the content of the Fugitive buffer as a last step (:e) to trigger the issue again, even with VIM 8.2.

So this is possibly similar to #108. Some corner cases of setting the filetype slip by our detection. In particular we don’t re-detect on new filetype events, of which there might be several. I think the main reason for that is to not override the user’s manual calls to Enable/DisableWhitespace (especially when set from an autocommand e.g. matching on some paths). There might be other reasons that I can’t recall right now.

Anyways, maybe the workaround there also works for you, in the mean time:

au FileType fugitive DisableWhitespace

Thanks it actually works.

Closing as this issue is tracked in #108