Skip to content

feat: Show filepath context in bufferline #13565

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

icorbrey
Copy link

@icorbrey icorbrey commented May 18, 2025

This change adds functionality that computes the shortest unique filepath for each document in the editor to display as the title in the bufferline, along with the appropriate configuration options.

Configuration changes

editor.bufferline has been moved to editor.bufferline.show, and a new key editor.bufferline.context has been added with the following variants:

  • "none": Don't provide any additional context in the bufferline. This maintains previous functionality.
  • "minimal": Show the shortest unique filepath for each document in the bufferline. This is the new default.

Setting the render mode directly in editor.bufferline is still supported, so existing configs won't break.

Functionality

With editor.bufferline.context = "none", the following set of documents is mapped as follows:

Path Bufferline text
book/src/editor.md editor.md
helix-term/src/ui/editor.rs editor.rs
helix-view/src/editor.rs editor.rs

With editor.bufferline.context = "minimal", the same set of documents is now mapped as follows:

Path Bufferline text
book/src/editor.md editor.md
helix-term/src/ui/editor.rs ui/editor.rs
helix-view/src/editor.rs src/editor.rs

Verification steps

  1. Set editor.bufferline.show to always.
  2. Open multiple buffers pointed at the files with the same filename.
    • Those buffers should show enough of their files' paths to be unique.
  3. Open another buffer with a different name.
    • That buffer should only show the filename.
  4. Set editor.bufferline.context to none.
    • The buffer titles should now show the filename only.

Possible additions

We could add another context variant "full" which would map documents to their full path (either from Helix's working directory or, if outside that, from the user's home directory (e.g. ~/...) or from the system root (e.g. /...).

@icorbrey icorbrey force-pushed the feat/bufferline-context branch from 99a23ae to 0676f6a Compare May 18, 2025 15:41
@icorbrey icorbrey marked this pull request as ready for review May 18, 2025 16:19
@icorbrey icorbrey force-pushed the feat/bufferline-context branch from 0676f6a to 1abbf96 Compare May 18, 2025 22:11
This change adds functionality that computes the shortest unique
filepath for each document in the editor to display as the title in the
bufferline, along with the appropriate configuration options.
@icorbrey icorbrey force-pushed the feat/bufferline-context branch from 1abbf96 to 7d43d39 Compare May 18, 2025 23:39
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

Successfully merging this pull request may close these issues.

2 participants