This commit is contained in:
DarthMooMancer
2025-09-04 21:07:31 -04:00
4 changed files with 191 additions and 174 deletions
+3 -5
View File
@@ -1,6 +1,6 @@
<h1 align="center">Polydev</h1>
<p align="center"><em>A multi-language project managing plugin for file creation, building, and running code—all within neovim. Whether you're coding in Java, Python, Lua, Rust, or more, Polydev provides seamless integration to boost your productivity inside Neovim.</em></p>
<p align="center"><em>A multi-language project managing plugin for file creation, building, and running code—all within neovim. Whether you're coding in C/C++ Java, Python, Lua, Rust, and more, Polydev provides seamless integration to boost your productivity inside Neovim.</em></p>
<p align="center">
<img src="https://img.shields.io/badge/Lua-1e90ff?style=for-the-badge&logo=lua&logoColor=white" />
@@ -10,9 +10,8 @@
<img src="https://img.shields.io/badge/Docs-Available-blue?style=for-the-badge&logo=readthedocs&logoColor=white" />
</p>
<p align="center">
<img src="https://github.com/user-attachments/assets/c8e84056-5080-4ec3-ba15-30be61faaf68" alt="Polydev Preview" width="720"/>
</p>
https://github.com/user-attachments/assets/39d406e7-19cc-4040-823f-0a5c30dec714
## Features
@@ -26,7 +25,6 @@
> 📚 [View the full documentation](https://darthmoomancer.github.io/Polydev/) for setup, configuration, and usage details.
## Supported Languages
Polydev currently supports the following languages:
+4 -1
View File
@@ -89,6 +89,10 @@ M.languages = {
run = function ()
local root = utils.get_project_root()
local build_dir = root .. "/build"
if utils.exists(build_dir) == nil then
vim.fn.mkdir(build_dir, "p")
vim.fn.system(string.format("cd %s/build && cmake -S .. -B . && cmake --build . && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. && ln -sf compile_commands.json ../compile_commands.json", root))
end
local cmd = "cd '" .. build_dir .. "' && cmake --build ."
local output = vim.fn.system(cmd)
@@ -102,7 +106,6 @@ M.languages = {
vim.list_extend({ "Error during compilation:" }, vim.split(output, "\n", { trimempty = true }))
)
vim.api.nvim_set_option_value("modifiable", false, { buf = term_buf })
end
if success then
local run_cmd = "cd '" .. build_dir .. "' && ./" .. utils.get_project_name()
+30 -18
View File
@@ -99,19 +99,25 @@ int main() {
}
]])
utils.write_file({ full_project_root, "CMakeLists.txt" }, string.format([[
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.16)
project(%s)
include_directories(include)
set(SOURCES src/main.c)
add_executable(%s ${SOURCES})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_STANDARD_REQUIRED ON)
include_directories(include)
# find_package(SDL3 CONFIG REQUIRED) # An example of how to import libraries from vcpkg
# target_link_libraries(Game PRIVATE SDL3::SDL3)
]], project_name, project_name))
local gitignore = { "build/" }
set(SOURCES
src/main.c
)
add_executable(%s ${SOURCES})
# find_package(Curses REQUIRED)
# include_directories(${CURSES_INCLUDE_DIR})
# target_link_libraries(%s ${CURSES_LIBRARIES})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
]], project_name, project_name, project_name))
local gitignore = { "build/", ".cache/" }
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.cmd("edit " .. full_project_root .. "/src/main.c")
@@ -132,20 +138,26 @@ int main() {
}
]])
utils.write_file({ full_project_root, "CMakeLists.txt" }, string.format([[
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.16)
project(%s)
include_directories(include)
set(SOURCES src/main.cpp)
add_executable(%s ${SOURCES})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_STANDARD_REQUIRED ON)
include_directories(include)
# find_package(SDL3 CONFIG REQUIRED) # An example of how to import libraries from vcpkg
# target_link_libraries(Game PRIVATE SDL3::SDL3)
]], project_name, project_name))
set(SOURCES
src/main.cpp
)
local gitignore = { "build/" }
add_executable(%s ${SOURCES})
# find_package(Curses REQUIRED)
# include_directories(${CURSES_INCLUDE_DIR})
# target_link_libraries(%s ${CURSES_LIBRARIES})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
]], project_name, project_name, project_name))
local gitignore = { "build/", ".cache/" }
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.cmd("edit " .. full_project_root .. "/src/main.cpp")
+4
View File
@@ -5,6 +5,10 @@ function M.setup(opts)
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("terminal"), opts or {})
end
function M.exists(path)
return (io.open(path,"r") ~= nil)
end
---@return string
function M.get_project_root()
local plugin_dir = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":h:h:h")