✨ feat(nvim): add snippets for neovim dev
This commit is contained in:
parent
3b663d09c7
commit
9500e72a26
2 changed files with 37 additions and 0 deletions
|
@ -38,6 +38,10 @@
|
||||||
{
|
{
|
||||||
"language": "lua",
|
"language": "lua",
|
||||||
"path": "./languages/lua.json"
|
"path": "./languages/lua.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language": "lua",
|
||||||
|
"path": "./projects/nvim.json"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
33
.config/nvim/snippets/projects/nvim.json
Normal file
33
.config/nvim/snippets/projects/nvim.json
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"autocmd": {
|
||||||
|
"body": [
|
||||||
|
"vim.api.nvim_create_autocmd(\"${1:event}\", {",
|
||||||
|
"\tcallback = function()",
|
||||||
|
"\t\t$0",
|
||||||
|
"\tend,",
|
||||||
|
"})"
|
||||||
|
],
|
||||||
|
"prefix": "autocmd"
|
||||||
|
},
|
||||||
|
"autocmd (Filetype)": {
|
||||||
|
"body": [
|
||||||
|
"vim.api.nvim_create_autocmd(\"FileType\", {",
|
||||||
|
"\tpattern = \"${1:ft}\",",
|
||||||
|
"\tcallback = function()",
|
||||||
|
"\t\t$0",
|
||||||
|
"\tend,",
|
||||||
|
"})"
|
||||||
|
],
|
||||||
|
"filetype": "lua",
|
||||||
|
"prefix": "autocmd (Filetype)"
|
||||||
|
},
|
||||||
|
"check if file exists": {
|
||||||
|
"body": "local fileExists = vim.loop.fs_stat(\"${1:filepath}\") ~= nil",
|
||||||
|
"prefix": "check if file exists"
|
||||||
|
},
|
||||||
|
"keymap": {
|
||||||
|
"body": "keymap(\"n\", \"${1:lhs}\", \"${2:rhs}\", { desc = \"${3:description}\" })",
|
||||||
|
"filetype": "lua",
|
||||||
|
"prefix": "keymap"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue