185 Commits
Author SHA1 Message Date
DarthMooMancer 421cf95bc6 chore(go): fixing project creation 2026-11-18 01:13:55 -05:00
DarthMooMancer 1c13c8cbe2 chore(actions.create_project): now has a list over manually typing for
easier creation
2026-11-08 23:57:52 -05:00
DarthMooMancer adbd2bc0e9 refactor(utils): Split into fs and moved the inits to the project. 2026-11-01 20:48:36 -05:00
DarthMooMancer 15f3648af8 chore(readme): rewrote it for new version 2026-10-31 02:19:43 -04:00
DarthMooMancer 51e911ec33 chore(langs): moved folder again (last time promise), also fixed python
venv bug.
2026-10-31 01:52:49 -04:00
DarthMooMancer 1b5d413404 chore(configs): moved all files to languages 2026-10-31 01:37:29 -04:00
DarthMooMancer ae0df7fe28 refactor(actions): deleted actions files for language types and fixed them 2026-10-31 01:34:14 -04:00
DarthMooMancer 08967f9070 chore(deprecation): removed old deprecated files (#7), cleaned c/c++ code 2026-10-30 14:17:01 -04:00
DarthMooMancer 9a6eb90efc refactor(configs): completely overhauled how projects and files are handled
1. Run is now handled by the global run function instead
of language specific runs
2. Fixed some notifications, making them more unified and informational
3. Cleaned up c/c++ code that was broken from create_file changes
4. Create_file has new architecture. It still takes in a function but
   can be disabled to be skipped (this will most likely change later as
   its unoptimized)
5. Added rust support
6. Keybinds are now only setup for language specific
7. Project creation has error and nil checking allowing for skipping and
   more customizable templates and setups for future languages
2026-10-30 13:24:38 -04:00
DarthMooMancer 72951f7327 chore: fixed create_file to take filetype over asking for language each
time as 97% of the time people (I) will want to make the same filetype
instead
2026-10-28 10:30:06 -04:00
DarthMooMancer 4765da0539 chore: cleaning deprecated code 2026-10-27 17:03:32 -04:00
DarthMooMancer 9f4649b5d2 chore: combined (actions/utils.lua).create with (actions/init.lua).create_project 2026-10-27 16:53:43 -04:00
DarthMooMancer e8c55ec18f feat: added java and refactored how context is utilized 2026-10-27 14:35:19 -04:00
DarthMooMancer fcde51bc05 chore: redundancy removing and pushing before local changes 2026-10-27 00:14:09 -04:00
DarthMooMancer 9eefdb6166 refactor: fully moved attach to configs for compression
Removed the entire folder of attach because there was mostly boilerplate
instead of language specific code. It was redundant and just for testing
to have concept of what I wanted
2026-10-26 23:45:04 -04:00
DarthMooMancer 3046a3ce36 refactor: continuation of compressing languages to be agnostic 2026-10-26 21:11:55 -04:00
DarthMooMancer 5eaa7d10a7 refactor: realized I was heavily unoptimized.
Each language had the same boilerplate code to create new projects and
new files with minor differences between each language making them
difficult to edit and navigate.
2026-10-26 14:13:33 -04:00
DarthMooMancer 774f14809d RENAME: Changed vern.nvim to vern-nvim and moved vern to vern-nvim 2026-10-26 09:48:33 -04:00
DarthMooMancer 645eeed296 README: updated available languages 2026-10-23 09:32:40 -04:00
DarthMooMancer 4bf705df03 CHORE: Bug fixed c and cpp files and fixed their templates. Bug #3 is
also done
2026-10-23 09:30:37 -04:00
DarthMooMancer 1c4a61ce7f CHORE: Fixed bug #4 by looping dirs and creating directories before
other loops in creation.
LANG: Added CPP and bugfixed c to use c code and not python
2026-10-23 08:25:21 -04:00
DarthMooMancer b6d46a0cef Chore: moved similar functions to a utils for actions so they dont
repeat and copy costantly. Going to have to think of a better way that
consolidates it all as a lot of it overlaps
2026-10-22 14:36:19 -04:00
DarthMooMancer 685a711644 REFACTOR: Annotations for autocompletion, reworked how projects are made
and handled, wrote the c file replacing the copied python code.
2026-10-22 04:29:52 -04:00
DarthMooMancer 3bb97d833b REFACTOR: Completely changed how project creation is done so I can make
other languages easier and hopefully faster
2026-10-22 00:19:19 -04:00
DarthMooMancer df760783ba CHORE: cleaning up 2026-10-20 22:40:38 -04:00
DarthMooMancer 57e8eb0248 PYTHON: added venv creation 2026-10-20 17:42:25 -04:00
DarthMooMancer 0f542d56ef PYTHON: Project setup fixed and working, just need to add providers 2026-10-19 20:24:45 -04:00
DarthMooMancer e2864159a8 CHORE: officially renamed files to be deprecated and also made making
templates simpler
2026-10-19 14:29:51 -04:00
DarthMooMancer 380f295c93 FEAT: adding create_project 2026-10-19 11:59:24 -04:00
DarthMooMancer 06eb74e13f REFACTOR: Cleaning up project and removing more deprecated code 2026-10-16 10:38:06 -04:00
DarthMooMancer 98bd619cfa REFACTOR: Merged templates into a per language file, deleted init.lua as
it was just a middle man and wasnt needed (in fact it is better without
it)
FT: Changes to python
2026-10-15 23:32:26 -04:00
DarthMooMancer 6593db3829 CHORE: Updated License and cleaned up repo 2026-10-15 09:59:14 -04:00
DarthMooMancer 4bcac5d09b REFACTOR: I spent all day on it but I am heavily refactoring the API and
organization because it was terrible before and hard to maintain. Now it
should be much easier and there is still of a design decisions to figure
out
2026-10-15 02:07:14 -04:00
Andrew Haynes 2b30e36fad major changes to try and fix a bunch of random bugs 2026-08-03 16:03:08 -04:00
Andrew Haynes 8d41141e9a configs should update properly 2026-03-31 18:38:18 -04:00
Andrew Haynes 919d141c6a LANG: Javascript finally fixed...hopefully 2026-03-30 00:17:21 -04:00
Andrew Haynes 89bf0333c4 ? 2026-03-30 00:16:04 -04:00
Andrew Haynes 9210dff133 ? 2026-03-30 00:12:17 -04:00
Andrew Haynes 262e377873 ? 2026-03-30 00:09:40 -04:00
Andrew Haynes 5cec285828 ? 2026-03-30 00:08:30 -04:00
Andrew Haynes 22215cccda ? 2026-03-30 00:04:53 -04:00
Andrew Haynes 2ca6c62cd8 LANG: javascript - lets see if this works 2026-03-29 00:47:50 -04:00
Andrew Haynes d99dc30dcd LANG: added javascript init 2026-03-29 00:27:54 -04:00
Andrew Haynes 62015919dd plz 2026-03-19 14:01:42 -04:00
Andrew Haynes e0cbc48cc0 c/c++ changes 2026-03-07 13:45:34 -05:00
Gentoo 15718d57fa .clang-format for c/c++ 2026-03-06 03:55:26 -05:00
DarthMooMancer c907211784 Update README.md 2025-12-10 17:58:20 +00:00
DarthMooMancer 053c567618 cleaning 2025-12-01 01:08:04 -05:00
DarthMooMancer faf87f3643 Update README.md 2025-12-01 06:07:13 +00:00
DarthMooMancer 1df75ee212 removing github 2025-12-01 00:40:00 -05:00
DarthMooMancer ce406bfad3 c++ 2025-11-13 02:24:38 -05:00
DarthMooMancer 0dec930412 c++ 2025-11-13 02:23:38 -05:00
DarthMooMancer d7b949d9f9 ui changes 2025-10-30 23:03:07 -04:00
DarthMooMancer bf56094156 fixes 2025-10-30 22:33:34 -04:00
DarthMooMancer 1a450ff79a wip 2025-10-26 21:04:05 -04:00
DarthMooMancer 76791fd7c1 wip 2025-10-26 21:02:59 -04:00
DarthMooMancer 45fcdf78be wip 2025-10-26 21:01:40 -04:00
DarthMooMancer d1cb867cf8 c++ fix 2025-10-03 09:23:57 -04:00
Andrew Haynes 5bf74a6639 Update templates.lua 2025-09-19 13:47:27 -04:00
dmm 2b440c2935 Update issue templates 2025-09-07 15:12:33 +00:00
dmm 5420c54d9a Create CONTRIBUTING.md 2025-09-07 15:08:25 +00:00
dmm ad97a31a31 Create CODE_OF_CONDUCT.md 2025-09-07 15:06:21 +00:00
DarthMooMancer 0a8495fe79 fix 2025-09-04 21:13:24 -04:00
DarthMooMancer a246f2ab03 Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-09-04 21:07:31 -04:00
DarthMooMancer 5765c8ea19 fix: c/c++ had compile commands linked unnecassarily 2025-09-04 21:07:27 -04:00
dmm e701aa1feb Update README.md 2025-09-04 20:52:09 -04:00
DarthMooMancer bc825895ac fix: changed formatting and defaults for c/c++ 2025-09-01 00:36:35 -04:00
DarthMooMancer 0cc4374865 wip 2025-08-22 19:30:24 -04:00
DarthMooMancer 66ae61f2c9 fix(ui): closes ui when making projects and files 2025-07-20 02:27:24 -04:00
DarthMooMancer cf84fe2080 feat(plugin.Polydev): Added for automatically starting the plugin so opts or require are not necessary 2025-06-29 16:09:45 -04:00
DarthMooMancer beddb26757 chore(presets): formatting presets to be nicer 2025-06-21 03:50:26 -04:00
DarthMooMancer df473b1d33 fix(ui): forgot to add keybinds to new ui 2025-06-21 03:35:11 -04:00
DarthMooMancer e3fdeb53b3 fix(README): readme no longer has warning about ui as I have it fixed 2025-06-21 02:56:42 -04:00
DarthMooMancer 8c2498d00f feat(ui): removed nui dependency and now have tabbed ui for current project and recent folders and files
chore(all): just cleaned up and removed some redundant code
2025-06-21 02:56:01 -04:00
DarthMooMancer 69c648c4f4 Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-05-27 13:50:55 -04:00
DarthMooMancer 60e5d9ea2f refactor(ui): removed the preview and search popups. Refactored project specific code be faster and more maintained 2025-05-27 13:50:50 -04:00
DarthMooMancer 109489a2aa Update README.md 2025-05-27 13:49:21 -04:00
DarthMooMancer 6937318b2e Update README.md 2025-05-27 13:46:26 -04:00
DarthMooMancer 23bc6c2bfc Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-05-22 08:12:32 -04:00
DarthMooMancer 38284658dd chore: removing redundant code 2025-05-22 08:12:27 -04:00
DarthMooMancer 759278b9ff Update README.md 2025-05-20 14:37:42 -04:00
DarthMooMancer 14b302151b fix(utils): fixed bottom split and added sizing for splits 2025-05-20 09:27:04 -04:00
DarthMooMancer e6c3353b51 feat(utils): added ability to have floating or split windows and anchors of where each are
fix(ui): also changed deprecated features to use newer features by
neovim
2025-05-17 18:33:55 -04:00
DarthMooMancer eea8def35c docs(appearance): update 2025-05-16 13:10:57 -04:00
DarthMooMancer d5fadfa55e docs(appearance): added appearance tab 2025-05-16 12:59:53 -04:00
DarthMooMancer 7e047478d5 fix(deprecated): replacing deprecated code throughout project
rework: moved load_language_module to languages as it makes more sense
2025-05-16 10:53:34 -04:00
DarthMooMancer 9eb38ba06e docs(mkdocs.yml): removed language specific docs 2025-05-16 09:40:25 -04:00
DarthMooMancer 85f05563ce docs(languages): added gitignore to each language fixing https://github.com/DarthMooMancer/Polydev/issues/6 2025-05-16 09:37:54 -04:00
DarthMooMancer 7646aa3295 fix(docs): forgot to push mkdocs.yml 2025-05-16 01:04:46 -04:00
DarthMooMancer 3942f88ef6 docs(languages): removed individual language files and moved them all to one 2025-05-16 01:01:11 -04:00
DarthMooMancer 46eb126ebe fix(.gitignore): removed everything but venv as they are no longer in project 2025-05-16 00:40:39 -04:00
DarthMooMancer 70ff086e0c Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-05-16 00:35:48 -04:00
DarthMooMancer b348710bd5 fix(docs, configs): removed build_attribues from docs and configs; removed unnecessary requirements from installation and index 2025-05-16 00:35:39 -04:00
DarthMooMancer dc0cf79188 Update README.md 2025-05-16 00:27:14 -04:00
DarthMooMancer 0ac0267888 Major Update: v1.2.0
rework: languages are in one files called languages making it easier to manage all languages and removes headache
feat: added ui in a725faaac8
2025-05-15 14:38:07 -04:00
DarthMooMancer 46263ca5e0 fix: project root is properly taken by user opts
feat: user can change border of terminal alongside enabling/disabling it
2025-05-15 11:31:11 -04:00
DarthMooMancer 28fdb698bf rework: check description
docs: removed lines about plenary
removal: plenary
chore: optmized presets load to default nil as 'max'
rework: changed window format of manager and added coloring

Future plans: Add custom highlight-groups for Polydev to configure
border and background or manager
2025-05-15 01:00:57 -04:00
DarthMooMancer 9105add777 rework: removed max preset and made it default as nil instead 2025-05-14 22:20:35 -04:00
DarthMooMancer eb3e75fe67 removal: keybinds to be added to main panel 2025-05-14 21:30:31 -04:00
DarthMooMancer def81ab3f3 Removal: center preset 2025-05-14 13:50:28 -04:00
DarthMooMancer 4d34b5d1be docs: update to setup and installation
Removing redudancy in installation at the top. Changed setup to use
names for each setting for clarity for people who don't know what is
going on
2025-05-14 13:26:04 -04:00
DarthMooMancer fa7851a787 rework: top-level project folder is now changeable and organized templates 2025-05-14 16:27:53 -04:00
DarthMooMancer 632add5f4a Update setup.md 2025-05-14 13:11:35 -04:00
DarthMooMancer 95bad52a3e Update LICENSE 2025-05-14 12:47:50 -04:00
DarthMooMancer 31929db357 Update index.md 2025-05-14 12:44:14 -04:00
DarthMooMancer e888571c63 Update installation.md 2025-05-14 11:36:36 -04:00
DarthMooMancer 645ddcab04 Update index.md 2025-05-14 11:34:29 -04:00
DarthMooMancer 2787644994 Update index.md 2025-05-14 11:34:03 -04:00
DarthMooMancer e884de149a Update index.md 2025-05-14 11:28:40 -04:00
DarthMooMancer 71c88ec956 Update README.md 2025-05-14 11:27:30 -04:00
DarthMooMancer 4c6b1289fc Update README.md 2025-05-14 11:27:11 -04:00
DarthMooMancer e8f51361ad Update README.md 2025-05-14 11:24:44 -04:00
DarthMooMancer ee73604008 Update README.md 2025-05-14 11:22:30 -04:00
DarthMooMancer cf5c7d8bbb Update README.md 2025-05-14 11:19:01 -04:00
DarthMooMancer 9c4a50da8e Update README.md 2025-05-14 11:18:28 -04:00
DarthMooMancer 2c8ae6b254 Update README.md 2025-05-14 11:17:58 -04:00
DarthMooMancer fa975c2aab feat: added compile_commands support for c/c++ when creating project 2025-05-12 18:23:41 -04:00
DarthMooMancer 88910d039b asdff 2025-05-12 11:13:37 -04:00
DarthMooMancer 75b43d31c9 fixed c/c++ build and run with error handling 2025-05-12 14:18:39 -04:00
DarthMooMancer e935cad8b7 Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-05-12 09:33:22 -04:00
DarthMooMancer b5b1cfa449 chore: removed unused guard in templates for c/c++ 2025-05-12 09:32:51 -04:00
DarthMooMancer 1306f86a65 chore: removed redundant lines in templates 2025-05-12 09:31:27 -04:00
DarthMooMancer 41e6fa1c48 Update index.md 2025-05-12 09:27:09 -04:00
DarthMooMancer 5f45ee5029 Update README.md 2025-05-12 09:24:36 -04:00
DarthMooMancer 3a50bf9375 chore: renamed open_project_manager to manager and added aux files to hints 2025-05-12 09:09:08 -04:00
DarthMooMancer 8d913ce979 docs: fixed bold for installation 2025-05-12 09:01:32 -04:00
DarthMooMancer 2d2164c380 chore: renamed open_float_terminal to terminal and annotated utils.lua 2025-05-12 08:59:02 -04:00
DarthMooMancer a2c43661c4 rework: open_float_terminal uses table instead of string
fix: all languages now use proper terminal setup
2025-05-12 08:43:42 -04:00
DarthMooMancer 4ddbe07a30 docs: update to fix .polydev mentions and improper presets 2025-05-12 02:19:54 -04:00
DarthMooMancer fe6d03981c removed: reorganized utils code because it was unused and removed
unnecessary presets_opts calls
2025-05-12 02:17:26 -04:00
DarthMooMancer 294047bcda docs: removed .polydev mentions and changed presets names
fix: presets had improper variable names on call
fix: java now builds properly and runs
2025-05-12 02:12:55 -04:00
DarthMooMancer b07b2aec9d fix: made preset names more simple to understand 2025-05-12 01:38:33 -04:00
DarthMooMancer c6ea4f4f89 rework: removed old get functions from each language to use utils
instead and changed run in each language to use new system to be simpler

feat: added aux_files for c/c++ and reworked them to work with new
update
2025-05-12 01:27:46 -04:00
DarthMooMancer 8584ed4bbf rework: templates.files uses table instead of deprecated string format
rework: templates.files no longer requires the deprecated .polydev files
feat: added get_project_name to utils
2025-05-12 01:09:03 -04:00
DarthMooMancer 4ecaf54f82 refactor: fixed deprecated write_file to use table instead of string for
each language in templates.projects
2025-05-12 00:41:05 -04:00
DarthMooMancer 677e5bbc67 fix: fixed git initialization for project
chore: change write_file to take table instead of string
2025-05-11 14:19:49 -04:00
DarthMooMancer 674dd47dbc cleanup: removed unnecessary files 2025-05-11 09:09:11 -04:00
DarthMooMancer 1e987bf5b6 feat: added git initalization to java as test for replacement to polydev files 2025-05-11 09:07:03 -04:00
DarthMooMancer acb859f9e5 Add walkup for now 2025-05-11 15:38:57 -04:00
DarthMooMancer 734b60f145 feat: added ui.lua to cleanup init.lua
chore: optimized keybind setup in init.lua
2025-05-08 09:22:47 -04:00
DarthMooMancer 34aa8346e9 chore: changed presets to preset for config and updated docs 2025-05-08 08:47:04 -04:00
DarthMooMancer 96378ec33d fix: readded build_attributes to c because I forgot I removed it 2025-05-08 08:31:46 -04:00
DarthMooMancer 6c53a052b3 docs: update to languages to contain proper information and added (Html,
Rust)
2025-05-08 08:30:29 -04:00
DarthMooMancer 368a5d98f8 chore: organized and optimized startup
docs: updated documentation to be simpler and up to date
2025-05-08 00:35:37 -04:00
DarthMooMancer 15913c75b7 FIX: fixed lua to not use global function but local to stop nil error 2025-05-07 11:31:49 -04:00
DarthMooMancer 20a375aaf5 chore: cleaned up cpp.lua to find polydev file faster and cleaned up
configs file
2025-05-07 11:11:17 -04:00
DarthMooMancer cac1fdb02c docs: removed warning from c files about early build issues 2025-05-07 10:45:21 -04:00
DarthMooMancer bb9efdbd8a REMOVED: padding options from default options in configs.lua 2025-05-02 10:52:34 -04:00
DarthMooMancer bbb1e0c24a FIX: Changed naming convention to be the same throughout the presets
file and fixed neovim api for temrinal.

Update: Changed how presets are made to be simpler
2025-05-02 10:46:07 -04:00
DarthMooMancer ff360658e4 FIX: Changed terminal to use new vim api as neovim deprecated old 2025-05-01 22:00:09 -04:00
DarthMooMancer 908cb7ae03 fix: cleaned up hint popup page for simplicity 2025-05-01 09:26:49 -04:00
DarthMooMancer 9aedf18379 Removed: vcpkg cmake creation, will readd somehow later 2025-04-30 12:58:36 -04:00
DarthMooMancer cbaf74418b Added gitignore creation for c++ 2025-04-30 12:55:41 -04:00
DarthMooMancer e2ebe918bd Changes and fixes to c++ project creation 2025-04-25 09:04:59 -04:00
DarthMooMancer 546d204f9d Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-04-23 14:50:25 -04:00
DarthMooMancer 534dc2819e Update to documentation, update with merging run and build commands, cleaned up and organized the project manager 2025-04-23 14:50:17 -04:00
DarthMooMancer 5449c2a9f3 Update README.md 2025-04-21 05:21:37 -04:00
DarthMooMancer 9db6059fb7 Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-04-21 05:19:54 -04:00
DarthMooMancer a725faaac8 added project manager and updated documentation 2025-04-21 05:19:27 -04:00
DarthMooMancer c70246818e Update mkdocs.yml 2025-04-21 01:56:29 -04:00
DarthMooMancer 3db95f1b7c Update ci.yml 2025-04-21 01:55:39 -04:00
DarthMooMancer 467d864eb4 Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-04-21 01:53:27 -04:00
DarthMooMancer 919a856d93 Update to mkdocs 2025-04-21 01:53:19 -04:00
DarthMooMancer cb476fa5ec Update ci.yml 2025-04-21 01:46:37 -04:00
DarthMooMancer f5b59c0f95 Update ci.yml 2025-04-21 01:41:28 -04:00
DarthMooMancer e28bcc41ea Added presets and updated documentation 2025-04-21 01:35:57 -04:00
DarthMooMancer 8425a838d0 Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-04-18 23:55:00 -04:00
DarthMooMancer 71bc395125 Added Presets for terminal placements 2025-04-18 23:54:43 -04:00
DarthMooMancer b6640dfcee Update README.md 2025-04-18 10:52:51 -04:00
DarthMooMancer 11ecd94afd Changed the files to work with templates 2025-04-17 20:39:25 -04:00
DarthMooMancer a5c8a04e0f Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-04-17 09:59:31 -04:00
DarthMooMancer c79c414859 Changing how lanaguages are handled with templates 2025-04-17 09:59:11 -04:00
DarthMooMancer 87e6408291 Update README.md 2025-04-16 03:44:12 -04:00
DarthMooMancer 4cf429c210 Update README.md 2025-04-16 03:43:35 -04:00
DarthMooMancer 2dbb367eb5 updated mkdocs.yml 2025-04-16 03:40:29 -04:00
DarthMooMancer 29643fe1d5 Updated language docs 2025-04-16 03:38:34 -04:00
DarthMooMancer 068a650e85 Update to setup 2025-04-16 03:17:39 -04:00
DarthMooMancer 48322f04e1 Fixing installation.md 2025-04-16 03:15:47 -04:00
DarthMooMancer 1c8ec76875 Update to installation 2025-04-16 03:11:43 -04:00
DarthMooMancer 156f92cc31 Updating index to be more friendly and informational 2025-04-16 02:53:39 -04:00
DarthMooMancer a882c3b30e Update README.md 2025-04-16 02:35:51 -04:00
DarthMooMancer 838148bccb Update README.md 2025-04-16 02:35:22 -04:00
DarthMooMancer 4b8300c9c0 Update README.md 2025-04-16 02:34:24 -04:00
DarthMooMancer cc61c9029d Merge branch 'main' of https://github.com/DarthMooMancer/Polydev 2025-04-16 02:22:22 -04:00
DarthMooMancer 3f7c412d77 Update README.md 2025-04-16 02:18:26 -04:00
53 changed files with 1953 additions and 1384 deletions

No files matched your search

-22
View File
@@ -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
View File
@@ -1,2 +1,2 @@
*.polydev
LICENSE
venv/
+1 -1
View File
@@ -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
+45 -17
View File
@@ -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="left">Vern-nvim (aka Vernacular-nvim) is a multilingual project scaffolder with a bunch of extra add-ons. It creates new projects, new files based on buffer filetype, runs projects and builds if needed and more.</p>
![Python-polydev-720](https://github.com/user-attachments/assets/b66f46e8-901f-4a46-8e79-10b688d4109a)
> [!WARNING]
> Vern-nvim is only tested on vim.pack as of right now.
> Meaning it may not work well with lazy.nvim or any other package manager
### 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]
> This is solely a passion project to improve my own workflow meaning that the plugin is very opinionated. If it were to ever pickup traction, I would love it if people could suggest larger changes that allowed this to be an even better neovim project scaffold
## Features
* Works out of the box with no additional configuration needed
* Extensibility towards custom templates.
* Custom commands
* Builtin terminal for viewing code !(scratchpad in future)
* !(Future) Allows for custom providers for languages and custom commands
> All features and configs are documented here [Future Documentation](https://vern-nvim.moomancer.xyz/docs) (lies, it will be here one day)
## Supported Languages
Vern-nvim currently supports the following languages:
### Currently Supported (And working) Languages
* Java
* Python
* C/C++
* C / C++
* Lua
* Java
* Rust
## Questions and Contributing
Additional language support is planned for future releases.
If you want to contribute, make a PR or issue and I will answer as soon as I see it. If there is a language that you want added for easier use, please voice it. If you have questions, just ask in issues or discussions and I will answer them.
- Web based languages (HTML, CSS, JS/TS), these will be scaffolded by deno, bun, etc
- Other languages I am interested in
## Roadmap
- [ ] Refactoring and internal cleanup from v1.
- [ ] Implement scratchpad functionality
- [ ] Impleemtn custom provider support
- [ ] Keybinds for specific languages to rebuild (c/c++/java/rust) (Part 1)
- [ ] Adding language specific keybinds for extra information or convienence (Part 2)
## Contributing
Contributions are welcome and appreciated!
* Open an issue for bug reports, questions, or feature requests.
* Submit a pull request if you'd like to contribute directly.
Thank you for checking out Vern-nvim!
-29
View File
@@ -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,
},
}
}
}
```
-13
View File
@@ -1,13 +0,0 @@
# Welcome to Polydev
![Python-polydev-720](https://github.com/user-attachments/assets/08232673-01a4-4464-9e98-5a94227e98f9)
----
### 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
-32
View File
@@ -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
--})
```
-29
View File
@@ -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
```
-23
View File
@@ -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
```
-22
View File
@@ -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
```
-28
View File
@@ -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
View File
@@ -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,
}
})
```
+3
View File
@@ -0,0 +1,3 @@
module com.DarthMooMancer.test_2
go 1.27.3
-100
View File
@@ -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
-73
View File
@@ -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
-170
View File
@@ -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
-171
View File
@@ -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
-55
View File
@@ -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
-82
View File
@@ -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
-75
View File
@@ -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
-146
View File
@@ -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
-70
View File
@@ -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
-52
View File
@@ -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
+52
View File
@@ -0,0 +1,52 @@
---@module "vern-nvim.core.actions"
local actions = require("vern-nvim.core.actions")
---@type VernCoreConfig
return {
workspace_root = "~/personal/Projects",
env = {
--- In documentation, make recommendation to change to username or name instead of company
author = "company",
},
keybinds = {
["<leader>pc"] = {
user_command = "VernCreateProject",
desc = "Creates a new project",
action = actions.create_project,
},
["<leader>pf"] = {
user_command = "VernCreateFile",
desc = "Creates a new project file based on current buffer filetype",
action = actions.create_file,
},
["<leader>pr"] = {
user_command = "VernRunProject",
desc = "Builds and runs project based on current buffer filetype",
action = actions.run,
},
},
terminal = {
mode = {
type = "split", --- (float)|(split)
win = {
float = {
padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
},
border = {
enabled = true,
type = vim.o.winborder, -- defaults to neovim winborder
},
},
split = {
direction = "horizontal", --- (vertical)|(horizontal)
anchor = "bottom", --- (right)|(bottom)
size = "20",
},
},
},
},
}
+227
View File
@@ -0,0 +1,227 @@
local M = {}
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.template"
local templates = require("vern-nvim.core.template")
---@module "vern-nvim.providers.web"
local providers = require("vern-nvim.providers.web")
---Imitate create_file so you can skip over and use for each filetype
M.create_project = function(opts)
opts = opts or {}
local ft = ""
local items = {
"cpp",
"c",
"rust",
"python",
"go",
"lua",
"java",
"web - not yet implemented",
}
vim.ui.select(items, {
prompt = "Select available language:",
format_item = function(item) return item end,
}, function(choice, _)
if choice then ft = vim.trim(choice) end
local ok, langs = pcall(require, "vern-nvim.langs." .. ft)
if not ok or type(langs) ~= "table" then
-- vim.notify("Empty or nil ft", vim.log.levels.WARN, {
-- title = "Vern Project",
-- })
return
end
local args = vim.tbl_deep_extend("force", {}, langs, opts or {})
if not args[ft] or type(args[ft]) ~= "table" then return end
if ft == "web" then
if type(langs.create_project) == "function" then
langs.create_project()
end
return
else
vim.ui.input({ prompt = "Enter project name: " }, function(pname)
pname = pname and vim.trim(pname)
if not pname or pname == "" then return end
local root = vim.fs.joinpath(
vim.fn.expand(args.workspace_root),
args[ft].root,
pname
)
local ctx = {
project_name = pname,
company_name = args.env.author,
file_name = "",
}
vim.fn.mkdir(root, "p")
local dirs = args[ft].dirs
if type(dirs) == "table" and next(dirs) then
for _, dir in pairs(dirs) do
local path = vim.fs.normalize(
vim.fs.joinpath(root, fs.fmt_path(dir, nil, ctx))
)
vim.fn.mkdir(path, "p")
end
end
local function write(tpl)
if type(tpl) == "table" and next(tpl) then
for _, tbl in pairs(tpl) do
local raw_path = vim.fs.joinpath(tbl.path, tbl.name)
local path = fs.fmt_path(raw_path, args[ft].dirs, ctx)
if tbl.enabled ~= false and tbl.kind then
local abs_file_path =
vim.fs.normalize(vim.fs.joinpath(root, path))
local abs_dir_path = vim.fs.dirname(abs_file_path)
if
abs_dir_path ~= root
and not vim.startswith(root, abs_dir_path)
then
vim.fn.mkdir(abs_dir_path, "p")
end
fs.write(
abs_file_path,
templates.fetch(tbl.kind_path, tbl.kind, ctx)
)
end
end
end
end
local tpl = args[ft].templates or {}
local bin
local project = tpl.project
if type(project) == "table" and next(project) then
for tbl_name, tbl in pairs(project) do
if tbl_name == "primary" then
bin = vim.fs.joinpath(
root,
fs.fmt_path(
vim.fs.joinpath(tbl.path, tbl.name),
args[ft].dirs,
ctx
)
)
end
end
end
write(project)
write(tpl.extras)
if type(langs.create_project) == "function" then
langs.create_project(root)
end
--- Init git
local gitignore =
require("vern-nvim.templates.extras.gitignore").template(ft)
local obj = vim.system({ "git", "-C", root, "init" }):wait()
if obj.code ~= 0 then
vim.notify(
"Git init failed " .. obj.stderr,
vim.log.levels.ERROR,
{ title = "Vern Git" }
)
end
fs.write(vim.fs.joinpath(root, ".gitignore"), gitignore)
--- Init Readme
local readme = require("vern-nvim.templates.extras.readme")
fs.write(vim.fs.joinpath(root, "README.md"), readme)
if bin then vim.cmd.edit(vim.fn.fnameescape(bin)) end
vim.notify(
"Project: " .. pname .. " has been created!",
vim.log.levels.INFO,
{ title = "Vern Project" }
)
end)
end
end)
end
M.create_file = function(opts)
opts = opts or {}
local filetype = vim.bo.filetype
local ft_ok, config = pcall(require, "vern-nvim.langs." .. filetype)
if not filetype or filetype == "" or not ft_ok or type(config) ~= "table" then
vim.notify("Unknown Filetype: " .. filetype, vim.log.levels.WARN, {
title = "Vern File",
})
return
else
local args = vim.tbl_deep_extend("force", {}, config, opts or {})
---@type VernCreateFile
local cf = args.create_file
local function function_write(mod, fname)
local raw_path = vim.fs.joinpath(mod.path, mod.name)
local context = {
project_name = fs.name(),
company_name = args.env.author,
file_name = fname,
}
local path = fs.fmt_path(raw_path, args[filetype].dirs or {}, context)
local full_path = vim.fs.joinpath(fs.root(), path)
fs.write(full_path, templates.fetch(mod.kind_path, mod.kind, context))
vim.cmd.edit(vim.fn.fnameescape(full_path))
vim.notify(
fname .. " has been created!",
vim.log.levels.INFO,
{ title = "Vern File" }
)
end
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
fname = fname and vim.trim(fname)
if not fname or fname == "" then return end
local done = function(mod)
if not mod or vim.tbl_isempty(mod) then return end
function_write(mod, fname)
end
if cf and type(cf) == "function" then
cf(args, done)
else
done(args[filetype].templates.file.source)
end
end)
end
end
M.run = function(opts)
opts = opts or {}
local filetype = vim.bo.filetype
local ft_ok, action = pcall(require, "vern-nvim.langs." .. filetype)
if
not filetype
or filetype == ""
or not ft_ok
or type(action.run) ~= "function"
then
vim.notify("Unknown Filetype: " .. filetype, vim.log.levels.WARN, {
title = "Vern Run",
})
return
else
local args = vim.tbl_deep_extend(
"force",
{},
opts,
require("vern-nvim.langs." .. filetype)
)
action.run(args)
end
end
return M
+28
View File
@@ -0,0 +1,28 @@
local M = {}
---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal")
---@param opts table
---@param build_cmd string
---@param run_cmd string
M.compile = function(opts, build_cmd, run_cmd)
vim.system({ "sh", "-c", build_cmd }, { text = true }, function(obj)
if obj.code ~= 0 then
vim.schedule(function()
local error_obj = (obj.stderr ~= "" and obj.stderr) or obj.stdout or ""
local error_lines = vim.list_extend(
{ "Error During compilation" },
vim.split(error_obj, "\n", { trimempty = true })
)
local buf, _ =
term.open({ "echo 'compilation failed'" }, opts.terminal, true)
term.set_lines(buf, error_lines)
end)
else
vim.schedule(function() term.open({ run_cmd }, opts.terminal, false) end)
end
end)
end
return M
+49
View File
@@ -0,0 +1,49 @@
local M = {}
---@param raw_path string Combination of tbl.path and tbl.name to override
---@param dir_tbl? table<string, string> Strings to replace raw directories in {dirs.<>} with
---@param ctx table<string, string> Strings to replace raw names like {project_name} with
---@return string path Fully replaced path
function M.fmt_path(raw_path, dir_tbl, ctx)
--- Replace the {dirs.<key>}
raw_path = raw_path:gsub(
"{dirs%.([%w_]+)}",
function(dir_key) return dir_tbl and dir_tbl[dir_key] or dir_key end
)
--- Replace the {<key>}
local path = raw_path:gsub(
"{([%w_]+)}",
function(key) return ctx and ctx[key] or ("{" .. key .. "}") end
)
return path
end
---@param path string
---@param content string
function M.write(path, content)
local file = assert(io.open(path, "w"), "Error creating file: " .. path)
file:write(content)
file:close()
end
---@return string
function M.name() return vim.fs.basename(M.root()) or "" end
---@param bufnr? integer Default is 0 (current buffer)
---@return string
function M.root(bufnr)
bufnr = bufnr or 0
local root_markers = {
".git",
"pyproject.toml",
"setup.py",
"Makefile",
"CMakeLists",
"Cargo.toml",
}
return vim.fs.root(bufnr, root_markers) or vim.uv.cwd() or "."
end
return M
+31
View File
@@ -0,0 +1,31 @@
local M = {}
local registers = {
project_name = "__PROJECT_NAME__",
company_name = "__COMPANY_NAME__",
file_name = "__FILE_NAME__",
}
---@param kind_path string Filetype of template
---@param kind string Template in language table
---@param context table<string, string> A string to replace temp values in template
---@return string Content Formatted string
function M.fetch(kind_path, kind, context)
kind, context = kind or "", context or {}
if not kind or kind == "" then return "" end
local ok, mod = pcall(require, kind_path)
if not ok or type(mod) ~= "table" or not mod[kind] then return "" end
local template = mod[kind] or ""
context = context or {}
if ok and type(mod) == "table" then
for key, placeholder in pairs(registers) do
local value = context[key]
if value then template = string.gsub(template, placeholder, value) end
end
end
return template
end
return M
+96
View File
@@ -0,0 +1,96 @@
local M = {}
---@param cmd table
---@param opts VernTerminalConfig
---@param scratch boolean
---@return integer, integer?
function M.open(cmd, opts, scratch)
opts = opts or {}
local buf, win
if opts.mode.type == "float" then
local ui = vim.api.nvim_list_uis()[1]
local dim = {
width = math.max(
1,
math.floor(ui.width * 0.9)
- opts.mode.win.float.padding.left
- opts.mode.win.float.padding.right
),
height = math.max(
1,
math.floor(ui.height * 0.9)
- opts.mode.win.float.padding.top
- opts.mode.win.float.padding.bottom
),
}
local pos = {
row = math.floor(
(
ui.height
- (vim.o.laststatus == 3 and 1 or 0)
- vim.o.cmdheight
- dim.height
) / 2
),
col = math.floor((ui.width - dim.width) / 2),
}
buf = vim.api.nvim_create_buf(false, true)
win = vim.api.nvim_open_win(buf, true, {
relative = "editor",
width = dim.width,
height = dim.height,
row = pos.row,
col = pos.col,
style = "minimal",
border = opts.mode.win.float.border.enabled
and opts.mode.win.float.border.type
or nil,
})
if scratch then return buf, win end
end
if opts.mode.type == "split" then
if opts.mode.win.split.direction == "vertical" then
if opts.mode.win.split.anchor == "right" then
vim.cmd("set splitright")
end
vim.cmd(opts.mode.win.split.size .. " vsplit")
end
if opts.mode.win.split.direction == "horizontal" then
if opts.mode.win.split.anchor == "bottom" then
vim.cmd("set splitbelow")
end
vim.cmd(opts.mode.win.split.size .. " split")
end
buf = vim.api.nvim_create_buf(false, true)
win = vim.api.nvim_get_current_win()
vim.api.nvim_win_set_buf(0, buf)
if scratch then return buf, win end
end
local full_cmd = type(cmd) == "table" and table.concat(cmd, " ") or cmd
vim.fn.jobstart(full_cmd, { term = true })
vim.api.nvim_buf_set_keymap(
buf,
"n",
"<ESC>",
"i<C-\\><C-n>:q<CR>",
{ noremap = true, silent = true }
)
return buf, win
end
---@param buf integer
---@param lines table
function M.set_lines(buf, lines)
if buf and vim.api.nvim_buf_is_valid(buf) then
vim.api.nvim_set_option_value("modifiable", true, { buf = buf })
vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
vim.api.nvim_set_option_value("modifiable", false, { buf = buf })
end
end
return M
+65
View File
@@ -0,0 +1,65 @@
local M = {}
---@module "vern-nvim.config.defaults"
local defaults = require("vern-nvim.config.defaults")
---@type VernCoreConfig
M.opts = vim.deepcopy(defaults)
---@param user_opts? VernUserConfig
function M.setup(user_opts)
---@type VernCoreConfig
M.opts = vim.tbl_deep_extend("force", {}, defaults, user_opts or {})
for key, def in pairs(M.opts.keybinds or {}) do
if type(def.action) == "function" then
vim.api.nvim_create_user_command(
def.user_command,
function() def.action(M.opts) end,
{ nargs = "*", desc = def.desc }
)
vim.keymap.set("n", key, function() def.action(M.opts) end, {
silent = true,
desc = def.desc,
})
end
end
local group =
vim.api.nvim_create_augroup("VernAutocommands", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
group = group,
pattern = "*",
callback = function(args)
local ft = vim.bo[args.buf].filetype
if not ft or ft == "" then return end
local ok, mod = pcall(require, "vern-nvim.langs." .. ft)
if not ok then return end
local opts = vim.tbl_deep_extend("force", {}, mod, M.opts or {})
if opts[ft] and opts[ft].keybinds ~= nil then
for key, def in pairs(opts[ft].keybinds or {}) do
if type(def.action) == "function" then
vim.api.nvim_buf_create_user_command(
args.buf,
def.user_command,
function() def.action(opts) end,
{ nargs = "*", desc = def.desc }
)
vim.keymap.set("n", key, function() def.action(opts) end, {
buffer = args.buf,
silent = true,
desc = def.desc,
})
end
end
end
if ok and type(mod.attach) == "function" then
mod.attach(args.buf, opts)
end
end,
desc = "Attach languages to buffer",
})
end
return M
+101
View File
@@ -0,0 +1,101 @@
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.compile"
local comp = require("vern-nvim.core.compile")
local M = {}
M.attach = nil
---@param root string
M.create_project = function(root)
local build_cmd = "cd "
.. root
.. " && cmake -S . -B build && cmake --build build"
local _ = vim.system({ "sh", "-c", build_cmd }):wait()
end
---@type VernCreateFile
---@param opts VernCConfig
M.create_file = function(opts, continue)
opts = opts or {}
local file = vim.tbl_get(opts, "c", "templates", "file")
local items = { "source", "header" }
vim.ui.select(items, {
prompt = "Select type:",
format_item = function(item) return item end,
}, function(choice, _)
if choice == items[1] then return continue(file.source) end
if choice == items[2] then return continue(file.header) end
continue(nil)
end)
end
---@param opts? VernCConfig Takes a table for the runtime
M.run = function(opts)
opts = opts or {}
local build_dir = vim.fn.fnameescape(fs.root() .. "/build")
local build_cmd = string.format("cd %s && cmake --build .", build_dir)
local run_cmd = string.format("cd %s && ./%s", build_dir, fs.name())
comp.compile(opts, build_cmd, run_cmd)
end
---@type VernLanguageConfig
M.c = {
root = "C",
dirs = {
src = "src",
include = "include/{project_name}",
},
keybinds = nil,
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "main.c",
kind = "main",
kind_path = "vern-nvim.templates.c",
},
manifest = {
path = ".",
name = "CMakeLists.txt",
kind = "CmakeLists",
kind_path = "vern-nvim.templates.c",
},
style = {
path = ".",
name = ".clang-format",
kind = "format",
kind_path = "vern-nvim.templates.c",
},
},
file = {
header = {
path = "{dirs.include}",
name = "{file_name}.h",
kind = "header",
kind_path = "vern-nvim.templates.c",
},
source = {
path = "{dirs.src}",
name = "{file_name}.c",
kind = "source",
kind_path = "vern-nvim.templates.c",
},
},
extras = {
linter = {
path = ".",
name = ".clang-tidy",
kind = "linter",
kind_path = "vern-nvim.templates.c",
enabled = false,
},
},
},
}
return M
+101
View File
@@ -0,0 +1,101 @@
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.compile"
local comp = require("vern-nvim.core.compile")
local M = {}
M.attach = nil
---@param root string
M.create_project = function(root)
local build_cmd = "cd "
.. root
.. " && cmake -S . -B build && cmake --build build"
local _ = vim.system({ "sh", "-c", build_cmd }):wait()
end
---@type VernCreateFile
---@param opts VernCPPConfig
M.create_file = function(opts, continue)
opts = opts or {}
local file = vim.tbl_get(opts, "cpp", "templates", "file")
local items = { "source", "header" }
vim.ui.select(items, {
prompt = "Select type:",
format_item = function(item) return item end,
}, function(choice, _)
if choice == items[1] then return continue(file.source) end
if choice == items[2] then return continue(file.header) end
continue(nil)
end)
end
---@param opts? VernCPPConfig Takes a table for the runtime
M.run = function(opts)
opts = opts or {}
local build_dir = vim.fn.fnameescape(fs.root() .. "/build")
local build_cmd = string.format("cd %s && cmake --build .", build_dir)
local run_cmd = string.format("cd %s && ./%s", build_dir, fs.name())
comp.compile(opts, build_cmd, run_cmd)
end
---@type VernLanguageConfig
M.cpp = {
root = "CPP",
dirs = {
src = "src",
include = "include/{project_name}",
},
keybinds = nil,
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "main.cpp",
kind = "main",
kind_path = "vern-nvim.templates.cpp",
},
manifest = {
path = ".",
name = "CMakeLists.txt",
kind = "CmakeLists",
kind_path = "vern-nvim.templates.cpp",
},
style = {
path = ".",
name = ".clang-format",
kind = "format",
kind_path = "vern-nvim.templates.cpp",
},
},
file = {
header = {
path = "{dirs.include}",
name = "{file_name}.hpp",
kind = "header",
kind_path = "vern-nvim.templates.cpp",
},
source = {
path = "{dirs.src}",
name = "{file_name}.cpp",
kind = "source",
kind_path = "vern-nvim.templates.cpp",
},
},
extras = {
linter = {
path = ".",
name = ".clang-tidy",
kind = "linter",
kind_path = "vern-nvim.templates.cpp",
enabled = false,
},
},
},
}
return M
+82
View File
@@ -0,0 +1,82 @@
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal")
local M = {}
M.attach = nil
M.create_project = function(root)
local root_name = vim.fs.basename(root)
local module_name = "com.DarthMooMancer." .. root_name
local obj = vim
.system({
"sh",
"-c",
string.format(
"go mod init %s && go build -o bin/%s main.go",
module_name,
root_name
),
}, { cwd = root })
:wait()
if obj.code ~= 0 then
vim.notify(
"Go init failed" .. obj.stderr,
vim.log.levels.ERROR,
{ title = "Vern Go" }
)
end
end
---@type VernCreateFile
M.create_file = nil
---@param opts VernPythonConfig Takes a table for the runtime
M.run = function(opts)
opts = opts or {}
local root = fs.root()
-- local context = {
-- project_name = fs.name(),
-- company_name = opts.env.author,
-- file_name = "",
-- }
-- local bin = vim.tbl_get(opts.python.templates.project.primary)
--
-- local exe = vim.fs.joinpath(bin.path, bin.name)
-- local exe_path = fs.fmt_path(exe, opts.python.dirs, context)
-- local full_path = vim.fs.joinpath(vim.fn.expand(root), exe_path)
term.open({ "go run ", root .. "/main.go" }, opts.terminal or {}, false)
end
---@type VernLanguageConfig
M.go = {
root = "Go",
dirs = {
src = "",
},
keybinds = nil,
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "main.go",
kind = "main",
kind_path = "vern-nvim.templates.go",
},
},
file = {
source = {
path = "{dirs.src}",
name = "{file_name}.go",
kind = "module",
kind_path = "vern-nvim.templates.go",
},
},
extras = nil,
},
}
return M
+81
View File
@@ -0,0 +1,81 @@
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.compile"
local comp = require("vern-nvim.core.compile")
local M = {}
M.attach = nil
M.create_project = nil
---@type VernCreateFile
M.create_file = nil
---@param opts VernJavaConfig Takes a table for the runtime
M.run = function(opts)
opts = opts or {}
local root = fs.root()
local context = {
project_name = fs.name(),
company_name = opts.env.author,
file_name = "",
}
local src_root = vim.fs.joinpath(
root,
fs.fmt_path(opts.java.dirs.src, opts.java.dirs, context)
)
local build_dir = root .. "/bin"
local build_cmd = string.format(
"javac -d %s -sourcepath %s $(find %s -name '*java')",
build_dir,
src_root,
src_root
)
local run_cmd = string.format(
"java -cp %s com.%s.%s.Main",
build_dir,
context.company_name,
context.project_name
)
comp.compile(opts, build_cmd, run_cmd)
end
---@type VernLanguageConfig
M.java = {
root = "Java",
dirs = {
src = "src/com/{company_name}/{project_name}",
bin = "bin",
},
keybinds = nil,
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "Main.java",
kind = "main",
kind_path = "vern-nvim.templates.java",
},
style = {
path = ".",
name = ".clang-format",
kind = "format",
kind_path = "vern-nvim.templates.java",
},
},
file = {
source = {
path = "{dirs.src}",
name = "{file_name}.java",
kind = "source",
kind_path = "vern-nvim.templates.java",
},
},
extras = nil,
},
}
return M
+59
View File
@@ -0,0 +1,59 @@
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal")
local M = {}
M.attach = nil
M.create_project = nil
---@type VernCreateFile
M.create_file = nil
---@param opts VernLuaConfig Takes a table for the runtime
M.run = function(opts)
opts = opts or {}
term.open({
"lua " .. vim.fs.joinpath(fs.root(), "lua", fs.name(), "/init.lua"),
}, opts.terminal or {}, false)
end
---@type VernLanguageConfig
M.lua = {
root = "Lua",
dirs = {
src = "lua/{project_name}",
},
keybinds = nil,
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "init.lua",
kind = "main",
kind_path = "vern-nvim.templates.lua",
},
style = {
path = ".",
name = "stylua.toml",
kind = "format",
kind_path = "vern-nvim.templates.lua",
},
},
file = {
source = {
path = "{dirs.src}",
name = "{file_name}.lua",
kind = "source",
kind_path = "vern-nvim.templates.lua",
},
},
extras = nil,
},
}
return M
+138
View File
@@ -0,0 +1,138 @@
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal")
local M = {}
M.attach = function()
local root = fs.root()
if not root then return end
local venv_dir = nil
if vim.uv.fs_stat(root .. "/venv/bin/python") then
venv_dir = root .. "/venv"
elseif vim.uv.fs_stat(root .. "/.venv/bin/python") then
venv_dir = root .. "/.venv"
end
if venv_dir then
vim.env.VIRTUAL_ENV = venv_dir
vim.env.PATH = venv_dir .. "/bin:" .. vim.env.PATH
end
end
---@param root string
M.create_project = function(root)
local obj = vim.system({ "python3", "-m", "venv", root .. "/venv" }):wait()
if obj.code ~= 0 then
vim.notify(
"Virtual environment failed to initialize " .. obj.stderr,
vim.log.levels.ERROR,
{ title = "Vern Python" }
)
end
end
---@type VernCreateFile
M.create_file = nil
---@param opts VernPythonConfig Takes a table for the runtime
M.run = function(opts)
opts = opts or {}
local root = fs.root()
local context = {
project_name = fs.name(),
company_name = opts.env.author,
file_name = "",
}
local bin = vim.tbl_get(opts.python.templates.project.primary)
local exe = vim.fs.joinpath(bin.path, bin.name)
local exe_path = fs.fmt_path(exe, opts.python.dirs, context)
local full_path = vim.fs.joinpath(vim.fn.expand(root), exe_path)
term.open({ "python3 " .. full_path }, opts.terminal or {}, false)
end
M.pip_install = function()
vim.ui.input({ prompt = "Enter pip module: " }, function(mod)
mod = mod and vim.trim(mod)
if not mod or mod == "" then
vim.notify(
"Pip Cancelled",
vim.log.levels.WARN,
{ title = "Vern Python" }
)
return
end
vim.notify(
"Installing " .. mod,
vim.log.levels.INFO,
{ title = "Vern Python" }
)
vim.system({ "pip", "install", mod }, { text = true }, function(obj)
vim.schedule(function()
if obj.code ~= 0 then
vim.notify(
"Pip failed: " .. obj.stderr,
vim.log.levels.WARN,
{ title = "Vern Python" }
)
else
vim.notify(
"Pip installed " .. mod,
vim.log.levels.INFO,
{ title = "Vern Python" }
)
end
end)
end)
end)
end
---@type VernLanguageConfig
M.python = {
root = "Python",
dirs = {
src = "src/{project_name}",
},
keybinds = {
["<leader>pi"] = {
user_command = "VernPythonPip",
desc = "Install python packages for environment",
action = M.pip_install,
},
},
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "main.py",
kind = "main",
kind_path = "vern-nvim.templates.python",
},
manifest = {
path = ".",
name = "pyproject.toml",
kind = "pyproject",
kind_path = "vern-nvim.templates.python",
},
pkg_init = {
path = "{dirs.src}",
name = "__init__.py",
kind = "__init__",
kind_path = "vern-nvim.templates.python",
},
},
file = {
source = {
path = "{dirs.src}",
name = "{file_name}.py",
kind = "module",
kind_path = "vern-nvim.templates.python",
},
},
extras = nil,
},
}
return M
+61
View File
@@ -0,0 +1,61 @@
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal")
local M = {}
M.attach = nil
M.create_project = function(root)
local obj = vim
.system({
"cargo",
"init",
vim.fn.expand(root),
"--name",
vim.fs.basename(root),
})
:wait()
if obj.code ~= 0 then
vim.notify("Cargo init failed:" .. obj.stderr, vim.log.levels.ERROR)
end
end
---@type VernCreateFile
M.create_file = nil
---@param opts VernRustConfig Takes a table for the runtime
M.run = function(opts)
opts = opts or {}
term.open(
{ "cd " .. fs.root() .. " && cargo run" },
opts.terminal or {},
false
)
end
---@type VernLanguageConfig
M.rust = {
root = "Rust",
dirs = nil,
keybinds = nil,
templates = {
project = {
primary = { path = "src", name = "main.rs" },
},
file = {
source = {
path = "src",
name = "{file_name}.rs",
kind = "source",
kind_path = "vern-nvim.templates.rust",
},
},
extras = nil,
},
}
return M
+59
View File
@@ -0,0 +1,59 @@
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal")
---@module "vern-nvim.providers.web"
local providers = require("vern-nvim.providers.web")
local M = {}
M.attach = nil
M.create_project = function(opts, continue)
opts = opts or {}
local provider = vim.tbl_get(opts, "web", "providers")
if vim.trim(provider) == "bun" then
local items = { "Vanilla", "Tailwind", "Shadcn" }
vim.ui.select(items, {
prompt = "Select scaffold from Bun:",
format_item = function(item) return item end,
}, function(choice, _)
if choice then return continue(choice) end
end)
end
end
---@type VernCreateFile
M.create_file = nil
---@param opts VernWebConfig Takes a table for the runtime
M.run = function(opts)
opts = opts or {}
-- term.open({
-- "lua " .. vim.fs.joinpath(fs.root(), "lua", fs.name(), "/init.lua"),
-- }, opts.terminal or {}, false)
end
---@type VernLanguageConfig
M.web = {
root = "Web",
dirs = nil,
providers = "bun", --- "bun"|"deno"|"vanilla"
keybinds = nil,
templates = {
project = nil,
file = {
source = {
path = "{dirs.src}",
name = "{file_name}.lua",
kind = "source",
kind_path = "vern-nvim.templates.lua",
},
},
extras = nil,
},
}
return M
+3
View File
@@ -0,0 +1,3 @@
local M = {}
return M
+10
View File
@@ -0,0 +1,10 @@
--- Providers for bun
---
--[[ React
--react
--react=tailwind
--react=shadcn
--]]
File renamed without changes.
+137
View File
@@ -0,0 +1,137 @@
return {
--[[ =====================================================================
template: main (entrypoint)
file: main.c
target: src/main.c
===================================================================== --]]
main = vim.trim([=[
#include <stdio.h>
int
main()
{
char* str = "hello world";
printf("%s\n", str);
return 0;
}
]=]) .. "\n",
--[[ =====================================================================
template: clang-format (code formatter)
file: .clang-format
target: .clang-format
===================================================================== --]]
format = vim.trim([=[
---
basedonstyle: google
standard: latest
usetab: always
tabwidth: 8
indentwidth: 8
breakbeforebraces: allman
spacebeforecpp11bracedlist: true
separatedefinitionblocks: always
cpp11bracedliststyle: false
breakafterreturntype: toplevel
reflowcomments: always
allowshortfunctionsonasingleline: all
allowshortifstatementsonasingleline: allifsandelse
allowshortloopsonasingleline: true
indentaccessmodifiers: false # indent access specifiers by one level
accessmodifieroffset: -4 # optional: adjust offset relative to the class indentation level
indentgotolabels: innerindent
derivepointeralignment: false
pointeralignment: left
indentppdirectives: afterhash
sortincludes: casesensitive
includeblocks: preserve
]=]) .. "\n",
--[[ =====================================================================
template: cmakelists (spec / build manifest)
file: cmakelists.txt
target: cmakelists.txt
===================================================================== --]]
cmakelists = vim.trim([=[
cmake_minimum_required(version 3.16)
project(__project_name__ languages c)
set(cmake_c_standard 23)
set(cmake_c_standard_required on)
set(cmake_export_compile_commands on)
set(lib_sources
# add your other types here as you implement them:
# src/example1.c
# src/example2.c
)
if(lib_sources)
add_library(__project_name__ static ${lib_sources})
target_include_directories(__project_name__
public
${cmake_current_source_dir}/include
)
endif()
add_executable(__project_name___bin src/main.c)
set_target_properties(__project_name___bin properties output_name "__project_name__")
if(target __project_name__)
target_link_libraries(__project_name___bin private __project_name__)
endif()
]=]) .. "\n",
--[[ =====================================================================
template: header (standalone file)
file: {name}.h
target: include/{project_name}/{name}.h
===================================================================== --]]
header = vim.trim([=[
#ifndef __file_name___h
#define __file_name___h
// code
#endif /* __file_name___h */
]=]) .. "\n",
--[[ =====================================================================
template: source (standalone file)
file: {name}.c
target: src/{name}.c
===================================================================== --]]
source = vim.trim([=[
]=]) .. "\n",
--[[ =====================================================================
template: clang_tidy (linter)
file: .clang-tidy
target: .clang-tidy
===================================================================== --]]
linter = vim.trim([=[
checks: >
-*,
clang-analyzer-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-reserved-identifier,
performance-*,
security-*
readability-redundant-declaration
readability-misleading-indentation
readability-implicit-bool-conversion
misc-misplaced-const,
misc-include-cleaner
-bugprone-narrowing-conversions,
-readability-identifier-length
checkoptions:
readability-identifier-naming.variablecase: lower_case
readability-identifier-naming.functioncase: lower_case
readability-identifier-naming.structcase: lower_case
readability-identifier-naming.enumcase: camelcase
readability-identifier-naming.enumconstantcase: upper_case
readability-identifier-naming.macrodefinitioncase: upper_case
]=]) .. "\n",
}
+137
View File
@@ -0,0 +1,137 @@
return {
--[[ =====================================================================
TEMPLATE: MAIN (Entrypoint)
File: main.cpp
Target: src/main.cpp
===================================================================== --]]
main = vim.trim([=[
#include <iostream>
int
main()
{
std::string str = "Hello World";
std::cout << str << "\n";
return 0;
}
]=]) .. "\n",
--[[ =====================================================================
TEMPLATE: CLANG-FORMAT (Code formatter)
File: .clang-format
Target: .clang-format
===================================================================== --]]
format = vim.trim([=[
---
BasedOnStyle: Google
Standard: Latest
UseTab: Always
TabWidth: 8
IndentWidth: 8
BreakBeforeBraces: Allman
SpaceBeforeCpp11BracedList: true
SeparateDefinitionBlocks: Always
Cpp11BracedListStyle: false
BreakAfterReturnType: TopLevel
ReflowComments: Always
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AllowShortLoopsOnASingleLine: true
IndentAccessModifiers: false # Indent access specifiers by one level
AccessModifierOffset: -4 # Optional: adjust offset relative to the class indentation level
IndentGotoLabels: InnerIndent
DerivePointerAlignment: false
PointerAlignment: Left
IndentPPDirectives: AfterHash
SortIncludes: CaseSensitive
IncludeBlocks: Preserve
]=]) .. "\n",
--[[ =====================================================================
TEMPLATE: CMAKELISTS (Spec / Build Manifest)
File: CMakeLists.txt
Target: CMakeLists.txt
===================================================================== --]]
CmakeLists = vim.trim([=[
cmake_minimum_required(VERSION 3.16)
project(__PROJECT_NAME__ LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(LIB_SOURCES
# Add your other types here as you implement them:
# src/example1.cpp
# src/example2.cpp
)
if(LIB_SOURCES)
add_library(__PROJECT_NAME__ STATIC ${LIB_SOURCES})
target_include_directories(__PROJECT_NAME__
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
)
endif()
add_executable(__PROJECT_NAME___bin src/main.cpp)
set_target_properties(__PROJECT_NAME___bin PROPERTIES OUTPUT_NAME "__PROJECT_NAME__")
if(TARGET __PROJECT_NAME__)
target_link_libraries(__PROJECT_NAME___bin PRIVATE __PROJECT_NAME__)
endif()
]=]) .. "\n",
--[[ =====================================================================
TEMPLATE: HEADER (Standalone File)
File: {name}.hpp
Target: include/{project_name}/{name}.hpp
===================================================================== --]]
header = vim.trim([=[
#ifndef __FILE_NAME___HPP
#define __FILE_NAME___HPP
// Code
#endif /* __FILE_NAME___HPP */
]=]) .. "\n",
--[[ =====================================================================
TEMPLATE: SOURCE (Standalone File)
File: {name}.cpp
Target: src/{name}.cpp
===================================================================== --]]
source = vim.trim([=[
]=]) .. "\n",
--[[ =====================================================================
TEMPLATE: CLANG_TIDY (LINTER)
File: .clang-tidy
Target: .clang-tidy
===================================================================== --]]
linter = vim.trim([=[
Checks: >
-*,
clang-analyzer-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-reserved-identifier,
performance-*,
security-*
readability-redundant-declaration
readability-misleading-indentation
readability-implicit-bool-conversion
misc-misplaced-const,
misc-include-cleaner
-bugprone-narrowing-conversions,
-readability-identifier-length
CheckOptions:
readability-identifier-naming.VariableCase: lower_case
readability-identifier-naming.FunctionCase: lower_case
readability-identifier-naming.StructCase: lower_case
readability-identifier-naming.EnumCase: CamelCase
readability-identifier-naming.EnumConstantCase: UPPER_CASE
readability-identifier-naming.MacroDefinitionCase: UPPER_CASE
]=]) .. "\n",
}
@@ -0,0 +1,63 @@
local M = {}
---@param lang string
M.template = function(lang)
local base = [=[
.DS_Store
.vscode/
.idea/
.env
.env.*
]=]
local lang_block = {
python = vim.trim([=[
__pycache__/
build/
dist/
.venv/
env/
venv/
.pytest_cache/
]=]),
c = vim.trim([=[
build/
.cache/
]=]),
cpp = vim.trim([=[
build/
.cache/
]=]),
lua = vim.trim([=[
luac.out
]=]),
java = vim.trim([=[
bin/
*.class
*.jar
]=]),
rust = vim.trim([=[
debug
target
**/*.rs.bk
*.pdb
**/mutants.out*/
rustc-ice-*.txt
#.idea/
]=]),
go = vim.trim([=[
bin/
]=]),
}
local extra = (lang and lang_block[lang]) or ""
return base .. extra
end
return M
@@ -0,0 +1 @@
return "# Hello from your fellow README.md"
+25
View File
@@ -0,0 +1,25 @@
return {
--[[ =====================================================================
template: main (entrypoint)
file: main.go
target: main.go
===================================================================== --]]
main = vim.trim([=[
package main
import ("fmt")
func main() {
fmt.Println("Hello World")
}
]=]) .. "\n",
--[[ =====================================================================
template: source (standalone file)
file: {name}.go
target: {name}.go
===================================================================== --]]
--- Add boilder plate
source = vim.trim([=[
]=]) .. "\n",
}
+65
View File
@@ -0,0 +1,65 @@
return {
--[[ =====================================================================
TEMPLATE: MAIN (Entrypoint)
File: Main.java
Target: src/com/company/app/Main.java
===================================================================== --]]
main = vim.trim([=[
package com.__COMPANY_NAME__.__PROJECT_NAME__;
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
]=]) .. "\n",
--[[ =====================================================================
TEMPLATE: CLANG-FORMAT (Code formatter)
File: .clang-format
Target: .clang-format
===================================================================== --]]
format = vim.trim([=[
---
Language: Java
BasedOnStyle: Google
Standard: Latest
UseTab: Always
TabWidth: 8
IndentWidth: 8
BreakBeforeBraces: Allman
SeparateDefinitionBlocks: Always
BreakAfterReturnType: TopLevel
ReflowComments: Always
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AllowShortLoopsOnASingleLine: true
SortIncludes: CaseSensitive
IncludeBlocks: Preserve
]=]) .. "\n",
--[[ =====================================================================
TEMPLATE: SOURCE (Standalone File)
File: {name}.java
Target: src/com/company/app/{name}.java
===================================================================== --]]
source = vim.trim([=[
package com.__COMPANY_NAME__.__PROJECT_NAME__;
public class __FILE_NAME__ {
// Fields / Attributes
private String data;
// Constructor
public __FILE_NAME__() {
}
// Methods
public void doSomething() {
}
}
]=]) .. "\n",
}
+58
View File
@@ -0,0 +1,58 @@
return {
--[[ =====================================================================
template: main (entrypoint)
file: init.lua
target: lua/init.lua
===================================================================== --]]
main = vim.trim([=[
local M = {}
---@param opts? table
function M.setup(opts)
M.opts = opts or {}
end
return M
]=]) .. "\n",
--[[ =====================================================================
template: stylua (code formatter)
file: stylua.toml
target: stylua.toml
===================================================================== --]]
format = vim.trim([=[
# stylua.toml
# How many characters per line before wrapping
column_width = 80
# Indentation style: "Tabs" or "Spaces"
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 4
# Quote styling: "AutoPreferDouble", "AutoPreferSingle", "ForceDouble", "ForceSingle"
quote_style = "AutoPreferDouble"
# Call parentheses: "Always", "NoSingleString", "None", "Input"
# "None" removes parens when a single string/table literal is passed: fn "arg" / fn { ... }
# "Always" keeps them strictly standard: fn("arg") / fn({ ... })
call_parentheses = "Always"
# Sorting and formatting behavior
# collapse_simple_statement = "Never"
collapse_simple_statement = "Always"
]=]) .. "\n",
--[[ =====================================================================
template: source (standalone file)
file: {name}.lua
target: lua/{name}.lua
===================================================================== --]]
source = vim.trim([=[
local M = {}
return M
]=]) .. "\n",
}
+59
View File
@@ -0,0 +1,59 @@
return {
--[[ =====================================================================
TEMPLATE: MAIN (Entrypoint)
File: main.py
Target: src/{project_name}/main.py
===================================================================== --]]
main = vim.trim([=[
def main() -> None:
print("Hello from __PROJECT_NAME__!")
if __name__ == "__main__":
main()
]=]) .. "\n",
--[[ =====================================================================
TEMPLATE: INIT (Package Anchor)
File: __init__.py
Target: src/{project_name}/__init__.py
===================================================================== --]]
__init__ = vim.trim([=[
# __PROJECT_NAME__ init
__all__: list[str] = []
]=]) .. "\n",
--[[ =====================================================================
TEMPLATE: PYPROJECT (Spec / Build Manifest)
File: pyproject.toml
Target: pyproject.toml
===================================================================== --]]
pyproject = vim.trim([=[
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "__PROJECT_NAME__"
version = "0.1.0"
description = "Project __PROJECT_NAME__"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []
[project.scripts]
__PROJECT_NAME__ = "__PROJECT_NAME__.main:main"
]=]) .. "\n",
--[[ =====================================================================
TEMPLATE: MODULE (Standalone File)
File: {name}.py
Target: src/{project_name}/{name}.py
===================================================================== --]]
module = vim.trim([=[
"""
Module: __FILE_NAME__
"""
]=]) .. "\n",
}
+9
View File
@@ -0,0 +1,9 @@
return {
--[[ =====================================================================
TEMPLATE: SOURCE (Standalone File)
File: {name}.rs
Target: src/{name}.rs
===================================================================== --]]
source = vim.trim([=[
]=]) .. "\n",
}
+85
View File
@@ -0,0 +1,85 @@
---@alias TerminalModeType "split" | "float"
---@alias SplitDirection "vertical" | "horizontal"
---@alias SplitAnchorType "right" | "bottom"
---@alias VernCreateFile fun(opts: any, continue: fun(mod: VernFileLayout|nil))
---@class VernUserConfig
---@field workspace_root? string
---@field keybinds? table<string, VernKeybindItem>
---@field terminal? VernTerminalConfig | table
---@class VernKeybindItem
---@field user_command string
---@field desc string
---@field action fun(opts: VernCoreConfig)
---@class VernFloatWindowConfig
---@field padding { left: integer, right: integer, top: integer, bottom: integer }
---@field border { enabled: boolean, type: string }
---@class VernSplitWindowConfig
---@field direction SplitDirection
---@field anchor SplitAnchorType
---@field size string
---@class VernWindowConfig
---@field float VernFloatWindowConfig
---@field split VernSplitWindowConfig
---@class VernModeConfig
---@field type TerminalModeType
---@field win VernWindowConfig
---@class VernTerminalConfig
---@field mode VernModeConfig
---@class VernEnvItem
---@field author string
---@class VernCoreConfig
---@field workspace_root string
---@field env VernEnvItem
---@field keybinds table<string, VernKeybindItem>
---@field terminal VernTerminalConfig
---@class VernFileLayout
---@field path string
---@field name string
---@field kind? string
---@field kind_path? string
---@class VernExtrasLayout : VernFileLayout
---@field enabled? boolean
---@class VernLanguageTemplates
---@field project table<string, VernFileLayout>|nil
---@field file table<string, VernFileLayout>|nil
---@field extras table<string, VernExtrasLayout>|nil
---@class VernLanguageConfig
---@field root string
---@field dirs table<string, string>|nil
---@field keybinds? table<string, VernKeybindItem>
---@field templates VernLanguageTemplates
---@class VernPythonConfig : VernCoreConfig
---@field python? VernLanguageConfig
---@class VernCConfig : VernCoreConfig
---@field c? VernLanguageConfig
---@class VernCPPConfig : VernCoreConfig
---@field cpp? VernLanguageConfig
---@class VernLuaConfig : VernCoreConfig
---@field lua? VernLanguageConfig
---@class VernJavaConfig : VernCoreConfig
---@field java? VernLanguageConfig
---@class VernRustConfig : VernCoreConfig
---@field rust? VernLanguageConfig
---@class VernWebConfig : VernCoreConfig
---@field web? VernLanguageConfig
-53
View File
@@ -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: |
&copy; 2025 <a href="https://github.com/DarthMooMancer" target="_blank" rel="noopener">DarthMooMancer</a>
+21
View File
@@ -0,0 +1,21 @@
# stylua.toml
# How many characters per line before wrapping
column_width = 80
# Indentation style: "Tabs" or "Spaces"
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
# Quote styling: "AutoPreferDouble", "AutoPreferSingle", "ForceDouble", "ForceSingle"
quote_style = "AutoPreferDouble"
# Call parentheses: "Always", "NoSingleString", "None", "Input"
# "None" removes parens when a single string/table literal is passed: fn "arg" / fn { ... }
# "Always" keeps them strictly standard: fn("arg") / fn({ ... })
call_parentheses = "Always"
# Sorting and formatting behavior
# collapse_simple_statement = "Never"
collapse_simple_statement = "Always"