neovim: Use Lua snippets for rstate
This commit is contained in:
parent
8205c6a269
commit
321c20de0d
3 changed files with 18 additions and 2 deletions
|
|
@ -576,6 +576,7 @@ return {
|
|||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
build = "make install_jsregexp",
|
||||
init = function()
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
|
|
@ -583,6 +584,7 @@ return {
|
|||
|
||||
-- Put snippets in ./snippets/<filetype>.snippets
|
||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||
require("luasnip.loaders.from_lua").lazy_load()
|
||||
|
||||
local cmp = require('cmp')
|
||||
cmp.setup {
|
||||
|
|
|
|||
16
neovim/luasnippets/react.lua
Normal file
16
neovim/luasnippets/react.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
local snippets = {
|
||||
-- const [show, setShow] = useState(false);
|
||||
s("rstate", {
|
||||
t("const ["),
|
||||
i(1),
|
||||
t(","),
|
||||
l(l._1:gsub("^%l", string.upper):gsub("^", "set"), 1),
|
||||
t("] = useState("),
|
||||
i(0),
|
||||
t(");"),
|
||||
}),
|
||||
}
|
||||
|
||||
local autosnippets = {}
|
||||
|
||||
return snippets, autosnippets
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
snippet rstate const [get, set] = useState(s);
|
||||
const [$1, $2] = useState($0);
|
||||
Loading…
Add table
Add a link
Reference in a new issue