Compare commits
168
Commits
v1.0.0
...
774f14809d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
c79c414859 | ||
|
|
87e6408291 | ||
|
|
4cf429c210 | ||
|
|
2dbb367eb5 | ||
|
|
29643fe1d5 | ||
|
|
068a650e85 | ||
|
|
48322f04e1 | ||
|
|
1c8ec76875 | ||
|
|
156f92cc31 | ||
|
|
a882c3b30e | ||
|
|
838148bccb | ||
|
|
4b8300c9c0 | ||
|
|
cc61c9029d | ||
|
|
3f7c412d77 |
@@ -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
-1
@@ -1,2 +1,2 @@
|
||||
*.polydev
|
||||
LICENSE
|
||||
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,26 +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>
|
||||
|
||||
!!! Documentation is over at [Polydev Documentation](https://darthmoomancer.github.io/Polydev/)
|
||||
<p align="center"><em>Vern.nvim or Vernacular.nvim is a multi lingual project manager. It creates new projects and files from templates, builds and runs code and can run language specific functions within Neovim</em></p>
|
||||
|
||||

|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/Lua-1e90ff?style=for-the-badge&logo=lua&logoColor=white" />
|
||||
<img src="https://img.shields.io/badge/Neovim-0.10%2B-32c48d?style=for-the-badge&logo=neovim&logoColor=white" />
|
||||
<img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge" />
|
||||
<!-- <img src="https://img.shields.io/badge/Docs-Available-blue?style=for-the-badge&logo=readthedocs&logoColor=white" /> -->
|
||||
</p>
|
||||
|
||||
|
||||
### Quick Features
|
||||
The ability to -
|
||||
* Create new projects
|
||||
* Create new files
|
||||
* Build those files
|
||||
* Run those files
|
||||
* Builtin terminal for running code
|
||||
* And More!
|
||||
NOTE: The plugin may not work well with lazy or any other package manager other than vim.pack. I dont understand enough about nvim api and lua to handle these other things right now
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
* Create projects directly from Neovim
|
||||
* Generate new files quickly
|
||||
* Build your code with customizable build systems
|
||||
* Run programs without leaving the editor
|
||||
* Integrated terminal for flexible command execution
|
||||
* Minimal configuration with extensibility in mind
|
||||
|
||||
> 📚 [View the full documentation](https://git.moomancer.xyz/DarthMooMancer/vern-nvim.nvim/wiki/Home$0) for setup, configuration, and usage details.
|
||||
|
||||
## Supported Languages
|
||||
|
||||
Vern.nvim currently supports the following languages:
|
||||
|
||||
### Currently Supported (And working) Languages
|
||||
* Java
|
||||
* Python
|
||||
* C / C++
|
||||
* Lua
|
||||
<!-- * Java -->
|
||||
<!-- * Lua -->
|
||||
<!-- * Rust -->
|
||||
<!-- * HTML -->
|
||||
|
||||
## 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.
|
||||
|
||||
## Roadmap
|
||||
|
||||
Current focus:
|
||||
* **Refactoring and internal cleanup.**
|
||||
|
||||
## 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.
|
||||
|
||||
If you have an idea or use case you'd like to see supported, let’s discuss it.
|
||||
Your feedback and contributions are key to making Vern.nvim even better! Thank you for being part of the journey. 🙏
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
### Lazy and Config
|
||||
```lua
|
||||
-- There is no need to copy this. This is an example and it consists of the defaults. This is a c example
|
||||
return {
|
||||
'DarthMooMancer/Polydev',
|
||||
opts = {
|
||||
c = {
|
||||
build_attributes = "-DBUILD_SHARED_LIBS=OFF"
|
||||
project_root = "~/Projects/C",
|
||||
keybinds = {
|
||||
["<Esc>"] = "CloseTerminal",
|
||||
["<leader>pb"] = "CBuild",
|
||||
["<leader>pr"] = "CRun",
|
||||
["<leader>nh"] = "NewCHeaderFile",
|
||||
},
|
||||
terminal = {
|
||||
right_padding = 0,
|
||||
bottom_padding = 0,
|
||||
left_padding = 0,
|
||||
top_padding = 0,
|
||||
border = true,
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
scroll = true,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1,13 +0,0 @@
|
||||
# Welcome to Polydev
|
||||
|
||||

|
||||
|
||||
----
|
||||
### What is Polydev?
|
||||
Polydev is a simple plugin that gives neovim some nice functions while being extremely extensible for developers. It automatically detects your language and enables the module for that language. It is a standalone plugin that has no dependencies aside from getting file types. Below are a few features that are currently implemented:
|
||||
|
||||
* Creating New Projects
|
||||
* Creating New Files
|
||||
* Building Files
|
||||
* Running Files
|
||||
* Builtin Terminal
|
||||
@@ -1,32 +0,0 @@
|
||||
# Installation
|
||||
!!! Polydev can be installed with any plugin installer or manually. These are just examples.
|
||||
|
||||
* Side note: A lot of the languages require a <project_name>.polydev file. If you dont have it in a language that needs it, it will error out and yell at you.
|
||||
|
||||
## Lazyvim
|
||||
----------
|
||||
|
||||
```lua
|
||||
require {
|
||||
"DarthMooMancer/Polydev",
|
||||
config = function()
|
||||
require("Polydev").setup()
|
||||
--require("Polydev").language.setup({
|
||||
-- configs
|
||||
--})
|
||||
end
|
||||
}
|
||||
```
|
||||
|
||||
## Mini.Deps
|
||||
------------
|
||||
```lua
|
||||
MiniDeps.add({
|
||||
source = 'DarthMooMancer/Polydev',
|
||||
})
|
||||
|
||||
require("Polydev").setup()
|
||||
--require("Polydev").language.setup({
|
||||
-- configs
|
||||
--})
|
||||
```
|
||||
@@ -1,29 +0,0 @@
|
||||
## Key Notes
|
||||
* Currently with the way I have it work, the first time you build a project, it will error out no matter what. Just rerun the build and then if there are errors it is most likely a you issue more than a me issue.
|
||||
|
||||
## Keybinds
|
||||
```lua
|
||||
require("Polydev").c.setup({
|
||||
keybinds = {
|
||||
["<Esc>"] = "CloseTerminal" -- Closes terminal, esc by default.
|
||||
["<leader>pb"] = "CBuild", -- Building all C Files in src directory in.
|
||||
["<leader>pr"] = "CRun", -- Runs <Project_name> in your build directory
|
||||
["<leader>nf"] = "NewCFile", -- Creates a new c file in the current project src folder
|
||||
["<leader>nh"] = "NewCHeaderFile", -- Creates a new header file in the current project src folder
|
||||
})
|
||||
```
|
||||
|
||||
## File Structure
|
||||
```md
|
||||
Projects/
|
||||
└── C/
|
||||
└── Project_Name/
|
||||
├── CMakeLists.txt
|
||||
├── src/
|
||||
│ ├── main.c
|
||||
│ └── *.c
|
||||
├── build/
|
||||
│ └── <project_name>.polydev
|
||||
└── include/
|
||||
└── *.h
|
||||
```
|
||||
@@ -1,23 +0,0 @@
|
||||
## Keybinds
|
||||
```lua
|
||||
-- These are defaults, so no need to copy them
|
||||
require("Polydev").java.setup({
|
||||
keybinds = {
|
||||
["<Esc>"] = "CloseTerminal" -- Closes terminal, esc by default.
|
||||
["<leader>pb"] = "JavaBuild" -- Building all Java Files in src directory in.
|
||||
["<leader>pr"] = "JavaRun" -- Runs Main.java in the out folder in your project_root
|
||||
["<leader>nf"] = "NewJavaFile" -- Creates a new Java file in the current project src folder
|
||||
}
|
||||
})
|
||||
```
|
||||
## File Structure
|
||||
|
||||
```md
|
||||
Projects/
|
||||
└── Java/
|
||||
└── Project_Name/
|
||||
├── src/
|
||||
│ └── Main.java
|
||||
└── build/
|
||||
└── *.class
|
||||
```
|
||||
@@ -1,22 +0,0 @@
|
||||
## Keybinds
|
||||
```lua
|
||||
-- These are the defaults for lua
|
||||
require("Polydev").lua.setup({
|
||||
keybinds = {
|
||||
["<Esc>"] = "CloseTerminal",
|
||||
["<leader>pr"] = "LuaRun",
|
||||
["<leader>nf"] = "NewLuaFile",
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## File Structure
|
||||
```md
|
||||
Projects/
|
||||
└── Lua/
|
||||
└── Project_Name/
|
||||
├── <Project_name>.polydev
|
||||
└── lua/
|
||||
└── Project_name/
|
||||
└── init.lua
|
||||
```
|
||||
@@ -1,28 +0,0 @@
|
||||
## Keybinds
|
||||
```lua
|
||||
require("Polydev").python.setup({
|
||||
keybinds = {
|
||||
["<Esc>"] = "CloseTerminal",
|
||||
["<leader>pr"] = "PythonRun",
|
||||
["<leader>nf"] = "NewPythonFile",
|
||||
["<leader>pb"] = "PythonPip"
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Python Features
|
||||
* A feature that is added to the python language for this plugin is to be able to install dependencies with pip within the terminal. You can even update pip. Just type your dependency you want and boom it is installed or not depending on if python likes you.
|
||||
* Each project with python creates a new virtual environment and automatically uses it so you dont have to worry, just install modules as you like.
|
||||
|
||||
## File Structure
|
||||
```md
|
||||
Projects/
|
||||
└── Python/
|
||||
└── Project_Name/
|
||||
├── main.py
|
||||
├── requirements.txt
|
||||
├── setup.py
|
||||
├── tests/
|
||||
└── venv/
|
||||
|
||||
```
|
||||
-120
@@ -1,120 +0,0 @@
|
||||
# Setup and Customizing
|
||||
|
||||
## Project Name
|
||||
* You can change the default directory for the project. The project can be made from anywhere you want.
|
||||
* It will automatically make the new Root Directory, so you don't have to worry about making it.
|
||||
|
||||
### Lazy
|
||||
```lua
|
||||
return {
|
||||
...
|
||||
opts = {
|
||||
<language> = {
|
||||
project_root = "~/Home/..." -- Default: ~/Projects/Language
|
||||
|
||||
}
|
||||
}
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Others
|
||||
```lua
|
||||
require("Polydev").language.setup({
|
||||
project_root = "~/Home/..." -- Default: ~/Projects/Language
|
||||
})
|
||||
```
|
||||
|
||||
## Keybinds
|
||||
* Every language has the almost same keybinds so it is easy to remember keybinds and not have to remember thousands of keybinds.
|
||||
* Some languages have separate functions (python has a pip keybind for example) adding more keybinds
|
||||
|
||||
```
|
||||
Key/
|
||||
├── *Universal, cannot be changed through specific language settings
|
||||
└── *Per-language, can be changed separately by language if wanted
|
||||
```
|
||||
|
||||
### Lazy
|
||||
```lua
|
||||
return {
|
||||
...
|
||||
opts = {
|
||||
<language> = {
|
||||
["<Esc>"] = "CloseTerminal", -- Planned to be *Universal -- However can be changed per language for now
|
||||
["<leader>pb"] = "languageBuild", -- *Per-language
|
||||
["<leader>pr"] = "languageRun", -- *Per-language
|
||||
["<leader>nf"] = "NewLanguageFile", --*Universal -- such as .c files
|
||||
["<leader>nh"] = "NewLanguageSecondaryFile", --*Universal -- such as .h files
|
||||
}
|
||||
}
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Others
|
||||
```lua
|
||||
require("Polydev"}.language.setup({
|
||||
keybinds = [
|
||||
["<Esc>"] = "CloseTerminal", -- Planned to be *Universal -- However can be changed per language for now
|
||||
["<leader>pb"] = "languageBuild", -- *Per-language
|
||||
["<leader>pr"] = "languageRun", -- *Per-language
|
||||
["<leader>nf"] = "NewLanguageFile", --*Universal -- such as .c files
|
||||
["<leader>nh"] = "NewLanguageSecondaryFile", --*Universal -- such as .h files
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Terminal
|
||||
* I plan on making the terminal settings a global setting instead of language specific, just need to figure out how
|
||||
* The terminal has a couple of options that can be customized and with more to come
|
||||
- Each is set to 0 by default
|
||||
* **_right_padding:_** Padding for the right width of the terminal
|
||||
* **_left_padding:_** Padding for the left width of the terminal
|
||||
* **_top_padding:_** Padding for the top height of the terminal
|
||||
* **_bottom_padding:_** Padding for the bottom padding of the terminal
|
||||
- Each is enabled by default
|
||||
* **_border:_** Adds a rounded border to the window
|
||||
* **_number:_** Adds numbers to side of terminal
|
||||
* **_relativenumber:_** Relative numbers indicate distances from the cursor, only works if number is enabled
|
||||
* **_scroll:_** Allows scrolling in terminal
|
||||
|
||||
### Lazy
|
||||
```lua
|
||||
return {
|
||||
...
|
||||
opts = {
|
||||
<language> = {
|
||||
terminal = {
|
||||
right_padding = 0,
|
||||
bottom_padding = 0,
|
||||
left_padding = 0,
|
||||
top_padding = 0,
|
||||
border = true,
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
scroll = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Others
|
||||
|
||||
```lua
|
||||
-- These are just defaults, so no need to copy them
|
||||
require("Polydev").language.setup({
|
||||
terminal = {
|
||||
right_padding = 0,
|
||||
bottom_padding = 0,
|
||||
left_padding = 0,
|
||||
top_padding = 0,
|
||||
border = true,
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
scroll = true,
|
||||
}
|
||||
})
|
||||
```
|
||||
@@ -1,100 +0,0 @@
|
||||
local M = {}
|
||||
---@class Keybinds
|
||||
---@field [string] string
|
||||
---
|
||||
---@class Language
|
||||
---@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 Language
|
||||
---@field rust Language
|
||||
---@field java Language
|
||||
---@field python Language
|
||||
---@field lua Language
|
||||
---@field c Language
|
||||
---@field cpp Language
|
||||
---@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,
|
||||
}
|
||||
}
|
||||
|
||||
M.user_config = {}
|
||||
|
||||
function M.setup(user_opts)
|
||||
M.user_config = vim.tbl_deep_extend("force", {}, M.defaults, user_opts or {})
|
||||
end
|
||||
|
||||
function M.get(lang)
|
||||
return M.user_config[lang] or {}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,73 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.loaded_languages = {}
|
||||
M.config = require("Polydev.configs")
|
||||
M.utils = require("Polydev.utils")
|
||||
M.java = require("Polydev.languages.java")
|
||||
M.c = require("Polydev.languages.c")
|
||||
M.cpp = require("Polydev.languages.cpp")
|
||||
M.lua = require("Polydev.languages.lua")
|
||||
M.python = require("Polydev.languages.python")
|
||||
M.rust = require("Polydev.languages.rust")
|
||||
M.html = require("Polydev.languages.html")
|
||||
|
||||
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()
|
||||
vim.ui.input({ prompt = "Enter language for project: " }, function(lang)
|
||||
if not lang or lang == "" then return print("Project creation canceled.") end
|
||||
|
||||
if M.load_language_module(lang) and M.loaded_languages[lang].create_project then
|
||||
M.loaded_languages[lang].create_project()
|
||||
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
|
||||
|
||||
function M.setup(opts)
|
||||
opts = opts or {}
|
||||
M.config.setup(opts)
|
||||
M.utils.setup(opts)
|
||||
for lang, user_opts in pairs(opts) do
|
||||
local default = M.config.defaults[lang] or {}
|
||||
M.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 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,82 +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_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({ "/src", "/build" }) do vim.fn.mkdir(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(project_root .. "/src/Main.java", main_java_content)
|
||||
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,146 +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_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({ "/include" }) do
|
||||
vim.fn.mkdir(project_root .. path, "p")
|
||||
end
|
||||
|
||||
utils.write_file(project_root .. "/main.py", [[
|
||||
def main():
|
||||
print("Hello, World!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
]])
|
||||
|
||||
utils.write_file(project_root .. "/include/__init__.py", "")
|
||||
utils.write_file(project_root .. "/requirements.txt", "")
|
||||
utils.write_file(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 " .. project_root .. "/main.py")
|
||||
local venv_path = project_root .. "/venv"
|
||||
vim.fn.system("python3 -m venv " .. venv_path)
|
||||
vim.g.python3_host_prog = venv_path .. "/bin/python"
|
||||
vim.fn.setenv("VIRTUAL_ENV", venv_path)
|
||||
vim.fn.setenv("PATH", venv_path .. "/bin:" .. vim.fn.getenv("PATH"))
|
||||
|
||||
print("Virtual environment activated for " .. project_name)
|
||||
end)
|
||||
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,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,106 @@
|
||||
local M = {}
|
||||
|
||||
local utils = require("vern-nvim.utils")
|
||||
local templates = require("vern-nvim.templates")
|
||||
local action_utils = require("vern-nvim.actions.utils")
|
||||
|
||||
local join = vim.fs.joinpath
|
||||
|
||||
---@param opts VernCConfig
|
||||
function M.create_project(opts)
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(pname)
|
||||
pname = pname and vim.trim(pname)
|
||||
if not pname or pname == "" then
|
||||
return
|
||||
end
|
||||
|
||||
local configs = require("vern-nvim.configs.c")
|
||||
|
||||
---@type VernCConfig
|
||||
local cfg = vim.tbl_deep_extend("force", {}, configs, configs, opts or {})
|
||||
local root = join(vim.fn.expand(cfg.workspace_root), cfg.c.root, pname)
|
||||
local bin = action_utils.create(cfg.c, pname, root)
|
||||
|
||||
local build_cmd = "cd " .. root .. " && cmake -S . -B build && cmake --build build"
|
||||
local _ = vim.system({ "sh", "-c", build_cmd }):wait()
|
||||
|
||||
utils.init_git(root, "c")
|
||||
|
||||
vim.cmd.edit(vim.fn.fnameescape(bin))
|
||||
end)
|
||||
end
|
||||
|
||||
function M.create_file(opts)
|
||||
vim.ui.input({ prompt = "Enter type (c/h): " }, function(ft)
|
||||
ft = ft and vim.trim(ft)
|
||||
if not ft or ft == "" then
|
||||
return
|
||||
end
|
||||
local configs = require("vern-nvim.configs.c")
|
||||
---@type VernCConfig
|
||||
local cfg = vim.tbl_deep_extend("force", {}, configs, opts or {})
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
|
||||
local root = join(vim.fn.expand(cfg.workspace_root), cfg.c.root, utils.proj_name())
|
||||
local input_txt = fname
|
||||
ft = ft and vim.trim(ft)
|
||||
if not ft or ft == "" then
|
||||
return
|
||||
end
|
||||
local mod
|
||||
if ft == "c" then
|
||||
mod = cfg.c.templates.file.source or {}
|
||||
end
|
||||
if ft == "h" then
|
||||
mod = cfg.c.templates.file.header or {}
|
||||
input_txt = fname:upper()
|
||||
end
|
||||
local raw_path = join(mod.path, mod.name)
|
||||
local context = { project_name = utils.proj_name(), name = fname }
|
||||
local path = utils.resolve_path(raw_path, cfg.c.dirs or {}, context)
|
||||
local abs_file_path = vim.fs.normalize(join(root, path))
|
||||
if ft == "h" then
|
||||
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
|
||||
end
|
||||
utils.dump(abs_file_path, templates.fetch(mod.kind_path, mod.kind, input_txt))
|
||||
vim.cmd.edit(vim.fn.expand(abs_file_path))
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts? VernCConfig Takes a table for the runtime
|
||||
function M.run(opts)
|
||||
opts = opts or {}
|
||||
local root = utils.proj_root() or "."
|
||||
local pname = vim.fs.basename(root)
|
||||
|
||||
local build_dir = root .. "/build"
|
||||
local build_cmd = "cd " .. build_dir .. " && cmake --build ."
|
||||
|
||||
vim.system({ "sh", "-c", build_cmd }, { text = true }, function(obj)
|
||||
if obj.code ~= 0 then
|
||||
vim.schedule(function()
|
||||
local error_obj = (obj.stderr ~= "" and obj.stderr) or obj.stdout or ""
|
||||
local error_lines = vim.list_extend(
|
||||
{ "Error During compilation" },
|
||||
vim.split(error_obj, "\n", { trimempty = true })
|
||||
)
|
||||
local buf, _ = utils.term({ "echo 'compilation failed'" }, opts.terminal, true)
|
||||
if buf and vim.api.nvim_buf_is_valid(buf) then
|
||||
vim.api.nvim_set_option_value("modifiable", true, { buf = buf })
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, error_lines)
|
||||
vim.api.nvim_set_option_value("modifiable", false, { buf = buf })
|
||||
end
|
||||
end)
|
||||
else
|
||||
vim.schedule(function()
|
||||
local run_cmd = "cd '" .. build_dir .. "' && ./" .. pname
|
||||
utils.term({ run_cmd }, opts.terminal, false)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,107 @@
|
||||
local M = {}
|
||||
|
||||
local utils = require("vern-nvim.utils")
|
||||
local templates = require("vern-nvim.templates")
|
||||
local action_utils = require("vern-nvim.actions.utils")
|
||||
|
||||
local join = vim.fs.joinpath
|
||||
|
||||
---@param opts VernCPPConfig
|
||||
function M.create_project(opts)
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(pname)
|
||||
pname = pname and vim.trim(pname)
|
||||
if not pname or pname == "" then
|
||||
return
|
||||
end
|
||||
|
||||
local configs = require("vern-nvim.configs.cpp")
|
||||
|
||||
---@type VernCPPConfig
|
||||
local cfg = vim.tbl_deep_extend("force", {}, configs, configs, opts or {})
|
||||
local root = join(vim.fn.expand(cfg.workspace_root), cfg.cpp.root, pname)
|
||||
local bin = action_utils.create(cfg.cpp, pname, root)
|
||||
|
||||
local build_cmd = "cd " .. root .. " && cmake -S . -B build && cmake --build build"
|
||||
local _ = vim.system({ "sh", "-c", build_cmd }):wait()
|
||||
|
||||
utils.init_git(root, "cpp")
|
||||
|
||||
vim.cmd.edit(vim.fn.fnameescape(bin))
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts VernCPPConfig
|
||||
function M.create_file(opts)
|
||||
vim.ui.input({ prompt = "Enter type (c/h): " }, function(ft)
|
||||
ft = ft and vim.trim(ft)
|
||||
if not ft or ft == "" then
|
||||
return
|
||||
end
|
||||
local configs = require("vern-nvim.configs.cpp")
|
||||
---@type VernCPPConfig
|
||||
local cfg = vim.tbl_deep_extend("force", {}, configs, opts or {})
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
|
||||
local root = join(vim.fn.expand(cfg.workspace_root), cfg.cpp.root, utils.proj_name())
|
||||
local input_txt = fname
|
||||
ft = ft and vim.trim(ft)
|
||||
if not ft or ft == "" then
|
||||
return
|
||||
end
|
||||
local mod
|
||||
if ft == "c" then
|
||||
mod = cfg.cpp.templates.file.source or {}
|
||||
end
|
||||
if ft == "h" then
|
||||
mod = cfg.cpp.templates.file.header or {}
|
||||
input_txt = fname:upper()
|
||||
end
|
||||
local raw_path = join(mod.path, mod.name)
|
||||
local context = { project_name = utils.proj_name(), name = fname }
|
||||
local path = utils.resolve_path(raw_path, cfg.cpp.dirs or {}, context)
|
||||
local abs_file_path = vim.fs.normalize(join(root, path))
|
||||
if ft == "h" then
|
||||
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
|
||||
end
|
||||
utils.dump(abs_file_path, templates.fetch(mod.kind_path, mod.kind, input_txt))
|
||||
vim.cmd.edit(vim.fn.expand(abs_file_path))
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts? VernCPPConfig Takes a table for the runtime
|
||||
function M.run(opts)
|
||||
opts = opts or {}
|
||||
local root = utils.proj_root() or "."
|
||||
local pname = vim.fs.basename(root)
|
||||
|
||||
local build_dir = root .. "/build"
|
||||
local build_cmd = "cd " .. build_dir .. " && cmake --build ."
|
||||
|
||||
vim.system({ "sh", "-c", build_cmd }, { text = true }, function(obj)
|
||||
if obj.code ~= 0 then
|
||||
vim.schedule(function()
|
||||
local error_obj = (obj.stderr ~= "" and obj.stderr) or obj.stdout or ""
|
||||
local error_lines = vim.list_extend(
|
||||
{ "Error During compilation" },
|
||||
vim.split(error_obj, "\n", { trimempty = true })
|
||||
)
|
||||
local buf, _ = utils.term({ "echo 'compilation failed'" }, opts.terminal, true)
|
||||
if buf and vim.api.nvim_buf_is_valid(buf) then
|
||||
vim.api.nvim_set_option_value("modifiable", true, { buf = buf })
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, error_lines)
|
||||
vim.api.nvim_set_option_value("modifiable", false, { buf = buf })
|
||||
end
|
||||
end)
|
||||
else
|
||||
vim.schedule(function()
|
||||
local run_cmd = "cd '" .. build_dir .. "' && ./" .. pname
|
||||
utils.term({ run_cmd }, opts.terminal, false)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,52 @@
|
||||
local M = {}
|
||||
|
||||
M.create_project = function(opts)
|
||||
opts = opts or {}
|
||||
vim.ui.input(
|
||||
{ prompt = "Project language (e.g. python): ", completion = "filetype" },
|
||||
function(ft)
|
||||
ft = ft and vim.trim(ft)
|
||||
if not ft or vim.trim(ft) == "" then
|
||||
return
|
||||
end
|
||||
local ok, actions = pcall(require, "vern-nvim.actions." .. ft)
|
||||
local configs = require("vern-nvim.configs." .. ft)
|
||||
local args = vim.tbl_deep_extend("force", {}, configs, opts or {})
|
||||
if ok and actions and type(actions.create_project) == "function" then
|
||||
actions.create_project(args)
|
||||
else
|
||||
vim.notify("Unknown Filetype: " .. ft, vim.log.levels.WARN, {
|
||||
title = "Vern Project",
|
||||
})
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
M.create_file = function(opts)
|
||||
opts = opts or {}
|
||||
vim.ui.input({
|
||||
prompt = "File language (e.g. python): ",
|
||||
completion = "filetype",
|
||||
}, function(ft)
|
||||
ft = ft and vim.trim(ft)
|
||||
if not ft or vim.trim(ft) == "" then
|
||||
return
|
||||
end
|
||||
local ok, actions = pcall(require, "vern-nvim.actions." .. ft)
|
||||
local configs = require("vern-nvim.configs." .. ft)
|
||||
local args = vim.tbl_deep_extend("force", {}, configs, opts or {})
|
||||
if ok and actions and type(actions.create_file) == "function" then
|
||||
actions.create_file(args)
|
||||
else
|
||||
vim.notify("Unknown Filetype: " .. ft, vim.log.levels.WARN, {
|
||||
title = "Vern File",
|
||||
})
|
||||
vim.notify("Error: " .. actions, vim.log.levels.ERROR, {
|
||||
title = "Vern File",
|
||||
})
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,65 @@
|
||||
local M = {}
|
||||
|
||||
local utils = require("vern-nvim.utils")
|
||||
local templates = require("vern-nvim.templates")
|
||||
local action_utils = require("vern-nvim.actions.utils")
|
||||
|
||||
local join = vim.fs.joinpath
|
||||
|
||||
---@param opts VernLuaConfig
|
||||
function M.create_project(opts)
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(pname)
|
||||
pname = pname and vim.trim(pname)
|
||||
if not pname or pname == "" then
|
||||
return
|
||||
end
|
||||
|
||||
local configs = require("vern-nvim.configs.lua")
|
||||
|
||||
---@type VernLuaConfig
|
||||
local cfg = vim.tbl_deep_extend("force", {}, configs, configs, opts or {})
|
||||
local root = join(vim.fn.expand(cfg.workspace_root), cfg.lua.root, pname)
|
||||
local bin = action_utils.create(cfg.lua, pname, root)
|
||||
|
||||
utils.init_git(root, "lua")
|
||||
|
||||
vim.cmd.edit(vim.fn.fnameescape(bin))
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts VernLuaConfig
|
||||
function M.create_file(opts)
|
||||
opts = opts or {}
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
|
||||
fname = fname and vim.trim(fname)
|
||||
if not fname or fname == "" then
|
||||
return
|
||||
end
|
||||
local configs = require("vern-nvim.configs.lua")
|
||||
---@type VernLuaConfig
|
||||
local cfg = vim.tbl_deep_extend("force", {}, configs, opts or {})
|
||||
local mod = cfg.lua.templates.file.source or {}
|
||||
|
||||
local raw_path = join(mod.path, mod.name)
|
||||
local context = { project_name = utils.proj_name(), name = fname }
|
||||
local path = utils.resolve_path(raw_path, cfg.lua.dirs or {}, context)
|
||||
|
||||
utils.dump(path, templates.fetch(mod.kind_path, mod.kind, fname))
|
||||
vim.notify("File: " .. fname .. " has been created!")
|
||||
vim.cmd.edit(vim.fn.expand(path))
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts VernCPPConfig Takes a table for the runtime
|
||||
function M.run(opts)
|
||||
opts = opts or {}
|
||||
local root = utils.proj_root() or "."
|
||||
local pname = vim.fs.basename(root)
|
||||
|
||||
local full_path = join(root, pname, "lua", pname)
|
||||
print(full_path .. "/init.lua")
|
||||
|
||||
utils.term({ "lua " .. full_path .. "/init.lua" }, opts.terminal or {}, false)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,90 @@
|
||||
local M = {}
|
||||
|
||||
local utils = require("vern-nvim.utils")
|
||||
local templates = require("vern-nvim.templates")
|
||||
local action_utils = require("vern-nvim.actions.utils")
|
||||
|
||||
local join = vim.fs.joinpath
|
||||
|
||||
---@param opts VernPythonConfig
|
||||
function M.create_project(opts)
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(pname)
|
||||
pname = pname and vim.trim(pname)
|
||||
if not pname or pname == "" then
|
||||
return
|
||||
end
|
||||
|
||||
local configs = require("vern-nvim.configs.python")
|
||||
|
||||
---@type VernPythonConfig
|
||||
local cfg = vim.tbl_deep_extend("force", {}, configs, opts or {})
|
||||
local root = join(vim.fn.expand(cfg.workspace_root), cfg.python.root, pname)
|
||||
local bin = action_utils.create(cfg.python, pname, root)
|
||||
|
||||
utils.init_git(root, "python")
|
||||
|
||||
local venv_path = root .. "/venv"
|
||||
vim.fn.system("python3 -m venv " .. venv_path)
|
||||
|
||||
vim.notify("Project: " .. pname .. " has been created!")
|
||||
vim.cmd.edit(vim.fn.fnameescape(bin))
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts VernPythonConfig
|
||||
function M.create_file(opts)
|
||||
opts = opts or {}
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
|
||||
fname = fname and vim.trim(fname)
|
||||
if not fname or fname == "" then
|
||||
return
|
||||
end
|
||||
local configs = require("vern-nvim.configs.python")
|
||||
---@type VernPythonConfig
|
||||
local cfg = vim.tbl_deep_extend("force", {}, configs, opts or {})
|
||||
local mod = cfg.python.templates.file.source or {}
|
||||
|
||||
local raw_path = join(mod.path, mod.name)
|
||||
local context = { project_name = utils.proj_name(), name = fname }
|
||||
local path = utils.resolve_path(raw_path, cfg.python.dirs or {}, context)
|
||||
|
||||
utils.dump(path, templates.fetch(mod.kind_path, mod.kind, fname))
|
||||
vim.notify("File: " .. fname .. " has been created!")
|
||||
vim.cmd.edit(vim.fn.expand(path))
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts VernPythonConfig Takes a table for the runtime
|
||||
function M.run(opts)
|
||||
opts = opts or {}
|
||||
local root = utils.proj_root() or "."
|
||||
local pname = vim.fs.basename(root)
|
||||
local bin = opts.python.templates.project.primary
|
||||
|
||||
local exe = join(bin.path, bin.name) or "src/{project_name}/main.py"
|
||||
local exe_path = utils.resolve_path(exe, opts.python.dirs, { project_name = pname })
|
||||
local full_path = join(vim.fn.expand(root), exe_path)
|
||||
utils.term({ "python3 " .. full_path }, opts.terminal or {}, false)
|
||||
end
|
||||
|
||||
function M.pip_install()
|
||||
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)
|
||||
return
|
||||
end
|
||||
vim.notify("Installing " .. mod, vim.log.levels.INFO)
|
||||
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)
|
||||
else
|
||||
vim.notify("Pip installed " .. mod, vim.log.levels.INFO)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,52 @@
|
||||
local M = {}
|
||||
|
||||
local utils = require("vern-nvim.utils")
|
||||
local templates = require("vern-nvim.templates")
|
||||
|
||||
local join = vim.fs.joinpath
|
||||
|
||||
---@param cfg table Language config
|
||||
---@param pname string Name of project
|
||||
---@param root string Project location
|
||||
---@return string bin Location of executable
|
||||
function M.create(cfg, pname, root)
|
||||
local ctx = { project_name = pname }
|
||||
|
||||
vim.fn.mkdir(root, "p")
|
||||
local bin
|
||||
|
||||
for _, dir in pairs(cfg.dirs) do
|
||||
local path = vim.fs.normalize(join(root, utils.fmt(dir, ctx)))
|
||||
vim.fn.mkdir(path, "p")
|
||||
end
|
||||
|
||||
for tbl_name, tbl in pairs(cfg.templates.project) do
|
||||
local raw_path = join(tbl.path, tbl.name)
|
||||
local path = utils.resolve_path(raw_path, cfg.dirs, ctx)
|
||||
if tbl_name == "primary" then
|
||||
bin = join(root, path)
|
||||
end
|
||||
local abs_file_path = vim.fs.normalize(join(root, path))
|
||||
local abs_dir_path = vim.fs.dirname(abs_file_path)
|
||||
if abs_dir_path ~= root and not vim.startswith(root, abs_dir_path) then
|
||||
vim.fn.mkdir(abs_dir_path, "p")
|
||||
end
|
||||
utils.dump(abs_file_path, templates.fetch(tbl.kind_path, tbl.kind, pname))
|
||||
end
|
||||
for _, tbl in pairs(cfg.templates.extras) do
|
||||
if tbl.enabled then
|
||||
local raw_path = join(tbl.path, tbl.name)
|
||||
local path = utils.resolve_path(raw_path, cfg.dirs, ctx)
|
||||
local abs_file_path = vim.fs.normalize(join(root, path))
|
||||
local abs_dir_path = vim.fs.dirname(abs_file_path)
|
||||
if abs_dir_path ~= root and not vim.startswith(root, abs_dir_path) then
|
||||
vim.fn.mkdir(abs_dir_path, "p")
|
||||
end
|
||||
utils.dump(abs_file_path, templates.fetch(tbl.kind_path, tbl.kind, pname))
|
||||
end
|
||||
end
|
||||
|
||||
return bin
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,26 @@
|
||||
local actions = require("vern-nvim.actions.c")
|
||||
local config = require("vern-nvim.configs.c")
|
||||
|
||||
---@param bufnr integer Buffer to activate on : defaults to 0
|
||||
---@param user_opts? VernCConfig
|
||||
return function(bufnr, user_opts)
|
||||
---@type VernCConfig
|
||||
local opts = vim.tbl_deep_extend("force", {}, config, user_opts or {})
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "CRun", function()
|
||||
if type(actions.run) == "function" then
|
||||
actions.run(opts)
|
||||
end
|
||||
end, { desc = "Run c project" })
|
||||
|
||||
for key, def in pairs(opts.c.keybinds or {}) do
|
||||
if type(def.action) == "function" then
|
||||
vim.keymap.set("n", key, function()
|
||||
def.action(opts)
|
||||
end, {
|
||||
buffer = bufnr,
|
||||
silent = true,
|
||||
desc = def.desc,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
local actions = require("vern-nvim.actions.cpp")
|
||||
local config = require("vern-nvim.configs.cpp")
|
||||
|
||||
---@param bufnr integer Buffer to activate on : defaults to 0
|
||||
---@param user_opts? VernCPPConfig
|
||||
return function(bufnr, user_opts)
|
||||
---@type VernCPPConfig
|
||||
local opts = vim.tbl_deep_extend("force", {}, config, user_opts or {})
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "CPPRun", function()
|
||||
if type(actions.run) == "function" then
|
||||
actions.run(opts)
|
||||
end
|
||||
end, { desc = "Run cpp project" })
|
||||
|
||||
for key, def in pairs(opts.cpp.keybinds or {}) do
|
||||
if type(def.action) == "function" then
|
||||
vim.keymap.set("n", key, function()
|
||||
def.action(opts)
|
||||
end, {
|
||||
buffer = bufnr,
|
||||
silent = true,
|
||||
desc = def.desc,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
local actions = require("vern-nvim.actions.lua")
|
||||
local config = require("vern-nvim.configs.lua")
|
||||
|
||||
---@param bufnr integer Buffer to activate on : defaults to 0
|
||||
---@param user_opts? VernLuaConfig
|
||||
return function(bufnr, user_opts)
|
||||
---@type VernLuaConfig
|
||||
local opts = vim.tbl_deep_extend("force", {}, config, user_opts or {})
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "LuaRun", function()
|
||||
if type(actions.run) == "function" then
|
||||
actions.run(opts)
|
||||
end
|
||||
end, { desc = "Run lua project" })
|
||||
|
||||
for key, def in pairs(opts.lua.keybinds or {}) do
|
||||
if type(def.action) == "function" then
|
||||
vim.keymap.set("n", key, function()
|
||||
def.action(opts)
|
||||
end, {
|
||||
buffer = bufnr,
|
||||
silent = true,
|
||||
desc = def.desc,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,47 @@
|
||||
local actions = require("vern-nvim.actions.python")
|
||||
local config = require("vern-nvim.configs.python")
|
||||
|
||||
---@param bufnr integer Buffer to activate on : defaults to 0
|
||||
---@param user_opts? VernPythonConfig
|
||||
return function(bufnr, user_opts)
|
||||
---@type VernPythonConfig
|
||||
local opts = vim.tbl_deep_extend("force", {}, config, user_opts or {})
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Pythonrun", function()
|
||||
if type(actions.run) == "function" then
|
||||
actions.run(opts)
|
||||
end
|
||||
end, { desc = "Run python project" })
|
||||
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Pythonpip", function()
|
||||
if actions.pip_install then
|
||||
actions.pip_install()
|
||||
end
|
||||
end, { nargs = "*", desc = "Install python packages" })
|
||||
|
||||
for key, def in pairs(opts.python.keybinds or {}) do
|
||||
if type(def.action) == "function" then
|
||||
vim.keymap.set("n", key, function()
|
||||
def.action(opts)
|
||||
end, {
|
||||
buffer = bufnr,
|
||||
silent = true,
|
||||
desc = def.desc,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local root = require("vern-nvim.utils").proj_root()
|
||||
if not root then
|
||||
return
|
||||
end
|
||||
local venv_dir = nil
|
||||
if vim.uv.fs_stat(root .. "/venv/bin/python") then
|
||||
venv_dir = root .. "/venv"
|
||||
elseif vim.uv.fs_stat(root .. "/.venv/bin/python") then
|
||||
venv_dir = root .. "/.venv"
|
||||
end
|
||||
if venv_dir then
|
||||
vim.env.VIRTUAL_ENV = venv_dir
|
||||
vim.env.PATH = venv_dir .. "/bin:" .. vim.env.PATH
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,67 @@
|
||||
local M = {}
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.c = {
|
||||
root = "C",
|
||||
dirs = {
|
||||
src = "src",
|
||||
include = "include/{project_name}",
|
||||
},
|
||||
keybinds = {
|
||||
["<leader>pr"] = {
|
||||
desc = "Executes c code",
|
||||
action = require("vern-nvim.actions.c").run,
|
||||
},
|
||||
["<leader>pf"] = {
|
||||
desc = "Creates source/header files",
|
||||
action = require("vern-nvim.actions.c").create_file,
|
||||
},
|
||||
},
|
||||
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 = "{name}.h",
|
||||
kind = "header",
|
||||
kind_path = "vern-nvim.templates.c",
|
||||
},
|
||||
source = {
|
||||
path = "{dirs.src}",
|
||||
name = "{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,67 @@
|
||||
local M = {}
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.cpp = {
|
||||
root = "CPP",
|
||||
dirs = {
|
||||
src = "src",
|
||||
include = "include/{project_name}",
|
||||
},
|
||||
keybinds = {
|
||||
["<leader>pr"] = {
|
||||
desc = "Executes cpp code",
|
||||
action = require("vern-nvim.actions.cpp").run,
|
||||
},
|
||||
["<leader>pf"] = {
|
||||
desc = "Creates source/header files",
|
||||
action = require("vern-nvim.actions.cpp").create_file,
|
||||
},
|
||||
},
|
||||
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 = "{name}.hpp",
|
||||
kind = "header",
|
||||
kind_path = "vern-nvim.templates.cpp",
|
||||
},
|
||||
source = {
|
||||
path = "{dirs.src}",
|
||||
name = "{name}.c",
|
||||
kind = "source",
|
||||
kind_path = "vern-nvim.templates.cpp",
|
||||
},
|
||||
},
|
||||
extras = {
|
||||
linter = {
|
||||
path = ".",
|
||||
name = ".clang-tidy",
|
||||
kind = "linter",
|
||||
kind_path = "vern-nvim.templates.c",
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,40 @@
|
||||
local actions = require("vern-nvim.actions")
|
||||
|
||||
---@type VernCoreConfig
|
||||
return {
|
||||
workspace_root = "~/personal/Projects",
|
||||
keybinds = {
|
||||
["<leader>pc"] = {
|
||||
desc = "Creates a new project",
|
||||
action = actions.create_project,
|
||||
},
|
||||
["<leader>pf"] = {
|
||||
desc = "Creates a new project file",
|
||||
action = actions.create_file,
|
||||
},
|
||||
},
|
||||
terminal = {
|
||||
mode = {
|
||||
type = "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",
|
||||
anchor = "bottom",
|
||||
size = "20",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
local M = {}
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.lua = {
|
||||
root = "Lua",
|
||||
dirs = {
|
||||
src = "lua/{project_name}",
|
||||
},
|
||||
keybinds = {
|
||||
["<leader>pr"] = {
|
||||
desc = "Executes lua code",
|
||||
action = require("vern-nvim.actions.lua").run,
|
||||
},
|
||||
},
|
||||
templates = {
|
||||
project = {
|
||||
primary = {
|
||||
path = "{dirs.src}",
|
||||
name = "init.lua",
|
||||
kind = "init",
|
||||
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 = "{name}.lua",
|
||||
kind = "source",
|
||||
kind_path = "vern-nvim.templates.lua",
|
||||
},
|
||||
},
|
||||
extras = {},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,51 @@
|
||||
local M = {}
|
||||
|
||||
---@type VernLanguageConfig
|
||||
M.python = {
|
||||
root = "Python",
|
||||
dirs = {
|
||||
src = "src/{project_name}",
|
||||
},
|
||||
keybinds = {
|
||||
["<leader>pr"] = {
|
||||
desc = "Executes python code",
|
||||
action = require("vern-nvim.actions.python").run,
|
||||
},
|
||||
["<leader>pi"] = {
|
||||
desc = "Asks for what python package to install",
|
||||
action = require("vern-nvim.actions.python").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 = "{name}.py",
|
||||
kind = "module",
|
||||
kind_path = "vern-nvim.templates.python",
|
||||
},
|
||||
},
|
||||
extras = {},
|
||||
},
|
||||
}
|
||||
return M
|
||||
@@ -0,0 +1,157 @@
|
||||
local ok, health = pcall(require, "vim.health")
|
||||
if not ok then
|
||||
health = nil
|
||||
end
|
||||
|
||||
local new_api = health ~= nil and type(health.start) == "function"
|
||||
|
||||
local function report_start(name)
|
||||
if new_api then health.start(name) else vim.health.report_start(name) end
|
||||
end
|
||||
|
||||
local function report_ok(msg)
|
||||
if new_api then health.ok(msg) else vim.health.report_ok(msg) end
|
||||
end
|
||||
|
||||
local function report_info(msg)
|
||||
if new_api then health.info(msg) else vim.health.report_info(msg) end
|
||||
end
|
||||
|
||||
local function report_warn(msg, advice)
|
||||
if new_api then
|
||||
health.warn(msg, advice)
|
||||
else
|
||||
vim.health.report_warn(msg, advice)
|
||||
end
|
||||
end
|
||||
|
||||
local function report_error(msg, advice)
|
||||
if new_api then
|
||||
health.error(msg, advice)
|
||||
else
|
||||
vim.health.report_error(msg, advice)
|
||||
end
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
local function fmt_langs(langs)
|
||||
if type(langs) == "table" then
|
||||
return "[" .. table.concat(langs, ", ") .. "]"
|
||||
end
|
||||
return "[" .. tostring(langs) .. "]"
|
||||
end
|
||||
|
||||
local function check_nvim_version()
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
report_ok(string.format("Neovim %s detected.", tostring(vim.version())))
|
||||
else
|
||||
report_error("Polydev requires Neovim 0.10 or newer.", "You are running " .. tostring(vim.version()))
|
||||
end
|
||||
end
|
||||
|
||||
local function check_setup()
|
||||
local ok_configs, configs = pcall(require, "Polydev.configs")
|
||||
if not ok_configs then
|
||||
report_error("Could not load Polydev.configs", tostring(configs))
|
||||
return nil
|
||||
end
|
||||
if next(configs.user_config or {}) == nil then
|
||||
report_warn("Polydev.setup() has not run.",
|
||||
"Add require('Polydev').setup() to your Neovim config, or make sure plugin/Polydev.lua is sourced by your plugin manager.")
|
||||
return nil
|
||||
end
|
||||
report_ok("Polydev.setup() ran and the config is loaded.")
|
||||
return configs
|
||||
end
|
||||
|
||||
local function check_project_root(configs)
|
||||
if not configs then return end
|
||||
local root = configs.get("globals").project_root
|
||||
local expanded = vim.fn.expand(root)
|
||||
if vim.fn.isdirectory(expanded) == 1 then
|
||||
if vim.fn.filewritable(expanded) == 2 then
|
||||
report_ok(string.format("project_root exists and is writable: %s", expanded))
|
||||
else
|
||||
report_warn(string.format("project_root exists but is not writable: %s", expanded))
|
||||
end
|
||||
else
|
||||
report_warn(string.format("project_root does not exist yet: %s", expanded),
|
||||
"It is created automatically the first time the manager is opened.")
|
||||
end
|
||||
end
|
||||
|
||||
local function check_ui_input()
|
||||
local ok_default, default = pcall(require, "vim.ui")
|
||||
if ok_default and default.input and vim.ui.input ~= default.input then
|
||||
report_warn("vim.ui.input has been overridden, likely by a UI plugin such as dressing.nvim or nui.nvim.",
|
||||
"An asynchronous override can break project/file creation from the manager. Polydev now uses callbacks, but report here if it still misbehaves.")
|
||||
else
|
||||
report_ok("vim.ui.input is Neovim's default (synchronous) implementation.")
|
||||
end
|
||||
end
|
||||
|
||||
local function check_tools()
|
||||
local tools = {
|
||||
{ name = "git", langs = "all" },
|
||||
{ name = "node", langs = "javascript" },
|
||||
{ name = "python3", langs = "python" },
|
||||
{ name = "pip3", langs = "python" },
|
||||
{ name = "javac", langs = "java" },
|
||||
{ name = "java", langs = "java" },
|
||||
{ name = "cmake", langs = { "c", "cpp" } },
|
||||
{ name = "cc", langs = { "c", "cpp" } },
|
||||
{ name = "clang", langs = { "c", "cpp" } },
|
||||
{ name = "clang-format", langs = { "c", "cpp" } },
|
||||
{ name = "clang-tidy", langs = { "c", "cpp" } },
|
||||
{ name = "cargo", langs = "rust" },
|
||||
{ name = "lua", langs = "lua" },
|
||||
{ name = "luajit", langs = "lua" },
|
||||
}
|
||||
for _, t in ipairs(tools) do
|
||||
if vim.fn.executable(t.name) == 1 then
|
||||
report_ok(string.format("%s is available for %s.", t.name, fmt_langs(t.langs)))
|
||||
else
|
||||
report_warn(string.format("%s was not found.", t.name),
|
||||
"Project templates for " .. fmt_langs(t.langs) .. " may fail without it.")
|
||||
end
|
||||
end
|
||||
|
||||
if vim.fn.executable("python3") == 1 then
|
||||
vim.fn.system("python3 -c 'import venv' 2>/dev/null")
|
||||
if vim.v.shell_error == 0 then
|
||||
report_ok("python3 venv module is available.")
|
||||
else
|
||||
report_warn("python3 venv module is missing.",
|
||||
"Python project creation sets up a virtualenv and needs python3 -m venv.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function check_walkup()
|
||||
local scripts = vim.api.nvim_get_runtime_file("bash_scripts/walkup.sh", false)
|
||||
if #scripts == 0 then
|
||||
report_error("bash_scripts/walkup.sh was not found on the runtimepath.",
|
||||
"Reinstall the plugin so bash_scripts/ sits next to lua/ and plugin/.")
|
||||
return
|
||||
end
|
||||
local script = scripts[1]
|
||||
if vim.fn.executable(script) == 1 then
|
||||
report_ok(string.format("bash_scripts/walkup.sh found and executable: %s", script))
|
||||
else
|
||||
report_warn(string.format("bash_scripts/walkup.sh is not executable: %s", script),
|
||||
"Run: chmod +x " .. script)
|
||||
end
|
||||
end
|
||||
|
||||
function M.check()
|
||||
report_start("Polydev")
|
||||
check_nvim_version()
|
||||
local configs = check_setup()
|
||||
check_project_root(configs)
|
||||
check_ui_input()
|
||||
check_tools()
|
||||
check_walkup()
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,57 @@
|
||||
local M = {}
|
||||
|
||||
local configs = require("vern-nvim.configs")
|
||||
local actions = require("vern-nvim.actions")
|
||||
|
||||
---@type VernCoreConfig
|
||||
M.opts = vim.deepcopy(configs)
|
||||
|
||||
---@class VernUserConfig
|
||||
---@field workspace_root? string
|
||||
---@field keybinds? table<string, VernKeybindItem>
|
||||
---@field terminal? VernTerminalConfig | table
|
||||
|
||||
---@param user_opts? VernUserConfig
|
||||
function M.setup(user_opts)
|
||||
---@type VernCoreConfig
|
||||
M.opts = vim.tbl_deep_extend("force", {}, configs, user_opts or {})
|
||||
|
||||
for key, def in pairs(M.opts.keybinds or {}) do
|
||||
if type(def.action) == "function" then
|
||||
vim.keymap.set("n", key, function()
|
||||
def.action(M.opts)
|
||||
end, {
|
||||
silent = true,
|
||||
desc = def.desc,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("VernCreateProject", function()
|
||||
if actions.create_project then
|
||||
actions.create_project(M.opts)
|
||||
end
|
||||
end, { nargs = "*", desc = "Create a new project" })
|
||||
|
||||
vim.api.nvim_create_user_command("VernCreateFile", function()
|
||||
if type(actions.create_file) == "function" then
|
||||
actions.create_file(M.opts)
|
||||
end
|
||||
end, { nargs = "*", desc = "Creates a new file for project" })
|
||||
|
||||
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
|
||||
local ok, attach = pcall(require, "vern-nvim.attach." .. ft)
|
||||
if ok and type(attach) == "function" then
|
||||
attach(args.buf, M.opts)
|
||||
end
|
||||
end,
|
||||
desc = "Attach languages to buffer",
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,142 @@
|
||||
local utils = require("Polydev.utils")
|
||||
local configs = require("Polydev.configs")
|
||||
local M = {}
|
||||
|
||||
M.languages = {
|
||||
javascript = {
|
||||
setup = function(self, user_opts)
|
||||
local opts =
|
||||
vim.tbl_deep_extend("force", {}, configs.get("javascript"), user_opts or {})
|
||||
vim.api.nvim_create_user_command("JavascriptRun", function()
|
||||
self:run()
|
||||
end, {})
|
||||
for key, _ in pairs(opts.keybinds) do
|
||||
vim.keymap.set("n", key, ":JavascriptRun<CR>", { silent = true })
|
||||
end
|
||||
end,
|
||||
run = function()
|
||||
local root = utils.get_project_root()
|
||||
|
||||
local cmd = string.format("node " .. root .. "/main.js")
|
||||
local output = vim.fn.system(cmd)
|
||||
|
||||
if not vim.v.shell_error == 0 then
|
||||
local term_buf = utils.terminal({ cmd })
|
||||
vim.api.nvim_set_option_value("modifiable", true, { buf = term_buf })
|
||||
vim.api.nvim_buf_set_lines(
|
||||
term_buf,
|
||||
0,
|
||||
-1,
|
||||
false,
|
||||
vim.list_extend(
|
||||
{ "Error during compilation:" },
|
||||
vim.split(output, "\n", { trimempty = true })
|
||||
)
|
||||
)
|
||||
vim.api.nvim_set_option_value("modifiable", false, { buf = term_buf })
|
||||
else
|
||||
utils.terminal({ "node " .. root .. "/main.js" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
java = {
|
||||
setup = function(self, user_opts)
|
||||
local opts = vim.tbl_deep_extend("force", {}, configs.get("java"), user_opts or {})
|
||||
vim.api.nvim_create_user_command("JavaRun", function()
|
||||
self:run()
|
||||
end, {})
|
||||
for key, _ in pairs(opts.keybinds) do
|
||||
vim.keymap.set("n", key, ":JavaRun<CR>", { silent = true })
|
||||
end
|
||||
end,
|
||||
run = function()
|
||||
local root = utils.get_project_root()
|
||||
|
||||
local cmd = string.format("javac -d %s %s", root .. "/build", root .. "/src/*.java")
|
||||
local output = vim.fn.system(cmd)
|
||||
|
||||
if not vim.v.shell_error == 0 then
|
||||
local term_buf = utils.terminal({ cmd })
|
||||
vim.api.nvim_set_option_value("modifiable", true, { buf = term_buf })
|
||||
vim.api.nvim_buf_set_lines(
|
||||
term_buf,
|
||||
0,
|
||||
-1,
|
||||
false,
|
||||
vim.list_extend(
|
||||
{ "Error during compilation:" },
|
||||
vim.split(output, "\n", { trimempty = true })
|
||||
)
|
||||
)
|
||||
vim.api.nvim_set_option_value("modifiable", false, { buf = term_buf })
|
||||
else
|
||||
utils.terminal({ "java -cp " .. root, "build" .. " Main" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
html = {
|
||||
setup = function(user_opts)
|
||||
vim.tbl_deep_extend("force", {}, configs.get("html"), user_opts or {})
|
||||
end,
|
||||
},
|
||||
rust = {
|
||||
setup = function(self, user_opts)
|
||||
local opts = vim.tbl_deep_extend("force", {}, configs.get("rust"), user_opts or {})
|
||||
vim.api.nvim_create_user_command("RustRun", function()
|
||||
self:run()
|
||||
end, {})
|
||||
for key, _ in pairs(opts.keybinds) do
|
||||
vim.keymap.set("n", key, ":RustRun<CR>", { silent = true })
|
||||
end
|
||||
end,
|
||||
run = function()
|
||||
local root = utils.get_project_root()
|
||||
if not root then
|
||||
return print("Error: Project root not found.")
|
||||
end
|
||||
|
||||
local cmd = { "cargo build" }
|
||||
local output = vim.fn.system(table.concat(cmd))
|
||||
|
||||
if not vim.v.shell_error == 0 then
|
||||
local term_buf = utils.terminal(cmd)
|
||||
vim.api.nvim_set_option_value("modifiable", true, { buf = term_buf })
|
||||
vim.api.nvim_buf_set_lines(
|
||||
term_buf,
|
||||
0,
|
||||
-1,
|
||||
false,
|
||||
vim.list_extend(
|
||||
{ "Error during compilation:" },
|
||||
vim.split(output, "\n", { trimempty = true })
|
||||
)
|
||||
)
|
||||
vim.api.nvim_set_option_value("modifiable", false, { buf = term_buf })
|
||||
else
|
||||
utils.terminal({ "cargo run" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
lua = {
|
||||
setup = function(self, user_opts)
|
||||
local opts = vim.tbl_deep_extend("force", {}, configs.get("lua"), user_opts or {})
|
||||
vim.api.nvim_create_user_command("LuaRun", function()
|
||||
self:run()
|
||||
end, {})
|
||||
for key, _ in pairs(opts.keybinds) do
|
||||
vim.keymap.set("n", key, ":LuaRun<CR>", { silent = true })
|
||||
end
|
||||
end,
|
||||
run = function()
|
||||
local init_lua_path = utils.get_project_root()
|
||||
.. "/lua/"
|
||||
.. utils.get_project_name()
|
||||
.. "/init.lua"
|
||||
if vim.fn.filereadable(init_lua_path) == 1 then
|
||||
utils.terminal({ "lua " .. init_lua_path })
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,26 @@
|
||||
local M = {}
|
||||
|
||||
local presets = {
|
||||
right = {
|
||||
left = 100,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
},
|
||||
corner = {
|
||||
left = 100,
|
||||
right = 0,
|
||||
top = 25,
|
||||
bottom = 0,
|
||||
}
|
||||
}
|
||||
|
||||
---@param preset string
|
||||
---@return table|nil
|
||||
function M.getPresets(preset)
|
||||
if presets[preset] then
|
||||
return presets[preset]
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,3 @@
|
||||
local M = {}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,195 @@
|
||||
local utils = require("Polydev.utils")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.projects = {
|
||||
javascript = {
|
||||
run = function(project_name, project_root)
|
||||
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
|
||||
vim.fn.mkdir(full_project_root, "p")
|
||||
utils.write_file(
|
||||
{ full_project_root, "main.js" },
|
||||
[[
|
||||
console.log("Hello World!");
|
||||
]]
|
||||
)
|
||||
local gitignore = { "" }
|
||||
utils.init_git(full_project_root, gitignore)
|
||||
vim.cmd("edit " .. full_project_root .. "/main.js")
|
||||
end,
|
||||
},
|
||||
lua = {
|
||||
run = function(project_name, project_root)
|
||||
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
|
||||
vim.fn.mkdir(full_project_root .. "/lua/" .. project_name, "p")
|
||||
utils.write_file(
|
||||
{ full_project_root, "lua", project_name, "init.lua" },
|
||||
[[
|
||||
local M = {}
|
||||
|
||||
return M
|
||||
]]
|
||||
)
|
||||
local gitignore = { "" }
|
||||
utils.init_git(full_project_root, gitignore)
|
||||
vim.cmd("edit " .. full_project_root .. "/lua/" .. project_name .. "/init.lua")
|
||||
end,
|
||||
},
|
||||
java = {
|
||||
run = function(project_name, project_root)
|
||||
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
|
||||
for _, path in ipairs({ "/src", "/build" }) do
|
||||
vim.fn.mkdir(full_project_root .. path, "p")
|
||||
end
|
||||
local content = [[
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello, World!");
|
||||
}
|
||||
}
|
||||
]]
|
||||
local gitignore = {
|
||||
"build/",
|
||||
}
|
||||
utils.init_git(full_project_root, gitignore)
|
||||
utils.write_file({ full_project_root, "src", "Main.java" }, content)
|
||||
end,
|
||||
},
|
||||
python = {
|
||||
run = function(project_name, project_root)
|
||||
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
|
||||
vim.fn.mkdir(full_project_root .. "/include", "p")
|
||||
utils.write_file(
|
||||
{ full_project_root, "main.py" },
|
||||
[[
|
||||
def main():
|
||||
print("Hello, World!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
]]
|
||||
)
|
||||
utils.write_file({ full_project_root, "include/__init__.py" }, "")
|
||||
utils.write_file({ full_project_root, "requirements.txt" }, "")
|
||||
utils.write_file(
|
||||
{ full_project_root, "setup.py" },
|
||||
string.format(
|
||||
[[
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="%s",
|
||||
version="0.1.0",
|
||||
packages=find_packages(),
|
||||
install_requires=[],
|
||||
python_requires=">=3.6",
|
||||
)
|
||||
]],
|
||||
project_name
|
||||
)
|
||||
)
|
||||
local gitignore = {
|
||||
"venv/",
|
||||
}
|
||||
utils.init_git(full_project_root, gitignore)
|
||||
vim.cmd("edit " .. full_project_root .. "/main.py")
|
||||
local venv_path = full_project_root .. "/venv"
|
||||
vim.fn.system("python3 -m venv " .. venv_path)
|
||||
vim.g.python3_host_prog = venv_path .. "/bin/python"
|
||||
vim.fn.setenv("VIRTUAL_ENV", venv_path)
|
||||
vim.fn.setenv("PATH", venv_path .. "/bin:" .. vim.fn.getenv("PATH"))
|
||||
print("Virtual environment activated for " .. project_name)
|
||||
end,
|
||||
},
|
||||
rust = {
|
||||
run = function(project_name, project_root)
|
||||
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
|
||||
vim.fn.system("cargo new " .. full_project_root)
|
||||
vim.cmd("edit " .. full_project_root .. "/src/main.rs")
|
||||
end,
|
||||
},
|
||||
html = {
|
||||
run = function(project_name, project_root)
|
||||
local full_project_root = vim.fn.expand(project_root) .. "/" .. project_name
|
||||
if vim.fn.isdirectory(full_project_root) == 0 then
|
||||
vim.fn.mkdir(full_project_root, "p") -- Create directory with parent directories
|
||||
end
|
||||
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({ full_project_root, "index.html" }, main_html_content)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
M.files = {
|
||||
lua = {
|
||||
run = function(file_name)
|
||||
utils.write_file({
|
||||
utils.get_project_root(),
|
||||
"lua",
|
||||
utils.get_project_name(),
|
||||
file_name .. ".lua",
|
||||
}, "")
|
||||
end,
|
||||
},
|
||||
java = {
|
||||
run = function(file_name)
|
||||
utils.write_file(
|
||||
{ utils.get_project_root(), "src", file_name .. ".java" },
|
||||
string.format(
|
||||
[[
|
||||
public class %s {
|
||||
// New File
|
||||
}
|
||||
]],
|
||||
file_name
|
||||
)
|
||||
)
|
||||
end,
|
||||
},
|
||||
python = {
|
||||
run = function(file_name)
|
||||
utils.write_file({ utils.get_project_root(), "include", file_name .. ".py" }, "")
|
||||
end,
|
||||
},
|
||||
rust = {
|
||||
run = function(file_name)
|
||||
utils.write_file({ utils.get_project_root(), "src", file_name .. ".rs" }, "")
|
||||
end,
|
||||
},
|
||||
html = {
|
||||
run = function(file_name)
|
||||
utils.write_file(
|
||||
{ ".", file_name .. ".html" },
|
||||
string.format([[
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>My First Heading</h1>
|
||||
<p>My first paragraph.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
]])
|
||||
)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -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 __PROJECT_NAME___H
|
||||
#define __PROJECT_NAME___H
|
||||
|
||||
// Code
|
||||
|
||||
#endif /* __PROJECT_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 __PROJECT_NAME___HPP
|
||||
#define __PROJECT_NAME___HPP
|
||||
|
||||
// Code
|
||||
|
||||
#endif /* __PROJECT_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,45 @@
|
||||
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
|
||||
]=]),
|
||||
}
|
||||
|
||||
local extra = (lang and lang_block[lang]) or ""
|
||||
return base .. extra
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,19 @@
|
||||
local M = {}
|
||||
|
||||
---@param kind_path string Filetype of template
|
||||
---@param kind string Template in language table
|
||||
---@param name string A string to replace temp values in template
|
||||
---@return string Content Formatted string
|
||||
function M.fetch(kind_path, kind, name)
|
||||
kind, name = kind or "", name or ""
|
||||
if (kind == "" or nil) or (name == "" or nil) then
|
||||
return ""
|
||||
end
|
||||
local ok, mod = pcall(require, kind_path)
|
||||
if ok and type(mod) == "table" then
|
||||
return (string.gsub(mod[kind], "__PROJECT_NAME__", name))
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -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: __PROJECT_NAME__
|
||||
"""
|
||||
]=]) .. "\n",
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
---@alias TerminalModeType "split" | "float"
|
||||
---@alias SplitDirection "vertical" | "horizontal"
|
||||
---@alias SplitAnchorType "right" | "bottom"
|
||||
|
||||
---@class VernKeybindItem
|
||||
---@field desc string
|
||||
---@field action function
|
||||
|
||||
---@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 VernCoreConfig
|
||||
---@field workspace_root string
|
||||
---@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>
|
||||
---@field file table<string, VernFileLayout>
|
||||
---@field extras table<string, VernExtrasLayout>
|
||||
|
||||
---@class VernLanguageConfig
|
||||
---@field root string
|
||||
---@field dirs table<string, string>
|
||||
---@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
|
||||
@@ -0,0 +1,154 @@
|
||||
local M = {}
|
||||
|
||||
---@param path string
|
||||
---@param content string
|
||||
function M.dump(path, content)
|
||||
local file = assert(io.open(path, "w"), "Error creating file: " .. path)
|
||||
file:write(content)
|
||||
file:close()
|
||||
end
|
||||
|
||||
---@param str string String to replace
|
||||
---@param ctx table<string, string> Replacment characters
|
||||
---@return string
|
||||
function M.fmt(str, ctx)
|
||||
return (str:gsub("{([^}]+)}", ctx))
|
||||
end
|
||||
|
||||
---@param bufnr? integer Default is 0 (current buffer)
|
||||
function M.proj_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()
|
||||
end
|
||||
|
||||
---@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.resolve_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
|
||||
|
||||
---@return string
|
||||
function M.proj_name()
|
||||
return vim.fn.fnamemodify(M.proj_root(), ":t")
|
||||
end
|
||||
|
||||
---@param path string
|
||||
---@param ft string
|
||||
function M.init_git(path, ft)
|
||||
ft = ft and vim.trim(ft)
|
||||
if not ft or ft == "" then
|
||||
return
|
||||
end
|
||||
|
||||
local gitignore = require("vern-nvim.templates.extras.gitignore").template(ft)
|
||||
vim.fn.system({ "git", "-C", path, "init" })
|
||||
M.dump(vim.fs.joinpath(path, ".gitignore"), gitignore)
|
||||
end
|
||||
|
||||
---@param path string
|
||||
function M.init_readme(path)
|
||||
local readme = require("vern-nvim.templates.extras.readme")
|
||||
M.dump(vim.fs.joinpath(path, "README.md"), readme)
|
||||
end
|
||||
|
||||
---@param cmd table
|
||||
---@param opts VernTerminalConfig
|
||||
---@param scratch boolean
|
||||
---@return integer, integer?
|
||||
function M.term(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
|
||||
|
||||
return M
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
site_name: Polydev
|
||||
nav:
|
||||
- Home: index.md
|
||||
- Installation: installation.md
|
||||
- Setup: setup.md
|
||||
- Examples: examples.md
|
||||
- Language Specific Docs:
|
||||
- Java: languages/java.md
|
||||
- C: languages/c.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>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
# stylua.toml
|
||||
|
||||
# How many characters per line before wrapping
|
||||
column_width = 100
|
||||
|
||||
# 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"
|
||||
Reference in New Issue
Block a user