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

S-return in file picker should open file in the background and keep the picker open with the same search query #3924

Closed
emilyyyylime opened this issue Sep 21, 2022 · 10 comments · Fixed by #4435
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@emilyyyylime
Copy link
Contributor

A lot of the time I want to open multiple files at once from the file picker and I think this small qol feature could make it easier to do so.

I would like to help write a PR to close this issue myself. Could anyone direct me as to where I should be looking to see how to make this work?

@emilyyyylime emilyyyylime added the C-enhancement Category: Improvements label Sep 21, 2022
@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label Sep 21, 2022
@A-Walrus
Copy link
Contributor

Could anyone direct me as to where I should be looking to see how to make this work?

Take a look at helix-term/src/ui/picker.rs. Specifically line 535 is where it handles Enter events.

@gavynriebau
Copy link
Contributor

gavynriebau commented Oct 5, 2022

I'd also love to see this feature added but just wanted to throw in some suggestions for how it could work:

  • Open picker, e.g. Ctrl + Space Space + / for a global search
  • For each file you want to open press Ctrl + Enter Tab.
    Rather than immediately opening the file it just marks the file(s) with an indicator such as * to show it is in the list of files to be opened
  • When finished selecting files press Enter.
    Each marked file is then opened as a new buffer and helix switches to editing the first buffer from the list.

The would enable scenarios such as searching across a codebase and editing multiple files matching a search criteria without having to repeat the search again.
(I know there is a shortcut Space + ' to open the last picker but if you open another picker, such as diagnostics picker, while editing you will lose the results from the first picker and have to search again which can be frustrating).

@Itay123TheKing I hope my idea aligns with what you were thinking but please let me know what you think.

Edit: Updated what I think keybindings should be

@emilyyyylime
Copy link
Contributor Author

@gavynriebau I was thinking of some keybind that would simply load the file in a new buffer without closing the picker, that wy you could use that keybind on every file you want to open until the last one, which you could open with normal enter and it would close the picker and focus the new buffer. This approach also aligns really well with the existing code, adding *s to the files would require changing how the picker rendering works. Although the only reason I haven't yet submitted a PR with those changes, besides being too busy, is that it would seem <C+ret> doesn't get picked up by Helix currently, might have a special meaning for the terminal? Can you think of another keybind that could work there?

@gavynriebau
Copy link
Contributor

gavynriebau commented Oct 6, 2022

@Itay123TheKing thanks, good call on Ctrl + Enter which I think often toggles terminal fullscreen.
I edited my comment above with the suggestion that rather than using Ctrl + Enter just change the meaning of tab from "next entry" to "toggle marked for opening".

The user flow would then be arrow up/down and press Tab on files they want to open and when finished press Enter to open them all.

This would have the small advantage they could mark/unmark files for editing before opening them all in case they change their mind

@the-mikedavis
Copy link
Member

<S-ret> and <C-ret> are mistakenly interpreted by the terminal as just <ret>. We could use <A-ret> or now that #3969 is in, we could repurpose <C-space>.

The checklist idea is interesting but it would take quite some work to implement. In scenarios where I want this feature, I have a file I'm interested in selected already and the file I'm really looking for still needs more typing to find. The "open in the background" idea works well for that but with checklists how do you see files that you've checked that no longer match the filter? Do they show up anyway?

@gavynriebau
Copy link
Contributor

Ah, I see what you mean and in that case opening in the background definitely makes sense.

The ability to open in the background and the "checklist" type behaviour could be separate features but in this issue perhaps we should just focus on the original idea of opening files in the background.

I think the checklist style selection approach could work well with the open in background feature but could be added later

@geometryolife
Copy link

<S-ret> and <C-ret> are mistakenly interpreted by the terminal as just <ret>. We could use <A-ret> or now that #3969 is in, we could repurpose <C-space>.

I don’t recommend using <C-space>, because some people use this to switch input methods, and I often use <C-space> on my iPad to switch input methods.

@emilyyyylime
Copy link
Contributor Author

Hey sorry for not working on this, I think I should be able to PR later today. But should we go A-ret or tab or?

@emilyyyylime
Copy link
Contributor Author

Also maybe right click should also do this?

@emilyyyylime
Copy link
Contributor Author

I hope I did this right. I decided not to implement right click because as I discovered not even left click is implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants