add custom snippets

This commit is contained in:
yongseokj 2024-09-11 09:55:43 -07:00 committed by Yongseok Jin
parent 8aaadac855
commit dfa4d03042
3 changed files with 33 additions and 6 deletions

View File

@ -584,6 +584,7 @@ require('lazy').setup({
cmd = {'/home/utils/llvm-17.0.6/bin/clangd', cmd = {'/home/utils/llvm-17.0.6/bin/clangd',
"--background-index", "--background-index",
"--clang-tidy", "--clang-tidy",
"--header-insertion=iwyu",
"--j=2"}, "--j=2"},
filetypes = {"cpp"}, filetypes = {"cpp"},
single_file_support = true, single_file_support = true,
@ -720,12 +721,14 @@ require('lazy').setup({
-- `friendly-snippets` contains a variety of premade snippets. -- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets: -- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets -- https://github.com/rafamadriz/friendly-snippets
-- { {
-- 'rafamadriz/friendly-snippets', 'rafamadriz/friendly-snippets',
-- config = function() config = function()
-- require('luasnip.loaders.from_vscode').lazy_load() require('luasnip.loaders.from_vscode').lazy_load({ include={"cpp", "python", "lua"} })
-- end, local snip_loader = require('luasnip.loaders.from_vscode')
-- }, snip_loader.lazy_load({ paths = vim.fn.stdpath("config").."/snippets/" })
end,
},
}, },
opts = {}, opts = {},
}, },

13
package.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "custom snippets",
"contributes": {
"snippets": [
{
"language": [
"cpp"
],
"path": "snippets/cpp.json"
}
]
}
}

11
snippets/cpp.json Normal file
View File

@ -0,0 +1,11 @@
{
"iterator": {
"prefix": "iterator",
"body": [
"class Iterator {",
"}",
""
],
"description": "iterator class"
}
}