Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Add commands for number-based buffer switching #475

Closed
tmke8 opened this issue Jul 20, 2021 · 7 comments
Closed

Add commands for number-based buffer switching #475

tmke8 opened this issue Jul 20, 2021 · 7 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@tmke8
Copy link

tmke8 commented Jul 20, 2021

I know I can switch buffers with space+b and then searching or moving up-and-down, but this still introduces some kind of mental cost for buffer switching, especially when you do it frequently. I also feel like a modern editor should show a list of the open files.

With (n)vim, both of these problems are solved by buftabline.nvim. It shows the open buffers in the "tabline" and allows switching to them with +buffer number. This allows fast access to the first 10 buffers, at almost no mental cost. (From experience I can tell you that once you get used to this, all other methods of buffer switching will feel excruciatingly slow.)

I know that keymappings in helix deliberately do not make use of the numbers, because they're farther away, but this isn't really an editing command, so I think it's fine in this case, though I don't know how you see this.

@tmke8 tmke8 added the C-enhancement Category: Improvements label Jul 20, 2021
@pickfire
Copy link
Contributor

pickfire commented Jul 21, 2021

Personally I don't like this because it waste space (I am on a 80x24 terminal). May seemed useful at times but I might still use space b for now. If it shows up only when space is pressed then I am okay with it.

@kirawi
Copy link
Member

kirawi commented Jul 21, 2021

Could be something configurable.

@kirawi kirawi added the A-helix-term Area: Helix term improvements label Aug 19, 2021
@kirawi kirawi mentioned this issue Sep 26, 2021
@antoyo
Copy link
Contributor

antoyo commented Mar 6, 2022

As an additional argument, I find this feature almost required to make any use of the commands goto_next_buffer and goto_previous_buffer as we currently have no way to know what are the next and previous buffers.

@kirawi kirawi added E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors labels Nov 10, 2022
@kirawi
Copy link
Member

kirawi commented Nov 10, 2022

As a bufferline implementation was merged a while ago, I'm marking this as a good-first-issue for the fast buffer switching shortcut.

@Elias-Graf
Copy link

Elias-Graf commented Nov 15, 2022

I have implemented the command buffer-goto here: #4756.

I've currently implemented it only as a normal, typed command. So no +<i>, nor space + <i>.

Usage: :buffer-goto <i> or :b <i>.

I've also refactored the "previous" / "next" buffer commands a bit, as there was some functional overlap, and a naming collision with the function goto_buffer(&Editor, Direction) (now named goto_buffer_by_direction).

I personally would love to see switching buffers using a shortcut like ctrl + <i>. That would match many other programs behaviour. For example browsers, some terminals (Windows terminal uses ctrl+alt + <i>, and iTerm 2 on MacOS cmd+<i>), Windows explorer, and probably a lot more I can't think of right now. Interestingly, VS Code choose ctrl + <i> as shortcut for pane (you call those "Windows") switching, and alt + <i> for tabs. That's probably why I've never used it there. Instead, I mainly utilized ctrl + tab (it cycles through the open editors).

I would be happy to implement more functionality, but I'm not really sure if that would collide with other shortcuts, nor have I figured out how to do that yet :D.

@Elias-Graf
Copy link

Update: Added shortcut support

I've now added support for shortcuts in the previously mentioned pull request. I've gone with the combinations that I was already most familiar with (see above).
One can now do: ctrl+<[1-9]> to quickly access buffers. I've already found it very nice to use, and even tried to use it while editing my fork with the upstream version, which sadly didn't work, lol.

@tmke8 tmke8 changed the title Show open (file-)buffers as a "tabline" and allow fast buffer switching with space+[0-9] Allow fast buffer switching with space+[0-9] Jun 14, 2023
@tmke8 tmke8 changed the title Allow fast buffer switching with space+[0-9] Add commands for number-based buffer switching Jun 14, 2023
@the-mikedavis the-mikedavis removed E-good-first-issue Call for participation: Issues suitable for new contributors E-easy Call for participation: Experience needed to fix: Easy / not much labels Aug 19, 2023
@DreckSallow
Copy link

Hello! I've added a PR #8198 to close this issue because it has been open for a long time.

@helix-editor helix-editor locked and limited conversation to collaborators Apr 11, 2024
@pascalkuthe pascalkuthe converted this issue into discussion #10353 Apr 11, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

7 participants