chore: cleaning deprecated code
This commit is contained in:
@@ -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 -->
|
||||||
|
|
||||||
|
|||||||
@@ -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" }, "")
|
||||||
|
|||||||
Reference in New Issue
Block a user