From 56bf4b7d11c2bc4c3dd7cef5777c599e5cb9d985 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sat, 4 Jul 2026 08:46:05 -0500 Subject: [PATCH] chore: initial project setup --- .gitmodules | 3 +++ .luarc.json | 13 +++++++++++++ .tests/vendor/plenary.nvim | 1 + LICENSE.md | 19 +++++++++++++++++++ README.md | 3 +++ lua/watchexec/init.lua | 15 +++++++++++++++ plugin/watchexec.lua | 9 +++++++++ run_tests.ps1 | 1 + tests/minimal_init.lua | 3 +++ tests/watchexec/watchexec_spec.lua | 17 +++++++++++++++++ 10 files changed, 84 insertions(+) create mode 100644 .gitmodules create mode 100644 .luarc.json create mode 160000 .tests/vendor/plenary.nvim create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 lua/watchexec/init.lua create mode 100644 plugin/watchexec.lua create mode 100644 run_tests.ps1 create mode 100644 tests/minimal_init.lua create mode 100644 tests/watchexec/watchexec_spec.lua diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..548bd62 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".tests/vendor/plenary.nvim"] + path = .tests/vendor/plenary.nvim + url = https://github.com/nvim-lua/plenary.nvim diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..281018d --- /dev/null +++ b/.luarc.json @@ -0,0 +1,13 @@ +{ + "compiler": { + "verbosity": "Information" + }, + "workspace": { + "library": [ + "$VIMRUNTIME/lua", + "${3rd}/luv/library", + "./.tests/vendor/plenary.nvim" + ] + } +} + diff --git a/.tests/vendor/plenary.nvim b/.tests/vendor/plenary.nvim new file mode 160000 index 0000000..74b06c6 --- /dev/null +++ b/.tests/vendor/plenary.nvim @@ -0,0 +1 @@ +Subproject commit 74b06c6c75e4eeb3108ec01852001636d85a932b diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..307cc61 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,19 @@ +# Copyright (c) 2026 Stevan Freeborn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a58274c --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# watchexec.nvim + +This plugin allows you to start and stop a task using watchexec and display the output of the task within Neovim. diff --git a/lua/watchexec/init.lua b/lua/watchexec/init.lua new file mode 100644 index 0000000..b09c92d --- /dev/null +++ b/lua/watchexec/init.lua @@ -0,0 +1,15 @@ +local M = {} + +M.config = { + greeting = "Hello from my plugin" +} + +function M.setup(opts) + M.config = vim.tbl_deep_extend("force", M.config, opts or {}) +end + +function M.say_hello() + print(M.config.greeting) +end + +return M diff --git a/plugin/watchexec.lua b/plugin/watchexec.lua new file mode 100644 index 0000000..c852cd0 --- /dev/null +++ b/plugin/watchexec.lua @@ -0,0 +1,9 @@ +if vim.g.loaded_watchexec then + return +end + +vim.g.loaded_watchexec = 1 + +vim.api.nvim_create_user_command("SayHello", function() + require("watchexec").say_hello() +end, {}) diff --git a/run_tests.ps1 b/run_tests.ps1 new file mode 100644 index 0000000..f3d421c --- /dev/null +++ b/run_tests.ps1 @@ -0,0 +1 @@ +nvim --headless -c "PlenaryBustedDirectory tests/watchexec/ {minimal_init = 'tests/minimal_init.lua'}" diff --git a/tests/minimal_init.lua b/tests/minimal_init.lua new file mode 100644 index 0000000..02834f6 --- /dev/null +++ b/tests/minimal_init.lua @@ -0,0 +1,3 @@ +vim.opt.runtimepath:append(".") +vim.opt.runtimepath:append(".tests/vendor/plenary.nvim") +print("Minimal init loaded successfully!") diff --git a/tests/watchexec/watchexec_spec.lua b/tests/watchexec/watchexec_spec.lua new file mode 100644 index 0000000..1c0ae9a --- /dev/null +++ b/tests/watchexec/watchexec_spec.lua @@ -0,0 +1,17 @@ +local plugin = require("watchexec") + +describe("watchexec logic", function() + before_each(function() + plugin.setup({ + greeting = "Hello Test!" + }) + end) + + it("can be required without errors", function() + assert.not_nil(plugin) + end) + + it("correctly applies user configuration", function() + assert.equals("Hello Test!", plugin.config.greeting) + end) +end)