A new top-level ide/: install.sh places a hash-checked Neovim release, five third-party plugins each at one pinned commit, the LLeMbas plugin from nvim/, a generated colourscheme and a launcher, for one user and under its own NVIM_APPNAME. Built in a staging directory, started there once, then swapped in. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
41 lines
1.2 KiB
Lua
41 lines
1.2 KiB
Lua
-- One terminal at the bottom that opens and closes; what runs in it keeps running.
|
|
local M = {}
|
|
|
|
local state = { buf = nil, win = nil }
|
|
|
|
function M.toggle()
|
|
if state.win and vim.api.nvim_win_is_valid(state.win) then
|
|
vim.api.nvim_win_hide(state.win)
|
|
state.win = nil
|
|
return
|
|
end
|
|
vim.cmd("botright " .. math.max(8, math.floor(vim.o.lines * 0.3)) .. "split")
|
|
state.win = vim.api.nvim_get_current_win()
|
|
if state.buf and vim.api.nvim_buf_is_valid(state.buf) then
|
|
vim.api.nvim_win_set_buf(state.win, state.buf)
|
|
else
|
|
vim.cmd.terminal()
|
|
state.buf = vim.api.nvim_get_current_buf()
|
|
vim.bo[state.buf].buflisted = false
|
|
end
|
|
vim.wo[state.win].number = false
|
|
vim.wo[state.win].signcolumn = "no"
|
|
vim.cmd.startinsert()
|
|
end
|
|
|
|
--- Run a command of the IDE's own in a terminal split and leave its output on the screen.
|
|
function M.run(argv)
|
|
vim.cmd("botright " .. math.max(12, math.floor(vim.o.lines * 0.45)) .. "new")
|
|
local buf = vim.api.nvim_get_current_buf()
|
|
vim.bo[buf].bufhidden = "wipe"
|
|
if vim.fn.has("nvim-0.11") == 1 then
|
|
vim.fn.jobstart(argv, { term = true })
|
|
else
|
|
vim.fn.termopen(argv)
|
|
end
|
|
vim.bo[buf].buflisted = false
|
|
vim.keymap.set("n", "q", "<Cmd>bwipeout!<CR>", { buffer = buf, nowait = true })
|
|
end
|
|
|
|
return M
|