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:
parent
7c21370759
commit
43ae49ee46
1 changed files with 4 additions and 2 deletions
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue