From b2fb49d48bb94b22910dc8972cdab404e909ee7f Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:13:53 -0500 Subject: [PATCH] fix: gate `ft=git` attachment on `fugitive` config toggle (#163) ## Problem The `is_fugitive_buffer` guard in the `FileType` callback checked the buffer name for `fugitive://` without checking whether the `fugitive` integration was enabled. `ft=git` fugitive buffers got highlighted even with `fugitive = false` (the default). ## Solution Check `get_fugitive_config()` before `is_fugitive_buffer()`. When `fugitive = false` (default), no `ft=git` buffer gets through the guard. --- plugin/diffs.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/diffs.lua b/plugin/diffs.lua index 340df9c..43c5564 100644 --- a/plugin/diffs.lua +++ b/plugin/diffs.lua @@ -22,8 +22,10 @@ vim.api.nvim_create_autocmd('FileType', { pattern = require('diffs').compute_filetypes(vim.g.diffs or {}), callback = function(args) local diffs = require('diffs') - if args.match == 'git' and not diffs.is_fugitive_buffer(args.buf) then - return + if args.match == 'git' then + if not diffs.get_fugitive_config() or not diffs.is_fugitive_buffer(args.buf) then + return + end end diffs.attach(args.buf)