Skip to content

Commit

Permalink
Merge pull request #47 from Cassin01/update
Browse files Browse the repository at this point in the history
  • Loading branch information
Cassin01 authored Feb 28, 2023
2 parents 81bbe97 + c93b11b commit af4e291
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,38 @@ vim.keymap.set(
which_key({ text_insert_in_advance = "<Leader>" }),
{ noremap = true, silent = true, desc = "[wf.nvim] which-key /", }
)

-- start up which_key immediately after pressing the key.
local function timeout(ms, callback)
local uv = vim.loop
local timer = uv.new_timer()
local _callback = vim.schedule_wrap(function()
uv.timer_stop(timer)
uv.close(timer)
callback()
end)
uv.timer_start(timer, ms, 0, _callback)
end
timeout(100, function()
vim.keymap.set(
"n",
"<Leader>",
which_key({ text_insert_in_advance = "<Leader>" }),
{ noremap = true, silent = true, desc = "[wf.nvim] which-key /", }
)
end)
vim.api.nvim_create_autocmd({"BufEnter", "BufAdd"}, {
group = vim.api.nvim_create_augroup("my_wf", { clear = true }),
callback = function()
timeout(100, function()
vim.keymap.set(
"n",
"<Leader>",
which_key({ text_insert_in_advance = "<Leader>" }),
{ noremap = true, silent = true, desc = "[wf.nvim] which-key /", buffer = true })
end)
end
})
```

<!-- </details> -->
Expand Down

0 comments on commit af4e291

Please sign in to comment.