@@ -516,9 +516,10 @@ function M.toggle(opts_override)
516
516
local current_neovim_win_id = vim .api .nvim_get_current_win ()
517
517
518
518
if claude_term_neovim_win_id == current_neovim_win_id then
519
- close_fallback_terminal ( )
519
+ vim . api . nvim_win_hide ( claude_term_neovim_win_id )
520
520
else
521
- focus_fallback_terminal () -- This already calls startinsert
521
+ vim .api .nvim_set_current_win (claude_term_neovim_win_id )
522
+ vim .cmd (" startinsert" )
522
523
end
523
524
else
524
525
-- Check if there's an existing Claude terminal we lost track of
@@ -532,7 +533,7 @@ function M.toggle(opts_override)
532
533
-- Check if we're currently in this terminal
533
534
local current_neovim_win_id = vim .api .nvim_get_current_win ()
534
535
if existing_win == current_neovim_win_id then
535
- close_fallback_terminal ( )
536
+ vim . api . nvim_win_hide ( existing_win )
536
537
else
537
538
focus_fallback_terminal ()
538
539
end
572
573
573
574
return M
574
575
575
- --- Toggles the Claude terminal window.
576
- -- If the terminal is already open, it brings it to focus.
577
- -- If it's not open, it creates a new terminal.
578
- function M .toggle_fallback_terminal ()
579
- if is_fallback_terminal_valid () then
580
- vim .api .nvim_set_current_win (managed_fallback_terminal_winid )
581
- else
582
- local cmd_string = get_claude_command ()
583
- local env_table = { CLAUDE_TERMINAL_MODE = " true" }
584
- open_fallback_terminal (cmd_string , env_table , term_module_config )
585
- end
586
- end
0 commit comments