Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Digit keys in normal mode act as universal-argument without needing C-u #590

Open
spacelike opened this issue May 4, 2024 · 1 comment

Comments

@spacelike
Copy link

Requesting a feature for digit keys in normal mode to automatically act as universal-arguments, without needing to press C-u first.

For example, assuming the "j" key is mapped to move cursor down 1 line in normal mode (meow-next function), you can then move down 10 lines by typing "C-u 1 0 j".
My suggestion would allow you to move down 10 lines by simply typing "1 0 j" in normal mode.

I've already been testing this for a while in my own meow config with the following:

(defun my-meow-digit ( digit )
  (interactive)
  (if (not (and meow--expand-nav-function
                (region-active-p)
                (meow--selection-type)))
      (progn
        (universal-argument)
        (meow-digit-argument))
    (meow-expand digit)))

And then bind the number keys to it as follows:

(meow-normal-define-key
 '("1" . (lambda () (interactive) (my-meow-digit 1)))
  ("2" . (lambda () (interactive) (my-meow-digit 2)))
  ;; And so on...

It seems to work great and I haven't noticed any issues or conflicts with anything. It's very useful and I can't think of any reason not to have such a feature built-in to meow.
Of course there's probably a better way to build it into meow directly, such as modifying the meow-expand function or adding a var so this feature can be enabled/disabled (in case someone doesn't want it for some reason although I can't think of any downsides).

@DogLooksGood
Copy link
Collaborator

Hey, first of all, thanks for the suggestion.

There's a simple principle in Meow that we want to avoid DWIM command. Especially for those have different behaviors when there's a selection and when there's no selection. So a digit command should only work for one form, either as prefix or as suffix, otherwise user must distinguish whether there's a selection or not.

But yes, you can mix them up to build your own command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants