Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iurimateus/luasnip-latex-snippets.nvim
A port of Gilles Castel's UltiSnip snippets for LuaSnip.
https://github.com/iurimateus/luasnip-latex-snippets.nvim
latex luasnip neovim nvim nvim-plugin snippets
Last synced: 3 months ago
JSON representation
A port of Gilles Castel's UltiSnip snippets for LuaSnip.
- Host: GitHub
- URL: https://github.com/iurimateus/luasnip-latex-snippets.nvim
- Owner: iurimateus
- License: apache-2.0
- Created: 2021-12-17T17:35:36.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-09T10:21:57.000Z (6 months ago)
- Last Synced: 2024-06-25T22:40:10.396Z (5 months ago)
- Topics: latex, luasnip, neovim, nvim, nvim-plugin, snippets
- Language: Lua
- Homepage:
- Size: 37.1 KB
- Stars: 131
- Watchers: 1
- Forks: 50
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# luasnip-latex-snippets
A port of [Gilles Castel's](https://github.com/gillescastel/latex-snippets)
snippets for the [LuaSnip Engine](https://github.com/L3MON4D3/LuaSnip).## Why?
UltiSnips felt unbearably slow. See
and
.## Installation
Depends on [vimtex](https://github.com/lervag/vimtex) to determine if the
cursor is within math mode. Alternatively, you can use
[nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) (experimental) by passing `{ use_treesitter = true }` to the setup call.It's necessary to enable `autosnippets` in luasnip: `require("luasnip").config.setup { enable_autosnippets = true }`.
Can be installed like any neovim plugin. If using
[wbthomason/packer.nvim](https://github.com/wbthomason/packer.nvim):```lua
use {
"iurimateus/luasnip-latex-snippets.nvim",
-- vimtex isn't required if using treesitter
requires = { "L3MON4D3/LuaSnip", "lervag/vimtex" },
config = function()
require'luasnip-latex-snippets'.setup()
-- or setup({ use_treesitter = true })
require("luasnip").config.setup { enable_autosnippets = true }
end,
}
```## Configuration
```
{
use_treesitter = false, -- whether to use treesitter to determine if cursor is in math mode; if false, vimtex is used
allow_on_markdown = true, -- whether to add snippets to markdown filetype
}
```## Misc
The following convention, from
[SirVer/ultisnips](https://github.com/SirVer/ultisnips), is used for naming lua
tables and respective files:```
A: Automatic snippet expansion - snippets will activate as soon as their trigger
matches.w: Word boundary - With this option the snippet trigger will match when the
trigger is a word boundary character. This is the default behavior.b: Beginning of line expansion - A snippet with this option is expanded only if
the trigger is the first word on the line (i.e., only whitespace precedes the
trigger).
```Note that the _regex_ term used in LuaSnip is misleading: it is not a POSIX
regexp. What's actually being used is Lua pattern matching, which has some
limitations. In particular, it lacks positive lookbehind and alternation `|`.
The first which is used in postfix completions (e.g. match `delta`, but not
`\delta`) and can be handled with simple functions. The second was solved by
splitting and/or partially rewriting the expressions.### Adding your own snippets / overrides
See discussion https://github.com/iurimateus/luasnip-latex-snippets.nvim/discussions/3
## Roadmap
- [ ] Tests