god-mode icon indicating copy to clipboard operation
god-mode copied to clipboard

Only assume "C-"-prefix for the first part of a command sequence

Open mattiasb opened this issue 10 years ago • 9 comments

Most keybindings I use (standard and nonstandard) are in the following form: C-c₁ c₂ c₃ c₄ … That is, only the first part of the command demands me holding down Ctrl.

I would love to be able to tell god-mode to skip Ctrl (like it does now) but only for the first part of a command sequence and then instead force me to actually use Ctrl (or space?) in the few places where Ctrl is needed for more than the first part of a sequence.

Or by example:

Current god-mode

rectangle-kill: x SPC r SPC k split-window-below: x SPC 2 insert-register: x SPC r SPC i find-file: xf save-buffer: xs

god-mode with my proposed setting

rectangle-kill: xrk split-window-below: x2 insert-register: xri find-file: x C-f or x SPC f save-buffer: x C-s or x SPC s

I understand that find-file and save-buffer are very common commands, but you can easily swap those two with set-fill-column and save-some-buffers with a modified keybinding. My experience tells me that the number of keybindings I'd want to change would be fewer this way (meaning less configuration).

Hope this makes sense, and thanks for a cool project!

mattiasb avatar Apr 07 '15 20:04 mattiasb

Correction:

Current god-mode

rectangle-kill: x SPC rk split-window-below: x2 insert-register: x SPC ri find-file: xf save-buffer: xs

IME commands that require SPC are rare by comparison to the vast number of basic commands that are C-a C-b. Are you sure this would be a real benefit?

chrisdone avatar Apr 08 '15 09:04 chrisdone

(See here for the split-window-below: https://github.com/chrisdone/god-mode#nice-keybindings)

chrisdone avatar Apr 08 '15 09:04 chrisdone

We must just be using different commands a lot. :) C-x C-s and C-x C-f are the only ones I use that I can immediately think of that are on the C-a C-b-form.

And yeah I know about that split-window keybinding. And it sure make sense to rebind a few commands to fit with god-mode but for me that would be almost all commands I use on a daily basis. What I'd do if god-mode worked like I'm suggesting is to just rebind save-buffer and find-file and then be done with it.

mattiasb avatar Apr 10 '15 01:04 mattiasb

I agree with Chris re this. I use a lot of C-i C-j C-k stuff. And, since I've been using god mode for a while, my new commands also usually are in that form.

But, more importantly: how would you distinguish between a sequence of separate C- commands vs one C-initiated command sequence? For example C-e C-t C-b C-m (go to end of line, switch the two characters, go to beginning of line, insert new line) in god mode now is just etbm.

snan avatar Nov 24 '16 13:11 snan

I also use a lot of commands like C-e, C-a and C-SPC etc. And under my proposal those commands would work just like now. That is C-e C-t C-b C-m would still just be etbm.

But I also do a bunch of C-x r k, C-x 4 f and C-x ( etc. where current god-mode gives me (respectively): x SPC r SPC k, x SPC 4 SPC f and x SPC (. I would love to just type xrk, x4f and x( instead. :)

I have no idea about the technical implications of this. A while after I posted this issue I switched to control-mode instead which largely solves this issue for me (while at the same time feeling a bit more hacky :/ ).

Anyways, I'm personally totally fine with just closing this issue. If I decide to work on this I can always fork. :)

mattiasb avatar Nov 25 '16 13:11 mattiasb

I would like to draw some attention to meow. Their keypad mode is very similar to god-mode, only it infers the next key-bind. You only need to be explicit with conflicting key-binds.

I think it's a feature god-mode can benefit from.

https://github.com/meow-edit/meow/blob/master/meow-keypad.el#L366

trev-dev avatar Aug 15 '22 15:08 trev-dev

Meow borrowed this idea from a fork of god-mode. But there's also some bugs involved, so I forked and had a fix. https://github.com/DogLooksGood/god-mode

DogLooksGood avatar Nov 11 '22 19:11 DogLooksGood

But I also do a bunch of C-x r k, C-x 4 f and C-x ( etc. where current god-mode gives me (respectively): x SPC r SPC k, x SPC 4 SPC f and x SPC (. I would love to just type xrk, x4f and x( instead. :)

I want xrk to be C-x C-r C-k and x r to be C-x r

snan avatar Nov 11 '22 20:11 snan

Someone on #emacs told me about "devil-mode" which might be more what you want, @mattiasb. This difference is actually why I decided to stay with god-mode.

One thing I've been wondering is… in message-mode there's C-c RET C-e. I know that in god-mode, that works by typing c SPC RET C-e, and also I mapped C-c C-RET C-e to it so c RET e works great, but I wonder how to do the originsl sequence without a control key, i.e. how to "get back to control" after a space. Maybe it'd be fun if the space was a toggle so that foo SPC bar SPC baz would be C-f C-o C-o b a r C-b C-a C-z. Although maybe that's not idempotent enough and it should be something other than space to go in that direction.

snan avatar Nov 11 '23 18:11 snan