echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.45k stars 171 forks source link

Option to change what keys are mapped to fix macros #998

Closed lostl1ght closed 4 days ago

lostl1ght commented 4 days ago

Contributing guidelines

Module(s)

mini.clue

Description

Hello! I have remapped q and Q so that I don't accidentally start recording a macro when mashing q to close some windows.

vim.keymap.set('n', 'Q', 'q')
vim.keymap.set('n', 'q', '', { remap = true })

However, now I cannot record macros at all because pressing Q now throws an error:

E354: Invalid register name: '^@'

I'm guessing this is because mini.clue remaps Q.

Is it possible to add options to change what keys mini.clue maps in order to solve issues with macros?

echasnovski commented 4 days ago

Thanks for the suggestion!

The 'mini.clue' module indeed does some things with macro recording. This is done so that it is possible to use keys with triggers inside macros.

It indeed remaps @ (default key for replaying macro from some register) and Q (default key for repeating the last recorded register). Those keys are not arbitrary and are there to make replaying possible (mostly because there is no automated way to do that; see neovim/neovim#24565).

If you want your own mapping for Q instead of what 'mini.clue' does, the suggestion is to make own mapping after require('mini.clue').setup().

Closing as not planned.