fix: gate ft=git attachment on fugitive config toggle

Problem: the `is_fugitive_buffer` guard in the `FileType` callback
checked the buffer name for `fugitive://` without checking whether
the `fugitive` integration was enabled. This meant `ft=git` fugitive
buffers got highlighted even with `fugitive = false`.

Solution: check `get_fugitive_config()` before `is_fugitive_buffer()`.
When `fugitive = false` (default), no `ft=git` buffer gets through.
This commit is contained in:
Barrett Ruth 2026-03-06 11:12:53 -05:00
parent 7c21370759
commit 43ae49ee46
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -22,8 +22,10 @@ vim.api.nvim_create_autocmd('FileType', {
pattern = require('diffs').compute_filetypes(vim.g.diffs or {}), pattern = require('diffs').compute_filetypes(vim.g.diffs or {}),
callback = function(args) callback = function(args)
local diffs = require('diffs') local diffs = require('diffs')
if args.match == 'git' and not diffs.is_fugitive_buffer(args.buf) then if args.match == 'git' then
return if not diffs.get_fugitive_config() or not diffs.is_fugitive_buffer(args.buf) then
return
end
end end
diffs.attach(args.buf) diffs.attach(args.buf)