/blink-cmp-latex

A latex source for blink.cmp

Primary LanguageLuaBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

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