Should I see names for the Conjure sub-menus in whick-key when pressing the local leader ? (and so I need to fix my config)
Or would I need to add Conjure sub-menu labels for which-key myself?
Example screenshot: Clojure file open and pressed , local leader (there are some nvim-treesitter-sexp keys as well as conjure)
I added Conjure key mappings in my Neovim config using the add function of which-key version 3 https://github.com/practicalli/astro/blob/39bb5f18592d75113bb1f4ad09f33fc863b777dc/lua/plugins/user-practicalli.lua#L145
I add these myself as part of init() in lazy.vim config for conjure
vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('group_conjure-wk', {}),
pattern = { 'clojure', 'python', 'lua' },
callback = function(args)
local wk = require('which-key')
wk.register({
[',c'] = { name = '+connect' },
[',e'] = { name = '+evaluate' },
[',g'] = { name = '+get' },
[',l'] = { name = '+log' },
[',r'] = { name = '+refresh' },
[',s'] = { name = '+session' },
[',t'] = { name = '+test' },
[',v'] = { name = '+display' },
}, { mode = 'n', buffer = args.buf })
end,
})
To make the conjure menu names only show when using Clojure, I have move the whichkey config to after/ftplugin/clojure.lua file. Thus file is loaded when tye current buffer is set to Clojure (e.g by opening a clojure file.
This seems to be simpler approach than writing an autocmd.
https://github.com/practicalli/astro/blob/main/after%2Fftplugin%2Fclojure.lua
It could be related to a which-key bug, but https://github.com/folke/which-key.nvim/issues/476, so not sure its the same issue
I used AstroNvim as a base, so I should be able to add them to the conjure pack on AstroCommunity (the key mapping code shared seems similar) It's also very useful to understand how to do it directly with Lazy package manager, thanks.