Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3942f88ef6 | ||
|
|
46eb126ebe | ||
|
|
70ff086e0c | ||
|
|
b348710bd5 | ||
|
|
dc0cf79188 | ||
|
|
0ac0267888 |
@@ -1,3 +1,2 @@
|
|||||||
LICENSE
|
LICENSE
|
||||||
Lua_Annotation_CheatSheet/
|
|
||||||
venv/
|
venv/
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<img src="https://img.shields.io/badge/Lua-1e90ff?style=for-the-badge&logo=lua&logoColor=white" />
|
<img src="https://img.shields.io/badge/Lua-1e90ff?style=for-the-badge&logo=lua&logoColor=white" />
|
||||||
<img src="https://img.shields.io/badge/Neovim-0.10%2B-32c48d?style=for-the-badge&logo=neovim&logoColor=white" />
|
<img src="https://img.shields.io/badge/Neovim-0.10%2B-32c48d?style=for-the-badge&logo=neovim&logoColor=white" />
|
||||||
<img src="https://img.shields.io/github/stars/DarthMooMancer/Polydev?style=for-the-badge&logo=github" />
|
<img src="https://img.shields.io/github/stars/DarthMooMancer/Polydev?style=for-the-badge&logo=github" />
|
||||||
<img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge" />
|
<img src="https://img.shields.io/badge/License-Apache-yellow.svg?style=for-the-badge" />
|
||||||
<img src="https://img.shields.io/badge/Docs-Available-blue?style=for-the-badge&logo=readthedocs&logoColor=white" />
|
<img src="https://img.shields.io/badge/Docs-Available-blue?style=for-the-badge&logo=readthedocs&logoColor=white" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -4,8 +4,7 @@
|
|||||||
<img src="https://img.shields.io/badge/Lua-1e90ff?style=for-the-badge&logo=lua&logoColor=white" />
|
<img src="https://img.shields.io/badge/Lua-1e90ff?style=for-the-badge&logo=lua&logoColor=white" />
|
||||||
<img src="https://img.shields.io/badge/Neovim-0.10%2B-32c48d?style=for-the-badge&logo=neovim&logoColor=white" />
|
<img src="https://img.shields.io/badge/Neovim-0.10%2B-32c48d?style=for-the-badge&logo=neovim&logoColor=white" />
|
||||||
<img src="https://img.shields.io/github/stars/DarthMooMancer/Polydev?style=for-the-badge&logo=github" />
|
<img src="https://img.shields.io/github/stars/DarthMooMancer/Polydev?style=for-the-badge&logo=github" />
|
||||||
<img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge" />
|
<img src="https://img.shields.io/badge/License-Apache-yellow.svg?style=for-the-badge" />
|
||||||
<img src="https://img.shields.io/badge/Docs-Available-blue?style=for-the-badge&logo=readthedocs&logoColor=white" />
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
# **Installation**
|
|
||||||
|
|
||||||
Polydev can be installed using any plugin manager of your choice — or even manually. Below are some examples for popular managers to get you started.
|
|
||||||
|
|
||||||
> **Requirement**: Neovim v0.10+
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## **Lazy.nvim**
|
## **Lazy.nvim**
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
## Java
|
||||||
|
|
||||||
|
#### Structure Reference
|
||||||
|
|
||||||
|
| Directory/File Path | Description |
|
||||||
|
|----------------------------|------------------------------------------------------|
|
||||||
|
| `src/` | Contains the source code files, including `Main.java` |
|
||||||
|
| `build/` | Contains compiled `.class` files |
|
||||||
|
| `Main.java` | The main entry point of your Java project |
|
||||||
|
|
||||||
|
#### Project Layout
|
||||||
|
|
||||||
|
```md
|
||||||
|
Projects/
|
||||||
|
└── Java/
|
||||||
|
└── Project_Name/
|
||||||
|
├── src/
|
||||||
|
│ └── Main.java
|
||||||
|
└── build/
|
||||||
|
└── *.class
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## C
|
||||||
|
|
||||||
|
#### Structure Reference
|
||||||
|
|
||||||
|
| Directory/File Path | Description |
|
||||||
|
|----------------------------|------------------------------------------------------|
|
||||||
|
| `CMakeLists.txt` | Configuration file for your project build |
|
||||||
|
| `src/` | Folder containing source files for the project |
|
||||||
|
| `main.c` | Main C file for the project |
|
||||||
|
| `*.c` | Additional C source files |
|
||||||
|
| `build/` | Folder where the build artifacts will be generated |
|
||||||
|
| `include/` | Folder for header files |
|
||||||
|
| `*.h` | C header files |
|
||||||
|
|
||||||
|
#### Project Layout
|
||||||
|
|
||||||
|
```md
|
||||||
|
Projects/
|
||||||
|
└── C/
|
||||||
|
└── Project_Name/
|
||||||
|
├── CMakeLists.txt
|
||||||
|
├── src/
|
||||||
|
│ ├── main.c
|
||||||
|
│ └── *.c
|
||||||
|
├── build/
|
||||||
|
│ └── <CMAKE_FILES>
|
||||||
|
│ └── <main-executable>
|
||||||
|
└── include/
|
||||||
|
└── *.h
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## C++
|
||||||
|
|
||||||
|
#### Structure Reference
|
||||||
|
|
||||||
|
| Directory/File Path | Description |
|
||||||
|
|----------------------------|------------------------------------------------------|
|
||||||
|
| `CMakeLists.txt` | Configuration file for your project build |
|
||||||
|
| `src/` | Folder containing source files for the project |
|
||||||
|
| `main.cpp` | Main Cpp file for the project |
|
||||||
|
| `*.cpp` | Additional Cpp source files |
|
||||||
|
| `build/` | Folder where the build artifacts will be generated |
|
||||||
|
| `include/` | Folder for header files |
|
||||||
|
| `*.hpp` | Cpp header files |
|
||||||
|
|
||||||
|
#### Project Layout
|
||||||
|
|
||||||
|
```md
|
||||||
|
Projects/
|
||||||
|
└── Cpp/
|
||||||
|
└── Project_Name/
|
||||||
|
├── CMakeLists.txt
|
||||||
|
├── src/
|
||||||
|
│ ├── main.cpp
|
||||||
|
│ └── *.cpp
|
||||||
|
├── build/
|
||||||
|
│ └── <CMAKE_FILES>
|
||||||
|
│ └── <main-executable>
|
||||||
|
└── include/
|
||||||
|
└── *.hpp
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Lua
|
||||||
|
|
||||||
|
#### Structure Reference
|
||||||
|
|
||||||
|
| Directory/File Path | Description |
|
||||||
|
|----------------------------|-----------------------------------------------------|
|
||||||
|
| `lua/<Project_name>` | Directory containing the main Lua project files |
|
||||||
|
| `lua/<Project_name>/init.lua` | The main entry point for your Lua project |
|
||||||
|
|
||||||
|
#### Project Layout
|
||||||
|
|
||||||
|
```md
|
||||||
|
Projects/
|
||||||
|
└── Lua/
|
||||||
|
└── Project_Name/
|
||||||
|
└── lua/
|
||||||
|
└── Project_name/
|
||||||
|
└── init.lua -- Main Lua file
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Python
|
||||||
|
|
||||||
|
- **Automatic Virtual Environment Creation**: Each Python project automatically sets up and uses a new virtual environment. You don’t need to worry about environment management. Just install your dependencies with `pip` as needed.
|
||||||
|
|
||||||
|
- **Dependency Management with Pip**: Need to install Python modules? Simply type the name of the module in the terminal, and Polydev will take care of the installation using `pip`. You can even update `pip` if required, ensuring smooth installation.
|
||||||
|
|
||||||
|
#### Structure Reference
|
||||||
|
|
||||||
|
| Directory/File Path | Description |
|
||||||
|
|----------------------------|------------------------------------------------------|
|
||||||
|
| `requirements.txt` | File for listing project dependencies |
|
||||||
|
| `setup.py` | Python project setup file |
|
||||||
|
| `tests/` | Folder containing test files |
|
||||||
|
| `venv/` | Virtual environment folder |
|
||||||
|
| `main.py` | Main Python file for your project |
|
||||||
|
|
||||||
|
#### Project Layout
|
||||||
|
|
||||||
|
```md
|
||||||
|
Projects/
|
||||||
|
└── Python/
|
||||||
|
└── Project_Name/
|
||||||
|
├── main.py
|
||||||
|
├── requirements.txt
|
||||||
|
├── setup.py
|
||||||
|
├── tests/
|
||||||
|
└── venv/
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Html
|
||||||
|
|
||||||
|
Nothing here yet! Html is supported however! Will do later
|
||||||
|
|
||||||
|
## Rust
|
||||||
|
|
||||||
|
Nothing here yet! Rust is supported however! Will do later
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
### **Build**
|
|
||||||
```lua
|
|
||||||
-- Adds build attributes when compiling if you need extra arguments
|
|
||||||
build_attributes = ""
|
|
||||||
```
|
|
||||||
|
|
||||||
#### File Structure 📂
|
|
||||||
This is the recommended file structure for your C projects using Polydev:
|
|
||||||
|
|
||||||
| Directory/File Path | Description |
|
|
||||||
|----------------------------|------------------------------------------------------|
|
|
||||||
| `CMakeLists.txt` | Configuration file for your project build |
|
|
||||||
| `src/` | Folder containing source files for the project |
|
|
||||||
| `main.c` | Main C file for the project |
|
|
||||||
| `*.c` | Additional C source files |
|
|
||||||
| `build/` | Folder where the build artifacts will be generated |
|
|
||||||
| `include/` | Folder for header files |
|
|
||||||
| `*.h` | C header files |
|
|
||||||
|
|
||||||
#### Example Structure:
|
|
||||||
|
|
||||||
```md
|
|
||||||
Projects/
|
|
||||||
└── C/
|
|
||||||
└── Project_Name/
|
|
||||||
├── CMakeLists.txt
|
|
||||||
├── src/
|
|
||||||
│ ├── main.c
|
|
||||||
│ └── *.c
|
|
||||||
├── build/
|
|
||||||
│ └── <main-executable>
|
|
||||||
└── include/
|
|
||||||
└── *.h
|
|
||||||
```
|
|
||||||
---
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
### Build
|
|
||||||
```lua
|
|
||||||
-- Adds build attributes when compiling if you need extra arguments
|
|
||||||
build_attributes = ""
|
|
||||||
```
|
|
||||||
---
|
|
||||||
|
|
||||||
#### File Structure 📂
|
|
||||||
This is the recommended file structure for your C projects using Polydev:
|
|
||||||
|
|
||||||
| Directory/File Path | Description |
|
|
||||||
|----------------------------|------------------------------------------------------|
|
|
||||||
| `CMakeLists.txt` | Configuration file for your project build |
|
|
||||||
| `src/` | Folder containing source files for the project |
|
|
||||||
| `main.cpp` | Main Cpp file for the project |
|
|
||||||
| `*.cpp` | Additional Cpp source files |
|
|
||||||
| `build/` | Folder where the build artifacts will be generated |
|
|
||||||
| `include/` | Folder for header files |
|
|
||||||
| `*.hpp` | Cpp header files |
|
|
||||||
|
|
||||||
#### Example Structure:
|
|
||||||
|
|
||||||
```md
|
|
||||||
Projects/
|
|
||||||
└── Cpp/
|
|
||||||
└── Project_Name/
|
|
||||||
├── CMakeLists.txt
|
|
||||||
├── src/
|
|
||||||
│ ├── main.cpp
|
|
||||||
│ └── *.cpp
|
|
||||||
├── build/
|
|
||||||
│ └── <main-executable>
|
|
||||||
└── include/
|
|
||||||
└── *.hpp
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Nothing here yet! Html is supported however!
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
### **Java Features**
|
|
||||||
|
|
||||||
* **Java Build and Run**:
|
|
||||||
Polydev allows you to build all Java files in the `src` directory with the press of a keybind. Once built, you can run the project from the `out` folder, with the `Main.java` file executed automatically.
|
|
||||||
|
|
||||||
* **Project File Management**:
|
|
||||||
The plugin manages your Java project files efficiently, helping you quickly add new Java files to the `src` directory. It also ensures that your build and run processes are streamlined.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#### File Structure
|
|
||||||
Here’s the recommended structure for your Java projects using Polydev:
|
|
||||||
|
|
||||||
| Directory/File Path | Description |
|
|
||||||
|----------------------------|------------------------------------------------------|
|
|
||||||
| `src/` | Contains the source code files, including `Main.java` |
|
|
||||||
| `build/` | Contains compiled `.class` files |
|
|
||||||
| `Main.java` | The main entry point of your Java project |
|
|
||||||
|
|
||||||
#### Example Structure:
|
|
||||||
|
|
||||||
```md
|
|
||||||
Projects/
|
|
||||||
└── Java/
|
|
||||||
└── Project_Name/
|
|
||||||
├── src/
|
|
||||||
│ └── Main.java
|
|
||||||
└── build/
|
|
||||||
└── *.class
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
### **Lua Features**
|
|
||||||
|
|
||||||
* **Run Lua Projects**:
|
|
||||||
Easily run your Lua project from within your terminal using the `<leader>pr` keybind. This automatically runs your `init.lua` or the entry point of your Lua code.
|
|
||||||
|
|
||||||
* **Create New Lua Files**:
|
|
||||||
With the `<leader>nf` keybind, you can quickly create new Lua files in the `src` directory, maintaining an organized project structure.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#### File Structure 📂
|
|
||||||
|
|
||||||
Here’s the suggested directory structure for your Lua projects with Polydev:
|
|
||||||
|
|
||||||
| Directory/File Path | Description |
|
|
||||||
|----------------------------|-----------------------------------------------------|
|
|
||||||
| `lua/` | Directory containing the main Lua project files |
|
|
||||||
| `lua/<Project_name>/init.lua` | The main entry point for your Lua project |
|
|
||||||
|
|
||||||
##### Example File Structure:
|
|
||||||
|
|
||||||
```md
|
|
||||||
Projects/
|
|
||||||
└── Lua/
|
|
||||||
└── Project_Name/
|
|
||||||
└── lua/
|
|
||||||
└── Project_name/
|
|
||||||
└── init.lua -- Main Lua file
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
### **Python Features**
|
|
||||||
|
|
||||||
Here are some cool features available for Python projects using Polydev:
|
|
||||||
|
|
||||||
- **Automatic Virtual Environment Creation** 🔧
|
|
||||||
Each Python project automatically sets up and uses a new virtual environment. You don’t need to worry about environment management. Just install your dependencies with `pip` as needed.
|
|
||||||
|
|
||||||
- **Dependency Management with Pip** 📦
|
|
||||||
Need to install Python modules? Simply type the name of the module in the terminal, and Polydev will take care of the installation using `pip`. You can even update `pip` if required, ensuring smooth installation.
|
|
||||||
|
|
||||||
- **Effortless Dependency Handling** ⚡
|
|
||||||
You no longer need to manually activate or deactivate virtual environments. With Polydev, the environment is set up and activated automatically, simplifying your workflow.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#### **File Structure**
|
|
||||||
Here’s the recommended structure for your Python projects using Polydev:
|
|
||||||
|
|
||||||
| Directory/File Path | Description |
|
|
||||||
|----------------------------|------------------------------------------------------|
|
|
||||||
| `requirements.txt` | File for listing project dependencies |
|
|
||||||
| `setup.py` | Python project setup file |
|
|
||||||
| `tests/` | Folder containing test files |
|
|
||||||
| `venv/` | Virtual environment folder |
|
|
||||||
| `main.py` | Main Python file for your project |
|
|
||||||
|
|
||||||
#### **Tree Structure**:
|
|
||||||
|
|
||||||
```md
|
|
||||||
Projects/
|
|
||||||
└── Python/
|
|
||||||
└── Project_Name/
|
|
||||||
├── main.py
|
|
||||||
├── requirements.txt
|
|
||||||
├── setup.py
|
|
||||||
├── tests/
|
|
||||||
└── venv/
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Nothing here yet! Rust is supported however!
|
|
||||||
+3
-3
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
| Binding | Description |
|
| Binding | Description |
|
||||||
|------------------|-----------------|
|
|------------------|-----------------|
|
||||||
| **Enter** | `Open file / Enter directory` |
|
| **ENTER** | `Open file / Enter directory` |
|
||||||
| **Delete** | `Go to parent directory` |
|
| **DELETE** | `Go to parent directory` |
|
||||||
| **/** | `Filter (fuzzy search)` |
|
| **/** | `Filter (fuzzy search)` |
|
||||||
| **a** | `Create new folder` |
|
| **a** | `Create new folder` |
|
||||||
| **%** | `Create new file` |
|
| **%** | `Create new file` |
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
| **d** | `Create new project` |
|
| **d** | `Create new project` |
|
||||||
| **R** | `Rename file/folder` |
|
| **R** | `Rename file/folder` |
|
||||||
| **D** | `Delete file/folder` |
|
| **D** | `Delete file/folder` |
|
||||||
| **q** | `Quit popup` |
|
| **ESC** | `Quit popup` |
|
||||||
|
|
||||||
> **WARNING**: Do not copy the defaults. Only change what you need for your workflow!
|
> **WARNING**: Do not copy the defaults. Only change what you need for your workflow!
|
||||||
|
|
||||||
|
|||||||
@@ -41,14 +41,12 @@ local function default_languages(project_root)
|
|||||||
keybinds = {
|
keybinds = {
|
||||||
["<leader>pr"] = "CRun",
|
["<leader>pr"] = "CRun",
|
||||||
},
|
},
|
||||||
build_attributes = "",
|
|
||||||
},
|
},
|
||||||
cpp = {
|
cpp = {
|
||||||
project_root = project_root .. "/CPP",
|
project_root = project_root .. "/CPP",
|
||||||
keybinds = {
|
keybinds = {
|
||||||
["<leader>pr"] = "CppRun",
|
["<leader>pr"] = "CppRun",
|
||||||
},
|
},
|
||||||
build_attributes = "",
|
|
||||||
},
|
},
|
||||||
html = {
|
html = {
|
||||||
project_root = project_root .. "/Html",
|
project_root = project_root .. "/Html",
|
||||||
|
|||||||
@@ -0,0 +1,174 @@
|
|||||||
|
local utils = require("Polydev.utils")
|
||||||
|
local configs = require("Polydev.configs")
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.languages = {
|
||||||
|
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_buf_set_option(term_buf, "modifiable", true)
|
||||||
|
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_buf_set_option(term_buf, "modifiable", false)
|
||||||
|
else
|
||||||
|
utils.terminal({ "java -cp " .. root, "build" .. " Main" })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
},
|
||||||
|
c = {
|
||||||
|
setup = function (self, user_opts)
|
||||||
|
local opts = vim.tbl_deep_extend("force", {}, configs.get("c"), user_opts or {})
|
||||||
|
vim.api.nvim_create_user_command("CRun", function () self:run() end, {})
|
||||||
|
for key, _ in pairs(opts.keybinds) do
|
||||||
|
vim.keymap.set("n", key, ":CRun<CR>", { silent = true })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
run = function ()
|
||||||
|
local root = utils.get_project_root()
|
||||||
|
local build_dir = root .. "/build"
|
||||||
|
|
||||||
|
local cmd = "cd '" .. build_dir .. "' && cmake --build ."
|
||||||
|
local output = vim.fn.system(cmd)
|
||||||
|
local success = vim.v.shell_error == 0
|
||||||
|
|
||||||
|
if not success then
|
||||||
|
local term_buf = utils.terminal({ cmd })
|
||||||
|
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||||
|
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_buf_set_option(term_buf, "modifiable", false)
|
||||||
|
end
|
||||||
|
if success then
|
||||||
|
local run_cmd = "cd '" .. build_dir .. "' && ./" .. utils.get_project_name()
|
||||||
|
utils.terminal({ run_cmd })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
},
|
||||||
|
cpp = {
|
||||||
|
setup = function (self, user_opts)
|
||||||
|
local opts = vim.tbl_deep_extend("force", {}, configs.get("cpp"), user_opts or {})
|
||||||
|
vim.api.nvim_create_user_command("CppRun", function () self:run() end, {})
|
||||||
|
for key, _ in pairs(opts.keybinds) do
|
||||||
|
vim.keymap.set("n", key, ":CppRun<CR>", { silent = true })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
run = function ()
|
||||||
|
local root = utils.get_project_root()
|
||||||
|
local build_dir = root .. "/build"
|
||||||
|
|
||||||
|
local cmd = "cd '" .. build_dir .. "' && cmake --build ."
|
||||||
|
local output = vim.fn.system(cmd)
|
||||||
|
local success = vim.v.shell_error == 0
|
||||||
|
|
||||||
|
if not success then
|
||||||
|
local term_buf = utils.terminal({ cmd })
|
||||||
|
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||||
|
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_buf_set_option(term_buf, "modifiable", false)
|
||||||
|
end
|
||||||
|
if success then
|
||||||
|
local run_cmd = "cd '" .. build_dir .. "' && ./" .. utils.get_project_name()
|
||||||
|
utils.terminal({ run_cmd })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
},
|
||||||
|
html = {
|
||||||
|
setup = function (user_opts)
|
||||||
|
vim.tbl_deep_extend("force", {}, configs.get("html"), user_opts or {})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
rust = {
|
||||||
|
setup = function (self, user_opts)
|
||||||
|
local opts = vim.tbl_deep_extend("force", {}, configs.get("rust"), user_opts or {})
|
||||||
|
vim.api.nvim_create_user_command("RustRun", function () self:run() end, {})
|
||||||
|
for key, _ in pairs(opts.keybinds) do
|
||||||
|
vim.keymap.set("n", key, ":RustRun<CR>", { silent = true })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
run = function ()
|
||||||
|
local root = utils.get_project_root()
|
||||||
|
if not root then return print("Error: Project root not found.") end
|
||||||
|
|
||||||
|
local cmd = { "cargo build" }
|
||||||
|
local output = vim.fn.system(table.concat(cmd))
|
||||||
|
|
||||||
|
if not vim.v.shell_error == 0 then
|
||||||
|
local term_buf = utils.terminal(cmd)
|
||||||
|
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||||
|
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_buf_set_option(term_buf, "modifiable", false)
|
||||||
|
else
|
||||||
|
utils.terminal({ "cargo run" })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
},
|
||||||
|
python = {
|
||||||
|
setup = function(self, user_opts)
|
||||||
|
local opts = vim.tbl_deep_extend("force", {}, configs.get("python"), user_opts or {})
|
||||||
|
vim.api.nvim_create_user_command("PythonPip", function () self:install_dependency() end, {})
|
||||||
|
vim.api.nvim_create_user_command("PythonRun", function () self:run() end, {})
|
||||||
|
for key, command in pairs(opts.keybinds) do
|
||||||
|
if command == "PythonRun" then
|
||||||
|
vim.keymap.set("n", key, ":PythonRun<CR>", { silent = true })
|
||||||
|
end
|
||||||
|
if command == "PythonPip" then
|
||||||
|
vim.keymap.set("n", key, ":PythonPip<CR>", { silent = true })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local root = utils.get_project_root()
|
||||||
|
if root then
|
||||||
|
local venv_path = root .. "/venv/bin/activate"
|
||||||
|
if vim.fn.filereadable(venv_path) == 1 then
|
||||||
|
vim.env.VIRTUAL_ENV = venv_path
|
||||||
|
vim.env.PATH = root .. "/venv/bin:" .. vim.env.PATH
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
install_dependency = function ()
|
||||||
|
vim.ui.input({ prompt = "Enter pip module: " }, function(pip_module)
|
||||||
|
if not pip_module or pip_module == "" then return print("Pip canceled") end
|
||||||
|
utils.terminal({ "pip install " .. pip_module })
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
run = function ()
|
||||||
|
utils.terminal({ "python3 " .. utils.get_project_root(), "main.py" })
|
||||||
|
end
|
||||||
|
},
|
||||||
|
lua = {
|
||||||
|
setup = function (self, user_opts)
|
||||||
|
local opts = vim.tbl_deep_extend("force", {}, configs.get("lua"), user_opts or {})
|
||||||
|
vim.api.nvim_create_user_command("LuaRun", function () self:run() end, {})
|
||||||
|
for key, _ in pairs(opts.keybinds) do
|
||||||
|
vim.keymap.set("n", key, ":LuaRun<CR>", { silent = true })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
run = function ()
|
||||||
|
local init_lua_path = utils.get_project_root() .. "/lua/" .. utils.get_project_name() .. "/init.lua"
|
||||||
|
if vim.fn.filereadable(init_lua_path) == 1 then
|
||||||
|
utils.terminal({ "lua " .. init_lua_path })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
local utils = require("Polydev.utils")
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup(user_opts)
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("c"), user_opts or {})
|
|
||||||
vim.api.nvim_create_user_command("CRun", M.run, {})
|
|
||||||
for key, _ in pairs(opts.keybinds) do
|
|
||||||
vim.keymap.set("n", key, ":CRun<CR>", { silent = true })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.run()
|
|
||||||
local root = utils.get_project_root()
|
|
||||||
local build_dir = root .. "/build"
|
|
||||||
|
|
||||||
local cmd = "cd " .. build_dir .. " && cmake --build ."
|
|
||||||
local output = vim.fn.system(cmd)
|
|
||||||
local success = vim.v.shell_error == 0
|
|
||||||
|
|
||||||
if not success then
|
|
||||||
local term_buf = utils.terminal(cmd)
|
|
||||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
|
||||||
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_buf_set_option(term_buf, "modifiable", false)
|
|
||||||
end
|
|
||||||
if success then
|
|
||||||
local run_cmd = "cd " .. build_dir .. " && ./" .. utils.get_project_name()
|
|
||||||
utils.terminal({ run_cmd })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
local utils = require("Polydev.utils")
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup(user_opts)
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("cpp"), user_opts or {})
|
|
||||||
vim.api.nvim_create_user_command("CppRun", M.run, {})
|
|
||||||
for key, _ in pairs(opts.keybinds) do
|
|
||||||
vim.keymap.set("n", key, ":CppRun<CR>", { silent = true })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.run()
|
|
||||||
local root = utils.get_project_root()
|
|
||||||
local build_dir = root .. "/build"
|
|
||||||
|
|
||||||
local cmd = "cd " .. build_dir .. " && cmake --build ."
|
|
||||||
local output = vim.fn.system(cmd)
|
|
||||||
local success = vim.v.shell_error == 0
|
|
||||||
|
|
||||||
if not success then
|
|
||||||
local term_buf = utils.terminal({ cmd })
|
|
||||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
|
||||||
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_buf_set_option(term_buf, "modifiable", false)
|
|
||||||
end
|
|
||||||
if success then
|
|
||||||
local run_cmd = "cd " .. build_dir .. " && ./" .. utils.get_project_name()
|
|
||||||
utils.terminal({ run_cmd })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup(user_opts)
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("html"), user_opts or {})
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
local utils = require("Polydev.utils")
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup(user_opts)
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("java"), user_opts or {})
|
|
||||||
vim.api.nvim_create_user_command("JavaRun", M.run, {})
|
|
||||||
for key, _ in pairs(opts.keybinds) do
|
|
||||||
vim.keymap.set("n", key, ":JavaRun<CR>", { silent = true })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.run()
|
|
||||||
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_buf_set_option(term_buf, "modifiable", true)
|
|
||||||
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_buf_set_option(term_buf, "modifiable", false)
|
|
||||||
else
|
|
||||||
utils.terminal({ "java -cp " .. root, "build" .. " Main" })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
local utils = require("Polydev.utils")
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup(user_opts)
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("lua"), user_opts or {})
|
|
||||||
vim.api.nvim_create_user_command("LuaRun", M.run, {})
|
|
||||||
for key, _ in pairs(opts.keybinds) do
|
|
||||||
vim.keymap.set("n", key, ":LuaRun<CR>", { silent = true })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.run()
|
|
||||||
local init_lua_path = utils.get_project_root() .. "/lua/" .. utils.get_project_name() .. "/init.lua"
|
|
||||||
if vim.fn.filereadable(init_lua_path) == 1 then
|
|
||||||
utils.terminal({ "lua " .. init_lua_path })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
local utils = require("Polydev.utils")
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup(user_opts)
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("python"), user_opts or {})
|
|
||||||
vim.api.nvim_create_user_command("PythonPip", M.install_dependency, {})
|
|
||||||
vim.api.nvim_create_user_command("PythonRun", M.run, {})
|
|
||||||
for key, command in pairs(opts.keybinds) do
|
|
||||||
if command == "PythonRun" then
|
|
||||||
vim.keymap.set("n", key, ":PythonRun<CR>", { silent = true })
|
|
||||||
end
|
|
||||||
if command == "PythonPip" then
|
|
||||||
vim.keymap.set("n", key, ":PythonPip<CR>", { silent = true })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local root = utils.get_project_root()
|
|
||||||
if root then
|
|
||||||
local venv_path = root .. "/venv/bin/activate"
|
|
||||||
if vim.fn.filereadable(venv_path) == 1 then
|
|
||||||
vim.env.VIRTUAL_ENV = venv_path
|
|
||||||
vim.env.PATH = root .. "/venv/bin:" .. vim.env.PATH
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.install_dependency()
|
|
||||||
vim.ui.input({ prompt = "Enter pip module: " }, function(pip_module)
|
|
||||||
if not pip_module or pip_module == "" then return print("Pip canceled") end
|
|
||||||
utils.terminal({ "pip install " .. pip_module })
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.run()
|
|
||||||
utils.terminal({ "python3 " .. utils.get_project_root(), "main.py" })
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
local utils = require("Polydev.utils")
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup(user_opts)
|
|
||||||
local opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("rust"), user_opts or {})
|
|
||||||
vim.api.nvim_create_user_command("RustRun", M.run, {})
|
|
||||||
for key, _ in pairs(opts.keybinds) do
|
|
||||||
vim.keymap.set("n", key, ":RustRun<CR>", { silent = true })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.run()
|
|
||||||
local root = utils.get_project_root()
|
|
||||||
if not root then return print("Error: Project root not found.") end
|
|
||||||
|
|
||||||
local cmd = { "cargo build" }
|
|
||||||
local output = vim.fn.system(table.concat(cmd))
|
|
||||||
|
|
||||||
if not vim.v.shell_error == 0 then
|
|
||||||
local term_buf = utils.terminal(cmd)
|
|
||||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
|
||||||
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_buf_set_option(term_buf, "modifiable", false)
|
|
||||||
else
|
|
||||||
utils.terminal({ "cargo run" })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
+12
-4
@@ -63,11 +63,18 @@ local loaded_languages = {}
|
|||||||
function M.load_language_module(lang, opts)
|
function M.load_language_module(lang, opts)
|
||||||
if loaded_languages[lang] then return true end
|
if loaded_languages[lang] then return true end
|
||||||
|
|
||||||
local ok, mod = pcall(require, "Polydev.languages." .. lang)
|
local ok, mod = pcall(require, "Polydev.languages")
|
||||||
if not ok or type(mod.setup) ~= "function" then return false end
|
if not ok or type(mod.languages) ~= "table" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
mod.setup(opts and opts[lang] or {})
|
local lang_mod = mod.languages[lang]
|
||||||
loaded_languages[lang] = mod
|
if type(lang_mod) ~= "table" or type(lang_mod.setup) ~= "function" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
lang_mod:setup(opts and opts[lang] or {})
|
||||||
|
loaded_languages[lang] = lang_mod
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -308,6 +315,7 @@ function M.manager(project_root)
|
|||||||
if not lang or lang == "" then return print("Project creation canceled") end
|
if not lang or lang == "" then return print("Project creation canceled") end
|
||||||
opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get(lang), opts or {})
|
opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get(lang), opts or {})
|
||||||
if M.load_language_module(lang) and templates.projects[lang] and templates.projects[lang].run then
|
if M.load_language_module(lang) and templates.projects[lang] and templates.projects[lang].run then
|
||||||
|
-- if templates.projects[lang] and templates.projects[lang].run then
|
||||||
popup:unmount()
|
popup:unmount()
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.ui.input({ prompt = "Enter project name: " }, function(project_name)
|
vim.ui.input({ prompt = "Enter project name: " }, function(project_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user