neovim-config/lua/snippets/cpp.lua

26 lines
564 B
Lua
Raw Normal View History

2025-10-22 06:57:49 +02:00
local ls = require("luasnip") -- Import LuaSnip
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
return {
s("main", {
t({ "#include <iostream>", "", "int main() {", " " }),
i(1, "// Code ici"),
t({ "", " return 0;", "}" }),
}),
s("for", {
t("for (int "),
i(1, "i"),
t(" = 0; "),
i(2, "i"),
t(" < "),
i(3, "n"),
t("; ++"),
i(4, "i"),
t({ ") {", " " }),
i(5, "// Corps de la boucle"),
t({ "", "}" }),
}),
}