Project Awesome project awesome

saghen/blink.cmp > erooke/blink-cmp-latex

blink.cmp source for LaTeX.

Package 14 stars GitHub

blink-cmp-latex

A latex source for blink.cmp

Install

lazy.nvim

return {
	"saghen/blink.cmp",
	dependencies = {
		"erooke/blink-cmp-latex",
	},

	opts = {
		sources = {
			default = {"latex"},

			providers = {
				latex = {
					name = "Latex",
					module = "blink-cmp-latex",
					opts = {
						-- set to true to insert the latex command instead of the symbol
						insert_command = false
					},
				},
			},
		},
	},
}

Config

Right now the only configuration is insert_command. This needs to be a bool or a function which takes a blink context and returns a bool.

For example if you want to insert the unicode symbols unless you are in a buffer which is using tex you could set it to:

insert_command = function(ctx)
	local ft = vim.api.nvim_get_option_value("filetype", {
		scope = "local",
		buf = ctx.bufnr,
	})
	if ft == "tex" then
		return true
	end
	return false
end

FAQ

Typing symbols (for example: "{}/^()_") resets the match. What gives?

This is how blink is structured and there is not much we can do about it downstream. To work around it I just avoid typing the symbols (for example if I want ⅖ type \25) and trust the fuzzy matching to work around it.

As for why this happens, the short story is: blink resets on symbols and will only use whatever is after the most recent symbol as the search text. There is no way to change this matching logic or otherwise tell it to behave differently. (source)

Back to Neovim