fixed issues

This commit is contained in:
Jonas Widen 2025-03-16 14:52:17 +01:00
parent 1c55832ea4
commit 872005d593

View File

@ -44,6 +44,24 @@ local function update_chat_window(new_content)
return true -- Prevent the default behavior return true -- Prevent the default behavior
end end
}) })
-- Instead of creating commands, we'll use buffer-local keymaps to disable operations
local operations = {
'e', 'edit', 'w', 'write', 'sp', 'split', 'vs', 'vsplit',
'new', 'vnew', 'read', 'update', 'saveas'
}
for _, op in ipairs(operations) do
-- Disable both normal and command-line operations
vim.keymap.set('n', ':' .. op, function()
vim.notify('Operation not allowed in chat window', vim.log.levels.WARN)
end, { buffer = chat_bufnr, nowait = true })
end
-- Disable entering command-line mode
vim.keymap.set('n', ':', function()
vim.notify('Command mode disabled in chat window', vim.log.levels.WARN)
end, { buffer = chat_bufnr, nowait = true })
end end
-- Calculate dimensions -- Calculate dimensions
@ -78,18 +96,6 @@ local function update_chat_window(new_content)
chat_winnr = nil chat_winnr = nil
end, { buffer = chat_bufnr, nowait = true }) end, { buffer = chat_bufnr, nowait = true })
-- Disable common file operation commands in the chat buffer
local disabled_commands = {
'edit', 'enew', 'new', 'vnew', 'split', 'vsplit',
'read', 'write', 'update', 'saveas'
}
for _, cmd in ipairs(disabled_commands) do
vim.api.nvim_buf_create_user_command(chat_bufnr, cmd, function()
vim.notify('Command not allowed in chat window', vim.log.levels.WARN)
end, {})
end
-- Add input mapping -- Add input mapping
vim.keymap.set('n', 'i', function() vim.keymap.set('n', 'i', function()
vim.ui.input({ prompt = "Gemini: " }, function(input) vim.ui.input({ prompt = "Gemini: " }, function(input)