https://github.com/marcoslopezm/latex-snippets
Nvim + LaTeX snippets setup
https://github.com/marcoslopezm/latex-snippets
latex lua luasnip nvim snippets
Last synced: about 2 months ago
JSON representation
Nvim + LaTeX snippets setup
- Host: GitHub
- URL: https://github.com/marcoslopezm/latex-snippets
- Owner: MarcosLopezM
- License: mit
- Created: 2025-08-29T07:10:32.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-29T07:22:54.000Z (10 months ago)
- Last Synced: 2025-08-29T11:12:11.939Z (10 months ago)
- Topics: latex, lua, luasnip, nvim, snippets
- Language: Lua
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NVim + LaTeX snippets setup
## NVim configuration
Copy `luasnip.lua` to `~/.config/nvim/lua/plugins` assuming you're using [LazyVim](https://www.lazyvim.org/)
as your plugin manager.
```lua
return {
{
"L3MON4D3/LuaSnip",
build = "make install_jsregexp",
dependencies = {
"rafamadriz/friendly-snippets",
},
config = function()
local ls = require("luasnip")
require("luasnip.loaders.from_lua").lazy_load({
paths = { "~/.config/nvim/lua/snippets", "~/.config/nvim/lua/snippets/tex" },
})
-- User config
ls.config.set_config({
enable_autosnippets = true,
store_selection_keys = "",
update_events = "TextChanged,TextChangedI",
})
-- Keybindings
-- Expand or jump forward
vim.keymap.set({ "i", "s" }, "jk", function()
if ls.expand_or_jumpable() then
return "luasnip-expand-or-jump"
else
return "jk"
end
end, { expr = true, silent = true })
-- Jump backward
vim.keymap.set({ "i", "s" }, "kl", function()
if ls.expand_or_jumpable() then
return "luasnip-jump-prev"
else
return "kl"
end
end, { expr = true, silent = true })
vim.keymap.set({ "i", "s" }, "", function()
if ls.choice_active() then
ls.change_choice(1)
end
end, { silent = true })
ls.filetype_extend("tex", { "htb" })
end,
},
}
```
And copy `tex.lua` to `~/.config/nvim/lua/snippets` to keep thing organized.
> [!NOTE]
> Snippets are still in development, I'm currently learning the syntax and best practices
> of the plugin.