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:
parent
36504a3882
commit
7773c8a876
2 changed files with 27 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue