marks.nvim icon indicating copy to clipboard operation
marks.nvim copied to clipboard

keymap: use nvim api for setting keymaps

Open willnorris opened this issue 1 year ago • 2 comments

This allows setting a reasonable description for each mapping that will render nicely in plugins like which-key.

This is using the older vim.api.nvim_set_keymap function in order to retain compatibility with Neovim 0.5, as noted in the readme. If/when the minimum version were bumped to 0.7, this could be further simplified to:

vim.keymap.set("n", key, M[cmd], { desc = "marks: "..cmd:gsub("_", " ")  }) 

willnorris avatar Mar 04 '23 06:03 willnorris

I think this patch makes sense to me. I don’t really see this plugin upgrading to vim.keymap unless there’s a specific feature that it unlocks; I prefer to keep the plugin compatible with very old versions since its already pretty mature.

chentoast avatar Mar 05 '23 01:03 chentoast

yeah, I definitely don't think there is any reason to use vim.keymap here. And just to show the description change in which-key that I forgot in the original message...

before: before

after: after

willnorris avatar Mar 05 '23 03:03 willnorris