Skip to content

Instantly share code, notes, and snippets.

@AlixShahid
Last active November 8, 2021 17:47
Show Gist options
  • Select an option

  • Save AlixShahid/54d728ade6d40741eea7df3d6adbb59e to your computer and use it in GitHub Desktop.

Select an option

Save AlixShahid/54d728ade6d40741eea7df3d6adbb59e to your computer and use it in GitHub Desktop.
Medium-Setting Up Neovim for Web Development - 9
local ls = require("luasnip")
-- some shorthands...
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
-- Every unspecified option will be set to the default.
ls.config.set_config({
history = true,
-- Update more often, :h events for more info.
updateevents = "TextChanged,TextChangedI",
})
ls.snippets = {
all = {
},
html = {
},
}
-- enable html snippets in javascript/javascript(REACT)
ls.snippets.javascript = ls.snippets.html
ls.snippets.javascriptreact = ls.snippets.html
ls.snippets.typescriptreact = ls.snippets.html
require("luasnip/loaders/from_vscode").load({include = {"html"}})
-- You can also use lazy loading so you only get in memory snippets of languages you use
require'luasnip/loaders/from_vscode'.lazy_load()
@AlixShahid

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment