mirror of
https://github.com/harivansh-afk/nvim.git
synced 2026-04-16 19:04:40 +00:00
fx
This commit is contained in:
parent
acb7a4ea8c
commit
f828dd8ff1
1 changed files with 4 additions and 10 deletions
|
|
@ -19,17 +19,14 @@ return {
|
||||||
|
|
||||||
vim.notify(string.format("Refactoring with model '%s'...", model), vim.log.levels.INFO)
|
vim.notify(string.format("Refactoring with model '%s'...", model), vim.log.levels.INFO)
|
||||||
|
|
||||||
-- Run refactor script asynchronously in the background
|
-- Run refactor script synchronously
|
||||||
-- Using nohup to detach from nvim - continues running if nvim closes
|
|
||||||
local log_file = vim.fn.expand("~/.ai/refactor-nvim.log")
|
|
||||||
local cmd = {
|
local cmd = {
|
||||||
"sh", "-c",
|
"bun", refactor_script, filepath, model
|
||||||
string.format("nohup bun %s '%s' %s >> %s 2>&1 &", refactor_script, filepath, model, log_file)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local job_id = vim.fn.jobstart(cmd, {
|
local job_id = vim.fn.jobstart(cmd, {
|
||||||
on_exit = function(_, exit_code)
|
on_exit = function(j_id, exit_code)
|
||||||
active_jobs[job_id] = nil
|
active_jobs[j_id] = nil
|
||||||
if exit_code == 0 then
|
if exit_code == 0 then
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.cmd("checktime") -- Reload file if changed
|
vim.cmd("checktime") -- Reload file if changed
|
||||||
|
|
@ -129,9 +126,6 @@ return {
|
||||||
vim.keymap.set("n", "<leader>aX", refactor_with_model("X"), {
|
vim.keymap.set("n", "<leader>aX", refactor_with_model("X"), {
|
||||||
desc = "Refactor with Grok-4 (high)"
|
desc = "Refactor with Grok-4 (high)"
|
||||||
})
|
})
|
||||||
|
|
||||||
print("AI Refactor keybindings loaded: <leader>a[gisoX] for different models")
|
|
||||||
print("Use :RefactorJobs to view active jobs, :messages to view output")
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue