I too use this approach and it works well.
The only thing I didn't get to work is which-key
, got a bunch of errors there. Do you use that as well @matthew.newland?
For now I just copy pasted and modified @olical his dotfiles his noremap function:
(module dotfiles.mapping
{autoload {nvim aniseed.nvim
nu aniseed.nvim.util
core aniseed.core}})
(local my-mapped-keys [])
(defn show-my-mapped-keys []
(each [_ mapped-key (pairs my-mapped-keys)]
(print (. mapped-key "from")
" "
(. mapped-key "description"))))
(defn- noremap [mode from to description]
"Sets a mapping with {:noremap true}, and adds it to the my-mapped-keys value."
(table.insert my-mapped-keys
{:mode mode
:from from
:to to
:description description})
(nvim.set_keymap mode from to {:noremap true}))
(noremap :n :<leader>wh ":let &winheight = 999<CR>" "Set window height to 999")
(noremap :n :<leader><leader> ":call ShowMyMappedKeys()<cr>" "Show my mapped keys.")
(nu.fn-bridge
:ShowMyMappedKeys
:dotfiles.mapping :show-my-mapped-keys)
So hitting <leader><leader> will show me my keybindings.
I'm kinda tempted to create a key-witch
fennel plugin now, to keep up with the sorcery theme 😛I haven't really used which-key in practice, but I've tried https://github.com/folke/which-key.nvim very briefly for my conjure/aniseed starter kit and it worked really well out of the box!
👍