LANG: added javascript init

This commit is contained in:
Andrew Haynes
2026-03-29 00:27:54 -04:00
parent 62015919dd
commit d99dc30dcd
+23 -4
View File
@@ -17,6 +17,17 @@ local function extras(guard, file_type, file_name)
end end
M.projects = { M.projects = {
javascript = {
run = function(project_name, project_root)
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
utils.write_file({ full_project_root, "main.js" }, [[
console.log("Hello World!");
]])
local gitignore = { "" }
utils.init_git(full_project_root, gitignore)
vim.cmd("edit " .. full_project_root .. "main.js")
end
},
lua = { lua = {
run = function(project_name, project_root) run = function(project_name, project_root)
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
@@ -89,7 +100,10 @@ setup(
c = { c = {
run = function(project_name, project_root) run = function(project_name, project_root)
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
for _, path in ipairs({ "/src", "/build", "/include" }) do vim.fn.mkdir(full_project_root .. path, "p") end for _, path in ipairs({ "/src", "/build", "/include" }) do
vim.fn.mkdir(
full_project_root .. path, "p")
end
utils.write_file({ full_project_root, ".clang-format" }, [[ utils.write_file({ full_project_root, ".clang-format" }, [[
--- ---
BasedOnStyle: Google BasedOnStyle: Google
@@ -159,7 +173,9 @@ add_executable(%s ${SOURCES})
]], project_name, project_name, project_name)) ]], project_name, project_name, project_name))
local gitignore = { "build/", ".cache/" } local gitignore = { "build/", ".cache/" }
utils.init_git(full_project_root, gitignore) utils.init_git(full_project_root, gitignore)
vim.fn.system(string.format("cd %s/build && cmake -S .. -B . && cmake --build . && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..", full_project_root)) vim.fn.system(string.format(
"cd %s/build && cmake -S .. -B . && cmake --build . && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..",
full_project_root))
vim.cmd("edit " .. full_project_root .. "/src/main.c") vim.cmd("edit " .. full_project_root .. "/src/main.c")
end end
}, },
@@ -242,7 +258,9 @@ add_executable(%s ${SOURCES})
local gitignore = { "build/", ".cache/" } local gitignore = { "build/", ".cache/" }
utils.init_git(full_project_root, gitignore) utils.init_git(full_project_root, gitignore)
vim.fn.system(string.format("cd %s/build && cmake -S .. -B . && cmake --build . && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..", full_project_root)) vim.fn.system(string.format(
"cd %s/build && cmake -S .. -B . && cmake --build . && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..",
full_project_root))
vim.cmd("edit " .. full_project_root .. "/src/main.cpp") vim.cmd("edit " .. full_project_root .. "/src/main.cpp")
end end
}, },
@@ -281,7 +299,8 @@ add_executable(%s ${SOURCES})
M.files = { M.files = {
lua = { lua = {
run = function(file_name) run = function(file_name)
utils.write_file({ utils.get_project_root(), "lua", utils.get_project_name(), file_name .. ".lua"}, "") utils.write_file(
{ utils.get_project_root(), "lua", utils.get_project_name(), file_name .. ".lua" }, "")
end end
}, },
java = { java = {