From 9c176e33cfb8350f2cd51450233e1d1d1de655dc Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Wed, 13 Mar 2024 12:27:36 +0100 Subject: [PATCH] timeouts better --- lua/custom/init.lua | 10 ++++++++-- lua/custom/plugins.lua | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lua/custom/init.lua b/lua/custom/init.lua index 115e432..6731ad5 100644 --- a/lua/custom/init.lua +++ b/lua/custom/init.lua @@ -30,10 +30,16 @@ opt.shiftround = true -- Round indent to multiple of 'shiftwidth' -- Timing -- === +-- NOTE: the which-key plugin makes this a little different. Instead of going +-- to a newline after "o", the which-key panel opens. Only when we input +-- something other than "o" it will go to the line and write that. I don't +-- really like this behavior. We can disable this for specific triggers. +-- See https://github.com/folke/which-key.nvim +opt.timeout = true opt.ttimeout = true -opt.timeoutlen = 500 -- Time out on mappings +opt.timeoutlen = 250 -- Time out on mappings opt.ttimeoutlen = 10 -- Time out on key codes -opt.updatetime = 500 -- Idle time to write swap and trigger CursorHold +opt.updatetime = 300 -- Idle time to write swap and trigger CursorHold -- Searching -- === diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua index 6448e09..239ac5a 100644 --- a/lua/custom/plugins.lua +++ b/lua/custom/plugins.lua @@ -101,6 +101,27 @@ local plugins = { ["w"] = { name = "+window/which" }, ["f"] = { name = "+formatting" }, }, + opts = { + triggers_nowait = { + -- marks + "`", + "'", + "g`", + "g'", + -- registers + '"', + "", + -- spelling + "z=", + }, + triggers_blacklist = { + -- list of mode / prefixes that should never be hooked by WhichKey + -- this is mostly relevant for keymaps that start with a native binding + i = { "j", "k" }, + v = { "j", "k" }, + n = { "o", "O" }, + }, + }, }, { "echasnovski/mini.trailspace",