I want to make my custom snippets in latex files. I am using luasnip and this is my config:
{
"hrsh7th/nvim-cmp",
config = function()
require("luasnip.loaders.from_vscode").lazy_load({
paths = { "C:/Users/lenovo/AppData/Local/nvim/snippets" },
})
require("luasnip").filetype_extend("tex", { "latex" })
local cmp = require("cmp")
local ls = require("luasnip")
ls.add_snippets("latex", {
ls.snippet("ttt", {
ls.text_node("HELLO FROM LUA SNIPPET"),
}),
})
When I use this config it works without problems but i want to create a separate folder and get the snippets from there using:
require("luasnip.loaders.from_vscode").lazy_load({
paths = { "C:/Users/lenovo/AppData/Local/nvim/snippets" },})
but when i delete:
ls.add_snippets("latex", {
ls.snippet("ttt", {
ls.text_node("HELLO FROM LUA SNIPPET"),
}),
the snippets don't work.
Inside the snippets folder I have a file latex.json where I put this snippet:
{"test-snippet": {
"prefix": "ttt",
"body": ["HELLO FROM SNIPPET"] }}
And when I enter the command :set filetype? in the .tex file it returns tex.