This commit is contained in:
2025-02-15 01:17:09 -08:00
parent c839993a25
commit f1d8f5f834
5 changed files with 197 additions and 130 deletions

View File

@@ -63,3 +63,28 @@ vim.cmd([[
-- end
-- end
-- })
local function set_timeoutlen_for_insert_mode()
if vim.bo.buftype == "terminal" or vim.bo.filetype == "codecompanion" then
vim.o.timeoutlen = 0
else
vim.o.timeoutlen = 300 -- Default timeoutlen for other buffers
end
end
-- Create an augroup for managing the autocmds
local augroup = vim.api.nvim_create_augroup("InsertModeTimeout", { clear = true })
-- Autocommand to adjust timeoutlen when entering insert mode
vim.api.nvim_create_autocmd("InsertEnter", {
group = augroup,
callback = set_timeoutlen_for_insert_mode,
})
-- Autocommand to reset timeoutlen when leaving insert mode
vim.api.nvim_create_autocmd("InsertLeave", {
group = augroup,
callback = function()
vim.o.timeoutlen = 300
end,
})