fix: respect --resume/--continue args when terminal already exists#199
Open
paradisecy wants to merge 1 commit intocoder:mainfrom
Open
fix: respect --resume/--continue args when terminal already exists#199paradisecy wants to merge 1 commit intocoder:mainfrom
paradisecy wants to merge 1 commit intocoder:mainfrom
Conversation
When cmd_args (e.g. --resume, --continue) are passed to simple_toggle or focus_toggle, the existing terminal was reused and the args silently ignored. This made :ClaudeCode --resume only work on a fresh Neovim session. Add a force_new flag that propagates from terminal.lua to both the native and snacks providers. When force_new is true and a terminal already exists, close it first and open a fresh session with the supplied command args. Fixes the case where :ClaudeCode --resume or :ClaudeCode --continue has no effect because a previous Claude terminal is still alive in the session. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Problem
:ClaudeCode --resumeand:ClaudeCode --continueonly work on a fresh Neovim session with no prior Claude terminal. If a Claude terminal was opened earlier in the session (even if hidden),simple_toggleandfocus_togglereuse the existing terminal and silently ignore the command args.Root cause: Both
native.luaandsnacks.luaproviders check if a terminal buffer already exists. If it does, they show/hide it without ever passingcmd_stringto the terminal process — so flags like--resumeare dropped.Fix
Add a
force_newboolean parameter that propagates fromterminal.luathrough to both providers. Whenforce_newis true (i.e.cmd_argswas non-empty), the existing terminal is closed first, then a fresh session is opened with the supplied command args.Affected functions:
terminal.lua:simple_toggle,focus_toggle— setforce_new = cmd_args ~= nil and cmd_args ~= ""terminal/native.lua:simple_toggle,focus_toggle— handleforce_newterminal/snacks.lua:simple_toggle,focus_toggle— handleforce_newBehaviour after fix
:ClaudeCode --resume(terminal exists)--resume:ClaudeCode --continue(terminal exists)--continue:ClaudeCode(no args)Related
--resume/--continuefeature request, partially fixed by feat: configurable auto-close and enhanced terminal architecture #31 but only worked on fresh sessions)🤖 Generated with Claude Code