jmorag / kakoune.el

A very simple simulation of the kakoune editor inside of emacs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add all default commands to appropriate mc-list

jmorag opened this issue · comments

This goes away after using the package for a while, but it's very annoying when starting out to have to stop typing to tell the editor that yes, I do want to move every cursor down a line.

Hi! I haven't tried out kakoune.el but I'm happy to see that you've used ryo-modal to implement it. I've actually written a configuration inspired by Kakoune myself, but the feature set is smaller than kakoune.el.

Anyway I've added a keyword to ryo-modal-key (and ryo-modal-keys) named :mc-all which can be used if you want to insert the RYO commands into multiple-cursors run for all list. If set to 0 it can instead be added to the commands which should only be run once. Example:

(ryo-modal-keys
 (:mc-all t)
 ("j" next-line)
 ("k" previous-line)
 ("h" backward-char)
 ("l" forward-char))

Ofcourse it can be used one-by-one too:

(ryo-modal-keys
 ("j" next-line :mc-all t)
 ("k" previous-line :mc-all t)
 ("h" backward-char :mc-all t)
 ("l" forward-char :mc-all t))

That's excellent! I'll look into integrating this ASAP. I haven't been a new user of this package in a while but I definitely remember that manually whitelisting commands for mc was annoying in the beginning, so this should be a great boon. Thanks for the functionality and for the mention in ryo's readme :) It's a testament to ryo that I was able to emulate so much of another novel editing style with so little code

@Kungsgeten for some reason the :mc-all directive only takes effect for me if I go into my init and manually evaluate (kakoune-setup-keybinds) with C-x C-e https://github.com/jmorag/.emacs.d/blob/master/init.el#L86. Any idea why that might be?

Hmm, no. I see you're using a fork of ryo-modal (if I understand straight correctly), could it be that the latest version of ryo-modal isn't loaded during the init for some reason?

I just rebased my fork off of the most recent changes in ryo-modal, so I don't think that's it. You're correct about straight btw

Just guessing here: The way mc-all works is that it populates mc/cmds-to-run-for-all and mc/cmds-to-run-once. However it does this even though multiple-cursors isn't loaded (I stole this behaviour from the lispy package). I guess what might happen is that multiple-cursors is loaded after the bindings in kakoune-setup-keybinds have already been setup, and somehow overwrites mc/cmds-to-run-for-all. Maybe I should only manipulate the variables after multiple-cursors had been loaded.