fix(which-key): migrate to some new format, somewhat

This commit is contained in:
Oliver Ladner 2024-08-20 10:39:57 +02:00
commit 7467428750

View file

@ -1,39 +1,47 @@
return {
"folke/which-key.nvim",
--event = { "BufReadPre", "BufNewFile" },
--event = "VeryLazy",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 250
end,
opts = {
layout = {
height = { min = 4, max = 25 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 3, -- spacing between columns
align = "left", -- align columns left, center or right
spec = {
{ "<leader>d", group = "diagnostics" },
{ "<leader>f", group = "find shite" },
{ "<leader>g", group = "git things" },
{ "<leader>gl", desc = "git logg" },
{ "<leader>q", desc = "trouble (this buffer)" },
},
window = {
border = "none", -- none, single, double, shadow
position = "bottom", -- bottom, top
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]. When between 0 and 1, will be treated as a percentage of the screen size.
padding = { 1, 2, 1, 2 }, -- extra window padding [top, right, bottom, left]
winblend = 1, -- value between 0-100 0 for fully opaque and 100 for fully transparent
zindex = 1000, -- positive value to position WhichKey above other floating windows.
},
defaults = {
mode = { "n", "v" },
["<leader>d"] = { name = "diagnostics" },
["<leader>f"] = { name = "find shit" },
["<leader>g"] = { name = "git" },
["<leader>gl"] = { name = "git log" },
["<leader>q"] = { name = "trouble this buffer" },
["<leader>Q"] = { name = "trouble all buffers" },
notify = false, -- disable warnings for mappings
win = {
wo = {
winblend = 15,
},
},
expand = 3, -- expand groups when <= n mappings
},
config = function(_, opts)
local wk = require("which-key")
wk.setup(opts)
wk.register(opts.defaults)
--wk.register(opts.defaults)
wk.register(opts.spec)
--wk.add({
-- { "<leader>d", group = "diagnostics" },
-- { "<leader>f", group = "find shite" },
-- { "<leader>g", group = "git things" },
-- { "<leader>gl", desc = "git logg" },
-- { "<leader>q", desc = "trouble (this buffer)" },
-- --{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find File", mode = "n" },
-- {
-- "<leader>fb",
-- function()
-- print("hello")
-- end,
-- desc = "Foobar",
-- },
--})
end,
}