Skip to content

Commit 6f3e4a5

Browse files
authored
fix(kulala-nvim): resolve bugs in keymap setup and breaking lazy loading in general (#1567)
* fix(kulala-nvim): fix lazy loading issue with definition of `on_attach` function * fix(kulala-nvim): fix incorrect usage of astrocore setup function * fix(kulala-nvim): properly setup `keys` function to not be hard coded
1 parent 2db3ee2 commit 6f3e4a5

File tree

1 file changed

+11
-8
lines changed
  • lua/astrocommunity/programming-language-support/kulala-nvim

1 file changed

+11
-8
lines changed

lua/astrocommunity/programming-language-support/kulala-nvim/init.lua

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
return {
22
"mistweaverco/kulala.nvim",
33
ft = { "http", "rest" },
4-
keys = {
5-
{ "<leader>r", desc = "KulalaNvim" },
6-
},
4+
keys = function(_, keys)
5+
local plugin = require("lazy.core.config").spec.plugins["kulala.nvim"]
6+
local opts = require("lazy.core.plugin").values(plugin, "opts", false) -- resolve mini.clue options
7+
if opts.global_keymaps_prefix then table.insert(keys, { opts.global_keymaps_prefix, desc = "Load KulalaNvim" }) end
8+
return keys
9+
end,
710
dependencies = {
811
{
912
"nvim-treesitter/nvim-treesitter",
@@ -24,16 +27,16 @@ return {
2427
opts = {
2528
global_keymaps = true,
2629
global_keymaps_prefix = "<leader>r",
27-
lsp = { on_attach = require("astrolsp").on_attach },
30+
lsp = { on_attach = function(...) return require("astrolsp").on_attach(...) end },
2831
},
2932
config = function(_, opts)
3033
require("kulala").setup(opts)
31-
require("astrocore").setup {
32-
mappings = {
34+
if opts.global_keymaps_prefix then
35+
require("astrocore").set_mappings {
3336
n = {
3437
[opts.global_keymaps_prefix] = { desc = require("astroui").get_icon("KulalaNvim", 1, true) .. "KulalaNvim" },
3538
},
36-
},
37-
}
39+
}
40+
end
3841
end,
3942
}

0 commit comments

Comments
 (0)