Skip to content

Commit

Permalink
perf: setup which-key inside config() and load autocmds and keymaps…
Browse files Browse the repository at this point in the history
… as normal
  • Loading branch information
folke committed Dec 31, 2022
1 parent 6dd32b5 commit 478f75c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
10 changes: 2 additions & 8 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
require("config.options")
require("config.lazy")

vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
callback = function()
require("config.autocmds")
require("config.keymaps")
end,
})
require("config.autocmds")
require("config.keymaps")
5 changes: 0 additions & 5 deletions lua/config/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,3 @@ vim.keymap.set("n", "<leader>gg", function()
},
})
end, { desc = "Lazygit" })

require("which-key").register({
f = { name = "+file" },
g = { name = "+git" },
}, { prefix = "<leader>" })
17 changes: 12 additions & 5 deletions lua/plugins/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@ return {
{
"folke/which-key.nvim",
event = "VeryLazy",
config = {
show_help = false,
plugins = { spelling = true },
key_labels = { ["<leader>"] = "SPC" },
},
config = function()
local wk = require("which-key")
wk.setup({
show_help = false,
plugins = { spelling = true },
key_labels = { ["<leader>"] = "SPC" },
})
wk.register({
f = { name = "+file" },
g = { name = "+git" },
}, { prefix = "<leader>" })
end,
},

-- git signs
Expand Down

0 comments on commit 478f75c

Please sign in to comment.