26 lines
571 B
Lua
26 lines
571 B
Lua
if vim.g.loaded_fugitive_ts then
|
|
return
|
|
end
|
|
vim.g.loaded_fugitive_ts = 1
|
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
pattern = { 'fugitive', 'git' },
|
|
callback = function(args)
|
|
local ft = require('fugitive-ts')
|
|
if args.match == 'git' and not ft.is_fugitive_buffer(args.buf) then
|
|
return
|
|
end
|
|
ft.attach(args.buf)
|
|
end,
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd('OptionSet', {
|
|
pattern = 'diff',
|
|
callback = function()
|
|
if vim.wo.diff then
|
|
require('fugitive-ts').attach_diff()
|
|
else
|
|
require('fugitive-ts').detach_diff()
|
|
end
|
|
end,
|
|
})
|