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

Provide a way to move several buffers back or forth #9258

Closed
jerabaul29 opened this issue Jan 6, 2024 · 10 comments
Closed

Provide a way to move several buffers back or forth #9258

jerabaul29 opened this issue Jan 6, 2024 · 10 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@jerabaul29
Copy link
Contributor

If I have several buffers open and I want to move "2 forward" I need to type :bn twice. Would it be possible to parse these commands to allow a number of "next" moves, for example :2bn, :3bn etc? Same with :bp.

@jerabaul29 jerabaul29 added the C-enhancement Category: Improvements label Jan 6, 2024
@gyreas
Copy link

gyreas commented Jan 7, 2024

That's right. Did you know you can achieve the same with gn goto-next-buffer | gp goto-previous-buffer which can take a number prefix?
Edit: I checked again, don't.

@pascalkuthe
Copy link
Member

That's right. Did you know you can achieve the same with gn goto-next-buffer | gp goto-previous-buffer which can take a number prefix? Edit: I checked again, don't.

I think adding support for count to those two commands would be a reasonable way to adress this

@gyreas
Copy link

gyreas commented Jan 8, 2024

That would make there be at least two classes of commands, profitable and non-prefixable. This is a useful feature. I will look into the implementation of move_line_*. Where should I tackle?

@woojiq
Copy link
Contributor

woojiq commented Jan 8, 2024

What's the advantage of this method instead of opening buffer picker or creating key bindings for the next|previous buffer?
UPD: I wrote this before reading Pascal's answer and didn't notice that you want to fix gn command instead of modifying :bn.

Where should I tackle?

goto_next_buffer impl: https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs#L776C1-L806C2
How to use "count": https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs#L597

@jerabaul29
Copy link
Contributor Author

Actually, I just am used to / have some muscle memory around :bn, so I think that if there is consensus on it, it would be nice to consider implementing repeats of it? :) A bit busy now, but I may have time to look into this in the future too.

@woojiq
Copy link
Contributor

woojiq commented Jan 8, 2024

If you want to modify :bn, "count" must be an argument, not a prefix, imo. This is how all typed commands work.

@jerabaul29
Copy link
Contributor Author

So you would mean :bn4 rather than :4bn? :) both are fine to me.

@woojiq
Copy link
Contributor

woojiq commented Jan 8, 2024

:bn <x> (with space), like :w <filename>. But that's from a personal point of view, I'm not core maintainer.
It would be easier for you to just change your muscle memory and use <x>gn when this is fixed.

@blinxen
Copy link
Contributor

blinxen commented Jan 20, 2024

Another useful feature would be the ability to switch to a buffer at a specific position. Instead of typing <space> + b + 3 + <enter>, you could create a key mapping to switch directly to the specified buffer. I like to use <Alt> + buffer_position, where the position starts at 1.

@pascalkuthe
Copy link
Member

closing in favor of #10400 (comment)

@pascalkuthe pascalkuthe closed this as not planned Won't fix, can't repro, duplicate, stale Apr 13, 2024
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

No branches or pull requests

6 participants