From b2269e3b4e4b5e79ca838e5107aa56eaa166dab7 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 25 Mar 2026 11:20:35 -0400 Subject: [PATCH] fix(init): accept fugitive temp buffers in `filetype=git` guard Problem: `:Git show` (and similar fugitive commands) creates temp buffers under `/tmp/` with `filetype=git` instead of `fugitive://` URIs. The `is_fugitive_buffer` check only matched `^fugitive://`, so these buffers were silently skipped by the `FileType` autocmd. Solution: also check `vim.b.git_dir` which fugitive sets on all its managed buffers, including temp output buffers from `:Git` commands. --- plugin/diffs.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/diffs.lua b/plugin/diffs.lua index 2b785ef..cb2e9da 100644 --- a/plugin/diffs.lua +++ b/plugin/diffs.lua @@ -43,7 +43,8 @@ vim.api.nvim_create_autocmd('FileType', { callback = function(args) local diffs = require('diffs') if args.match == 'git' then - local is_fugitive = diffs.get_fugitive_config() and diffs.is_fugitive_buffer(args.buf) + local is_fugitive = diffs.get_fugitive_config() + and (diffs.is_fugitive_buffer(args.buf) or vim.b[args.buf].git_dir ~= nil) local is_committia = diffs.get_committia_config() and vim.api.nvim_buf_get_name(args.buf):match('__committia_diff__$') if not is_fugitive and not is_committia then