File tree 6 files changed +18
-7
lines changed
6 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -346,6 +346,9 @@ MiniDeps.add({
346
346
-- adjusts spacing to ensure icons are aligned
347
347
nerd_font_variant = ' normal' ,
348
348
349
+ -- don't show completions or signature help for these filetypes. Keymaps are also disabled.
350
+ blocked_filetypes = {},
351
+
349
352
kind_icons = {
350
353
Text = ' ' ,
351
354
Method = ' ' ,
Original file line number Diff line number Diff line change 134
134
--- @field highlight ? blink.cmp.HighlightConfig
135
135
--- @field nerd_font_variant ? ' mono' | ' normal'
136
136
--- @field kind_icons ? table<string , string>
137
+ --- @field blocked_filetypes ? string[]
137
138
138
139
--- @type blink.cmp.Config
139
140
local config = {
@@ -310,6 +311,9 @@ local config = {
310
311
-- adjusts spacing to ensure icons are aligned
311
312
nerd_font_variant = ' normal' ,
312
313
314
+ -- don't show completions or signature help for these filetypes. Keymaps are also disabled.
315
+ blocked_filetypes = {},
316
+
313
317
kind_icons = {
314
318
Text = ' ' ,
315
319
Method = ' ' ,
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ function keymap.setup(opts)
44
44
-- applied on other autocmds, such as LspAttach used by nvim-lspconfig and most configs
45
45
vim .api .nvim_create_autocmd (' InsertEnter' , {
46
46
callback = function ()
47
- if utils .is_special_buffer () then return end
47
+ if utils .is_ignored_buffer () then return end
48
48
keymap .apply_keymap_to_current_buffer (insert_keys_to_commands , snippet_keys_to_commands )
49
49
end ,
50
50
})
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ function trigger.activate_autocmds()
38
38
return
39
39
40
40
-- ignore if in a special buffer
41
- elseif utils .is_special_buffer () then
41
+ elseif utils .is_ignored_buffer () then
42
42
trigger .hide ()
43
43
44
44
-- character forces a trigger according to the sources, create a fresh context
@@ -61,7 +61,7 @@ function trigger.activate_autocmds()
61
61
62
62
vim .api .nvim_create_autocmd ({ ' CursorMovedI' , ' InsertEnter' }, {
63
63
callback = function (ev )
64
- if utils .is_special_buffer () then return end
64
+ if utils .is_ignored_buffer () then return end
65
65
66
66
-- we were told to ignore the cursor moved event, so we update the context
67
67
-- but don't send an on_show event upstream
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ function trigger.activate_autocmds()
39
39
40
40
for _ , last_char in ipairs (last_chars ) do
41
41
-- ignore if in a special buffer
42
- if utils .is_special_buffer () then
42
+ if utils .is_ignored_buffer () then
43
43
trigger .hide ()
44
44
break
45
45
-- character forces a trigger according to the sources, refresh the existing context if it exists
@@ -60,7 +60,7 @@ function trigger.activate_autocmds()
60
60
-- check if we've moved outside of the context by diffing against the query boundary
61
61
vim .api .nvim_create_autocmd ({ ' CursorMovedI' , ' InsertEnter' }, {
62
62
callback = function (ev )
63
- if utils .is_special_buffer () then return end
63
+ if utils .is_ignored_buffer () then return end
64
64
65
65
-- characters added so let textchanged handle it
66
66
if # last_chars ~= 0 then return end
Original file line number Diff line number Diff line change @@ -28,11 +28,15 @@ function utils.union_keys(t1, t2)
28
28
return vim .tbl_keys (t3 )
29
29
end
30
30
31
- --- Determines whether the current buffer is a "special" buffer
31
+ --- Determines whether the current buffer is a "special" buffer or if the filetype is in the list of ignored filetypes
32
32
--- @return boolean
33
- function utils .is_special_buffer ()
33
+ function utils .is_ignored_buffer ()
34
34
local bufnr = vim .api .nvim_get_current_buf ()
35
35
local buftype = vim .api .nvim_get_option_value (' buftype' , { buf = bufnr })
36
+ local blocked_filetypes = require (' blink.cmp.config' ).blocked_filetypes or {}
37
+ local buf_filetype = vim .api .nvim_get_option_value (' filetype' , { buf = bufnr })
38
+
39
+ if vim .tbl_contains (blocked_filetypes , buf_filetype ) then return true end
36
40
return buftype ~= ' '
37
41
end
38
42
You can’t perform that action at this time.
0 commit comments