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 - Add mark toggling functions #2214

Closed
ambihelical opened this issue Aug 24, 2019 · 7 comments
Closed

Feature Request - Add mark toggling functions #2214

ambihelical opened this issue Aug 24, 2019 · 7 comments

Comments

@ambihelical
Copy link
Contributor

@ambihelical ambihelical commented Aug 24, 2019

I discovered only by accident that ivy has candidate marking functionality. There are no bindings as far as I can tell and it doesn't seem to be very well documented. However, I think the defined functions are suboptimal.

It would be useful if there is a function that toggles the mark and moves to the next line. This really is the only function that should be bound since it provides the functionality of mark and unmark. Once you've marked a candidate there's no reason to stay on the same candidate since your action will apply to it anyway, so there's no need for a toggle mark without the convenience of moving to the next candidate.

abo-abo added a commit that referenced this issue Aug 25, 2019
@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Aug 25, 2019

There are no bindings as far as I can tell and it doesn't seem to be very well documented. However, I think the defined functions are suboptimal.

The marking is now documented in the manual. The marking model is made after dired, so it's very familiar to users.

It would be useful if there is a function that toggles the mark and moves to the next line

You mean outside ivy-hydra? What key binding to you suggest for that? All the good ones are already taken.

@ambihelical
Copy link
Contributor Author

@ambihelical ambihelical commented Aug 25, 2019

Thanks for the doc update. I'm not sure about the utility of using dired as a model, but I think dired could also benefit from a mark and next line functionality, marking a sequence of files isn't an uncommon thing to do. But that monster already has enough bindings.

I don't know what a good binding would be because I'm an evil user and have changed many of the ivy bindings so they work better for me. But for a default binding, I'm surprised that there is no useful emacs keybinding that you can overload because it doesn't make sense in the minibuffer environment. I use C-SPC for my personal config implementation of the feature, but that might interfere with non-evil editing, I don't know. No binding would be fine by me, the function itself could be useful to others, if there's no default binding they can bind it if they want it.

I have tried ivy-hydra, and it was useful as a crutch, but in the end found a way to have which-key show me ivy bindings when I forget (basically I duplicate all but the basic ones on the C-c prefix key), and this helps me learn key bindings over time. Ivy-hydra actually prevents this learning process.

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Aug 26, 2019

Thanks for the doc update. I'm not sure about the utility of using dired as a model, but I think dired could also benefit from a mark and next line functionality, marking a sequence of files isn't an uncommon thing to do. But that monster already has enough bindings.

It's built-in: m calls dired-mark.

I have tried ivy-hydra, and it was useful as a crutch, but in the end found a way to have
which-key show me ivy bindings when I forget (basically I duplicate all but the basic ones on the
C-c prefix key), and this helps me learn key bindings over time. Ivy-hydra actually prevents this
learning process.

Ivy-hydra is a key prefix, a modal state if you will. It's not there to duplicate functionality, it's there for bindings that don't fit into the main prefix.

In any case, the command you wanted already exists, you can bind it if you like:

(define-key ivy-minibuffer-map (kbd "C-SPC") 'ivy-mark)

I think this can be closed now.

@abo-abo abo-abo closed this as completed Aug 26, 2019
@ambihelical
Copy link
Contributor Author

@ambihelical ambihelical commented Aug 26, 2019

That's not the function I wanted. Something like this is what I had in mind:

  (defun ivy-toggle-mark-and-next-line ()
    (interactive)
    (if (ivy--marked-p)
        (ivy-unmark)
      (ivy-mark)))

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Aug 26, 2019

No problem, now you have it.

@ambihelical
Copy link
Contributor Author

@ambihelical ambihelical commented Aug 26, 2019

Apparently I've offended you in some way, that wasn't my intention. I was hoping to help make a great package a little better in a small way, its fine with me if you don't agree that it is an improvement.

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Aug 27, 2019

No offense taken, I just don't want to have an extra command in ivy.el if it's not bound to anything: these cause me more work when refactoring since I have to look up the reason why they're there. And ivy-mark serves just as well as ivy-toggle-mark-and-next-line, in my opinion.

astoff pushed a commit to astoff/swiper that referenced this issue Jan 1, 2021
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