gabesoft / evil-mc

Multiple cursors implementation for evil-mode
MIT License
388 stars 36 forks source link

Choose default behavior for unknown commands #112

Closed ngharrison closed 3 years ago

ngharrison commented 3 years ago

First I want to say, awesome plugin, thanks for all the work.

I keep running into cases where evil-mc doesn't know a particular command and as a result performs it with only the real cursor. A specific example is org-meta-return. I've seen from #65 that new commands can be added to evil-mc-known-commands.el, but that does become cumbersome with many unknown ones. Would it be very complicated to add a default for unkown commands, similar to what is done in the multiple-cursors plugin?

gabesoft commented 3 years ago

Back when I wrote the plugin I hadn’t found an easy way to run unknown commands. There may be a way but these days I’m too busy with my day job to look into it. Pull requests are welcome though.

ngharrison commented 3 years ago

For the sake of completeness, to whoever comes across this, here is an example of how to resolve the issue:

Adding (add-to-list 'evil-mc-known-commands '(org-meta-return . ((:default . evil-mc-execute-default-call)))) to my init.el makes it now recognize that command.

This can be done for whatever command you choose. I don't know the difference between the possible functions at the end of this statement, but they do matter. Two examples of these are evil-mc-execute-default-call and evil-mc-execute-default-call-with-count.

You may need to put this in an eval-after-load block:

(eval-after-load evil-mc (add-to-list 'evil-mc-known-commands '(org-meta-return . ((:default . evil-mc-execute-default-call)))) )

Look in evil-mc-known-commands.el in the package for more examples.