refactor: simplify

This commit is contained in:
2026-09-03 20:27:45 +02:00
parent 71434f947b
commit ddd0c73341
8 changed files with 147 additions and 204 deletions
+17 -16
View File
@@ -1,21 +1,6 @@
local M = {}
--- Interactive picker for selecting and running tasks defined in a Justfile.
function M.pick_just_task()
local obj = vim.system({ "just", "--summary" }, { text = true }):wait()
if obj.code ~= 0 or not obj.stdout or obj.stdout == "" then
return vim.notify("No recipes or justfile found", vim.log.levels.WARN)
end
require("mini.pick").start({
source = {
items = vim.split(vim.trim(obj.stdout), "%s+"),
name = "󱁤 Just Tasks",
choose = function(choice) run_task("just " .. choice) end,
},
})
end
--- Runs a command in an ephemeral scratch buffer.
local function run_task(cmd)
vim.notify("󰑮 Running: " .. cmd)
@@ -36,4 +21,20 @@ local function run_task(cmd)
end)
end
--- Interactive picker for standard Justfile targets.
function M.pick_just_task()
local obj = vim.system({ "just", "--summary" }, { text = true }):wait()
if obj.code ~= 0 or not obj.stdout or obj.stdout == "" then
return vim.notify("No recipes or justfile found", vim.log.levels.WARN)
end
require("mini.pick").start({
source = {
items = vim.split(vim.trim(obj.stdout), "%s+"),
name = "󱁤 Just Tasks",
choose = function(choice) run_task("just " .. choice) end,
},
})
end
return M
+3 -2
View File
@@ -1,9 +1,10 @@
local M = {}
--- Opens a TUI application in a simple centered floating window.
--- Opens a command in a simple centered floating window.
function M.open_terminal_app(cmd)
local buf = vim.api.nvim_create_buf(false, true)
local w, h = math.floor(vim.o.columns * 0.95), math.floor(vim.o.lines * 0.95)
local w = math.floor(vim.o.columns * 0.95)
local h = math.floor(vim.o.lines * 0.95)
local win = vim.api.nvim_open_win(buf, true, {
relative = "editor",