Compare commits
6
Commits
3046a3ce36
..
v2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72951f7327 | ||
|
|
4765da0539 | ||
|
|
9f4649b5d2 | ||
|
|
e8c55ec18f | ||
|
|
fcde51bc05 | ||
|
|
9eefdb6166 |
@@ -30,8 +30,8 @@ Vern.nvim currently supports the following languages:
|
|||||||
|
|
||||||
* Python
|
* Python
|
||||||
* C / C++
|
* C / C++
|
||||||
<!-- * Java -->
|
* Lua
|
||||||
<!-- * Lua -->
|
* Java
|
||||||
<!-- * Rust -->
|
<!-- * Rust -->
|
||||||
<!-- * HTML -->
|
<!-- * HTML -->
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,16 @@ M.create_file = function(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local raw_path = vim.fs.joinpath(mod.path, mod.name)
|
local raw_path = vim.fs.joinpath(mod.path, mod.name)
|
||||||
local context = { project_name = utils.proj_name(), name = fname }
|
local context = {
|
||||||
|
project_name = utils.proj_name(),
|
||||||
|
company_name = opts.env.author,
|
||||||
|
file_name = fname,
|
||||||
|
}
|
||||||
local path = utils.resolve_path(raw_path, opts.c.dirs or {}, context)
|
local path = utils.resolve_path(raw_path, opts.c.dirs or {}, context)
|
||||||
local root = utils.proj_root()
|
local root = utils.proj_root()
|
||||||
utils.dump(
|
utils.dump(
|
||||||
vim.fs.joinpath(root, path),
|
vim.fs.joinpath(root, path),
|
||||||
require("vern-nvim.templates").fetch(mod.kind_path, mod.kind, fname)
|
require("vern-nvim.templates").fetch(mod.kind_path, mod.kind, context)
|
||||||
)
|
)
|
||||||
vim.cmd.edit(vim.fn.expand(path))
|
vim.cmd.edit(vim.fn.expand(path))
|
||||||
vim.notify(fname .. " has been created!", vim.log.levels.INFO, { title = "Vern File" })
|
vim.notify(fname .. " has been created!", vim.log.levels.INFO, { title = "Vern File" })
|
||||||
|
|||||||
@@ -30,12 +30,16 @@ M.create_file = function(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local raw_path = vim.fs.joinpath(mod.path, mod.name)
|
local raw_path = vim.fs.joinpath(mod.path, mod.name)
|
||||||
local context = { project_name = utils.proj_name(), name = fname }
|
local context = {
|
||||||
|
project_name = utils.proj_name(),
|
||||||
|
company_name = opts.env.author,
|
||||||
|
file_name = fname,
|
||||||
|
}
|
||||||
local path = utils.resolve_path(raw_path, opts.cpp.dirs or {}, context)
|
local path = utils.resolve_path(raw_path, opts.cpp.dirs or {}, context)
|
||||||
local root = utils.proj_root()
|
local root = utils.proj_root()
|
||||||
utils.dump(
|
utils.dump(
|
||||||
vim.fs.joinpath(root, path),
|
vim.fs.joinpath(root, path),
|
||||||
require("vern-nvim.templates").fetch(mod.kind_path, mod.kind, fname)
|
require("vern-nvim.templates").fetch(mod.kind_path, mod.kind, context)
|
||||||
)
|
)
|
||||||
vim.cmd.edit(vim.fn.expand(path))
|
vim.cmd.edit(vim.fn.expand(path))
|
||||||
vim.notify(fname .. " has been created!", vim.log.levels.INFO, { title = "Vern File" })
|
vim.notify(fname .. " has been created!", vim.log.levels.INFO, { title = "Vern File" })
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local action_utils = require("vern-nvim.actions.utils")
|
---TODO
|
||||||
|
---Split filetype only and just change a filetype variable and vairables both share and then run the duplicate code
|
||||||
|
|
||||||
local utils = require("vern-nvim.utils")
|
local utils = require("vern-nvim.utils")
|
||||||
local templates = require("vern-nvim.templates")
|
local templates = require("vern-nvim.templates")
|
||||||
|
|
||||||
@@ -26,7 +28,47 @@ M.create_project = function(opts)
|
|||||||
end
|
end
|
||||||
local root =
|
local root =
|
||||||
vim.fs.joinpath(vim.fn.expand(args.workspace_root), args[ft].root, pname)
|
vim.fs.joinpath(vim.fn.expand(args.workspace_root), args[ft].root, pname)
|
||||||
local bin = action_utils.create(args[ft], pname, root)
|
|
||||||
|
local ctx = {
|
||||||
|
project_name = pname,
|
||||||
|
company_name = args.env.author,
|
||||||
|
file_name = "",
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.fn.mkdir(root, "p")
|
||||||
|
|
||||||
|
for _, dir in pairs(args[ft].dirs) do
|
||||||
|
local path = vim.fs.normalize(vim.fs.joinpath(root, utils.fmt(dir, ctx)))
|
||||||
|
vim.fn.mkdir(path, "p")
|
||||||
|
end
|
||||||
|
|
||||||
|
local bin
|
||||||
|
for tbl_name, tbl in pairs(args[ft].templates.project) do
|
||||||
|
local raw_path = vim.fs.joinpath(tbl.path, tbl.name)
|
||||||
|
local path = utils.resolve_path(raw_path, args[ft].dirs, ctx)
|
||||||
|
if tbl_name == "primary" then
|
||||||
|
bin = vim.fs.joinpath(root, path)
|
||||||
|
end
|
||||||
|
local abs_file_path = vim.fs.normalize(vim.fs.joinpath(root, path))
|
||||||
|
local abs_dir_path = vim.fs.dirname(abs_file_path)
|
||||||
|
if abs_dir_path ~= root and not vim.startswith(root, abs_dir_path) then
|
||||||
|
vim.fn.mkdir(abs_dir_path, "p")
|
||||||
|
end
|
||||||
|
utils.dump(abs_file_path, templates.fetch(tbl.kind_path, tbl.kind, ctx))
|
||||||
|
end
|
||||||
|
for _, tbl in pairs(args[ft].templates.extras) do
|
||||||
|
if tbl.enabled then
|
||||||
|
local raw_path = vim.fs.joinpath(tbl.path, tbl.name)
|
||||||
|
local path = utils.resolve_path(raw_path, args[ft].dirs, ctx)
|
||||||
|
local abs_file_path = vim.fs.normalize(vim.fs.joinpath(root, path))
|
||||||
|
local abs_dir_path = vim.fs.dirname(abs_file_path)
|
||||||
|
if abs_dir_path ~= root and not vim.startswith(root, abs_dir_path) then
|
||||||
|
vim.fn.mkdir(abs_dir_path, "p")
|
||||||
|
end
|
||||||
|
utils.dump(abs_file_path, templates.fetch(tbl.kind_path, tbl.kind, ctx))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
utils.init_git(root, ft)
|
utils.init_git(root, ft)
|
||||||
utils.init_readme(root)
|
utils.init_readme(root)
|
||||||
if ok and actions and type(actions.create_project) == "function" then
|
if ok and actions and type(actions.create_project) == "function" then
|
||||||
@@ -45,22 +87,18 @@ end
|
|||||||
|
|
||||||
M.create_file = function(opts)
|
M.create_file = function(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
vim.ui.input({
|
local filetype = vim.bo.filetype
|
||||||
prompt = "File language (e.g. python): ",
|
|
||||||
completion = "filetype",
|
local function continue_filetype(ft)
|
||||||
}, function(ft)
|
filetype = ft
|
||||||
ft = ft and vim.trim(ft)
|
local ok, actions = pcall(require, "vern-nvim.actions." .. filetype)
|
||||||
if not ft or vim.trim(ft) == "" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local ok, actions = pcall(require, "vern-nvim.actions." .. ft)
|
|
||||||
if not ok then
|
if not ok then
|
||||||
vim.notify("Unknown Filetype: " .. ft, vim.log.levels.WARN, {
|
vim.notify("Unknown Filetype: " .. filetype, vim.log.levels.WARN, {
|
||||||
title = "Vern File",
|
title = "Vern File",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local configs = require("vern-nvim.configs." .. ft)
|
local configs = require("vern-nvim.configs." .. filetype)
|
||||||
local args = vim.tbl_deep_extend("force", {}, configs, opts or {})
|
local args = vim.tbl_deep_extend("force", {}, configs, opts or {})
|
||||||
|
|
||||||
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
|
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
|
||||||
@@ -71,17 +109,42 @@ M.create_file = function(opts)
|
|||||||
|
|
||||||
local mod
|
local mod
|
||||||
if ok and actions and type(actions.create_file) == "function" then
|
if ok and actions and type(actions.create_file) == "function" then
|
||||||
mod = actions.create_file(args[ft]) or args[ft].templates.file.source or {}
|
mod = actions.create_file(args[filetype])
|
||||||
|
or args[filetype].templates.file.source
|
||||||
|
or {}
|
||||||
end
|
end
|
||||||
local raw_path = vim.fs.joinpath(mod.path, mod.name)
|
local raw_path = vim.fs.joinpath(mod.path, mod.name)
|
||||||
local context = { project_name = utils.proj_name(), name = fname }
|
local context = {
|
||||||
local path = utils.resolve_path(raw_path, args[ft].dirs or {}, context)
|
project_name = utils.proj_name(),
|
||||||
|
company_name = opts.env.author,
|
||||||
|
file_name = fname,
|
||||||
|
}
|
||||||
|
local path = utils.resolve_path(raw_path, args[filetype].dirs or {}, context)
|
||||||
local root = utils.proj_root()
|
local root = utils.proj_root()
|
||||||
utils.dump(vim.fs.joinpath(root, path), templates.fetch(mod.kind_path, mod.kind, fname))
|
utils.dump(
|
||||||
vim.cmd.edit(vim.fn.expand(path))
|
vim.fs.joinpath(root, path),
|
||||||
|
templates.fetch(mod.kind_path, mod.kind, context)
|
||||||
|
)
|
||||||
|
vim.cmd.edit(vim.fn.fnameescape(path))
|
||||||
vim.notify(fname .. " has been created!", vim.log.levels.INFO, { title = "Vern File" })
|
vim.notify(fname .. " has been created!", vim.log.levels.INFO, { title = "Vern File" })
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
local ft_ok, ft_config = pcall(require, "vern-nvim.configs." .. filetype)
|
||||||
|
if not filetype or filetype == "" or not ft_ok or type(ft_config) ~= "table" then
|
||||||
|
vim.ui.input({
|
||||||
|
prompt = "File language (e.g. python): ",
|
||||||
|
completion = "filetype",
|
||||||
|
}, function(ft)
|
||||||
|
ft = ft and vim.trim(ft)
|
||||||
|
if not ft or vim.trim(ft) == "" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
continue_filetype(ft)
|
||||||
end)
|
end)
|
||||||
|
else
|
||||||
|
continue_filetype(filetype)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
local utils = require("vern-nvim.utils")
|
||||||
|
|
||||||
|
M.create_project = function() end
|
||||||
|
|
||||||
|
M.create_file = function() end
|
||||||
|
|
||||||
|
---@param opts VernJavaConfig Takes a table for the runtime
|
||||||
|
function M.run(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
local root = utils.proj_root() or "."
|
||||||
|
local context = {
|
||||||
|
project_name = utils.proj_name(),
|
||||||
|
company_name = opts.env.author,
|
||||||
|
file_name = "",
|
||||||
|
}
|
||||||
|
|
||||||
|
local src_root =
|
||||||
|
vim.fs.joinpath(root, utils.resolve_path(opts.java.dirs.src, opts.java.dirs, context))
|
||||||
|
local build_dir = root .. "/bin"
|
||||||
|
local build_cmd = string.format(
|
||||||
|
"javac -d %s -sourcepath %s $(find %s -name '*java')",
|
||||||
|
build_dir,
|
||||||
|
src_root,
|
||||||
|
src_root
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.system({ "sh", "-c", build_cmd }, { text = true }, function(obj)
|
||||||
|
if obj.code ~= 0 then
|
||||||
|
vim.schedule(function()
|
||||||
|
local error_obj = (obj.stderr ~= "" and obj.stderr) or obj.stdout or ""
|
||||||
|
local error_lines = vim.list_extend(
|
||||||
|
{ "Error During compilation" },
|
||||||
|
vim.split(error_obj, "\n", { trimempty = true })
|
||||||
|
)
|
||||||
|
local buf, _ = utils.term({ "echo 'compilation failed'" }, opts.terminal, true)
|
||||||
|
if buf and vim.api.nvim_buf_is_valid(buf) then
|
||||||
|
vim.api.nvim_set_option_value("modifiable", true, { buf = buf })
|
||||||
|
vim.api.nvim_buf_set_lines(buf, 0, -1, false, error_lines)
|
||||||
|
vim.api.nvim_set_option_value("modifiable", false, { buf = buf })
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
vim.schedule(function()
|
||||||
|
local run_cmd = string.format(
|
||||||
|
"java -cp %s com.%s.%s.Main",
|
||||||
|
build_dir,
|
||||||
|
context.company_name,
|
||||||
|
context.project_name
|
||||||
|
)
|
||||||
|
utils.term({ run_cmd }, opts.terminal, false)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -13,11 +13,15 @@ M.create_file = function() end
|
|||||||
function M.run(opts)
|
function M.run(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local root = utils.proj_root() or "."
|
local root = utils.proj_root() or "."
|
||||||
local pname = vim.fs.basename(root)
|
local context = {
|
||||||
|
project_name = utils.proj_name(),
|
||||||
|
company_name = opts.env.author,
|
||||||
|
file_name = "",
|
||||||
|
}
|
||||||
local bin = opts.python.templates.project.primary
|
local bin = opts.python.templates.project.primary
|
||||||
|
|
||||||
local exe = vim.fs.joinpath(bin.path, bin.name) or "src/{project_name}/main.py"
|
local exe = vim.fs.joinpath(bin.path, bin.name) or "src/{project_name}/main.py"
|
||||||
local exe_path = utils.resolve_path(exe, opts.python.dirs, { project_name = pname })
|
local exe_path = utils.resolve_path(exe, opts.python.dirs, context)
|
||||||
local full_path = vim.fs.joinpath(vim.fn.expand(root), exe_path)
|
local full_path = vim.fs.joinpath(vim.fn.expand(root), exe_path)
|
||||||
utils.term({ "python3 " .. full_path }, opts.terminal or {}, false)
|
utils.term({ "python3 " .. full_path }, opts.terminal or {}, false)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
local utils = require("vern-nvim.utils")
|
|
||||||
local templates = require("vern-nvim.templates")
|
|
||||||
|
|
||||||
local join = vim.fs.joinpath
|
|
||||||
|
|
||||||
---@param cfg table Language config
|
|
||||||
---@param pname string Name of project
|
|
||||||
---@param root string Project location
|
|
||||||
---@return string bin Location of executable
|
|
||||||
function M.create(cfg, pname, root)
|
|
||||||
local ctx = { project_name = pname }
|
|
||||||
|
|
||||||
vim.fn.mkdir(root, "p")
|
|
||||||
local bin
|
|
||||||
|
|
||||||
for _, dir in pairs(cfg.dirs) do
|
|
||||||
local path = vim.fs.normalize(join(root, utils.fmt(dir, ctx)))
|
|
||||||
vim.fn.mkdir(path, "p")
|
|
||||||
end
|
|
||||||
|
|
||||||
for tbl_name, tbl in pairs(cfg.templates.project) do
|
|
||||||
local raw_path = join(tbl.path, tbl.name)
|
|
||||||
local path = utils.resolve_path(raw_path, cfg.dirs, ctx)
|
|
||||||
if tbl_name == "primary" then
|
|
||||||
bin = join(root, path)
|
|
||||||
end
|
|
||||||
local abs_file_path = vim.fs.normalize(join(root, path))
|
|
||||||
local abs_dir_path = vim.fs.dirname(abs_file_path)
|
|
||||||
if abs_dir_path ~= root and not vim.startswith(root, abs_dir_path) then
|
|
||||||
vim.fn.mkdir(abs_dir_path, "p")
|
|
||||||
end
|
|
||||||
utils.dump(abs_file_path, templates.fetch(tbl.kind_path, tbl.kind, pname))
|
|
||||||
end
|
|
||||||
for _, tbl in pairs(cfg.templates.extras) do
|
|
||||||
if tbl.enabled then
|
|
||||||
local raw_path = join(tbl.path, tbl.name)
|
|
||||||
local path = utils.resolve_path(raw_path, cfg.dirs, ctx)
|
|
||||||
local abs_file_path = vim.fs.normalize(join(root, path))
|
|
||||||
local abs_dir_path = vim.fs.dirname(abs_file_path)
|
|
||||||
if abs_dir_path ~= root and not vim.startswith(root, abs_dir_path) then
|
|
||||||
vim.fn.mkdir(abs_dir_path, "p")
|
|
||||||
end
|
|
||||||
utils.dump(abs_file_path, templates.fetch(tbl.kind_path, tbl.kind, pname))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return bin
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
local config = require("vern-nvim.configs.c")
|
|
||||||
|
|
||||||
---@param bufnr integer Buffer to activate on : defaults to 0
|
|
||||||
---@param user_opts? VernCConfig
|
|
||||||
return function(bufnr, user_opts)
|
|
||||||
---@type VernCConfig
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, config, user_opts or {})
|
|
||||||
for key, def in pairs(opts.c.keybinds or {}) do
|
|
||||||
if type(def.action) == "function" then
|
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, def.user_command, function()
|
|
||||||
def.action(opts)
|
|
||||||
end, { nargs = "*", desc = def.desc })
|
|
||||||
vim.keymap.set("n", key, function()
|
|
||||||
def.action(opts)
|
|
||||||
end, {
|
|
||||||
buffer = bufnr,
|
|
||||||
silent = true,
|
|
||||||
desc = def.desc,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
local config = require("vern-nvim.configs.cpp")
|
|
||||||
|
|
||||||
---@param bufnr integer Buffer to activate on : defaults to 0
|
|
||||||
---@param user_opts? VernCPPConfig
|
|
||||||
return function(bufnr, user_opts)
|
|
||||||
---@type VernCPPConfig
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, config, user_opts or {})
|
|
||||||
for key, def in pairs(opts.cpp.keybinds or {}) do
|
|
||||||
if type(def.action) == "function" then
|
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, def.user_command, function()
|
|
||||||
def.action(opts)
|
|
||||||
end, { nargs = "*", desc = def.desc })
|
|
||||||
vim.keymap.set("n", key, function()
|
|
||||||
def.action(opts)
|
|
||||||
end, {
|
|
||||||
buffer = bufnr,
|
|
||||||
silent = true,
|
|
||||||
desc = def.desc,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
local config = require("vern-nvim.configs.lua")
|
|
||||||
|
|
||||||
---@param bufnr integer Buffer to activate on : defaults to 0
|
|
||||||
---@param user_opts? VernLuaConfig
|
|
||||||
return function(bufnr, user_opts)
|
|
||||||
---@type VernLuaConfig
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, config, user_opts or {})
|
|
||||||
for key, def in pairs(opts.lua.keybinds or {}) do
|
|
||||||
if type(def.action) == "function" then
|
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, def.user_command, function()
|
|
||||||
def.action(opts)
|
|
||||||
end, { nargs = "*", desc = def.desc })
|
|
||||||
vim.keymap.set("n", key, function()
|
|
||||||
def.action(opts)
|
|
||||||
end, {
|
|
||||||
buffer = bufnr,
|
|
||||||
silent = true,
|
|
||||||
desc = def.desc,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
local config = require("vern-nvim.configs.python")
|
|
||||||
|
|
||||||
---@param bufnr integer Buffer to activate on : defaults to 0
|
|
||||||
---@param user_opts? VernPythonConfig
|
|
||||||
return function(bufnr, user_opts)
|
|
||||||
---@type VernPythonConfig
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, config, user_opts or {})
|
|
||||||
for key, def in pairs(opts.python.keybinds or {}) do
|
|
||||||
if type(def.action) == "function" then
|
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, def.user_command, function()
|
|
||||||
def.action(opts)
|
|
||||||
end, { nargs = "*", desc = def.desc })
|
|
||||||
vim.keymap.set("n", key, function()
|
|
||||||
def.action(opts)
|
|
||||||
end, {
|
|
||||||
buffer = bufnr,
|
|
||||||
silent = true,
|
|
||||||
desc = def.desc,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local root = require("vern-nvim.utils").proj_root()
|
|
||||||
if not root then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local venv_dir = nil
|
|
||||||
if vim.uv.fs_stat(root .. "/venv/bin/python") then
|
|
||||||
venv_dir = root .. "/venv"
|
|
||||||
elseif vim.uv.fs_stat(root .. "/.venv/bin/python") then
|
|
||||||
venv_dir = root .. "/.venv"
|
|
||||||
end
|
|
||||||
if venv_dir then
|
|
||||||
vim.env.VIRTUAL_ENV = venv_dir
|
|
||||||
vim.env.PATH = venv_dir .. "/bin:" .. vim.env.PATH
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
M.attach = function() end
|
||||||
|
|
||||||
---@type VernLanguageConfig
|
---@type VernLanguageConfig
|
||||||
M.c = {
|
M.c = {
|
||||||
root = "C",
|
root = "C",
|
||||||
@@ -43,13 +45,13 @@ M.c = {
|
|||||||
file = {
|
file = {
|
||||||
header = {
|
header = {
|
||||||
path = "{dirs.include}",
|
path = "{dirs.include}",
|
||||||
name = "{name}.h",
|
name = "{file_name}.h",
|
||||||
kind = "header",
|
kind = "header",
|
||||||
kind_path = "vern-nvim.templates.c",
|
kind_path = "vern-nvim.templates.c",
|
||||||
},
|
},
|
||||||
source = {
|
source = {
|
||||||
path = "{dirs.src}",
|
path = "{dirs.src}",
|
||||||
name = "{name}.c",
|
name = "{file_name}.c",
|
||||||
kind = "source",
|
kind = "source",
|
||||||
kind_path = "vern-nvim.templates.c",
|
kind_path = "vern-nvim.templates.c",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
M.attach = function() end
|
||||||
|
|
||||||
---@type VernLanguageConfig
|
---@type VernLanguageConfig
|
||||||
M.cpp = {
|
M.cpp = {
|
||||||
root = "CPP",
|
root = "CPP",
|
||||||
@@ -43,13 +45,13 @@ M.cpp = {
|
|||||||
file = {
|
file = {
|
||||||
header = {
|
header = {
|
||||||
path = "{dirs.include}",
|
path = "{dirs.include}",
|
||||||
name = "{name}.hpp",
|
name = "{file_name}.hpp",
|
||||||
kind = "header",
|
kind = "header",
|
||||||
kind_path = "vern-nvim.templates.cpp",
|
kind_path = "vern-nvim.templates.cpp",
|
||||||
},
|
},
|
||||||
source = {
|
source = {
|
||||||
path = "{dirs.src}",
|
path = "{dirs.src}",
|
||||||
name = "{name}.cpp",
|
name = "{file_name}.cpp",
|
||||||
kind = "source",
|
kind = "source",
|
||||||
kind_path = "vern-nvim.templates.cpp",
|
kind_path = "vern-nvim.templates.cpp",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ local actions = require("vern-nvim.actions")
|
|||||||
---@type VernCoreConfig
|
---@type VernCoreConfig
|
||||||
return {
|
return {
|
||||||
workspace_root = "~/personal/Projects",
|
workspace_root = "~/personal/Projects",
|
||||||
|
env = {
|
||||||
|
--- In documentation, make recommendation to change to username or name instead of company
|
||||||
|
author = "company",
|
||||||
|
},
|
||||||
keybinds = {
|
keybinds = {
|
||||||
["<leader>pc"] = {
|
["<leader>pc"] = {
|
||||||
user_command = "VernCreateProject",
|
user_command = "VernCreateProject",
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.attach = function() end
|
||||||
|
|
||||||
|
---@type VernLanguageConfig
|
||||||
|
M.java = {
|
||||||
|
root = "Java",
|
||||||
|
dirs = {
|
||||||
|
src = "src/com/{company_name}/{project_name}",
|
||||||
|
bin = "bin",
|
||||||
|
},
|
||||||
|
keybinds = {
|
||||||
|
["<leader>pr"] = {
|
||||||
|
user_command = "JavaRun",
|
||||||
|
desc = "Executes java code",
|
||||||
|
action = require("vern-nvim.actions.java").run,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
templates = {
|
||||||
|
project = {
|
||||||
|
primary = {
|
||||||
|
path = "{dirs.src}",
|
||||||
|
name = "Main.java",
|
||||||
|
kind = "main",
|
||||||
|
kind_path = "vern-nvim.templates.java",
|
||||||
|
},
|
||||||
|
style = {
|
||||||
|
path = ".",
|
||||||
|
name = ".clang-format",
|
||||||
|
kind = "format",
|
||||||
|
kind_path = "vern-nvim.templates.java",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
file = {
|
||||||
|
source = {
|
||||||
|
path = "{dirs.src}",
|
||||||
|
name = "{file_name}.java",
|
||||||
|
kind = "source",
|
||||||
|
kind_path = "vern-nvim.templates.java",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extras = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return M
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
M.attach = function() end
|
||||||
|
|
||||||
---@type VernLanguageConfig
|
---@type VernLanguageConfig
|
||||||
M.lua = {
|
M.lua = {
|
||||||
root = "Lua",
|
root = "Lua",
|
||||||
@@ -31,7 +33,7 @@ M.lua = {
|
|||||||
file = {
|
file = {
|
||||||
source = {
|
source = {
|
||||||
path = "{dirs.src}",
|
path = "{dirs.src}",
|
||||||
name = "{name}.lua",
|
name = "{file_name}.lua",
|
||||||
kind = "source",
|
kind = "source",
|
||||||
kind_path = "vern-nvim.templates.lua",
|
kind_path = "vern-nvim.templates.lua",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
M.attach = function()
|
||||||
|
local root = require("vern-nvim.utils").proj_root()
|
||||||
|
if not root then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local venv_dir = nil
|
||||||
|
if vim.uv.fs_stat(root .. "/venv/bin/python") then
|
||||||
|
venv_dir = root .. "/venv"
|
||||||
|
elseif vim.uv.fs_stat(root .. "/.venv/bin/python") then
|
||||||
|
venv_dir = root .. "/.venv"
|
||||||
|
end
|
||||||
|
if venv_dir then
|
||||||
|
vim.env.VIRTUAL_ENV = venv_dir
|
||||||
|
vim.env.PATH = venv_dir .. "/bin:" .. vim.env.PATH
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---@type VernLanguageConfig
|
---@type VernLanguageConfig
|
||||||
M.python = {
|
M.python = {
|
||||||
root = "Python",
|
root = "Python",
|
||||||
@@ -42,7 +59,7 @@ M.python = {
|
|||||||
file = {
|
file = {
|
||||||
source = {
|
source = {
|
||||||
path = "{dirs.src}",
|
path = "{dirs.src}",
|
||||||
name = "{name}.py",
|
name = "{file_name}.py",
|
||||||
kind = "module",
|
kind = "module",
|
||||||
kind_path = "vern-nvim.templates.python",
|
kind_path = "vern-nvim.templates.python",
|
||||||
},
|
},
|
||||||
|
|||||||
+28
-3
@@ -35,9 +35,34 @@ function M.setup(user_opts)
|
|||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local ft = vim.bo[args.buf].filetype
|
local ft = vim.bo[args.buf].filetype
|
||||||
local ok, attach = pcall(require, "vern-nvim.attach." .. ft)
|
if not ft or ft == "" then
|
||||||
if ok and type(attach) == "function" then
|
return
|
||||||
attach(args.buf, M.opts)
|
end
|
||||||
|
local has_config, mod = pcall(require, "vern-nvim.configs." .. ft)
|
||||||
|
if not has_config then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local opts = vim.tbl_deep_extend("force", {}, mod, M.opts or {})
|
||||||
|
if opts[ft] and opts[ft].keybinds then
|
||||||
|
for key, def in pairs(opts[ft].keybinds or {}) do
|
||||||
|
if type(def.action) == "function" then
|
||||||
|
vim.api.nvim_buf_create_user_command(args.buf, def.user_command, function()
|
||||||
|
def.action(opts)
|
||||||
|
end, { nargs = "*", desc = def.desc })
|
||||||
|
vim.keymap.set("n", key, function()
|
||||||
|
def.action(opts)
|
||||||
|
end, {
|
||||||
|
buffer = args.buf,
|
||||||
|
silent = true,
|
||||||
|
desc = def.desc,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local ok, attach_mod = pcall(require, "vern-nvim.configs." .. ft)
|
||||||
|
if ok and type(attach_mod.attach) == "function" then
|
||||||
|
attach_mod.attach(args.buf, opts)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
desc = "Attach languages to buffer",
|
desc = "Attach languages to buffer",
|
||||||
|
|||||||
@@ -39,41 +39,6 @@ M.languages = {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
java = {
|
|
||||||
setup = function(self, user_opts)
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, configs.get("java"), user_opts or {})
|
|
||||||
vim.api.nvim_create_user_command("JavaRun", function()
|
|
||||||
self:run()
|
|
||||||
end, {})
|
|
||||||
for key, _ in pairs(opts.keybinds) do
|
|
||||||
vim.keymap.set("n", key, ":JavaRun<CR>", { silent = true })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
run = function()
|
|
||||||
local root = utils.get_project_root()
|
|
||||||
|
|
||||||
local cmd = string.format("javac -d %s %s", root .. "/build", root .. "/src/*.java")
|
|
||||||
local output = vim.fn.system(cmd)
|
|
||||||
|
|
||||||
if not vim.v.shell_error == 0 then
|
|
||||||
local term_buf = utils.terminal({ cmd })
|
|
||||||
vim.api.nvim_set_option_value("modifiable", true, { buf = term_buf })
|
|
||||||
vim.api.nvim_buf_set_lines(
|
|
||||||
term_buf,
|
|
||||||
0,
|
|
||||||
-1,
|
|
||||||
false,
|
|
||||||
vim.list_extend(
|
|
||||||
{ "Error during compilation:" },
|
|
||||||
vim.split(output, "\n", { trimempty = true })
|
|
||||||
)
|
|
||||||
)
|
|
||||||
vim.api.nvim_set_option_value("modifiable", false, { buf = term_buf })
|
|
||||||
else
|
|
||||||
utils.terminal({ "java -cp " .. root, "build" .. " Main" })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
html = {
|
html = {
|
||||||
setup = function(user_opts)
|
setup = function(user_opts)
|
||||||
vim.tbl_deep_extend("force", {}, configs.get("html"), user_opts or {})
|
vim.tbl_deep_extend("force", {}, configs.get("html"), user_opts or {})
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
local presets = {
|
|
||||||
right = {
|
|
||||||
left = 100,
|
|
||||||
right = 0,
|
|
||||||
top = 0,
|
|
||||||
bottom = 0,
|
|
||||||
},
|
|
||||||
corner = {
|
|
||||||
left = 100,
|
|
||||||
right = 0,
|
|
||||||
top = 25,
|
|
||||||
bottom = 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
---@param preset string
|
|
||||||
---@return table|nil
|
|
||||||
function M.getPresets(preset)
|
|
||||||
if presets[preset] then
|
|
||||||
return presets[preset]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -18,89 +18,6 @@ console.log("Hello World!");
|
|||||||
vim.cmd("edit " .. full_project_root .. "/main.js")
|
vim.cmd("edit " .. full_project_root .. "/main.js")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
lua = {
|
|
||||||
run = function(project_name, project_root)
|
|
||||||
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
|
|
||||||
vim.fn.mkdir(full_project_root .. "/lua/" .. project_name, "p")
|
|
||||||
utils.write_file(
|
|
||||||
{ full_project_root, "lua", project_name, "init.lua" },
|
|
||||||
[[
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
return M
|
|
||||||
]]
|
|
||||||
)
|
|
||||||
local gitignore = { "" }
|
|
||||||
utils.init_git(full_project_root, gitignore)
|
|
||||||
vim.cmd("edit " .. full_project_root .. "/lua/" .. project_name .. "/init.lua")
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
java = {
|
|
||||||
run = function(project_name, project_root)
|
|
||||||
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
|
|
||||||
for _, path in ipairs({ "/src", "/build" }) do
|
|
||||||
vim.fn.mkdir(full_project_root .. path, "p")
|
|
||||||
end
|
|
||||||
local content = [[
|
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
System.out.println("Hello, World!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]]
|
|
||||||
local gitignore = {
|
|
||||||
"build/",
|
|
||||||
}
|
|
||||||
utils.init_git(full_project_root, gitignore)
|
|
||||||
utils.write_file({ full_project_root, "src", "Main.java" }, content)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
python = {
|
|
||||||
run = function(project_name, project_root)
|
|
||||||
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
|
|
||||||
vim.fn.mkdir(full_project_root .. "/include", "p")
|
|
||||||
utils.write_file(
|
|
||||||
{ full_project_root, "main.py" },
|
|
||||||
[[
|
|
||||||
def main():
|
|
||||||
print("Hello, World!")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
]]
|
|
||||||
)
|
|
||||||
utils.write_file({ full_project_root, "include/__init__.py" }, "")
|
|
||||||
utils.write_file({ full_project_root, "requirements.txt" }, "")
|
|
||||||
utils.write_file(
|
|
||||||
{ full_project_root, "setup.py" },
|
|
||||||
string.format(
|
|
||||||
[[
|
|
||||||
from setuptools import setup, find_packages
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name="%s",
|
|
||||||
version="0.1.0",
|
|
||||||
packages=find_packages(),
|
|
||||||
install_requires=[],
|
|
||||||
python_requires=">=3.6",
|
|
||||||
)
|
|
||||||
]],
|
|
||||||
project_name
|
|
||||||
)
|
|
||||||
)
|
|
||||||
local gitignore = {
|
|
||||||
"venv/",
|
|
||||||
}
|
|
||||||
utils.init_git(full_project_root, gitignore)
|
|
||||||
vim.cmd("edit " .. full_project_root .. "/main.py")
|
|
||||||
local venv_path = full_project_root .. "/venv"
|
|
||||||
vim.fn.system("python3 -m venv " .. venv_path)
|
|
||||||
vim.g.python3_host_prog = venv_path .. "/bin/python"
|
|
||||||
vim.fn.setenv("VIRTUAL_ENV", venv_path)
|
|
||||||
vim.fn.setenv("PATH", venv_path .. "/bin:" .. vim.fn.getenv("PATH"))
|
|
||||||
print("Virtual environment activated for " .. project_name)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
rust = {
|
rust = {
|
||||||
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
|
||||||
@@ -134,36 +51,6 @@ setup(
|
|||||||
}
|
}
|
||||||
|
|
||||||
M.files = {
|
M.files = {
|
||||||
lua = {
|
|
||||||
run = function(file_name)
|
|
||||||
utils.write_file({
|
|
||||||
utils.get_project_root(),
|
|
||||||
"lua",
|
|
||||||
utils.get_project_name(),
|
|
||||||
file_name .. ".lua",
|
|
||||||
}, "")
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
java = {
|
|
||||||
run = function(file_name)
|
|
||||||
utils.write_file(
|
|
||||||
{ utils.get_project_root(), "src", file_name .. ".java" },
|
|
||||||
string.format(
|
|
||||||
[[
|
|
||||||
public class %s {
|
|
||||||
// New File
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
file_name
|
|
||||||
)
|
|
||||||
)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
python = {
|
|
||||||
run = function(file_name)
|
|
||||||
utils.write_file({ utils.get_project_root(), "include", file_name .. ".py" }, "")
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
rust = {
|
rust = {
|
||||||
run = function(file_name)
|
run = function(file_name)
|
||||||
utils.write_file({ utils.get_project_root(), "src", file_name .. ".rs" }, "")
|
utils.write_file({ utils.get_project_root(), "src", file_name .. ".rs" }, "")
|
||||||
|
|||||||
@@ -87,12 +87,12 @@ endif()
|
|||||||
Target: include/{project_name}/{name}.h
|
Target: include/{project_name}/{name}.h
|
||||||
===================================================================== --]]
|
===================================================================== --]]
|
||||||
header = vim.trim([=[
|
header = vim.trim([=[
|
||||||
#ifndef __PROJECT_NAME___H
|
#ifndef __FILE_NAME___H
|
||||||
#define __PROJECT_NAME___H
|
#define __FILE_NAME___H
|
||||||
|
|
||||||
// Code
|
// Code
|
||||||
|
|
||||||
#endif /* __PROJECT_NAME___H */
|
#endif /* __FILE_NAME___H */
|
||||||
]=]) .. "\n",
|
]=]) .. "\n",
|
||||||
|
|
||||||
--[[ =====================================================================
|
--[[ =====================================================================
|
||||||
|
|||||||
@@ -87,12 +87,12 @@ endif()
|
|||||||
Target: include/{project_name}/{name}.hpp
|
Target: include/{project_name}/{name}.hpp
|
||||||
===================================================================== --]]
|
===================================================================== --]]
|
||||||
header = vim.trim([=[
|
header = vim.trim([=[
|
||||||
#ifndef __PROJECT_NAME___HPP
|
#ifndef __FILE_NAME___HPP
|
||||||
#define __PROJECT_NAME___HPP
|
#define __FILE_NAME___HPP
|
||||||
|
|
||||||
// Code
|
// Code
|
||||||
|
|
||||||
#endif /* __PROJECT_NAME___HPP */
|
#endif /* __FILE_NAME___HPP */
|
||||||
]=]) .. "\n",
|
]=]) .. "\n",
|
||||||
|
|
||||||
--[[ =====================================================================
|
--[[ =====================================================================
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ build/
|
|||||||
lua = vim.trim([=[
|
lua = vim.trim([=[
|
||||||
luac.out
|
luac.out
|
||||||
]=]),
|
]=]),
|
||||||
|
|
||||||
|
java = vim.trim([=[
|
||||||
|
bin/
|
||||||
|
*.class
|
||||||
|
*.jar
|
||||||
|
]=]),
|
||||||
}
|
}
|
||||||
|
|
||||||
local extra = (lang and lang_block[lang]) or ""
|
local extra = (lang and lang_block[lang]) or ""
|
||||||
|
|||||||
@@ -1,19 +1,37 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
local registers = {
|
||||||
|
project_name = "__PROJECT_NAME__",
|
||||||
|
company_name = "__COMPANY_NAME__",
|
||||||
|
file_name = "__FILE_NAME__",
|
||||||
|
}
|
||||||
|
|
||||||
---@param kind_path string Filetype of template
|
---@param kind_path string Filetype of template
|
||||||
---@param kind string Template in language table
|
---@param kind string Template in language table
|
||||||
---@param name string A string to replace temp values in template
|
---@param context table<string, string> A string to replace temp values in template
|
||||||
---@return string Content Formatted string
|
---@return string Content Formatted string
|
||||||
function M.fetch(kind_path, kind, name)
|
function M.fetch(kind_path, kind, context)
|
||||||
kind, name = kind or "", name or ""
|
kind, context = kind or "", context or {}
|
||||||
if (kind == "" or nil) or (name == "" or nil) then
|
if not kind or kind == "" then
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
local ok, mod = pcall(require, kind_path)
|
local ok, mod = pcall(require, kind_path)
|
||||||
if ok and type(mod) == "table" then
|
if not ok or type(mod) ~= "table" or not mod[kind] then
|
||||||
return (string.gsub(mod[kind], "__PROJECT_NAME__", name))
|
|
||||||
end
|
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local template = mod[kind] or ""
|
||||||
|
context = context or {}
|
||||||
|
|
||||||
|
if ok and type(mod) == "table" then
|
||||||
|
for key, placeholder in pairs(registers) do
|
||||||
|
local value = context[key]
|
||||||
|
if value then
|
||||||
|
template = string.gsub(template, placeholder, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return template
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
return {
|
||||||
|
--[[ =====================================================================
|
||||||
|
TEMPLATE: MAIN (Entrypoint)
|
||||||
|
File: Main.java
|
||||||
|
Target: src/com/company/app/Main.java
|
||||||
|
===================================================================== --]]
|
||||||
|
main = vim.trim([=[
|
||||||
|
package com.__COMPANY_NAME__.__PROJECT_NAME__;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello, World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
]=]) .. "\n",
|
||||||
|
|
||||||
|
--[[ =====================================================================
|
||||||
|
TEMPLATE: CLANG-FORMAT (Code formatter)
|
||||||
|
File: .clang-format
|
||||||
|
Target: .clang-format
|
||||||
|
===================================================================== --]]
|
||||||
|
format = vim.trim([=[
|
||||||
|
---
|
||||||
|
Language: Java
|
||||||
|
BasedOnStyle: Google
|
||||||
|
Standard: Latest
|
||||||
|
UseTab: Always
|
||||||
|
TabWidth: 8
|
||||||
|
IndentWidth: 8
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
SeparateDefinitionBlocks: Always
|
||||||
|
BreakAfterReturnType: TopLevel
|
||||||
|
ReflowComments: Always
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
SortIncludes: CaseSensitive
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
]=]) .. "\n",
|
||||||
|
|
||||||
|
--[[ =====================================================================
|
||||||
|
TEMPLATE: SOURCE (Standalone File)
|
||||||
|
File: {name}.java
|
||||||
|
Target: src/com/company/app/{name}.java
|
||||||
|
===================================================================== --]]
|
||||||
|
source = vim.trim([=[
|
||||||
|
package com.__COMPANY_NAME__.__PROJECT_NAME__;
|
||||||
|
|
||||||
|
public class __FILE_NAME__ {
|
||||||
|
|
||||||
|
// Fields / Attributes
|
||||||
|
private String data;
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
public __FILE_NAME__() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
public void doSomething() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]=]) .. "\n",
|
||||||
|
}
|
||||||
@@ -53,7 +53,7 @@ __PROJECT_NAME__ = "__PROJECT_NAME__.main:main"
|
|||||||
===================================================================== --]]
|
===================================================================== --]]
|
||||||
module = vim.trim([=[
|
module = vim.trim([=[
|
||||||
"""
|
"""
|
||||||
Module: __PROJECT_NAME__
|
Module: __FILE_NAME__
|
||||||
"""
|
"""
|
||||||
]=]) .. "\n",
|
]=]) .. "\n",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,12 @@
|
|||||||
---@class VernTerminalConfig
|
---@class VernTerminalConfig
|
||||||
---@field mode VernModeConfig
|
---@field mode VernModeConfig
|
||||||
|
|
||||||
|
---@class VernEnvItem
|
||||||
|
---@field author string
|
||||||
|
|
||||||
---@class VernCoreConfig
|
---@class VernCoreConfig
|
||||||
---@field workspace_root string
|
---@field workspace_root string
|
||||||
|
---@field env VernEnvItem
|
||||||
---@field keybinds table<string, VernKeybindItem>
|
---@field keybinds table<string, VernKeybindItem>
|
||||||
---@field terminal VernTerminalConfig
|
---@field terminal VernTerminalConfig
|
||||||
|
|
||||||
@@ -63,3 +67,6 @@
|
|||||||
|
|
||||||
---@class VernLuaConfig : VernCoreConfig
|
---@class VernLuaConfig : VernCoreConfig
|
||||||
---@field lua? VernLanguageConfig
|
---@field lua? VernLanguageConfig
|
||||||
|
---
|
||||||
|
---@class VernJavaConfig : VernCoreConfig
|
||||||
|
---@field java? VernLanguageConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user