feat: add telescope.nvim integration

Problem: Telescope never sets `filetype=diff` on preview buffers — it
calls `vim.treesitter.start(bufnr, "diff")` directly, so diffs.nvim's
`FileType` autocmd never fires.

Solution: add a `telescope` config toggle (same pattern as neogit,
gitsigns, committia) and a `User TelescopePreviewerLoaded` autocmd
that calls `attach()` on the preview buffer.
This commit is contained in:
Barrett Ruth 2026-03-06 13:22:18 -05:00
parent 36504a3882
commit 7773c8a876
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
2 changed files with 27 additions and 0 deletions

View file

@ -18,6 +18,16 @@ if gs_cfg == true or type(gs_cfg) == 'table' then
end
end
local tel_cfg = (vim.g.diffs or {}).telescope
if tel_cfg == true or type(tel_cfg) == 'table' then
vim.api.nvim_create_autocmd('User', {
pattern = 'TelescopePreviewerLoaded',
callback = function()
require('diffs').attach(vim.api.nvim_get_current_buf())
end,
})
end
vim.api.nvim_create_autocmd('FileType', {
pattern = require('diffs').compute_filetypes(vim.g.diffs or {}),
callback = function(args)