Update files

This commit is contained in:
Chris
2026-07-03 16:05:57 +01:00
parent fbcdd3af0c
commit 7198cb031a
6 changed files with 78 additions and 440 deletions
+14 -8
View File
@@ -16,17 +16,24 @@ end
helpers.edit_cf('h', '/lua/helpers.lua')
---@param opts? { cmd?: string }
helpers.open_term = function(opts)
opts = opts or { cmd = '' }
---@param opts? { cmd?: string, win_opts?: table, buf_opts?: table }
helpers.open_term = function(opts, buf_opts)
opts = opts or {}
local cmd = opts.cmd or ''
local win_opts = opts.win_opts
local buf_options = buf_opts or opts.buf_opts or {
bufhidden = 'wipe',
modifiable = false,
}
local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_set_option_value('bufhidden', 'wipe', { buf = buf })
vim.api.nvim_set_option_value('modifiable', false, { buf = buf })
for k, v in pairs(buf_options) do
vim.api.nvim_set_option_value(k, v, { buf = buf })
end
local height = math.ceil(vim.o.lines * 0.9)
local width = math.ceil(vim.o.columns * 0.9)
local win = vim.api.nvim_open_win(buf, true, {
local win = vim.api.nvim_open_win(buf, true, win_opts or {
style = 'minimal',
relative = 'editor',
width = width,
@@ -38,7 +45,7 @@ helpers.open_term = function(opts)
vim.api.nvim_set_current_win(win)
vim.fn.jobstart(opts.cmd, {
vim.fn.jobstart(cmd, {
term = true,
on_exit = function(_, _, _)
if vim.api.nvim_win_is_valid(win) then
@@ -154,4 +161,3 @@ end
return helpers
-- nnoremap <Leader>ev :tabedit $MYVIMRC<CR>