Skip to content

Is there some manual way to add my own snippets to your plugin, or now I need to clone it and edit by hands? #3

Answered by iurimateus
daniilrozanov asked this question in Q&A
Discussion options

You must be logged in to vote

update:

local ls = require("luasnip")
local utils = require("luasnip-latex-snippets.util.utils")
local is_math = utils.with_opts(utils.is_math, true) -- true to use treesitter
local not_math = utils.with_opts(utils.not_math, true) -- true to use treesitter

-- set a higher priority (defaults to 0 for most snippets)
local snip = ls.parser.parse_snippet(
  { trig = "mk", name = "Math", condition = utils.pipe({ not_math }), priority = 10 },
  "$ ${1:${TM_SELECTED_TEXT}} $$0"
)

ls.add_snippets("tex", { snip }, {
  type = "autosnippets",
})

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@iurimateus
Comment options

@kiryph
Comment options

@iurimateus
Comment options

@iurimateus
Comment options

Answer selected by iurimateus
@grepgrok
Comment options

@iurimateus
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants