feat(chat): per-tab chats#3097
Merged
Merged
Conversation
When enabled, chat buffers visible in another tab are not hidden when
opening or cycling chats in the current tab. Cycling via { / } is
scoped to chats that are either visible in the current tab or not
currently visible in any tab, so chats opened in other tabs are never
stolen.
The Toggle command jumps to the existing tab when the chat is open
elsewhere (with a notify) instead of moving the chat. The close keymap
prefers a chat that's already in or available to the current tab when
auto-opening a sibling chat after close. Chats survive tab closure and
fall back into the hidden pool, where they remain cycle-eligible from
any tab.
pertab is mutually exclusive with sticky; if both are enabled, the
sticky autocmd's callback no-ops (a warning is logged at setup) so
the chat does not follow tab switches under pertab semantics.
Includes the bufnr_available_to_current_tab helper to share the
hidden-or-current-tab availability check between cycling and the
close keymap, and extends registry.move with an optional filter so
the chat keymaps can scope cycling to current-tab + hidden entries
without changing CLI cycling behaviour.
Adds tests for:
- chat in another tab survives opening a new chat in the current tab
- close_last_chat skips chats visible in other tabs
- sticky+pertab logs a warning and chat does not follow tab switch
- closing a tab leaves its chat in the hidden pool with registry intact
9c7b938 to
65ce47f
Compare
olimorris
reviewed
May 6, 2026
olimorris
reviewed
May 6, 2026
Owner
olimorris
left a comment
There was a problem hiding this comment.
Totally up for this PR and a great suggestion. Some minor nitpicks around how Claude has inserted verbose comments. I do wonder if we can use a faster Lua function in place of vimscript though.
Owner
|
Note to self: Still need to try this out |
Contributor
Author
|
Addressed comments |
Contributor
Author
|
Let me know if you give it a try and find anything. I've been running with this for a few days and it seems to behave well - allows me to have multiple chats open at once as I multiplex different aspects of work. |
Owner
|
Great PR, thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
For a long time i've wanted to be able to open a new chat window in a different tab without closing the first. I often work in multiple tabs at once and whilst you can cycle chats in the chat window it hasn't been possible to have more than one open at a time.
This PR adds display.chat.window.pertab for tab-local chats
When enabled, chat buffers visible in another tab are not hidden when opening or cycling chats in the current tab. Cycling via { / } is scoped to chats that are either visible in the current tab or not currently visible in any tab, so chats opened in other tabs are never stolen.
The Toggle command jumps to the existing tab when the chat is open elsewhere (with a notify) instead of moving the chat. The close keymap prefers a chat that's already in or available to the current tab when auto-opening a sibling chat after close. Chats survive tab closure and fall back into the hidden pool, where they remain cycle-eligible from any tab. Ie. if a tab is closed, the same behavior as currently without per-tab chats happens, and the cycling in a separate window will cycle through the now closed chat window's tabs.
pertab is mutually exclusive with sticky; if both are enabled, the sticky autocmd's callback no-ops (a warning is logged at setup) so the chat does not follow tab switches under pertab semantics.
AI Usage
Drafted in part with claude to figure out the right interception points, design mine,
Related Issue(s)
N/a
Screenshots
N/a
Checklist
make allto ensure docs are generated, tests pass and StyLua has formatted the code