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

Combine mouse keys #1692

Open
pzant opened this issue Apr 22, 2024 · 6 comments
Open

Combine mouse keys #1692

pzant opened this issue Apr 22, 2024 · 6 comments

Comments

@pzant
Copy link

pzant commented Apr 22, 2024

Is it possible to combine mouse keys? I have bind : toggle, but I want use it with scroll or lkm for multiple selection, something like <m-3+m-down> :down; toggle.

@joelim-work
Copy link
Collaborator

I don't think it's supported, the closest alternative I can find is to combine mouse keys with ctrl:

map <c-m-down> :down; toggle

@pzant
Copy link
Author

pzant commented Apr 23, 2024

This makes no sense and I can't perform most actions with on hand with the mouse. So ctrl bind is not a solution.

@joelim-work
Copy link
Collaborator

Mouse support was added in #963. I don't know the history behind the change, but I'm guessing mouse events aren't stored in ui.keyAcc because then it wouldn't be possible to map it to the default behavior, which is hard-coded since unlike key events, mouse events have the position (x, y coordinates) as additional context.

@joelim-work
Copy link
Collaborator

joelim-work commented Apr 24, 2024

This makes no sense and I can't perform most actions with on hand with the mouse. So ctrl bind is not a solution.

So after looking into this further, I have come to the conclusion that this kind of use case is actually what doesn't make much sense. I'm not sure which one it is, but you are looking to trigger an action either when:

  • <m-3> and <m-down> are pressed in sequence. It would be possible to change lf to do this, but it would be tedious and impractical to use, e.g. to select 10 files you would have to press <m-3>, followed by <m-down>, followed by <m-3> again, etc., repeating this 10 times.
  • <m-3> and <m-down> are pressed simultaneously. But this is simply not how mouse events work. Unlike ctrl, <m-3> is not a key modifier and trying to press it along with <m-down> will just generate two separate events, one for each key.

If you must use a mouse for everything, then the only other suggestion I have is to use <m-3> to set a 'mode' where scrolling also selects files, something like this:

set mouse

cmd enable_scroll_select :{{
    map <m-down> :down; toggle
    map <m-up> :toggle; up
    map <m-3> disable_scroll_select
}}

cmd disable_scroll_select :{{
    map <m-down> down
    map <m-up> up
    map <m-3> enable_scroll_select
}}

# set initial mode
disable_scroll_select

@pzant
Copy link
Author

pzant commented Apr 24, 2024

@joelim-work Great solution, thanks!
But still I think that in the future it is worth adding extended mouse binding.

@joelim-work
Copy link
Collaborator

Yeah from a theoretical perspective, if it's possible to map sequences of keys (e.g. map ab for pressing a followed by b), then it should be possible to include mouse events as well (e.g. map a<m-1> for pressing a followed by mouse button 1). But I don't know how useful that would actually be in practice.

I guess this issue can be left open in case someone else is interested in this.

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