Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
421cf95bc6 | ||
|
|
1c13c8cbe2 | ||
|
|
adbd2bc0e9 | ||
|
|
15f3648af8 | ||
|
|
51e911ec33 | ||
|
|
1b5d413404 | ||
|
|
ae0df7fe28 | ||
|
|
08967f9070 | ||
|
|
9a6eb90efc | ||
|
|
72951f7327 | ||
|
|
4765da0539 | ||
|
|
9f4649b5d2 | ||
|
|
e8c55ec18f | ||
|
|
fcde51bc05 | ||
|
|
9eefdb6166 | ||
|
|
3046a3ce36 | ||
|
|
5eaa7d10a7 | ||
|
|
774f14809d | ||
|
|
645eeed296 | ||
|
|
4bf705df03 | ||
|
|
1c4a61ce7f | ||
|
|
b6d46a0cef | ||
|
|
685a711644 | ||
|
|
3bb97d833b | ||
|
|
df760783ba | ||
|
|
57e8eb0248 | ||
|
|
0f542d56ef | ||
|
|
e2864159a8 | ||
|
|
380f295c93 | ||
|
|
06eb74e13f | ||
|
|
98bd619cfa | ||
|
|
6593db3829 | ||
|
|
4bcac5d09b | ||
|
|
2b30e36fad | ||
|
|
8d41141e9a | ||
|
|
919d141c6a | ||
|
|
89bf0333c4 | ||
|
|
9210dff133 | ||
|
|
262e377873 | ||
|
|
5cec285828 | ||
|
|
22215cccda | ||
|
|
2ca6c62cd8 | ||
|
|
d99dc30dcd | ||
|
|
62015919dd | ||
|
|
e0cbc48cc0 | ||
|
|
15718d57fa | ||
|
|
c907211784 | ||
|
|
053c567618 | ||
|
|
faf87f3643 | ||
|
|
1df75ee212 | ||
|
|
ce406bfad3 | ||
|
|
0dec930412 | ||
|
|
d7b949d9f9 | ||
|
|
bf56094156 | ||
|
|
1a450ff79a | ||
|
|
76791fd7c1 | ||
|
|
45fcdf78be | ||
|
|
d1cb867cf8 | ||
|
|
5bf74a6639 | ||
|
|
2b440c2935 | ||
|
|
5420c54d9a | ||
|
|
ad97a31a31 | ||
|
|
0a8495fe79 | ||
|
|
a246f2ab03 | ||
|
|
5765c8ea19 | ||
|
|
e701aa1feb | ||
|
|
bc825895ac | ||
|
|
0cc4374865 | ||
|
|
66ae61f2c9 | ||
|
|
cf84fe2080 | ||
|
|
beddb26757 | ||
|
|
df473b1d33 | ||
|
|
e3fdeb53b3 | ||
|
|
8c2498d00f | ||
|
|
69c648c4f4 | ||
|
|
60e5d9ea2f | ||
|
|
109489a2aa | ||
|
|
6937318b2e | ||
|
|
23bc6c2bfc | ||
|
|
38284658dd | ||
|
|
759278b9ff | ||
|
|
14b302151b | ||
|
|
e6c3353b51 | ||
|
|
eea8def35c | ||
|
|
d5fadfa55e | ||
|
|
7e047478d5 | ||
|
|
9eb38ba06e | ||
|
|
85f05563ce | ||
|
|
7646aa3295 | ||
|
|
3942f88ef6 | ||
|
|
46eb126ebe | ||
|
|
70ff086e0c | ||
|
|
b348710bd5 | ||
|
|
dc0cf79188 | ||
|
|
0ac0267888 | ||
|
|
46263ca5e0 | ||
|
|
28fdb698bf | ||
|
|
9105add777 | ||
|
|
eb3e75fe67 | ||
|
|
def81ab3f3 | ||
|
|
4d34b5d1be | ||
|
|
fa7851a787 | ||
|
|
632add5f4a | ||
|
|
95bad52a3e | ||
|
|
31929db357 | ||
|
|
e888571c63 | ||
|
|
645ddcab04 | ||
|
|
2787644994 | ||
|
|
e884de149a | ||
|
|
71c88ec956 | ||
|
|
4c6b1289fc | ||
|
|
e8f51361ad | ||
|
|
ee73604008 | ||
|
|
cf5c7d8bbb | ||
|
|
9c4a50da8e | ||
|
|
2c8ae6b254 | ||
|
|
fa975c2aab | ||
|
|
88910d039b | ||
|
|
75b43d31c9 | ||
|
|
e935cad8b7 | ||
|
|
b5b1cfa449 | ||
|
|
1306f86a65 | ||
|
|
41e6fa1c48 | ||
|
|
5f45ee5029 | ||
|
|
3a50bf9375 | ||
|
|
8d913ce979 | ||
|
|
2d2164c380 | ||
|
|
a2c43661c4 | ||
|
|
4ddbe07a30 | ||
|
|
fe6d03981c | ||
|
|
294047bcda | ||
|
|
b07b2aec9d | ||
|
|
c6ea4f4f89 | ||
|
|
8584ed4bbf | ||
|
|
4ecaf54f82 | ||
|
|
677e5bbc67 | ||
|
|
674dd47dbc | ||
|
|
1e987bf5b6 | ||
|
|
acb859f9e5 | ||
|
|
734b60f145 | ||
|
|
34aa8346e9 | ||
|
|
96378ec33d | ||
|
|
6c53a052b3 | ||
|
|
368a5d98f8 | ||
|
|
15913c75b7 | ||
|
|
20a375aaf5 | ||
|
|
cac1fdb02c | ||
|
|
bb9efdbd8a | ||
|
|
bbb1e0c24a | ||
|
|
ff360658e4 | ||
|
|
908cb7ae03 | ||
|
|
9aedf18379 | ||
|
|
cbaf74418b | ||
|
|
e2ebe918bd | ||
|
|
546d204f9d | ||
|
|
534dc2819e | ||
|
|
5449c2a9f3 | ||
|
|
9db6059fb7 | ||
|
|
a725faaac8 | ||
|
|
c70246818e | ||
|
|
3db95f1b7c | ||
|
|
467d864eb4 | ||
|
|
919a856d93 | ||
|
|
cb476fa5ec | ||
|
|
f5b59c0f95 | ||
|
|
e28bcc41ea | ||
|
|
8425a838d0 | ||
|
|
71bc395125 | ||
|
|
b6640dfcee | ||
|
|
11ecd94afd | ||
|
|
a5c8a04e0f | ||
|
|
87e6408291 | ||
|
|
4cf429c210 |
No files matched your search
@@ -1,22 +0,0 @@
|
||||
name: ci
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.x
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
key: ${{ github.ref }}
|
||||
path: .cache
|
||||
- run: pip install mkdocs-material
|
||||
- run: mkdocs gh-deploy --force
|
||||
+1
-2
@@ -1,3 +1,2 @@
|
||||
*.polydev
|
||||
LICENSE
|
||||
Lua_Annotation_CheatSheet/
|
||||
venv/
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 DarthMooMancer
|
||||
Copyright (c) 2026 Andrew Haynes
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,29 +1,54 @@
|
||||
# Polydev
|
||||
A multi-lingual plugin that adds some nice features to neovim for managing, creating, building and runnning projects all within neovim.
|
||||
<h1 align="center">Vern-nvim</h1>
|
||||
|
||||

|
||||
<p align="left">Vern-nvim (aka Vernacular-nvim) is a multilingual project scaffolder with a bunch of extra add-ons. It creates new projects, new files based on buffer filetype, runs projects and builds if needed and more.</p>
|
||||
|
||||
### Quick Features
|
||||
The ability to -
|
||||
* Create new projects
|
||||
* Create new files
|
||||
* Build those files
|
||||
* Run those files
|
||||
* Builtin terminal for running code
|
||||
* And More!
|
||||
> [!WARNING]
|
||||
> Vern-nvim is only tested on vim.pack as of right now.
|
||||
> Meaning it may not work well with lazy.nvim or any other package manager
|
||||
|
||||
Documentation is over at [Polydev Documentation](https://darthmoomancer.github.io/Polydev/)
|
||||
|
||||
### Currently Supported (And working) Languages
|
||||
* Java
|
||||
> [!NOTE]
|
||||
> This is solely a passion project to improve my own workflow meaning that the plugin is very opinionated. If it were to ever pickup traction, I would love it if people could suggest larger changes that allowed this to be an even better neovim project scaffold
|
||||
|
||||
## Features
|
||||
|
||||
* Works out of the box with no additional configuration needed
|
||||
* Extensibility towards custom templates.
|
||||
* Custom commands
|
||||
* Builtin terminal for viewing code !(scratchpad in future)
|
||||
* !(Future) Allows for custom providers for languages and custom commands
|
||||
|
||||
> All features and configs are documented here [Future Documentation](https://vern-nvim.moomancer.xyz/docs) (lies, it will be here one day)
|
||||
|
||||
## Supported Languages
|
||||
|
||||
Vern-nvim currently supports the following languages:
|
||||
|
||||
* Python
|
||||
* C/C++
|
||||
* C / C++
|
||||
* Lua
|
||||
* Java
|
||||
* Rust
|
||||
* Html
|
||||
|
||||
## Things planned
|
||||
* The use of rust to speed up some aspects of the plugin
|
||||
## Questions and Contributing
|
||||
Additional language support is planned for future releases.
|
||||
|
||||
If you want to contribute, make a PR or issue and I will answer as soon as I see it. If there is a language that you want added for easier use, please voice it. If you have questions, just ask in issues or discussions and I will answer them.
|
||||
- Web based languages (HTML, CSS, JS/TS), these will be scaffolded by deno, bun, etc
|
||||
- Other languages I am interested in
|
||||
|
||||
|
||||
## Roadmap
|
||||
|
||||
- [ ] Refactoring and internal cleanup from v1.
|
||||
- [ ] Implement scratchpad functionality
|
||||
- [ ] Impleemtn custom provider support
|
||||
- [ ] Keybinds for specific languages to rebuild (c/c++/java/rust) (Part 1)
|
||||
- [ ] Adding language specific keybinds for extra information or convienence (Part 2)
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome and appreciated!
|
||||
|
||||
* Open an issue for bug reports, questions, or feature requests.
|
||||
* Submit a pull request if you'd like to contribute directly.
|
||||
|
||||
Thank you for checking out Vern-nvim!
|
||||
@@ -1,56 +0,0 @@
|
||||
# 🚀 Welcome to Polydev
|
||||
|
||||
Polydev is a highly customizable and extensible Neovim plugin aimed at streamlining project creation and management for multiple programming languages. It’s especially suited for developers who work across different languages and want a consistent workflow for initializing, building, and running projects.
|
||||
|
||||

|
||||
|
||||
## ❓ What is Polydev?
|
||||
|
||||
Polydev is designed to be a centralized workspace tool that reduces repetitive tasks involved in setting up development environments. Whether you’re working on a Lua plugin, a Rust CLI tool, or a C++ project, Polydev helps you scaffold project directories, create boilerplate code, and define keybinds to streamline execution — all from within Neovim.
|
||||
|
||||
## 💡 Why Polydev?
|
||||
|
||||
Modern development often involves juggling multiple languages. Setting up similar environments repeatedly or manually running commands wastes time. Polydev solves this by providing:
|
||||
|
||||
- 📦 **Project templates per language**
|
||||
- 🎯 **Custom keybindings for common actions**
|
||||
- 💻 **Floating terminal support**
|
||||
- 🗂 **Easy file creation and directory structure generation**
|
||||
- 🔌 **Plugin-first architecture to expand functionality**
|
||||
|
||||
## 🔧 Core Features
|
||||
|
||||
- 🌐 **Language Support**: Define custom settings per language including `project_root`, `keybinds`, and `build_attributes`.
|
||||
- 🪟 **Floating Terminals**: Run builds and executions in a Neovim floating terminal.
|
||||
- 🧱 **Scaffolding**: Automatically create the appropriate directory and file layout for new projects.
|
||||
- 🎹 **Keybind Mapping**: Rebind keys to execute project-specific commands like `Build`, `Run`, or `Test`.
|
||||
- 🔌 **Pluggable**: Designed to easily integrate with other tools or extend with your own commands and language presets.
|
||||
|
||||
## 👥 Target Audience
|
||||
|
||||
Polydev is perfect for:
|
||||
|
||||
- 🧑💻 Developers building across multiple languages
|
||||
- 🔌 Plugin authors and power users of Neovim
|
||||
- ⚡ Anyone who wants automated project bootstrapping
|
||||
|
||||
## 🎯 Goals
|
||||
|
||||
- 📏 **Consistency**: Provide a common interface for all your dev projects.
|
||||
- 🧩 **Extensibility**: Let users add their own languages and tools.
|
||||
- ✨ **Simplicity**: Reduce boilerplate and context switching.
|
||||
|
||||
## 🧪 Example Use Case
|
||||
|
||||
Say you're a developer who works with Rust, Lua, and Python. Instead of remembering build commands, directory structures, or manually creating a `main.rs` or `init.lua`, Polydev:
|
||||
|
||||
1. 🏗 Sets up your directory based on language conventions.
|
||||
2. 📄 Generates boilerplate files.
|
||||
3. 🎛 Maps `<leader>pr` to `Run`, `<leader>pb` to `Build`, and so on.
|
||||
4. 🖥 Opens a floating terminal to show your output.
|
||||
|
||||
## 🏷 Versioning
|
||||
|
||||
Polydev uses GitHub tags and branches to manage plugin versions. Each version corresponds to a stable release that users can track.
|
||||
|
||||
---
|
||||
@@ -1,127 +0,0 @@
|
||||
# 📦 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.
|
||||
|
||||
> ⚠️ **Disclaimer**: The `opts` and configuration values shown below are simply examples. You can customize them based on your preferences or even omit them entirely if not needed.
|
||||
> 💡 **Heads up!** Many language presets in Polydev require a file named `<project_name>.polydev` in your project root. If it's missing, Polydev will let you know (loudly 😅).
|
||||
|
||||
---
|
||||
|
||||
## 🛌 Lazy.nvim
|
||||
|
||||
This is the **recommended** way if you're using [Lazy.nvim](https://github.com/folke/lazy.nvim):
|
||||
|
||||
```lua
|
||||
{
|
||||
"DarthMooMancer/Polydev",
|
||||
opts = {
|
||||
lua = {
|
||||
project_root = "~/Projects/Lua",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "LuaRun",
|
||||
},
|
||||
},
|
||||
terminal = {
|
||||
border = true,
|
||||
number = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
> ✅ Keep the `opts` key! It’s the modern way of setting up plugins in Lazy.
|
||||
|
||||
---
|
||||
|
||||
## 🧸 Mini.deps
|
||||
|
||||
For users of [mini.nvim](https://github.com/echasnovski/mini.nvim)'s dependency manager:
|
||||
|
||||
```lua
|
||||
MiniDeps.add({ source = "DarthMooMancer/Polydev" })
|
||||
|
||||
require("Polydev").setup({
|
||||
rust = {
|
||||
project_root = "~/Projects/Rust",
|
||||
keybinds = {
|
||||
["<leader>pb"] = "RustBuild",
|
||||
["<leader>pr"] = "RustRun",
|
||||
},
|
||||
},
|
||||
terminal = {
|
||||
border = true,
|
||||
number = true,
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📁 Packer.nvim
|
||||
|
||||
For fans of [Packer.nvim](https://github.com/wbthomason/packer.nvim):
|
||||
|
||||
```lua
|
||||
use({
|
||||
"DarthMooMancer/Polydev",
|
||||
config = function()
|
||||
require("Polydev").setup({
|
||||
python = {
|
||||
project_root = "~/Projects/Python",
|
||||
keybinds = {
|
||||
["<leader>pb"] = "PythonPip",
|
||||
["<leader>pr"] = "PythonRun",
|
||||
},
|
||||
},
|
||||
terminal = {
|
||||
relativenumber = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Vim-Plug (Classic)
|
||||
|
||||
Even if you're still using [vim-plug](https://github.com/junegunn/vim-plug), you’re covered:
|
||||
|
||||
```vim
|
||||
Plug 'DarthMooMancer/Polydev'
|
||||
|
||||
lua << EOF
|
||||
require("Polydev").setup({
|
||||
c = {
|
||||
project_root = "~/Projects/C",
|
||||
keybinds = {
|
||||
["<leader>pb"] = "CBuild",
|
||||
["<leader>pr"] = "CRun",
|
||||
},
|
||||
},
|
||||
terminal = {
|
||||
number = true,
|
||||
},
|
||||
})
|
||||
EOF
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛠 Manual Install
|
||||
|
||||
Clone the repo into your `~/.config/nvim/lua` or any runtime path:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/DarthMooMancer/Polydev ~/.config/nvim/lua/Polydev
|
||||
```
|
||||
|
||||
Then in your config:
|
||||
|
||||
```lua
|
||||
require("Polydev").setup({
|
||||
terminal = {
|
||||
border = true,
|
||||
},
|
||||
})
|
||||
```
|
||||
@@ -1,61 +0,0 @@
|
||||
### C Setup for Polydev 🛠️
|
||||
|
||||
#### Key Notes ⚠️
|
||||
> **Important**: The first time you build a project, it might throw an error. This is expected behavior. Simply rerun the build, and if errors persist, it may be an issue with your project setup rather than the plugin.
|
||||
|
||||
---
|
||||
|
||||
#### Keybinds 🎮
|
||||
You can customize keybinds for your C projects with Polydev.
|
||||
|
||||
| Keybind | Action |
|
||||
|---------------------|--------------------------------------------------|
|
||||
| `<leader>pb` | Build all C files in the `src` directory |
|
||||
| `<leader>pr` | Run `<Project_name>` in your build directory |
|
||||
| `<leader>nh` | Create a new header file in the current project’s `src` folder |
|
||||
|
||||
#### Configuration Example:
|
||||
|
||||
```lua
|
||||
require("Polydev").c.setup({
|
||||
keybinds = {
|
||||
["<leader>pb"] = "CBuild", -- Build all C files in the src directory
|
||||
["<leader>pr"] = "CRun", -- Run <Project_name> in your build directory
|
||||
["<leader>nh"] = "NewCHeaderFile" -- Create a new header file in the current project’s src folder
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### 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 |
|
||||
| `<project_name>.polydev` | Polydev metadata file (generated during build) |
|
||||
| `include/` | Folder for header files |
|
||||
| `*.h` | C header files |
|
||||
|
||||
#### Example Structure:
|
||||
|
||||
```md
|
||||
Projects/
|
||||
└── C/
|
||||
└── Project_Name/
|
||||
├── CMakeLists.txt
|
||||
├── src/
|
||||
│ ├── main.c
|
||||
│ └── *.c
|
||||
├── build/
|
||||
│ └── <project_name>.polydev
|
||||
└── include/
|
||||
└── *.h
|
||||
```
|
||||
|
||||
---
|
||||
@@ -1,61 +0,0 @@
|
||||
### C Setup for Polydev 🛠️
|
||||
|
||||
#### Key Notes ⚠️
|
||||
> **Important**: The first time you build a project, it might throw an error. This is expected behavior. Simply rerun the build, and if errors persist, it may be an issue with your project setup rather than the plugin.
|
||||
|
||||
---
|
||||
|
||||
#### Keybinds 🎮
|
||||
You can customize keybinds for your C projects with Polydev.
|
||||
|
||||
| Keybind | Action |
|
||||
|---------------------|--------------------------------------------------|
|
||||
| `<leader>pb` | Build all C files in the `src` directory |
|
||||
| `<leader>pr` | Run `<Project_name>` in your build directory |
|
||||
| `<leader>nh` | Create a new header file in the current project’s `src` folder |
|
||||
|
||||
#### Configuration Example:
|
||||
|
||||
```lua
|
||||
require("Polydev").c.setup({
|
||||
keybinds = {
|
||||
["<leader>pb"] = "CppBuild", -- Build all C files in the src directory
|
||||
["<leader>pr"] = "CppRun", -- Run <Project_name> in your build directory
|
||||
["<leader>nh"] = "NewCppHeaderFile" -- Create a new header file in the current project’s src folder
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### 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 |
|
||||
| `<project_name>.polydev` | Polydev metadata file (generated during build) |
|
||||
| `include/` | Folder for header files |
|
||||
| `*.hpp` | Cpp header files |
|
||||
|
||||
#### Example Structure:
|
||||
|
||||
```md
|
||||
Projects/
|
||||
└── Cpp/
|
||||
└── Project_Name/
|
||||
├── CMakeLists.txt
|
||||
├── src/
|
||||
│ ├── main.cpp
|
||||
│ └── *.cpp
|
||||
├── build/
|
||||
│ └── <project_name>.polydev
|
||||
└── include/
|
||||
└── *.hpp
|
||||
```
|
||||
|
||||
---
|
||||
@@ -1,58 +0,0 @@
|
||||
### Java Setup for Polydev ☕️
|
||||
|
||||
#### Keybinds 🎮
|
||||
You can customize the keybinds for your Java projects in Polydev.
|
||||
|
||||
| Keybind | Action |
|
||||
|---------------------|-----------------------------------------------------|
|
||||
| `<leader>pb` | Build all Java files in the `src` directory |
|
||||
| `<leader>pr` | Run `Main.java` from the `out` folder in your project |
|
||||
| `<leader>nf` | Create a new Java file in the `src` folder |
|
||||
|
||||
#### Configuration Example:
|
||||
|
||||
```lua
|
||||
-- These are defaults, so no need to copy them
|
||||
require("Polydev").java.setup({
|
||||
keybinds = {
|
||||
["<leader>pb"] = "JavaBuild", -- Build all Java files in the src directory
|
||||
["<leader>pr"] = "JavaRun", -- Run Main.java in the out folder
|
||||
["<leader>nf"] = "NewJavaFile" -- Create a new Java file in the src folder
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### 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,64 +0,0 @@
|
||||
### Lua Setup for Polydev 🐢
|
||||
|
||||
#### Key Notes ⚠️
|
||||
|
||||
* Polydev provides seamless integration with Lua projects, allowing you to easily run and manage Lua code.
|
||||
* You must include a `<Project_name>.polydev` file in your project root directory for Polydev to recognize the project. Missing this file will lead to errors.
|
||||
* The file structure should be organized to ensure smooth execution and functionality.
|
||||
|
||||
---
|
||||
|
||||
#### Keybinds 🎮
|
||||
|
||||
Below are the default keybinds for Lua projects using Polydev. You can adjust them to suit your personal preferences.
|
||||
|
||||
| Keybind | Action |
|
||||
|---------------------|-------------------------------------------------|
|
||||
| `<leader>pr` | Run the Lua project |
|
||||
|
||||
##### Configuration Example:
|
||||
|
||||
```lua
|
||||
-- These are the defaults for Lua, adjust as needed
|
||||
require("Polydev").lua.setup({
|
||||
keybinds = {
|
||||
["<leader>pr"] = "LuaRun", -- Run the Lua project
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### 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 |
|
||||
|----------------------------|-----------------------------------------------------|
|
||||
| `<Project_name>.polydev` | Project metadata file that Polydev uses for configuration |
|
||||
| `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/
|
||||
├── <Project_name>.polydev -- Polydev configuration file
|
||||
└── lua/
|
||||
└── Project_name/
|
||||
└── init.lua -- Main Lua file
|
||||
```
|
||||
|
||||
---
|
||||
@@ -1,63 +0,0 @@
|
||||
### Python Setup for Polydev 🐍
|
||||
|
||||
#### Keybinds 🎮
|
||||
You can easily customize the keybinds for your Python projects using Polydev.
|
||||
|
||||
| Keybind | Action |
|
||||
|---------------------|---------------------------------------------------|
|
||||
| `<leader>pr` | Run the Python project in your active terminal |
|
||||
| `<leader>pb` | Install dependencies using pip |
|
||||
|
||||
#### Configuration Example:
|
||||
|
||||
```lua
|
||||
require("Polydev").python.setup({
|
||||
keybinds = {
|
||||
["<leader>pr"] = "PythonRun", -- Run the Python project
|
||||
["<leader>pb"] = "PythonPip" -- Install dependencies using pip
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### 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 |
|
||||
|
||||
#### Example Structure:
|
||||
|
||||
```md
|
||||
Projects/
|
||||
└── Python/
|
||||
└── Project_Name/
|
||||
├── main.py
|
||||
├── requirements.txt
|
||||
├── setup.py
|
||||
├── tests/
|
||||
└── venv/
|
||||
```
|
||||
|
||||
---
|
||||
-136
@@ -1,136 +0,0 @@
|
||||
|
||||
# Setup and Customizing Polydev
|
||||
|
||||
## 🔧 Project Name Customization
|
||||
You can easily customize the default directory for your project! The project can be created from any directory, and Polydev will automatically create the required project root directory for you.
|
||||
|
||||
> **Note:** `project_root` allows you to customize where your project will be stored. If you don't specify it, the default is `~/Projects/Language`.
|
||||
|
||||
---
|
||||
### LazyVim Example
|
||||
|
||||
```lua
|
||||
return {
|
||||
...
|
||||
opts = {
|
||||
<language> = {
|
||||
project_root = "~/Home/..." -- Default: ~/Projects/Language
|
||||
}
|
||||
}
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Packer Example
|
||||
|
||||
```lua
|
||||
require("Polydev").language.setup({
|
||||
project_root = "~/Home/..." -- Default: ~/Projects/Language
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
## ⌨ Keybinds Customization
|
||||
Polydev allows you to easily manage keybinds, providing a uniform way to interact with different languages. Most keybinds are the same across languages, while some have language-specific ones (e.g., Python's pip keybind).
|
||||
|
||||
### Keybind Categories
|
||||
| Keybind Type | Description |
|
||||
|-------------------|--------------------------------------------------|
|
||||
| **Universal** | Cannot be changed through specific language settings (e.g., `<leader>nf` for a new file). |
|
||||
| **Per-language** | Can be customized per language (e.g., `<leader>pb` for language build). |
|
||||
|
||||
### LazyVim Example
|
||||
|
||||
```lua
|
||||
return {
|
||||
...
|
||||
opts = {
|
||||
<language> = {
|
||||
["<Esc>"] = "CloseTerminal", -- Universal, can be changed per language for now
|
||||
["<leader>pb"] = "languageBuild", -- Per-language
|
||||
["<leader>pr"] = "languageRun", -- Per-language
|
||||
["<leader>nf"] = "NewLanguageFile", -- Universal
|
||||
["<leader>nh"] = "NewLanguageSecondaryFile", -- Universal
|
||||
}
|
||||
}
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Packer Example
|
||||
|
||||
```lua
|
||||
require("Polydev").language.setup({
|
||||
keybinds = {
|
||||
["<Esc>"] = "CloseTerminal", -- Universal, can be changed per language for now
|
||||
["<leader>pb"] = "languageBuild", -- Per-language
|
||||
["<leader>pr"] = "languageRun", -- Per-language
|
||||
["<leader>nf"] = "NewLanguageFile", -- Universal
|
||||
["<leader>nh"] = "NewLanguageSecondaryFile", -- Universal
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🖥 Terminal Customization
|
||||
You can further tweak the terminal settings to suit your preferences! These options allow you to adjust padding, borders, numbers, and scrolling behavior.
|
||||
|
||||
### Available Terminal Settings
|
||||
| Setting | Default Value | Description |
|
||||
|------------------|-----------------|---------------------------------------------------------|
|
||||
| **right_padding** | `0` | Padding for the right width of the terminal. |
|
||||
| **left_padding** | `0` | Padding for the left width of the terminal. |
|
||||
| **top_padding** | `0` | Padding for the top height of the terminal. |
|
||||
| **bottom_padding**| `0` | Padding for the bottom height of the terminal. |
|
||||
| **border** | `true` | Adds a rounded border to the window. |
|
||||
| **number** | `true` | Displays line numbers in the terminal. |
|
||||
| **relativenumber**| `true` | Displays relative numbers based on cursor position. |
|
||||
| **scroll** | `true` | Enables scroll functionality in the terminal. |
|
||||
|
||||
> **Note:** These terminal settings allow you to personalize the terminal view and improve usability. You can easily adjust the padding, borders, and other aspects to your preference.
|
||||
|
||||
---
|
||||
### LazyVim Example
|
||||
|
||||
```lua
|
||||
return {
|
||||
...
|
||||
opts = {
|
||||
terminal = {
|
||||
right_padding = 0,
|
||||
bottom_padding = 0,
|
||||
left_padding = 0,
|
||||
top_padding = 0,
|
||||
border = true,
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
scroll = true,
|
||||
}
|
||||
}
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Packer Example
|
||||
|
||||
```lua
|
||||
require("Polydev").setup({
|
||||
terminal = {
|
||||
right_padding = 0,
|
||||
bottom_padding = 0,
|
||||
left_padding = 0,
|
||||
top_padding = 0,
|
||||
border = true,
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
scroll = true,
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
## 🚀 Final Thoughts and Customizations
|
||||
This guide provided you with the basic configuration steps for setting up Polydev with your preferred package manager and customizing key aspects like project names, keybinds, and terminal settings.
|
||||
|
||||
You can further explore other Polydev features and modify the configuration to suit your development workflow.
|
||||
@@ -1,103 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
---@class Keybinds
|
||||
---@field [string] string
|
||||
---
|
||||
---@class ConfigsLanguage
|
||||
---@field project_root? string
|
||||
---@field keybinds? Keybinds -- ? makes fields optional
|
||||
---@field build_attributes? string
|
||||
---
|
||||
---@class Terminal
|
||||
---@field right_padding integer
|
||||
---@field left_padding integer
|
||||
---@field bottom_padding integer
|
||||
---@field top_padding integer
|
||||
---@field border boolean
|
||||
---@field number boolean
|
||||
---@field relativenumber boolean
|
||||
---
|
||||
---@class Defaults
|
||||
---@field html ConfigsLanguage
|
||||
---@field rust ConfigsLanguage
|
||||
---@field java ConfigsLanguage
|
||||
---@field python ConfigsLanguage
|
||||
---@field lua ConfigsLanguage
|
||||
---@field c ConfigsLanguage
|
||||
---@field cpp ConfigsLanguage
|
||||
---@field terminal Terminal
|
||||
|
||||
---@type Defaults
|
||||
M.defaults = {
|
||||
html = {
|
||||
project_root = "~/Projects/Html",
|
||||
},
|
||||
rust = {
|
||||
project_root = "~/Projects/Rust",
|
||||
keybinds = {
|
||||
["<leader>pb"] = "RustBuild",
|
||||
["<leader>pr"] = "RustRun",
|
||||
},
|
||||
},
|
||||
java = {
|
||||
project_root = "~/Projects/Java",
|
||||
keybinds = {
|
||||
["<leader>pb"] = "JavaBuild",
|
||||
["<leader>pr"] = "JavaRun",
|
||||
},
|
||||
},
|
||||
python = {
|
||||
project_root = "~/Projects/Python",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "PythonRun",
|
||||
["<leader>pb"] = "PythonPip",
|
||||
},
|
||||
},
|
||||
lua = {
|
||||
project_root = "~/Projects/Lua",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "LuaRun",
|
||||
},
|
||||
},
|
||||
c = {
|
||||
project_root = "~/Projects/C",
|
||||
keybinds = {
|
||||
["<leader>pb"] = "CBuild",
|
||||
["<leader>pr"] = "CRun",
|
||||
["<leader>nh"] = "NewCHeaderFile",
|
||||
},
|
||||
build_attributes = ""
|
||||
},
|
||||
cpp = {
|
||||
project_root = "~/Projects/Cpp",
|
||||
keybinds = {
|
||||
["<leader>pb"] = "CppBuild",
|
||||
["<leader>pr"] = "CppRun",
|
||||
["<leader>nh"] = "NewCppHeaderFile",
|
||||
},
|
||||
build_attributes = "",
|
||||
},
|
||||
terminal = {
|
||||
right_padding = 0,
|
||||
bottom_padding = 0,
|
||||
left_padding = 0,
|
||||
top_padding = 0,
|
||||
border = true,
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
}
|
||||
}
|
||||
|
||||
---@type string[]
|
||||
M.user_config = {}
|
||||
|
||||
function M.setup(user_opts)
|
||||
M.user_config = vim.tbl_deep_extend("force", {}, M.defaults, user_opts or {})
|
||||
end
|
||||
|
||||
---@param lang string
|
||||
function M.get(lang)
|
||||
return M.user_config[lang] or {}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,81 +0,0 @@
|
||||
---@module "Polydev.configs"
|
||||
local config = require("Polydev.configs")
|
||||
|
||||
---@module "Polydev.utils"
|
||||
local utils = require("Polydev.utils")
|
||||
|
||||
---@module "Polydev.templates"
|
||||
local templates = require("Polydev.templates")
|
||||
|
||||
---@type table
|
||||
local M = {}
|
||||
|
||||
---@type table
|
||||
M.loaded_languages = {}
|
||||
|
||||
---@param lang string
|
||||
---@param opts table?
|
||||
---@return boolean
|
||||
function M.load_language_module(lang, opts)
|
||||
if M.loaded_languages[lang] then return true end
|
||||
|
||||
local ok, lang_module = pcall(require, "Polydev.languages." .. lang)
|
||||
if ok and lang_module.setup then
|
||||
local lang_opts = opts and opts[lang] or {}
|
||||
lang_module.setup(lang_opts)
|
||||
M.loaded_languages[lang] = lang_module
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function M.create_project()
|
||||
local opts = {}
|
||||
vim.ui.input({ prompt = "Enter language for project: " }, function(lang)
|
||||
if not lang or lang == "" then return print("Project creation canceled.") end
|
||||
opts = vim.tbl_deep_extend("force", {}, config.get(lang), opts or {})
|
||||
if M.load_language_module(lang) and templates.projects[lang] and templates.projects[lang].run then
|
||||
templates.create_project(lang, opts.project_root)
|
||||
else
|
||||
print("Error: No project creation method for " .. lang)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function M.create_new_file()
|
||||
vim.ui.input({ prompt = "Enter language for new file: " }, function(lang)
|
||||
if not lang or lang == "" then return print("File creation canceled.") end
|
||||
|
||||
if M.load_language_module(lang) and M.loaded_languages[lang].create_new_file then
|
||||
M.loaded_languages[lang].create_new_file()
|
||||
else
|
||||
print("Error: No File creation method for " .. lang)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts table
|
||||
function M.setup(opts)
|
||||
opts = opts or {}
|
||||
config.setup(opts)
|
||||
utils.setup(opts)
|
||||
for lang, user_opts in pairs(opts) do
|
||||
local default = config.defaults[lang] or {}
|
||||
config.user_config[lang] = vim.tbl_deep_extend("force", default, user_opts)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("NewProject", M.create_project, {})
|
||||
vim.api.nvim_create_user_command("NewFile", M.create_new_file, {})
|
||||
vim.keymap.set("n", "<leader>np", ":NewProject<CR>", { silent = true })
|
||||
vim.keymap.set("n", "<leader>nf", ":NewFile<CR>", { silent = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
local filetype = vim.bo.filetype
|
||||
M.load_language_module(filetype, opts)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
---@return table
|
||||
return M
|
||||
@@ -1,170 +0,0 @@
|
||||
local utils = require("Polydev.utils")
|
||||
local M = {}
|
||||
|
||||
M.keybinds = {}
|
||||
M.opts = nil
|
||||
|
||||
function M.setup(opts)
|
||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("c"), opts or {})
|
||||
for key, command in pairs(M.opts.keybinds) do
|
||||
M.keybinds[command] = key
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("NewCHeaderFile", M.create_new_header_file, {})
|
||||
vim.api.nvim_create_user_command("CBuild", M.build, {})
|
||||
vim.api.nvim_create_user_command("CRun", M.run, {})
|
||||
|
||||
if M.keybinds.CBuild then
|
||||
vim.keymap.set("n", M.keybinds.CBuild, ":CBuild<CR>", { silent = true })
|
||||
end
|
||||
if M.keybinds.CRun then
|
||||
vim.keymap.set("n", M.keybinds.CRun, ":CRun<CR>", { silent = true })
|
||||
end
|
||||
if M.keybinds.NewCHeaderFile then
|
||||
vim.keymap.set("n", M.keybinds.NewCHeaderFile, ":NewCHeaderFile<CR>", { silent = true })
|
||||
end
|
||||
end
|
||||
|
||||
function M.create_project()
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(project_name)
|
||||
if not project_name or project_name == "" then
|
||||
print("Project creation canceled.")
|
||||
return
|
||||
end
|
||||
|
||||
local project_root = vim.fn.expand(M.opts.project_root) .. "/" .. project_name
|
||||
for _, path in ipairs({ "/src", "/build", "/include" }) do
|
||||
vim.fn.mkdir(project_root .. path, "p")
|
||||
end
|
||||
|
||||
utils.write_file(project_root .. "/build/" .. project_name .. ".polydev", project_name)
|
||||
utils.write_file(project_root .. "/src/main.c", [[
|
||||
/* If you have vcpkg and want to use it:
|
||||
vcpkg new --application
|
||||
vcpkg add port <package_name>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("%s", "Hello World");
|
||||
return 0;
|
||||
}
|
||||
]])
|
||||
|
||||
utils.write_file(project_root .. "/CMakeLists.txt", string.format([[
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
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)
|
||||
|
||||
# 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))
|
||||
|
||||
|
||||
utils.write_file(project_root .. "/CMakePresets.json", string.format([[
|
||||
# For the purposes of vcpkg, DO NOT REMOVE, but feel free to change as needed
|
||||
{
|
||||
"version": 2,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "vcpkg",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]]))
|
||||
|
||||
utils.write_file(project_root .. "/CMakeUserPresets.json", string.format([[
|
||||
{
|
||||
"version": 2,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"inherits": "vcpkg",
|
||||
"environment": {
|
||||
"VCPKG_ROOT": "/Users/<USER>/vcpkg"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]]))
|
||||
vim.cmd("edit " .. project_root .. "/src/main.c")
|
||||
vim.fn.system(string.format("cd %s/build/ && cmake .. && cmake --build .", project_root))
|
||||
end)
|
||||
end
|
||||
|
||||
function M.create_new_file()
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(class_name)
|
||||
if not class_name or class_name == "" then return print("File creation canceled.") end
|
||||
local root_dir = M.get_project_root()
|
||||
if not root_dir then return print("Error: Project root not found.") end
|
||||
utils.write_file(root_dir .. "/src/" .. class_name .. ".c", "")
|
||||
end)
|
||||
end
|
||||
|
||||
function M.create_new_header_file()
|
||||
vim.ui.input({ prompt = "Enter header file name: " }, function(header_name)
|
||||
if not header_name then return print("Header file creation canceled.") end
|
||||
local root_dir = M.get_project_root()
|
||||
if not root_dir then return print("Error: Project root not found.") end
|
||||
local guard_macro = header_name:upper():gsub("[^A-Z0-9]", "_") .. "_H"
|
||||
local content = string.format([[
|
||||
#ifndef %s
|
||||
#define %s
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// Function prototypes
|
||||
void example_function();
|
||||
|
||||
#endif // %s
|
||||
]], guard_macro, guard_macro, guard_macro)
|
||||
utils.write_file(root_dir .. "/include/" .. header_name .. ".h", content)
|
||||
end)
|
||||
end
|
||||
|
||||
function M.get_project_root()
|
||||
local dir = vim.fn.expand("%:p:h")
|
||||
while dir ~= "/" do
|
||||
if vim.fn.isdirectory(dir .. "/src") == 1 or vim.fn.filereadable(dir .. "/CMakeLists.txt") == 1 then
|
||||
return dir
|
||||
end
|
||||
dir = vim.fn.fnamemodify(dir, ":h")
|
||||
end
|
||||
end
|
||||
|
||||
function M.build()
|
||||
local root = M.get_project_root()
|
||||
if not root then return print("Error: Project root not found.") end
|
||||
local build_dir = root .. "/build"
|
||||
|
||||
local cmd = "cd " .. build_dir .. " && cmake --build ."
|
||||
local term_buf = utils.open_float_terminal(cmd)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||
local output = vim.fn.system(cmd)
|
||||
local success = vim.v.shell_error == 0
|
||||
vim.api.nvim_buf_set_lines(term_buf, 0, -1, false, vim.list_extend({ success and "Compilation successful!" or "Error during compilation:" }, vim.split(output, "\n", { trimempty = true })))
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", false)
|
||||
end
|
||||
|
||||
function M.run()
|
||||
local root = M.get_project_root()
|
||||
if not root then return print("Error: Project root not found.") end
|
||||
local build_dir = root .. "/build"
|
||||
local files = vim.fn.glob(build_dir .. "/*.polydev", true, true)
|
||||
if #files == 0 then return print("Error: No .polydev file found in build directory.") end
|
||||
utils.open_float_terminal("cd " .. build_dir .. " && ./" .. files[1]:match("([^/]+)%.polydev$"))
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,171 +0,0 @@
|
||||
local utils = require("Polydev.utils")
|
||||
local M = {}
|
||||
|
||||
M.keybinds = {}
|
||||
M.opts = nil
|
||||
|
||||
function M.setup(opts)
|
||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("cpp"), opts or {})
|
||||
for key, command in pairs(M.opts.keybinds) do
|
||||
M.keybinds[command] = key
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("NewCppHeaderFile", M.create_new_header_file, {})
|
||||
vim.api.nvim_create_user_command("CppBuild", M.build, {})
|
||||
vim.api.nvim_create_user_command("CppRun", M.run, {})
|
||||
|
||||
if M.keybinds.CppBuild then
|
||||
vim.keymap.set("n", M.keybinds.CppBuild, ":CppBuild<CR>", { silent = true })
|
||||
end
|
||||
if M.keybinds.CppRun then
|
||||
vim.keymap.set("n", M.keybinds.CppRun, ":CppRun<CR>", { silent = true })
|
||||
end
|
||||
if M.keybinds.NewCppHeaderFile then
|
||||
vim.keymap.set("n", M.keybinds.NewCppHeaderFile, ":NewCppHeaderFile<CR>", { silent = true })
|
||||
end
|
||||
end
|
||||
|
||||
function M.create_project()
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(project_name)
|
||||
if not project_name or project_name == "" then
|
||||
print("Project creation canceled.")
|
||||
return
|
||||
end
|
||||
|
||||
local project_root = vim.fn.expand(M.opts.project_root) .. "/" .. project_name
|
||||
for _, path in ipairs({ "/src", "/build", "/include" }) do
|
||||
vim.fn.mkdir(project_root .. path, "p")
|
||||
end
|
||||
|
||||
utils.write_file(project_root .. "/build/" .. project_name .. ".polydev", project_name)
|
||||
utils.write_file(project_root .. "/src/main.cpp", [[
|
||||
/* If you have vcpkg and want to use it:
|
||||
vcpkg new --application
|
||||
vcpkg add port <package_name>
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello World" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
]])
|
||||
|
||||
utils.write_file(project_root .. "/CMakeLists.txt", string.format([[
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
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)
|
||||
|
||||
# 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))
|
||||
|
||||
|
||||
utils.write_file(project_root .. "/CMakePresets.json", string.format([[
|
||||
# For the purposes of vcpkg, DO NOT REMOVE, but feel free to change as needed
|
||||
{
|
||||
"version": 2,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "vcpkg",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]]))
|
||||
|
||||
utils.write_file(project_root .. "/CMakeUserPresets.json", string.format([[
|
||||
{
|
||||
"version": 2,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"inherits": "vcpkg",
|
||||
"environment": {
|
||||
"VCPKG_ROOT": "/Users/<USER>/vcpkg"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]]))
|
||||
vim.fn.system(string.format("cd %s/build/ && cmake .. && cmake --build .", project_root))
|
||||
|
||||
vim.cmd("edit " .. project_root .. "/src/main.cpp")
|
||||
end)
|
||||
end
|
||||
|
||||
function M.create_new_file()
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(class_name)
|
||||
if not class_name or class_name == "" then return print("File creation canceled.") end
|
||||
local root_dir = M.get_project_root()
|
||||
if not root_dir then return print("Error: Project root not found.") end
|
||||
utils.write_file(root_dir .. "/src/" .. class_name .. ".cpp", "")
|
||||
end)
|
||||
end
|
||||
|
||||
function M.create_new_header_file()
|
||||
vim.ui.input({ prompt = "Enter header file name: " }, function(header_name)
|
||||
if not header_name then return print("Header file creation canceled.") end
|
||||
local root_dir = M.get_project_root()
|
||||
if not root_dir then return print("Error: Project root not found.") end
|
||||
local guard_macro = header_name:upper():gsub("[^A-Z0-9]", "_") .. "_HPP"
|
||||
local content = string.format([[
|
||||
#ifndef %s
|
||||
#define %s
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// Function prototypes
|
||||
void example_function();
|
||||
|
||||
#endif // %s
|
||||
]], guard_macro, guard_macro, guard_macro)
|
||||
utils.write_file(root_dir .. "/include/" .. header_name .. ".hpp", content)
|
||||
end)
|
||||
end
|
||||
|
||||
function M.get_project_root()
|
||||
local dir = vim.fn.expand("%:p:h")
|
||||
while dir ~= "/" do
|
||||
if vim.fn.isdirectory(dir .. "/src") == 1 or vim.fn.filereadable(dir .. "/CMakeLists.txt") == 1 then
|
||||
return dir
|
||||
end
|
||||
dir = vim.fn.fnamemodify(dir, ":h")
|
||||
end
|
||||
end
|
||||
|
||||
function M.build()
|
||||
local root = M.get_project_root()
|
||||
if not root then return print("Error: Project root not found.") end
|
||||
local build_dir = root .. "/build"
|
||||
|
||||
local cmd = "cd " .. build_dir .. " && cmake --build ."
|
||||
local term_buf = utils.open_float_terminal(cmd)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||
local output = vim.fn.system(cmd)
|
||||
local success = vim.v.shell_error == 0
|
||||
vim.api.nvim_buf_set_lines(term_buf, 0, -1, false, vim.list_extend({ success and "Compilation successful!" or "Error during compilation:" }, vim.split(output, "\n", { trimempty = true })))
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", false)
|
||||
end
|
||||
|
||||
function M.run()
|
||||
local root = M.get_project_root()
|
||||
if not root then return print("Error: Project root not found.") end
|
||||
local build_dir = root .. "/build"
|
||||
local files = vim.fn.glob(build_dir .. "/*.polydev", true, true)
|
||||
if #files == 0 then return print("Error: No .polydev file found in build directory.") end
|
||||
utils.open_float_terminal("cd " .. build_dir .. " && ./" .. files[1]:match("([^/]+)%.polydev$"))
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,55 +0,0 @@
|
||||
local utils = require("Polydev.utils")
|
||||
local M = {}
|
||||
|
||||
M.opts = nil
|
||||
|
||||
function M.setup(opts)
|
||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("html"), opts or {})
|
||||
end
|
||||
|
||||
function M.create_project()
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(project_name)
|
||||
if not project_name or project_name == "" then return print("Project creation canceled.") end
|
||||
local project_root = vim.fn.expand(M.opts.project_root) .. "/" .. project_name
|
||||
|
||||
local main_html_content = [[
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>My First Heading</h1>
|
||||
<p>My first paragraph.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
]]
|
||||
utils.write_file(project_root .. "index.html", main_html_content)
|
||||
end)
|
||||
end
|
||||
|
||||
function M.create_new_file()
|
||||
vim.ui.input({ prompt = "Enter page name: " }, function(page)
|
||||
if not page or page == "" then return print("Class creation canceled.") end
|
||||
local html_content = string.format([[
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>My First Heading</h1>
|
||||
<p>My first paragraph.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
]])
|
||||
|
||||
utils.write_file("./" .. page .. ".html", html_content)
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,65 +0,0 @@
|
||||
local utils = require("Polydev.utils")
|
||||
local M = {}
|
||||
|
||||
M.keybinds = {}
|
||||
M.opts = nil
|
||||
|
||||
function M.setup(opts)
|
||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("java"), opts or {})
|
||||
for key, command in pairs(M.opts.keybinds) do
|
||||
M.keybinds[command] = key
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("JavaBuild", M.build, {})
|
||||
vim.api.nvim_create_user_command("JavaRun", M.run, {})
|
||||
|
||||
if M.keybinds.JavaRun then
|
||||
vim.keymap.set("n", M.keybinds.JavaRun, ":JavaRun<CR>", { silent = true })
|
||||
end
|
||||
if M.keybinds.JavaBuild then
|
||||
vim.keymap.set("n", M.keybinds.JavaBuild, ":JavaBuild<CR>", { silent = true })
|
||||
end
|
||||
end
|
||||
|
||||
function M.create_new_file()
|
||||
vim.ui.input({ prompt = "Enter class name: " }, function(class_name)
|
||||
if not class_name or class_name == "" then return print("Class creation canceled.") end
|
||||
local root_dir = vim.fn.expand("%:p:h"):match("(.*)/src")
|
||||
if not root_dir then return print("Error: src directory not found.") end
|
||||
local java_content = string.format([[
|
||||
public class %s {
|
||||
// New File
|
||||
}
|
||||
]], class_name)
|
||||
|
||||
utils.write_file(root_dir .. "/src/" .. class_name .. ".java", java_content)
|
||||
end)
|
||||
end
|
||||
|
||||
function M.build()
|
||||
local project_root = vim.fn.expand("%:p:h"):match("(.*)/src")
|
||||
if not project_root then return print("Error: Could not detect project root directory.") end
|
||||
local out_dir = project_root .. "/build"
|
||||
|
||||
vim.fn.mkdir(out_dir, "p")
|
||||
local compile_command = string.format("javac -d %s %s/*.java", out_dir, project_root .. "/src")
|
||||
local compile_status = vim.fn.system(compile_command)
|
||||
|
||||
if vim.v.shell_error == 0 then
|
||||
print("Compilation successful!")
|
||||
else
|
||||
print("Error during compilation. Opening terminal for details...")
|
||||
local term_buf = utils.open_float_terminal(compile_command)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||
vim.api.nvim_buf_set_lines(term_buf, 0, -1, false, vim.split(compile_status, "\n", { trimempty = true }))
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", false)
|
||||
end
|
||||
end
|
||||
|
||||
function M.run()
|
||||
local project_root = vim.fn.expand("%:p:h"):match("(.*)/src")
|
||||
if not project_root then return print("Error: Must be inside the 'src' directory.") end
|
||||
utils.open_float_terminal("java -cp " .. project_root .. "/build" .. " Main")
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,75 +0,0 @@
|
||||
local utils = require("Polydev.utils")
|
||||
local M = {}
|
||||
|
||||
M.keybinds = {}
|
||||
M.opts = nil
|
||||
|
||||
function M.setup(opts)
|
||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("lua"), opts or {})
|
||||
for key, command in pairs(M.opts.keybinds) do
|
||||
M.keybinds[command] = key
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("LuaRun", M.run, {})
|
||||
|
||||
if M.keybinds.LuaRun then
|
||||
vim.keymap.set("n", M.keybinds.LuaRun, ":LuaRun<CR>", { silent = true })
|
||||
end
|
||||
end
|
||||
|
||||
function M.get_project_root()
|
||||
local dir = vim.fn.expand("%:p:h")
|
||||
while dir ~= "/" do
|
||||
local polydev_file = vim.fn.glob(dir .. "/*.polydev")
|
||||
if polydev_file ~= "" then return dir end
|
||||
dir = vim.fn.fnamemodify(dir, ":h")
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function M.get_project_name()
|
||||
local polydev_file = vim.fn.glob((M.get_project_root() or "") .. "/*.polydev")
|
||||
return polydev_file:match("([^/]+)%.polydev$")
|
||||
end
|
||||
|
||||
function M.create_project()
|
||||
vim.ui.input({ prompt = "Enter project name: " },
|
||||
function(project_name)
|
||||
if not project_name or project_name == "" then return print("Project creation canceled.") end
|
||||
local project_root = vim.fn.expand(M.opts.project_root) .. "/" .. project_name
|
||||
for _, path in ipairs({ "/lua/" .. project_name }) do vim.fn.mkdir(project_root .. path, "p") end
|
||||
|
||||
utils.write_file(project_root .. "/lua/" .. project_name .. "/init.lua", [[
|
||||
local M = {}
|
||||
|
||||
return M
|
||||
]])
|
||||
|
||||
utils.write_file(project_root .. "/" .. project_name .. ".polydev", "[[DO NOT REMOVE THIS FILE]]")
|
||||
vim.cmd("edit " .. project_root .. "/lua/" .. project_name .. "/init.lua")
|
||||
end)
|
||||
end
|
||||
|
||||
function M.create_new_file()
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(class_name)
|
||||
if not class_name or class_name == "" then return print("File creation canceled.") end
|
||||
local root_dir = M.get_project_root()
|
||||
local project_name = M.get_project_name()
|
||||
if not root_dir or not project_name then return print("Error: Project root not found.") end
|
||||
utils.write_file(root_dir .. "/lua/" .. project_name .. "/" .. class_name .. ".lua", "")
|
||||
end)
|
||||
end
|
||||
|
||||
function M.run()
|
||||
local root = M.get_project_root()
|
||||
local project_name = M.get_project_name()
|
||||
if not root or not project_name then return print("Error: Project root not found.") end
|
||||
local init_lua_path = root .. "/lua/" .. project_name .. "/init.lua"
|
||||
if vim.fn.filereadable(init_lua_path) == 1 then
|
||||
utils.open_float_terminal("lua " .. init_lua_path)
|
||||
else
|
||||
print("Error: " .. init_lua_path .. " not found in " .. root)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,101 +0,0 @@
|
||||
local utils = require("Polydev.utils")
|
||||
local config = require("Polydev.configs")
|
||||
local M = {}
|
||||
|
||||
M.keybinds = {}
|
||||
M.opts = nil
|
||||
|
||||
function M.setup(opts)
|
||||
M.opts = vim.tbl_deep_extend("force", {}, config.get("python"), opts or {})
|
||||
for key, command in pairs(M.opts.keybinds) do
|
||||
M.keybinds[command] = key
|
||||
end
|
||||
|
||||
local root = M.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
|
||||
|
||||
vim.api.nvim_create_user_command("PythonPip", M.install_dependency, {})
|
||||
vim.api.nvim_create_user_command("PythonRun", M.run, {})
|
||||
|
||||
if M.keybinds.PythonRun then
|
||||
vim.keymap.set("n", M.keybinds.PythonRun, ":PythonRun<CR>", { silent = true })
|
||||
end
|
||||
if M.keybinds.PythonPip then
|
||||
vim.keymap.set("n", M.keybinds.PythonPip, ":PythonPip<CR>", { silent = true })
|
||||
end
|
||||
end
|
||||
|
||||
function M.get_project_root()
|
||||
local dir = vim.fn.expand("%:p:h")
|
||||
while dir ~= "/" do
|
||||
if vim.fn.isdirectory(dir .. "/venv") == 1 or vim.fn.filereadable(dir .. "/main.py") == 1 then
|
||||
return dir
|
||||
end
|
||||
dir = vim.fn.fnamemodify(dir, ":h")
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function M.create_new_file()
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(file_name)
|
||||
if not file_name or file_name == "" then
|
||||
return print("File creation canceled.")
|
||||
end
|
||||
|
||||
if not file_name:match("%.py$") then
|
||||
file_name = file_name .. ".py"
|
||||
end
|
||||
|
||||
local root_dir = M.get_project_root()
|
||||
if not root_dir then
|
||||
return print("Error: Project root not found.")
|
||||
end
|
||||
|
||||
local file_path = root_dir .. "/include/" .. file_name
|
||||
utils.write_file(file_path, "")
|
||||
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.open_float_terminal("pip install " .. pip_module)
|
||||
end)
|
||||
end
|
||||
|
||||
function M.run()
|
||||
local root = M.get_project_root()
|
||||
if not root then
|
||||
return print("Error: Project root not found.")
|
||||
end
|
||||
|
||||
local main_file = root .. "/main.py"
|
||||
if vim.fn.filereadable(main_file) == 0 then
|
||||
return print("Error: main.py not found in project root.")
|
||||
end
|
||||
|
||||
-- Detect current shell
|
||||
local shell = vim.fn.getenv("SHELL") or ""
|
||||
local venv_cmd
|
||||
|
||||
if shell:match("fish") then
|
||||
local venv_fish = root .. "/venv/bin/activate.fish"
|
||||
venv_cmd = vim.fn.filereadable(venv_fish) == 1 and "source " .. venv_fish .. " && " or ""
|
||||
else
|
||||
local venv_bash = root .. "/venv/bin/activate"
|
||||
venv_cmd = vim.fn.filereadable(venv_bash) == 1 and "source " .. venv_bash .. " && " or ""
|
||||
end
|
||||
|
||||
utils.open_float_terminal(venv_cmd .. "python3 " .. main_file)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,70 +0,0 @@
|
||||
local utils = require("Polydev.utils")
|
||||
local M = {}
|
||||
|
||||
M.keybinds = {}
|
||||
M.opts = nil
|
||||
|
||||
function M.setup(opts)
|
||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("rust"), opts or {})
|
||||
for key, command in pairs(M.opts.keybinds) do
|
||||
M.keybinds[command] = key
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("RustBuild", M.build, {})
|
||||
vim.api.nvim_create_user_command("RustRun", M.run, {})
|
||||
|
||||
if M.keybinds.RustRun then
|
||||
vim.keymap.set("n", M.keybinds.RustRun, ":RustRun<CR>", { silent = true })
|
||||
end
|
||||
if M.keybinds.RustBuild then
|
||||
vim.keymap.set("n", M.keybinds.RustBuild, ":RustBuild<CR>", { silent = true })
|
||||
end
|
||||
end
|
||||
|
||||
function M.create_project()
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(project_name)
|
||||
if not project_name or project_name == "" then return print("Project creation canceled.") end
|
||||
local project_root = vim.fn.expand(M.config.project_root) .. "/" .. project_name
|
||||
vim.fn.system("cargo new " .. project_root)
|
||||
vim.cmd("edit " .. project_root .. "/src/main.rs")
|
||||
end)
|
||||
end
|
||||
|
||||
function M.create_new_file()
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(class_name)
|
||||
if not class_name or class_name == "" then return print("File creation canceled.") end
|
||||
local root_dir = M.get_project_root()
|
||||
if not root_dir then return print("Error: Project root not found.") end
|
||||
utils.write_file(root_dir .. "/src/" .. class_name .. ".rs", "")
|
||||
end)
|
||||
end
|
||||
|
||||
function M.get_project_root()
|
||||
local dir = vim.fn.expand("%:p:h")
|
||||
while dir ~= "/" do
|
||||
if vim.fn.isdirectory(dir .. "/src") == 1 then
|
||||
return dir
|
||||
end
|
||||
dir = vim.fn.fnamemodify(dir, ":h")
|
||||
end
|
||||
end
|
||||
|
||||
function M.build()
|
||||
local root = M.get_project_root()
|
||||
if not root then return print("Error: Project root not found.") end
|
||||
local cmd = "cargo build"
|
||||
local term_buf = utils.open_float_terminal(cmd)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||
local output = vim.fn.system(cmd)
|
||||
local success = vim.v.shell_error == 0
|
||||
vim.api.nvim_buf_set_lines(term_buf, 0, -1, false, vim.list_extend({ success and "Compilation successful!" or "Error during compilation:" }, vim.split(output, "\n", { trimempty = true })))
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", false)
|
||||
end
|
||||
|
||||
function M.run()
|
||||
local root = M.get_project_root()
|
||||
if not root then return print("Error: Project root not found.") end
|
||||
utils.open_float_terminal("cargo run")
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,99 +0,0 @@
|
||||
---@module 'Polydev.utils'
|
||||
local utils = require("Polydev.utils")
|
||||
---
|
||||
---@type table
|
||||
local M = {}
|
||||
|
||||
---@class TemplateLanguage
|
||||
---@field run fun(project_name: string, project_root: string): nil
|
||||
|
||||
---@class Projects
|
||||
---@field java TemplateLanguage
|
||||
---@field python TemplateLanguage
|
||||
---@field lua TemplateLanguage
|
||||
---@alias TemplatesLanguageName "java" | "python" | "lua"
|
||||
|
||||
---@type Projects
|
||||
M.projects = {
|
||||
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 main_java_content = [[
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello, World!");
|
||||
}
|
||||
}
|
||||
]]
|
||||
utils.write_file(full_project_root .. "/src/Main.java", main_java_content)
|
||||
return nil
|
||||
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))
|
||||
|
||||
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)
|
||||
return nil
|
||||
end
|
||||
},
|
||||
lua = {
|
||||
run = function(project_name, project_root)
|
||||
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
|
||||
for _, path in ipairs({ "/lua/" .. project_name }) do vim.fn.mkdir(full_project_root .. path, "p") end
|
||||
|
||||
utils.write_file(full_project_root .. "/lua/" .. project_name .. "/init.lua", [[
|
||||
local M = {}
|
||||
|
||||
return M
|
||||
]])
|
||||
utils.write_file(full_project_root .. "/" .. project_name .. ".polydev", "[[DO NOT REMOVE THIS FILE]]")
|
||||
vim.cmd("edit " .. full_project_root .. "/lua/" .. project_name .. "/init.lua")
|
||||
return nil
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
---@param lang TemplatesLanguageName
|
||||
---@param project_root string
|
||||
function M.create_project(lang, project_root)
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(project_name)
|
||||
if not project_name or project_name == "" then return print("Project creation canceled.") end
|
||||
M.projects[lang].run(project_name, project_root)
|
||||
end)
|
||||
end
|
||||
|
||||
---@return any
|
||||
return M
|
||||
@@ -1,52 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.opts = {}
|
||||
|
||||
function M.setup(opts)
|
||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("terminal"), opts or {})
|
||||
end
|
||||
|
||||
function M.write_file(path, content)
|
||||
local file = assert(io.open(path, "w"), "Error creating file: " .. path)
|
||||
file:write(content)
|
||||
file:close()
|
||||
vim.cmd("edit " .. path)
|
||||
print(path .. " created successfully!")
|
||||
end
|
||||
|
||||
function M.open_float_terminal(cmd)
|
||||
local ui = vim.api.nvim_list_uis()[1]
|
||||
|
||||
local width = math.max(1, math.floor(ui.width * 0.9) - M.opts.left_padding or 0 - M.opts.right_padding or 0)
|
||||
local height = math.max(1, math.floor(ui.height * 0.9) - M.opts.top_padding or 0 - M.opts.bottom_padding or 0)
|
||||
local row = math.max(1, math.floor((ui.height - height) / 2) + (M.opts.top_padding or 0))
|
||||
local col = math.max(1, math.floor((ui.width - width) / 2) + (M.opts.left_padding or 0))
|
||||
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
local win = vim.api.nvim_open_win(buf, true, {
|
||||
relative = "editor",
|
||||
width = width,
|
||||
height = height,
|
||||
row = row,
|
||||
col = col,
|
||||
style = "minimal",
|
||||
border = M.opts.border and "rounded" or "none",
|
||||
})
|
||||
|
||||
vim.api.nvim_win_set_option(win, "winblend", vim.o.pumblend)
|
||||
vim.api.nvim_win_set_option(win, "winhighlight", "Normal:Pmenu,FloatBorder:Pmenu")
|
||||
vim.api.nvim_win_set_option(win, "cursorline", true)
|
||||
vim.api.nvim_win_set_option(win, "scrolloff", 5)
|
||||
if(M.opts.number == true) then
|
||||
vim.api.nvim_win_set_option(win, "number", true)
|
||||
if(M.opts.relativenumber == true) then
|
||||
vim.api.nvim_win_set_option(win, "relativenumber", true)
|
||||
end
|
||||
end
|
||||
|
||||
vim.fn.termopen(cmd)
|
||||
vim.api.nvim_buf_set_keymap(buf, "n", "<ESC>", "i<C-\\><C-n>:q<CR>", { noremap = true, silent = true })
|
||||
return buf, win
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,52 @@
|
||||
---@module "vern-nvim.core.actions"
|
||||
local actions = require("vern-nvim.core.actions")
|
||||
|
||||
---@type VernCoreConfig
|
||||
return {
|
||||
workspace_root = "~/personal/Projects",
|
||||
env = {
|
||||
--- In documentation, make recommendation to change to username or name instead of company
|
||||
author = "company",
|
||||
},
|
||||
keybinds = {
|
||||
["<leader>pc"] = {
|
||||
user_command = "VernCreateProject",
|
||||
desc = "Creates a new project",
|
||||
action = actions.create_project,
|
||||
},
|
||||
["<leader>pf"] = {
|
||||
user_command = "VernCreateFile",
|
||||
desc = "Creates a new project file based on current buffer filetype",
|
||||
action = actions.create_file,
|
||||
},
|
||||
["<leader>pr"] = {
|
||||
user_command = "VernRunProject",
|
||||
desc = "Builds and runs project based on current buffer filetype",
|
||||
action = actions.run,
|
||||
},
|
||||
},
|
||||
terminal = {
|
||||
mode = {
|
||||
type = "split", --- (float)|(split)
|
||||
win = {
|
||||
float = {
|
||||
padding = {
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
},
|
||||
border = {
|
||||
enabled = true,
|
||||
type = vim.o.winborder, -- defaults to neovim winborder
|
||||
},
|
||||
},
|
||||
split = {
|
||||
direction = "horizontal", --- (vertical)|(horizontal)
|
||||
anchor = "bottom", --- (right)|(bottom)
|
||||
size = "20",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
local M = {}
|
||||
|
||||
---@module "vern-nvim.core.fs"
|
||||
local fs = require("vern-nvim.core.fs")
|
||||
|
||||
---@module "vern-nvim.core.template"
|
||||
local templates = require("vern-nvim.core.template")
|
||||
|
||||
---@module "vern-nvim.providers.web"
|
||||
local providers = require("vern-nvim.providers.web")
|
||||
|
||||
---Imitate create_file so you can skip over and use for each filetype
|
||||
|
||||
M.create_project = function(opts)
|
||||
opts = opts or {}
|
||||
local ft = ""
|
||||
local items = {
|
||||
"cpp",
|
||||
"c",
|
||||
"rust",
|
||||
"python",
|
||||
"go",
|
||||
"lua",
|
||||
"java",
|
||||
"web - not yet implemented",
|
||||
}
|
||||
vim.ui.select(items, {
|
||||
prompt = "Select available language:",
|
||||
format_item = function(item) return item end,
|
||||
}, function(choice, _)
|
||||
if choice then ft = vim.trim(choice) end
|
||||
local ok, langs = pcall(require, "vern-nvim.langs." .. ft)
|
||||
if not ok or type(langs) ~= "table" then
|
||||
-- vim.notify("Empty or nil ft", vim.log.levels.WARN, {
|
||||
-- title = "Vern Project",
|
||||
-- })
|
||||
return
|
||||
end
|
||||
local args = vim.tbl_deep_extend("force", {}, langs, opts or {})
|
||||
if not args[ft] or type(args[ft]) ~= "table" then return end
|
||||
if ft == "web" then
|
||||
if type(langs.create_project) == "function" then
|
||||
langs.create_project()
|
||||
end
|
||||
return
|
||||
else
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(pname)
|
||||
pname = pname and vim.trim(pname)
|
||||
if not pname or pname == "" then return end
|
||||
local root = vim.fs.joinpath(
|
||||
vim.fn.expand(args.workspace_root),
|
||||
args[ft].root,
|
||||
pname
|
||||
)
|
||||
|
||||
local ctx = {
|
||||
project_name = pname,
|
||||
company_name = args.env.author,
|
||||
file_name = "",
|
||||
}
|
||||
|
||||
vim.fn.mkdir(root, "p")
|
||||
local dirs = args[ft].dirs
|
||||
if type(dirs) == "table" and next(dirs) then
|
||||
for _, dir in pairs(dirs) do
|
||||
local path = vim.fs.normalize(
|
||||
vim.fs.joinpath(root, fs.fmt_path(dir, nil, ctx))
|
||||
)
|
||||
vim.fn.mkdir(path, "p")
|
||||
end
|
||||
end
|
||||
|
||||
local function write(tpl)
|
||||
if type(tpl) == "table" and next(tpl) then
|
||||
for _, tbl in pairs(tpl) do
|
||||
local raw_path = vim.fs.joinpath(tbl.path, tbl.name)
|
||||
local path = fs.fmt_path(raw_path, args[ft].dirs, ctx)
|
||||
if tbl.enabled ~= false and tbl.kind then
|
||||
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
|
||||
fs.write(
|
||||
abs_file_path,
|
||||
templates.fetch(tbl.kind_path, tbl.kind, ctx)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local tpl = args[ft].templates or {}
|
||||
|
||||
local bin
|
||||
local project = tpl.project
|
||||
if type(project) == "table" and next(project) then
|
||||
for tbl_name, tbl in pairs(project) do
|
||||
if tbl_name == "primary" then
|
||||
bin = vim.fs.joinpath(
|
||||
root,
|
||||
fs.fmt_path(
|
||||
vim.fs.joinpath(tbl.path, tbl.name),
|
||||
args[ft].dirs,
|
||||
ctx
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
write(project)
|
||||
write(tpl.extras)
|
||||
|
||||
if type(langs.create_project) == "function" then
|
||||
langs.create_project(root)
|
||||
end
|
||||
|
||||
--- Init git
|
||||
local gitignore =
|
||||
require("vern-nvim.templates.extras.gitignore").template(ft)
|
||||
local obj = vim.system({ "git", "-C", root, "init" }):wait()
|
||||
if obj.code ~= 0 then
|
||||
vim.notify(
|
||||
"Git init failed " .. obj.stderr,
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "Vern Git" }
|
||||
)
|
||||
end
|
||||
fs.write(vim.fs.joinpath(root, ".gitignore"), gitignore)
|
||||
|
||||
--- Init Readme
|
||||
local readme = require("vern-nvim.templates.extras.readme")
|
||||
fs.write(vim.fs.joinpath(root, "README.md"), readme)
|
||||
|
||||
if bin then vim.cmd.edit(vim.fn.fnameescape(bin)) end
|
||||
vim.notify(
|
||||
"Project: " .. pname .. " has been created!",
|
||||
vim.log.levels.INFO,
|
||||
{ title = "Vern Project" }
|
||||
)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
M.create_file = function(opts)
|
||||
opts = opts or {}
|
||||
local filetype = vim.bo.filetype
|
||||
|
||||
local ft_ok, config = pcall(require, "vern-nvim.langs." .. filetype)
|
||||
if not filetype or filetype == "" or not ft_ok or type(config) ~= "table" then
|
||||
vim.notify("Unknown Filetype: " .. filetype, vim.log.levels.WARN, {
|
||||
title = "Vern File",
|
||||
})
|
||||
return
|
||||
else
|
||||
local args = vim.tbl_deep_extend("force", {}, config, opts or {})
|
||||
---@type VernCreateFile
|
||||
local cf = args.create_file
|
||||
local function function_write(mod, fname)
|
||||
local raw_path = vim.fs.joinpath(mod.path, mod.name)
|
||||
local context = {
|
||||
project_name = fs.name(),
|
||||
company_name = args.env.author,
|
||||
file_name = fname,
|
||||
}
|
||||
local path = fs.fmt_path(raw_path, args[filetype].dirs or {}, context)
|
||||
local full_path = vim.fs.joinpath(fs.root(), path)
|
||||
fs.write(full_path, templates.fetch(mod.kind_path, mod.kind, context))
|
||||
vim.cmd.edit(vim.fn.fnameescape(full_path))
|
||||
vim.notify(
|
||||
fname .. " has been created!",
|
||||
vim.log.levels.INFO,
|
||||
{ title = "Vern File" }
|
||||
)
|
||||
end
|
||||
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
|
||||
fname = fname and vim.trim(fname)
|
||||
if not fname or fname == "" then return end
|
||||
|
||||
local done = function(mod)
|
||||
if not mod or vim.tbl_isempty(mod) then return end
|
||||
function_write(mod, fname)
|
||||
end
|
||||
|
||||
if cf and type(cf) == "function" then
|
||||
cf(args, done)
|
||||
else
|
||||
done(args[filetype].templates.file.source)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
M.run = function(opts)
|
||||
opts = opts or {}
|
||||
local filetype = vim.bo.filetype
|
||||
|
||||
local ft_ok, action = pcall(require, "vern-nvim.langs." .. filetype)
|
||||
if
|
||||
not filetype
|
||||
or filetype == ""
|
||||
or not ft_ok
|
||||
or type(action.run) ~= "function"
|
||||
then
|
||||
vim.notify("Unknown Filetype: " .. filetype, vim.log.levels.WARN, {
|
||||
title = "Vern Run",
|
||||
})
|
||||
return
|
||||
else
|
||||
local args = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
opts,
|
||||
require("vern-nvim.langs." .. filetype)
|
||||
)
|
||||
action.run(args)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,28 @@
|
||||
local M = {}
|
||||
|
||||
---@module "vern-nvim.core.terminal"
|
||||
local term = require("vern-nvim.core.terminal")
|
||||
|
||||
---@param opts table
|
||||
---@param build_cmd string
|
||||
---@param run_cmd string
|
||||
M.compile = function(opts, build_cmd, run_cmd)
|
||||
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, _ =
|
||||
term.open({ "echo 'compilation failed'" }, opts.terminal, true)
|
||||
term.set_lines(buf, error_lines)
|
||||
end)
|
||||
else
|
||||
vim.schedule(function() term.open({ run_cmd }, opts.terminal, false) end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,49 @@
|
||||
local M = {}
|
||||
|
||||
---@param raw_path string Combination of tbl.path and tbl.name to override
|
||||
---@param dir_tbl? table<string, string> Strings to replace raw directories in {dirs.<>} with
|
||||
---@param ctx table<string, string> Strings to replace raw names like {project_name} with
|
||||
---@return string path Fully replaced path
|
||||
function M.fmt_path(raw_path, dir_tbl, ctx)
|
||||
--- Replace the {dirs.<key>}
|
||||
raw_path = raw_path:gsub(
|
||||
"{dirs%.([%w_]+)}",
|
||||
function(dir_key) return dir_tbl and dir_tbl[dir_key] or dir_key end
|
||||
)
|
||||
|
||||
--- Replace the {<key>}
|
||||
local path = raw_path:gsub(
|
||||
"{([%w_]+)}",
|
||||
function(key) return ctx and ctx[key] or ("{" .. key .. "}") end
|
||||
)
|
||||
|
||||
return path
|
||||
end
|
||||
|
||||
---@param path string
|
||||
---@param content string
|
||||
function M.write(path, content)
|
||||
local file = assert(io.open(path, "w"), "Error creating file: " .. path)
|
||||
file:write(content)
|
||||
file:close()
|
||||
end
|
||||
|
||||
---@return string
|
||||
function M.name() return vim.fs.basename(M.root()) or "" end
|
||||
|
||||
---@param bufnr? integer Default is 0 (current buffer)
|
||||
---@return string
|
||||
function M.root(bufnr)
|
||||
bufnr = bufnr or 0
|
||||
local root_markers = {
|
||||
".git",
|
||||
"pyproject.toml",
|
||||
"setup.py",
|
||||
"Makefile",
|
||||
"CMakeLists",
|
||||
"Cargo.toml",
|
||||
}
|
||||
return vim.fs.root(bufnr, root_markers) or vim.uv.cwd() or "."
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,31 @@
|
||||
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 string Template in language table
|
||||
---@param context table<string, string> A string to replace temp values in template
|
||||
---@return string Content Formatted string
|
||||
function M.fetch(kind_path, kind, context)
|
||||
kind, context = kind or "", context or {}
|
||||
if not kind or kind == "" then return "" end
|
||||
local ok, mod = pcall(require, kind_path)
|
||||
if not ok or type(mod) ~= "table" or not mod[kind] then return "" 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
|
||||
@@ -0,0 +1,96 @@
|
||||
local M = {}
|
||||
|
||||
---@param cmd table
|
||||
---@param opts VernTerminalConfig
|
||||
---@param scratch boolean
|
||||
---@return integer, integer?
|
||||
function M.open(cmd, opts, scratch)
|
||||
opts = opts or {}
|
||||
local buf, win
|
||||
if opts.mode.type == "float" then
|
||||
local ui = vim.api.nvim_list_uis()[1]
|
||||
|
||||
local dim = {
|
||||
width = math.max(
|
||||
1,
|
||||
math.floor(ui.width * 0.9)
|
||||
- opts.mode.win.float.padding.left
|
||||
- opts.mode.win.float.padding.right
|
||||
),
|
||||
height = math.max(
|
||||
1,
|
||||
math.floor(ui.height * 0.9)
|
||||
- opts.mode.win.float.padding.top
|
||||
- opts.mode.win.float.padding.bottom
|
||||
),
|
||||
}
|
||||
|
||||
local pos = {
|
||||
row = math.floor(
|
||||
(
|
||||
ui.height
|
||||
- (vim.o.laststatus == 3 and 1 or 0)
|
||||
- vim.o.cmdheight
|
||||
- dim.height
|
||||
) / 2
|
||||
),
|
||||
col = math.floor((ui.width - dim.width) / 2),
|
||||
}
|
||||
|
||||
buf = vim.api.nvim_create_buf(false, true)
|
||||
win = vim.api.nvim_open_win(buf, true, {
|
||||
relative = "editor",
|
||||
width = dim.width,
|
||||
height = dim.height,
|
||||
row = pos.row,
|
||||
col = pos.col,
|
||||
style = "minimal",
|
||||
border = opts.mode.win.float.border.enabled
|
||||
and opts.mode.win.float.border.type
|
||||
or nil,
|
||||
})
|
||||
if scratch then return buf, win end
|
||||
end
|
||||
if opts.mode.type == "split" then
|
||||
if opts.mode.win.split.direction == "vertical" then
|
||||
if opts.mode.win.split.anchor == "right" then
|
||||
vim.cmd("set splitright")
|
||||
end
|
||||
vim.cmd(opts.mode.win.split.size .. " vsplit")
|
||||
end
|
||||
if opts.mode.win.split.direction == "horizontal" then
|
||||
if opts.mode.win.split.anchor == "bottom" then
|
||||
vim.cmd("set splitbelow")
|
||||
end
|
||||
vim.cmd(opts.mode.win.split.size .. " split")
|
||||
end
|
||||
|
||||
buf = vim.api.nvim_create_buf(false, true)
|
||||
win = vim.api.nvim_get_current_win()
|
||||
|
||||
vim.api.nvim_win_set_buf(0, buf)
|
||||
if scratch then return buf, win end
|
||||
end
|
||||
local full_cmd = type(cmd) == "table" and table.concat(cmd, " ") or cmd
|
||||
vim.fn.jobstart(full_cmd, { term = true })
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
buf,
|
||||
"n",
|
||||
"<ESC>",
|
||||
"i<C-\\><C-n>:q<CR>",
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
return buf, win
|
||||
end
|
||||
|
||||
---@param buf integer
|
||||
---@param lines table
|
||||
function M.set_lines(buf, lines)
|
||||
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, lines)
|
||||
vim.api.nvim_set_option_value("modifiable", false, { buf = buf })
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,65 @@
|
||||
local M = {}
|
||||
|
||||
---@module "vern-nvim.config.defaults"
|
||||
local defaults = require("vern-nvim.config.defaults")
|
||||
|
||||
---@type VernCoreConfig
|
||||
M.opts = vim.deepcopy(defaults)
|
||||
|
||||
---@param user_opts? VernUserConfig
|
||||
function M.setup(user_opts)
|
||||
---@type VernCoreConfig
|
||||
M.opts = vim.tbl_deep_extend("force", {}, defaults, user_opts or {})
|
||||
|
||||
for key, def in pairs(M.opts.keybinds or {}) do
|
||||
if type(def.action) == "function" then
|
||||
vim.api.nvim_create_user_command(
|
||||
def.user_command,
|
||||
function() def.action(M.opts) end,
|
||||
{ nargs = "*", desc = def.desc }
|
||||
)
|
||||
vim.keymap.set("n", key, function() def.action(M.opts) end, {
|
||||
silent = true,
|
||||
desc = def.desc,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local group =
|
||||
vim.api.nvim_create_augroup("VernAutocommands", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = group,
|
||||
pattern = "*",
|
||||
callback = function(args)
|
||||
local ft = vim.bo[args.buf].filetype
|
||||
if not ft or ft == "" then return end
|
||||
local ok, mod = pcall(require, "vern-nvim.langs." .. ft)
|
||||
if not ok then return end
|
||||
|
||||
local opts = vim.tbl_deep_extend("force", {}, mod, M.opts or {})
|
||||
if opts[ft] and opts[ft].keybinds ~= nil 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
|
||||
if ok and type(mod.attach) == "function" then
|
||||
mod.attach(args.buf, opts)
|
||||
end
|
||||
end,
|
||||
desc = "Attach languages to buffer",
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,101 @@
|
||||
---@module "vern-nvim.core.fs"
|
||||
local fs = require("vern-nvim.core.fs")
|
||||
|
||||
---@module "vern-nvim.core.compile"
|
||||
local comp = require("vern-nvim.core.compile")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.attach = nil
|
||||
|
||||
---@param root string
|
||||
M.create_project = function(root)
|
||||
local build_cmd = "cd "
|
||||
.. root
|
||||
.. " && cmake -S . -B build && cmake --build build"
|
||||
local _ = vim.system({ "sh", "-c", build_cmd }):wait()
|
||||
end
|
||||
|
||||
---@type VernCreateFile
|
||||
---@param opts VernCConfig
|
||||
M.create_file = function(opts, continue)
|
||||
opts = opts or {}
|
||||
local file = vim.tbl_get(opts, "c", "templates", "file")
|
||||
local items = { "source", "header" }
|
||||
vim.ui.select(items, {
|
||||
prompt = "Select type:",
|
||||
format_item = function(item) return item end,
|
||||
}, function(choice, _)
|
||||
if choice == items[1] then return continue(file.source) end
|
||||
if choice == items[2] then return continue(file.header) end
|
||||
continue(nil)
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts? VernCConfig Takes a table for the runtime
|
||||
M.run = function(opts)
|
||||
opts = opts or {}
|
||||
|
||||
local build_dir = vim.fn.fnameescape(fs.root() .. "/build")
|
||||
local build_cmd = string.format("cd %s && cmake --build .", build_dir)
|
||||
local run_cmd = string.format("cd %s && ./%s", build_dir, fs.name())
|
||||
|
||||
comp.compile(opts, build_cmd, run_cmd)
|
||||
end
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.c = {
|
||||
root = "C",
|
||||
dirs = {
|
||||
src = "src",
|
||||
include = "include/{project_name}",
|
||||
},
|
||||
keybinds = nil,
|
||||
templates = {
|
||||
project = {
|
||||
primary = {
|
||||
path = "{dirs.src}",
|
||||
name = "main.c",
|
||||
kind = "main",
|
||||
kind_path = "vern-nvim.templates.c",
|
||||
},
|
||||
manifest = {
|
||||
path = ".",
|
||||
name = "CMakeLists.txt",
|
||||
kind = "CmakeLists",
|
||||
kind_path = "vern-nvim.templates.c",
|
||||
},
|
||||
style = {
|
||||
path = ".",
|
||||
name = ".clang-format",
|
||||
kind = "format",
|
||||
kind_path = "vern-nvim.templates.c",
|
||||
},
|
||||
},
|
||||
file = {
|
||||
header = {
|
||||
path = "{dirs.include}",
|
||||
name = "{file_name}.h",
|
||||
kind = "header",
|
||||
kind_path = "vern-nvim.templates.c",
|
||||
},
|
||||
source = {
|
||||
path = "{dirs.src}",
|
||||
name = "{file_name}.c",
|
||||
kind = "source",
|
||||
kind_path = "vern-nvim.templates.c",
|
||||
},
|
||||
},
|
||||
extras = {
|
||||
linter = {
|
||||
path = ".",
|
||||
name = ".clang-tidy",
|
||||
kind = "linter",
|
||||
kind_path = "vern-nvim.templates.c",
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,101 @@
|
||||
---@module "vern-nvim.core.fs"
|
||||
local fs = require("vern-nvim.core.fs")
|
||||
|
||||
---@module "vern-nvim.core.compile"
|
||||
local comp = require("vern-nvim.core.compile")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.attach = nil
|
||||
|
||||
---@param root string
|
||||
M.create_project = function(root)
|
||||
local build_cmd = "cd "
|
||||
.. root
|
||||
.. " && cmake -S . -B build && cmake --build build"
|
||||
local _ = vim.system({ "sh", "-c", build_cmd }):wait()
|
||||
end
|
||||
|
||||
---@type VernCreateFile
|
||||
---@param opts VernCPPConfig
|
||||
M.create_file = function(opts, continue)
|
||||
opts = opts or {}
|
||||
local file = vim.tbl_get(opts, "cpp", "templates", "file")
|
||||
local items = { "source", "header" }
|
||||
vim.ui.select(items, {
|
||||
prompt = "Select type:",
|
||||
format_item = function(item) return item end,
|
||||
}, function(choice, _)
|
||||
if choice == items[1] then return continue(file.source) end
|
||||
if choice == items[2] then return continue(file.header) end
|
||||
continue(nil)
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts? VernCPPConfig Takes a table for the runtime
|
||||
M.run = function(opts)
|
||||
opts = opts or {}
|
||||
|
||||
local build_dir = vim.fn.fnameescape(fs.root() .. "/build")
|
||||
local build_cmd = string.format("cd %s && cmake --build .", build_dir)
|
||||
local run_cmd = string.format("cd %s && ./%s", build_dir, fs.name())
|
||||
|
||||
comp.compile(opts, build_cmd, run_cmd)
|
||||
end
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.cpp = {
|
||||
root = "CPP",
|
||||
dirs = {
|
||||
src = "src",
|
||||
include = "include/{project_name}",
|
||||
},
|
||||
keybinds = nil,
|
||||
templates = {
|
||||
project = {
|
||||
primary = {
|
||||
path = "{dirs.src}",
|
||||
name = "main.cpp",
|
||||
kind = "main",
|
||||
kind_path = "vern-nvim.templates.cpp",
|
||||
},
|
||||
manifest = {
|
||||
path = ".",
|
||||
name = "CMakeLists.txt",
|
||||
kind = "CmakeLists",
|
||||
kind_path = "vern-nvim.templates.cpp",
|
||||
},
|
||||
style = {
|
||||
path = ".",
|
||||
name = ".clang-format",
|
||||
kind = "format",
|
||||
kind_path = "vern-nvim.templates.cpp",
|
||||
},
|
||||
},
|
||||
file = {
|
||||
header = {
|
||||
path = "{dirs.include}",
|
||||
name = "{file_name}.hpp",
|
||||
kind = "header",
|
||||
kind_path = "vern-nvim.templates.cpp",
|
||||
},
|
||||
source = {
|
||||
path = "{dirs.src}",
|
||||
name = "{file_name}.cpp",
|
||||
kind = "source",
|
||||
kind_path = "vern-nvim.templates.cpp",
|
||||
},
|
||||
},
|
||||
extras = {
|
||||
linter = {
|
||||
path = ".",
|
||||
name = ".clang-tidy",
|
||||
kind = "linter",
|
||||
kind_path = "vern-nvim.templates.cpp",
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,82 @@
|
||||
---@module "vern-nvim.core.fs"
|
||||
local fs = require("vern-nvim.core.fs")
|
||||
|
||||
---@module "vern-nvim.core.terminal"
|
||||
local term = require("vern-nvim.core.terminal")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.attach = nil
|
||||
|
||||
M.create_project = function(root)
|
||||
local root_name = vim.fs.basename(root)
|
||||
local module_name = "com.DarthMooMancer." .. root_name
|
||||
local obj = vim
|
||||
.system({
|
||||
"sh",
|
||||
"-c",
|
||||
string.format(
|
||||
"go mod init %s && go build -o bin/%s main.go",
|
||||
module_name,
|
||||
root_name
|
||||
),
|
||||
}, { cwd = root })
|
||||
:wait()
|
||||
if obj.code ~= 0 then
|
||||
vim.notify(
|
||||
"Go init failed" .. obj.stderr,
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "Vern Go" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
---@type VernCreateFile
|
||||
M.create_file = nil
|
||||
|
||||
---@param opts VernPythonConfig Takes a table for the runtime
|
||||
M.run = function(opts)
|
||||
opts = opts or {}
|
||||
local root = fs.root()
|
||||
-- local context = {
|
||||
-- project_name = fs.name(),
|
||||
-- company_name = opts.env.author,
|
||||
-- file_name = "",
|
||||
-- }
|
||||
-- local bin = vim.tbl_get(opts.python.templates.project.primary)
|
||||
--
|
||||
-- local exe = vim.fs.joinpath(bin.path, bin.name)
|
||||
-- local exe_path = fs.fmt_path(exe, opts.python.dirs, context)
|
||||
-- local full_path = vim.fs.joinpath(vim.fn.expand(root), exe_path)
|
||||
|
||||
term.open({ "go run ", root .. "/main.go" }, opts.terminal or {}, false)
|
||||
end
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.go = {
|
||||
root = "Go",
|
||||
dirs = {
|
||||
src = "",
|
||||
},
|
||||
keybinds = nil,
|
||||
templates = {
|
||||
project = {
|
||||
primary = {
|
||||
path = "{dirs.src}",
|
||||
name = "main.go",
|
||||
kind = "main",
|
||||
kind_path = "vern-nvim.templates.go",
|
||||
},
|
||||
},
|
||||
file = {
|
||||
source = {
|
||||
path = "{dirs.src}",
|
||||
name = "{file_name}.go",
|
||||
kind = "module",
|
||||
kind_path = "vern-nvim.templates.go",
|
||||
},
|
||||
},
|
||||
extras = nil,
|
||||
},
|
||||
}
|
||||
return M
|
||||
@@ -0,0 +1,81 @@
|
||||
---@module "vern-nvim.core.fs"
|
||||
local fs = require("vern-nvim.core.fs")
|
||||
|
||||
---@module "vern-nvim.core.compile"
|
||||
local comp = require("vern-nvim.core.compile")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.attach = nil
|
||||
|
||||
M.create_project = nil
|
||||
|
||||
---@type VernCreateFile
|
||||
M.create_file = nil
|
||||
|
||||
---@param opts VernJavaConfig Takes a table for the runtime
|
||||
M.run = function(opts)
|
||||
opts = opts or {}
|
||||
local root = fs.root()
|
||||
local context = {
|
||||
project_name = fs.name(),
|
||||
company_name = opts.env.author,
|
||||
file_name = "",
|
||||
}
|
||||
|
||||
local src_root = vim.fs.joinpath(
|
||||
root,
|
||||
fs.fmt_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
|
||||
)
|
||||
local run_cmd = string.format(
|
||||
"java -cp %s com.%s.%s.Main",
|
||||
build_dir,
|
||||
context.company_name,
|
||||
context.project_name
|
||||
)
|
||||
|
||||
comp.compile(opts, build_cmd, run_cmd)
|
||||
end
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.java = {
|
||||
root = "Java",
|
||||
dirs = {
|
||||
src = "src/com/{company_name}/{project_name}",
|
||||
bin = "bin",
|
||||
},
|
||||
keybinds = nil,
|
||||
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 = nil,
|
||||
},
|
||||
}
|
||||
return M
|
||||
@@ -0,0 +1,59 @@
|
||||
---@module "vern-nvim.core.fs"
|
||||
local fs = require("vern-nvim.core.fs")
|
||||
|
||||
---@module "vern-nvim.core.terminal"
|
||||
local term = require("vern-nvim.core.terminal")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.attach = nil
|
||||
|
||||
M.create_project = nil
|
||||
|
||||
---@type VernCreateFile
|
||||
M.create_file = nil
|
||||
|
||||
---@param opts VernLuaConfig Takes a table for the runtime
|
||||
M.run = function(opts)
|
||||
opts = opts or {}
|
||||
|
||||
term.open({
|
||||
"lua " .. vim.fs.joinpath(fs.root(), "lua", fs.name(), "/init.lua"),
|
||||
}, opts.terminal or {}, false)
|
||||
end
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.lua = {
|
||||
root = "Lua",
|
||||
dirs = {
|
||||
src = "lua/{project_name}",
|
||||
},
|
||||
keybinds = nil,
|
||||
templates = {
|
||||
project = {
|
||||
primary = {
|
||||
path = "{dirs.src}",
|
||||
name = "init.lua",
|
||||
kind = "main",
|
||||
kind_path = "vern-nvim.templates.lua",
|
||||
},
|
||||
style = {
|
||||
path = ".",
|
||||
name = "stylua.toml",
|
||||
kind = "format",
|
||||
kind_path = "vern-nvim.templates.lua",
|
||||
},
|
||||
},
|
||||
file = {
|
||||
source = {
|
||||
path = "{dirs.src}",
|
||||
name = "{file_name}.lua",
|
||||
kind = "source",
|
||||
kind_path = "vern-nvim.templates.lua",
|
||||
},
|
||||
},
|
||||
extras = nil,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,138 @@
|
||||
---@module "vern-nvim.core.fs"
|
||||
local fs = require("vern-nvim.core.fs")
|
||||
|
||||
---@module "vern-nvim.core.terminal"
|
||||
local term = require("vern-nvim.core.terminal")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.attach = function()
|
||||
local root = fs.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
|
||||
|
||||
---@param root string
|
||||
M.create_project = function(root)
|
||||
local obj = vim.system({ "python3", "-m", "venv", root .. "/venv" }):wait()
|
||||
if obj.code ~= 0 then
|
||||
vim.notify(
|
||||
"Virtual environment failed to initialize " .. obj.stderr,
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "Vern Python" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
---@type VernCreateFile
|
||||
M.create_file = nil
|
||||
|
||||
---@param opts VernPythonConfig Takes a table for the runtime
|
||||
M.run = function(opts)
|
||||
opts = opts or {}
|
||||
local root = fs.root()
|
||||
local context = {
|
||||
project_name = fs.name(),
|
||||
company_name = opts.env.author,
|
||||
file_name = "",
|
||||
}
|
||||
local bin = vim.tbl_get(opts.python.templates.project.primary)
|
||||
|
||||
local exe = vim.fs.joinpath(bin.path, bin.name)
|
||||
local exe_path = fs.fmt_path(exe, opts.python.dirs, context)
|
||||
local full_path = vim.fs.joinpath(vim.fn.expand(root), exe_path)
|
||||
|
||||
term.open({ "python3 " .. full_path }, opts.terminal or {}, false)
|
||||
end
|
||||
|
||||
M.pip_install = function()
|
||||
vim.ui.input({ prompt = "Enter pip module: " }, function(mod)
|
||||
mod = mod and vim.trim(mod)
|
||||
if not mod or mod == "" then
|
||||
vim.notify(
|
||||
"Pip Cancelled",
|
||||
vim.log.levels.WARN,
|
||||
{ title = "Vern Python" }
|
||||
)
|
||||
return
|
||||
end
|
||||
vim.notify(
|
||||
"Installing " .. mod,
|
||||
vim.log.levels.INFO,
|
||||
{ title = "Vern Python" }
|
||||
)
|
||||
vim.system({ "pip", "install", mod }, { text = true }, function(obj)
|
||||
vim.schedule(function()
|
||||
if obj.code ~= 0 then
|
||||
vim.notify(
|
||||
"Pip failed: " .. obj.stderr,
|
||||
vim.log.levels.WARN,
|
||||
{ title = "Vern Python" }
|
||||
)
|
||||
else
|
||||
vim.notify(
|
||||
"Pip installed " .. mod,
|
||||
vim.log.levels.INFO,
|
||||
{ title = "Vern Python" }
|
||||
)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.python = {
|
||||
root = "Python",
|
||||
dirs = {
|
||||
src = "src/{project_name}",
|
||||
},
|
||||
keybinds = {
|
||||
["<leader>pi"] = {
|
||||
user_command = "VernPythonPip",
|
||||
desc = "Install python packages for environment",
|
||||
action = M.pip_install,
|
||||
},
|
||||
},
|
||||
templates = {
|
||||
project = {
|
||||
primary = {
|
||||
path = "{dirs.src}",
|
||||
name = "main.py",
|
||||
kind = "main",
|
||||
kind_path = "vern-nvim.templates.python",
|
||||
},
|
||||
manifest = {
|
||||
path = ".",
|
||||
name = "pyproject.toml",
|
||||
kind = "pyproject",
|
||||
kind_path = "vern-nvim.templates.python",
|
||||
},
|
||||
pkg_init = {
|
||||
path = "{dirs.src}",
|
||||
name = "__init__.py",
|
||||
kind = "__init__",
|
||||
kind_path = "vern-nvim.templates.python",
|
||||
},
|
||||
},
|
||||
file = {
|
||||
source = {
|
||||
path = "{dirs.src}",
|
||||
name = "{file_name}.py",
|
||||
kind = "module",
|
||||
kind_path = "vern-nvim.templates.python",
|
||||
},
|
||||
},
|
||||
extras = nil,
|
||||
},
|
||||
}
|
||||
return M
|
||||
@@ -0,0 +1,61 @@
|
||||
---@module "vern-nvim.core.fs"
|
||||
local fs = require("vern-nvim.core.fs")
|
||||
|
||||
---@module "vern-nvim.core.terminal"
|
||||
local term = require("vern-nvim.core.terminal")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.attach = nil
|
||||
|
||||
M.create_project = function(root)
|
||||
local obj = vim
|
||||
.system({
|
||||
"cargo",
|
||||
"init",
|
||||
vim.fn.expand(root),
|
||||
"--name",
|
||||
vim.fs.basename(root),
|
||||
})
|
||||
:wait()
|
||||
|
||||
if obj.code ~= 0 then
|
||||
vim.notify("Cargo init failed:" .. obj.stderr, vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
|
||||
---@type VernCreateFile
|
||||
M.create_file = nil
|
||||
|
||||
---@param opts VernRustConfig Takes a table for the runtime
|
||||
M.run = function(opts)
|
||||
opts = opts or {}
|
||||
term.open(
|
||||
{ "cd " .. fs.root() .. " && cargo run" },
|
||||
opts.terminal or {},
|
||||
false
|
||||
)
|
||||
end
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.rust = {
|
||||
root = "Rust",
|
||||
dirs = nil,
|
||||
keybinds = nil,
|
||||
templates = {
|
||||
project = {
|
||||
primary = { path = "src", name = "main.rs" },
|
||||
},
|
||||
file = {
|
||||
source = {
|
||||
path = "src",
|
||||
name = "{file_name}.rs",
|
||||
kind = "source",
|
||||
kind_path = "vern-nvim.templates.rust",
|
||||
},
|
||||
},
|
||||
extras = nil,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,59 @@
|
||||
---@module "vern-nvim.core.fs"
|
||||
local fs = require("vern-nvim.core.fs")
|
||||
|
||||
---@module "vern-nvim.core.terminal"
|
||||
local term = require("vern-nvim.core.terminal")
|
||||
|
||||
---@module "vern-nvim.providers.web"
|
||||
local providers = require("vern-nvim.providers.web")
|
||||
local M = {}
|
||||
|
||||
M.attach = nil
|
||||
|
||||
M.create_project = function(opts, continue)
|
||||
opts = opts or {}
|
||||
local provider = vim.tbl_get(opts, "web", "providers")
|
||||
if vim.trim(provider) == "bun" then
|
||||
local items = { "Vanilla", "Tailwind", "Shadcn" }
|
||||
vim.ui.select(items, {
|
||||
prompt = "Select scaffold from Bun:",
|
||||
format_item = function(item) return item end,
|
||||
}, function(choice, _)
|
||||
if choice then return continue(choice) end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
---@type VernCreateFile
|
||||
M.create_file = nil
|
||||
|
||||
---@param opts VernWebConfig Takes a table for the runtime
|
||||
M.run = function(opts)
|
||||
opts = opts or {}
|
||||
|
||||
-- term.open({
|
||||
-- "lua " .. vim.fs.joinpath(fs.root(), "lua", fs.name(), "/init.lua"),
|
||||
-- }, opts.terminal or {}, false)
|
||||
end
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.web = {
|
||||
root = "Web",
|
||||
dirs = nil,
|
||||
providers = "bun", --- "bun"|"deno"|"vanilla"
|
||||
keybinds = nil,
|
||||
templates = {
|
||||
project = nil,
|
||||
file = {
|
||||
source = {
|
||||
path = "{dirs.src}",
|
||||
name = "{file_name}.lua",
|
||||
kind = "source",
|
||||
kind_path = "vern-nvim.templates.lua",
|
||||
},
|
||||
},
|
||||
extras = nil,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,3 @@
|
||||
local M = {}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,10 @@
|
||||
--- Providers for bun
|
||||
---
|
||||
|
||||
--[[ React
|
||||
|
||||
--react
|
||||
--react=tailwind
|
||||
--react=shadcn
|
||||
|
||||
--]]
|
||||
File renamed without changes.
@@ -0,0 +1,137 @@
|
||||
return {
|
||||
--[[ =====================================================================
|
||||
template: main (entrypoint)
|
||||
file: main.c
|
||||
target: src/main.c
|
||||
===================================================================== --]]
|
||||
main = vim.trim([=[
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
char* str = "hello world";
|
||||
printf("%s\n", str);
|
||||
return 0;
|
||||
}
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
template: clang-format (code formatter)
|
||||
file: .clang-format
|
||||
target: .clang-format
|
||||
===================================================================== --]]
|
||||
format = vim.trim([=[
|
||||
---
|
||||
basedonstyle: google
|
||||
standard: latest
|
||||
usetab: always
|
||||
tabwidth: 8
|
||||
indentwidth: 8
|
||||
breakbeforebraces: allman
|
||||
spacebeforecpp11bracedlist: true
|
||||
separatedefinitionblocks: always
|
||||
cpp11bracedliststyle: false
|
||||
breakafterreturntype: toplevel
|
||||
reflowcomments: always
|
||||
allowshortfunctionsonasingleline: all
|
||||
allowshortifstatementsonasingleline: allifsandelse
|
||||
allowshortloopsonasingleline: true
|
||||
indentaccessmodifiers: false # indent access specifiers by one level
|
||||
accessmodifieroffset: -4 # optional: adjust offset relative to the class indentation level
|
||||
indentgotolabels: innerindent
|
||||
derivepointeralignment: false
|
||||
pointeralignment: left
|
||||
indentppdirectives: afterhash
|
||||
sortincludes: casesensitive
|
||||
includeblocks: preserve
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
template: cmakelists (spec / build manifest)
|
||||
file: cmakelists.txt
|
||||
target: cmakelists.txt
|
||||
===================================================================== --]]
|
||||
cmakelists = vim.trim([=[
|
||||
cmake_minimum_required(version 3.16)
|
||||
project(__project_name__ languages c)
|
||||
set(cmake_c_standard 23)
|
||||
set(cmake_c_standard_required on)
|
||||
set(cmake_export_compile_commands on)
|
||||
|
||||
set(lib_sources
|
||||
# add your other types here as you implement them:
|
||||
# src/example1.c
|
||||
# src/example2.c
|
||||
)
|
||||
|
||||
if(lib_sources)
|
||||
add_library(__project_name__ static ${lib_sources})
|
||||
target_include_directories(__project_name__
|
||||
public
|
||||
${cmake_current_source_dir}/include
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable(__project_name___bin src/main.c)
|
||||
set_target_properties(__project_name___bin properties output_name "__project_name__")
|
||||
|
||||
if(target __project_name__)
|
||||
target_link_libraries(__project_name___bin private __project_name__)
|
||||
endif()
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
template: header (standalone file)
|
||||
file: {name}.h
|
||||
target: include/{project_name}/{name}.h
|
||||
===================================================================== --]]
|
||||
header = vim.trim([=[
|
||||
#ifndef __file_name___h
|
||||
#define __file_name___h
|
||||
|
||||
// code
|
||||
|
||||
#endif /* __file_name___h */
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
template: source (standalone file)
|
||||
file: {name}.c
|
||||
target: src/{name}.c
|
||||
===================================================================== --]]
|
||||
source = vim.trim([=[
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
template: clang_tidy (linter)
|
||||
file: .clang-tidy
|
||||
target: .clang-tidy
|
||||
===================================================================== --]]
|
||||
linter = vim.trim([=[
|
||||
checks: >
|
||||
-*,
|
||||
clang-analyzer-*,
|
||||
bugprone-*,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-bugprone-reserved-identifier,
|
||||
performance-*,
|
||||
security-*
|
||||
|
||||
readability-redundant-declaration
|
||||
readability-misleading-indentation
|
||||
readability-implicit-bool-conversion
|
||||
misc-misplaced-const,
|
||||
misc-include-cleaner
|
||||
|
||||
-bugprone-narrowing-conversions,
|
||||
-readability-identifier-length
|
||||
checkoptions:
|
||||
readability-identifier-naming.variablecase: lower_case
|
||||
readability-identifier-naming.functioncase: lower_case
|
||||
readability-identifier-naming.structcase: lower_case
|
||||
readability-identifier-naming.enumcase: camelcase
|
||||
readability-identifier-naming.enumconstantcase: upper_case
|
||||
readability-identifier-naming.macrodefinitioncase: upper_case
|
||||
]=]) .. "\n",
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
return {
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: MAIN (Entrypoint)
|
||||
File: main.cpp
|
||||
Target: src/main.cpp
|
||||
===================================================================== --]]
|
||||
main = vim.trim([=[
|
||||
#include <iostream>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
std::string str = "Hello World";
|
||||
std::cout << str << "\n";
|
||||
return 0;
|
||||
}
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: CLANG-FORMAT (Code formatter)
|
||||
File: .clang-format
|
||||
Target: .clang-format
|
||||
===================================================================== --]]
|
||||
format = vim.trim([=[
|
||||
---
|
||||
BasedOnStyle: Google
|
||||
Standard: Latest
|
||||
UseTab: Always
|
||||
TabWidth: 8
|
||||
IndentWidth: 8
|
||||
BreakBeforeBraces: Allman
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SeparateDefinitionBlocks: Always
|
||||
Cpp11BracedListStyle: false
|
||||
BreakAfterReturnType: TopLevel
|
||||
ReflowComments: Always
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
IndentAccessModifiers: false # Indent access specifiers by one level
|
||||
AccessModifierOffset: -4 # Optional: adjust offset relative to the class indentation level
|
||||
IndentGotoLabels: InnerIndent
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Left
|
||||
IndentPPDirectives: AfterHash
|
||||
SortIncludes: CaseSensitive
|
||||
IncludeBlocks: Preserve
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: CMAKELISTS (Spec / Build Manifest)
|
||||
File: CMakeLists.txt
|
||||
Target: CMakeLists.txt
|
||||
===================================================================== --]]
|
||||
CmakeLists = vim.trim([=[
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(__PROJECT_NAME__ LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
set(LIB_SOURCES
|
||||
# Add your other types here as you implement them:
|
||||
# src/example1.cpp
|
||||
# src/example2.cpp
|
||||
)
|
||||
|
||||
if(LIB_SOURCES)
|
||||
add_library(__PROJECT_NAME__ STATIC ${LIB_SOURCES})
|
||||
target_include_directories(__PROJECT_NAME__
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable(__PROJECT_NAME___bin src/main.cpp)
|
||||
set_target_properties(__PROJECT_NAME___bin PROPERTIES OUTPUT_NAME "__PROJECT_NAME__")
|
||||
|
||||
if(TARGET __PROJECT_NAME__)
|
||||
target_link_libraries(__PROJECT_NAME___bin PRIVATE __PROJECT_NAME__)
|
||||
endif()
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: HEADER (Standalone File)
|
||||
File: {name}.hpp
|
||||
Target: include/{project_name}/{name}.hpp
|
||||
===================================================================== --]]
|
||||
header = vim.trim([=[
|
||||
#ifndef __FILE_NAME___HPP
|
||||
#define __FILE_NAME___HPP
|
||||
|
||||
// Code
|
||||
|
||||
#endif /* __FILE_NAME___HPP */
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: SOURCE (Standalone File)
|
||||
File: {name}.cpp
|
||||
Target: src/{name}.cpp
|
||||
===================================================================== --]]
|
||||
source = vim.trim([=[
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: CLANG_TIDY (LINTER)
|
||||
File: .clang-tidy
|
||||
Target: .clang-tidy
|
||||
===================================================================== --]]
|
||||
linter = vim.trim([=[
|
||||
Checks: >
|
||||
-*,
|
||||
clang-analyzer-*,
|
||||
bugprone-*,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-bugprone-reserved-identifier,
|
||||
performance-*,
|
||||
security-*
|
||||
|
||||
readability-redundant-declaration
|
||||
readability-misleading-indentation
|
||||
readability-implicit-bool-conversion
|
||||
misc-misplaced-const,
|
||||
misc-include-cleaner
|
||||
|
||||
-bugprone-narrowing-conversions,
|
||||
-readability-identifier-length
|
||||
CheckOptions:
|
||||
readability-identifier-naming.VariableCase: lower_case
|
||||
readability-identifier-naming.FunctionCase: lower_case
|
||||
readability-identifier-naming.StructCase: lower_case
|
||||
readability-identifier-naming.EnumCase: CamelCase
|
||||
readability-identifier-naming.EnumConstantCase: UPPER_CASE
|
||||
readability-identifier-naming.MacroDefinitionCase: UPPER_CASE
|
||||
]=]) .. "\n",
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
local M = {}
|
||||
|
||||
---@param lang string
|
||||
M.template = function(lang)
|
||||
local base = [=[
|
||||
.DS_Store
|
||||
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
.env
|
||||
.env.*
|
||||
|
||||
]=]
|
||||
local lang_block = {
|
||||
python = vim.trim([=[
|
||||
__pycache__/
|
||||
build/
|
||||
dist/
|
||||
.venv/
|
||||
env/
|
||||
venv/
|
||||
.pytest_cache/
|
||||
]=]),
|
||||
|
||||
c = vim.trim([=[
|
||||
build/
|
||||
.cache/
|
||||
]=]),
|
||||
|
||||
cpp = vim.trim([=[
|
||||
build/
|
||||
.cache/
|
||||
]=]),
|
||||
|
||||
lua = vim.trim([=[
|
||||
luac.out
|
||||
]=]),
|
||||
|
||||
java = vim.trim([=[
|
||||
bin/
|
||||
*.class
|
||||
*.jar
|
||||
]=]),
|
||||
rust = vim.trim([=[
|
||||
debug
|
||||
target
|
||||
**/*.rs.bk
|
||||
*.pdb
|
||||
**/mutants.out*/
|
||||
rustc-ice-*.txt
|
||||
#.idea/
|
||||
]=]),
|
||||
go = vim.trim([=[
|
||||
bin/
|
||||
]=]),
|
||||
}
|
||||
|
||||
local extra = (lang and lang_block[lang]) or ""
|
||||
return base .. extra
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1 @@
|
||||
return "# Hello from your fellow README.md"
|
||||
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
--[[ =====================================================================
|
||||
template: main (entrypoint)
|
||||
file: main.go
|
||||
target: main.go
|
||||
===================================================================== --]]
|
||||
main = vim.trim([=[
|
||||
package main
|
||||
|
||||
import ("fmt")
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello World")
|
||||
}
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
template: source (standalone file)
|
||||
file: {name}.go
|
||||
target: {name}.go
|
||||
===================================================================== --]]
|
||||
--- Add boilder plate
|
||||
source = vim.trim([=[
|
||||
]=]) .. "\n",
|
||||
}
|
||||
@@ -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",
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
return {
|
||||
--[[ =====================================================================
|
||||
template: main (entrypoint)
|
||||
file: init.lua
|
||||
target: lua/init.lua
|
||||
===================================================================== --]]
|
||||
main = vim.trim([=[
|
||||
local M = {}
|
||||
|
||||
---@param opts? table
|
||||
function M.setup(opts)
|
||||
M.opts = opts or {}
|
||||
end
|
||||
|
||||
return M
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
template: stylua (code formatter)
|
||||
file: stylua.toml
|
||||
target: stylua.toml
|
||||
===================================================================== --]]
|
||||
format = vim.trim([=[
|
||||
# stylua.toml
|
||||
|
||||
# How many characters per line before wrapping
|
||||
column_width = 80
|
||||
|
||||
# Indentation style: "Tabs" or "Spaces"
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 4
|
||||
|
||||
# Quote styling: "AutoPreferDouble", "AutoPreferSingle", "ForceDouble", "ForceSingle"
|
||||
quote_style = "AutoPreferDouble"
|
||||
|
||||
# Call parentheses: "Always", "NoSingleString", "None", "Input"
|
||||
# "None" removes parens when a single string/table literal is passed: fn "arg" / fn { ... }
|
||||
# "Always" keeps them strictly standard: fn("arg") / fn({ ... })
|
||||
call_parentheses = "Always"
|
||||
|
||||
# Sorting and formatting behavior
|
||||
# collapse_simple_statement = "Never"
|
||||
collapse_simple_statement = "Always"
|
||||
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
template: source (standalone file)
|
||||
file: {name}.lua
|
||||
target: lua/{name}.lua
|
||||
===================================================================== --]]
|
||||
source = vim.trim([=[
|
||||
local M = {}
|
||||
|
||||
return M
|
||||
]=]) .. "\n",
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
return {
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: MAIN (Entrypoint)
|
||||
File: main.py
|
||||
Target: src/{project_name}/main.py
|
||||
===================================================================== --]]
|
||||
main = vim.trim([=[
|
||||
def main() -> None:
|
||||
print("Hello from __PROJECT_NAME__!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: INIT (Package Anchor)
|
||||
File: __init__.py
|
||||
Target: src/{project_name}/__init__.py
|
||||
===================================================================== --]]
|
||||
__init__ = vim.trim([=[
|
||||
# __PROJECT_NAME__ init
|
||||
|
||||
__all__: list[str] = []
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: PYPROJECT (Spec / Build Manifest)
|
||||
File: pyproject.toml
|
||||
Target: pyproject.toml
|
||||
===================================================================== --]]
|
||||
pyproject = vim.trim([=[
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "__PROJECT_NAME__"
|
||||
version = "0.1.0"
|
||||
description = "Project __PROJECT_NAME__"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = []
|
||||
|
||||
[project.scripts]
|
||||
__PROJECT_NAME__ = "__PROJECT_NAME__.main:main"
|
||||
]=]) .. "\n",
|
||||
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: MODULE (Standalone File)
|
||||
File: {name}.py
|
||||
Target: src/{project_name}/{name}.py
|
||||
===================================================================== --]]
|
||||
module = vim.trim([=[
|
||||
"""
|
||||
Module: __FILE_NAME__
|
||||
"""
|
||||
]=]) .. "\n",
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
--[[ =====================================================================
|
||||
TEMPLATE: SOURCE (Standalone File)
|
||||
File: {name}.rs
|
||||
Target: src/{name}.rs
|
||||
===================================================================== --]]
|
||||
source = vim.trim([=[
|
||||
]=]) .. "\n",
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
---@alias TerminalModeType "split" | "float"
|
||||
---@alias SplitDirection "vertical" | "horizontal"
|
||||
---@alias SplitAnchorType "right" | "bottom"
|
||||
|
||||
---@alias VernCreateFile fun(opts: any, continue: fun(mod: VernFileLayout|nil))
|
||||
|
||||
---@class VernUserConfig
|
||||
---@field workspace_root? string
|
||||
---@field keybinds? table<string, VernKeybindItem>
|
||||
---@field terminal? VernTerminalConfig | table
|
||||
|
||||
---@class VernKeybindItem
|
||||
---@field user_command string
|
||||
---@field desc string
|
||||
---@field action fun(opts: VernCoreConfig)
|
||||
|
||||
---@class VernFloatWindowConfig
|
||||
---@field padding { left: integer, right: integer, top: integer, bottom: integer }
|
||||
---@field border { enabled: boolean, type: string }
|
||||
|
||||
---@class VernSplitWindowConfig
|
||||
---@field direction SplitDirection
|
||||
---@field anchor SplitAnchorType
|
||||
---@field size string
|
||||
|
||||
---@class VernWindowConfig
|
||||
---@field float VernFloatWindowConfig
|
||||
---@field split VernSplitWindowConfig
|
||||
|
||||
---@class VernModeConfig
|
||||
---@field type TerminalModeType
|
||||
---@field win VernWindowConfig
|
||||
|
||||
---@class VernTerminalConfig
|
||||
---@field mode VernModeConfig
|
||||
|
||||
---@class VernEnvItem
|
||||
---@field author string
|
||||
|
||||
---@class VernCoreConfig
|
||||
---@field workspace_root string
|
||||
---@field env VernEnvItem
|
||||
---@field keybinds table<string, VernKeybindItem>
|
||||
---@field terminal VernTerminalConfig
|
||||
|
||||
---@class VernFileLayout
|
||||
---@field path string
|
||||
---@field name string
|
||||
---@field kind? string
|
||||
---@field kind_path? string
|
||||
|
||||
---@class VernExtrasLayout : VernFileLayout
|
||||
---@field enabled? boolean
|
||||
|
||||
---@class VernLanguageTemplates
|
||||
---@field project table<string, VernFileLayout>|nil
|
||||
---@field file table<string, VernFileLayout>|nil
|
||||
---@field extras table<string, VernExtrasLayout>|nil
|
||||
|
||||
---@class VernLanguageConfig
|
||||
---@field root string
|
||||
---@field dirs table<string, string>|nil
|
||||
---@field keybinds? table<string, VernKeybindItem>
|
||||
---@field templates VernLanguageTemplates
|
||||
|
||||
---@class VernPythonConfig : VernCoreConfig
|
||||
---@field python? VernLanguageConfig
|
||||
|
||||
---@class VernCConfig : VernCoreConfig
|
||||
---@field c? VernLanguageConfig
|
||||
|
||||
---@class VernCPPConfig : VernCoreConfig
|
||||
---@field cpp? VernLanguageConfig
|
||||
|
||||
---@class VernLuaConfig : VernCoreConfig
|
||||
---@field lua? VernLanguageConfig
|
||||
|
||||
---@class VernJavaConfig : VernCoreConfig
|
||||
---@field java? VernLanguageConfig
|
||||
|
||||
---@class VernRustConfig : VernCoreConfig
|
||||
---@field rust? VernLanguageConfig
|
||||
|
||||
---@class VernWebConfig : VernCoreConfig
|
||||
---@field web? VernLanguageConfig
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
site_name: Polydev
|
||||
nav:
|
||||
- Home: index.md
|
||||
- Installation: installation.md
|
||||
- Setup: setup.md
|
||||
- Language Specific Docs:
|
||||
- Java: languages/java.md
|
||||
- C: languages/c.md
|
||||
- Cpp: languages/cpp.md
|
||||
- Lua: languages/lua.md
|
||||
- Python: languages/python.md
|
||||
theme:
|
||||
name: material
|
||||
features:
|
||||
- navigation.tabs
|
||||
- navigation.sections
|
||||
- toc.integrate
|
||||
- navigation.top
|
||||
- search.suggest
|
||||
- search.highlight
|
||||
- content.tabs.link
|
||||
- content.code.annotation
|
||||
- content.code.copy
|
||||
language: en
|
||||
palette:
|
||||
- scheme: slate
|
||||
primary: slate
|
||||
accent: teal
|
||||
|
||||
extra:
|
||||
social:
|
||||
- icon: fontawesome/brands/github-alt
|
||||
link: https://github.com/DarthMooMancer
|
||||
|
||||
markdown_extensions:
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets
|
||||
- admonition
|
||||
- pymdownx.arithmatex:
|
||||
generic: true
|
||||
- footnotes
|
||||
- pymdownx.details
|
||||
- pymdownx.superfences
|
||||
- pymdownx.mark
|
||||
- attr_list
|
||||
- pymdownx.emoji:
|
||||
emoji_index: !!python/name:materialx.emoji.twemoji
|
||||
emoji_generator: !!python/name:materialx.emoji.to_svg
|
||||
|
||||
copyright: |
|
||||
© 2025 <a href="https://github.com/DarthMooMancer" target="_blank" rel="noopener">DarthMooMancer</a>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# stylua.toml
|
||||
|
||||
# How many characters per line before wrapping
|
||||
column_width = 80
|
||||
|
||||
# Indentation style: "Tabs" or "Spaces"
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
|
||||
# Quote styling: "AutoPreferDouble", "AutoPreferSingle", "ForceDouble", "ForceSingle"
|
||||
quote_style = "AutoPreferDouble"
|
||||
|
||||
# Call parentheses: "Always", "NoSingleString", "None", "Input"
|
||||
# "None" removes parens when a single string/table literal is passed: fn "arg" / fn { ... }
|
||||
# "Always" keeps them strictly standard: fn("arg") / fn({ ... })
|
||||
call_parentheses = "Always"
|
||||
|
||||
# Sorting and formatting behavior
|
||||
# collapse_simple_statement = "Never"
|
||||
collapse_simple_statement = "Always"
|
||||
Reference in new issue
Block a user