From b4ca6af5d668821e26f63ba3e6dd50635d7fda37 Mon Sep 17 00:00:00 2001 From: Iron-E Date: Fri, 8 Mar 2024 14:13:20 -0500 Subject: [PATCH] fix(Mode): adapt to changes in `timeoutlen` --- lua/libmodal/Mode.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/libmodal/Mode.lua b/lua/libmodal/Mode.lua index 18d563d..3d5eebb 100644 --- a/lua/libmodal/Mode.lua +++ b/lua/libmodal/Mode.lua @@ -22,7 +22,6 @@ local HELP_CHAR = '?' local TIMEOUT = { CHAR = ' ', - LEN = vim.go.timeoutlen, SEND = function(self) vim.api.nvim_feedkeys(self.CHAR, 'nt', false) end } TIMEOUT.CHAR_NUMBER = TIMEOUT.CHAR:byte() @@ -64,8 +63,9 @@ function Mode:check_input_for_mapping() self.input_bytes = {} elseif command_type == 'table' and globals.is_true(self.timeouts_enabled) then -- the command was a table, meaning that it MIGHT match. + local timeout = vim.api.nvim_get_option_value('timeoutlen', {}) self.flush_input_timer:start( -- start the timer - TIMEOUT.LEN, 0, vim.schedule_wrap(function() + timeout, 0, vim.schedule_wrap(function() -- send input to interrupt a blocking `getchar` TIMEOUT:SEND() -- if there is a command, execute it.