Skip to content

Commit baa2e52

Browse files
authored
Update README.md
1 parent 11482d4 commit baa2e52

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,23 @@ splitting and/or partially rewriting the expressions.
6969

7070
### Adding your own snippets / overrides
7171

72-
See discussion [https://github.com/iurimateus/luasnip-latex-snippets.nvim/discussions/3](https://github.com/iurimateus/luasnip-latex-snippets.nvim/discussions/3#discussioncomment-11348707)
72+
See discussion https://github.com/iurimateus/luasnip-latex-snippets.nvim/discussions/3#discussioncomment-11348745
73+
74+
```lua
75+
local ls = require("luasnip")
76+
local utils = require("luasnip-latex-snippets.util.utils")
77+
local not_math = utils.not_math() -- pass true if using Treesitter
78+
79+
-- set a higher priority (defaults to 0 for most snippets)
80+
local snip = ls.parser.parse_snippet(
81+
{ trig = "mk", name = "Math", condition = not_math, priority = 10 },
82+
"$ ${1:${TM_SELECTED_TEXT}} $$0"
83+
)
84+
85+
ls.add_snippets("tex", { snip }, {
86+
type = "autosnippets",
87+
})
88+
```
7389

7490
## Roadmap
7591

0 commit comments

Comments
 (0)