Skip to content

Toggle lsp source #1787

Answered by tvanyo
tvanyo asked this question in Q&A
Discussion options

You must be logged in to vote

Think I figured this out.

I added a global, vim.g.blink_lspEnable = false, to my init.lua and the following keymap in the appropriate file:

vim.keymap.set({ "n" }, "<leader>bl", function()
	local temp = vim.g.blink_lspEnable
	temp = not temp
	vim.g.blink_lspEnable = temp
end, { desc = "toggle lsp source for completion" })

So that got my variable toggling. Then I added the following the my opts in blink.lua:

		sources = {
				providers = { lsp = {
				enabled = function()
					return vim.g.blink_lspEnable
				end,
			} },
		},

Tested and working as desired.

If you know a cleaner way, would like to see it.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tvanyo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant