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.
This commit is contained in:
parent
993fed4a45
commit
b2fb49d48b
1 changed files with 4 additions and 2 deletions
|
|
@ -22,9 +22,11 @@ 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
|
||||
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)
|
||||
|
||||
if args.match == 'fugitive' then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue