From 9695fb79be1f4b180d7c33a6ed42f49d24bdac3a Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 7 Jan 2025 11:54:28 +0100 Subject: [PATCH] Disable buffer autocomplete (execpt for comment & strings) --- nvim/lua/plugins/blink.lua | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/nvim/lua/plugins/blink.lua b/nvim/lua/plugins/blink.lua index 9428e7c..e948ca7 100644 --- a/nvim/lua/plugins/blink.lua +++ b/nvim/lua/plugins/blink.lua @@ -5,12 +5,12 @@ return { opts = { keymap = { preset = "default", - [''] = { 'show', }, - [''] = { 'select_and_accept' }, - [''] = { 'select_prev', 'fallback' }, - [''] = { 'select_next', 'fallback' }, - [''] = {}, - [''] = {}, + [""] = { "show", }, + [""] = { "select_and_accept" }, + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + [""] = {}, + ["S-Tab"] = {}, }, completion = { trigger = { @@ -33,6 +33,16 @@ return { download = false, }, }, + sources = { + default = function() + local success, node = pcall(vim.treesitter.get_node) + if success and node and (string.find(node:type(), "comment") or string.find(node:type(), "string")) then + return { "lsp", "path", "buffer" } + end + + return { "lsp" } + end, + }, }, after = function(plug) require("blink-cmp").setup(plug.opts)