Skip to content

[BUG] focus_after_send has no effect with provider = "none" #228

@cperalt

Description

@cperalt

Bug Description

focus_after_send = true silently has no effect when terminal.provider = "none". No
warning or error is shown — the option is accepted but never fires, leaving users with
external terminal setups unable to use this feature.

To Reproduce

  1. Configure the plugin with terminal.provider = "none" and focus_after_send = true
  2. Open a file in Neovim and make a visual selection
  3. Run ClaudeCodeSend
  4. Focus remains on Neovim — Claude session is never focused

Expected Behavior

Either:

  • focus_after_send accepts a user-defined callback so external terminal users can
    implement their own focus logic, or
  • A warning is emitted when focus_after_send = true is set alongside provider = "none"
    to make it clear the option has no effect

Environment

  • Neovim version: [e.g. 0.10.0]
  • Claude Code CLI version: [e.g. latest]
  • OS: macOS
  • Plugin version: [e.g. latest]

Error Messages

No error messages — the option silently does nothing.

Additional Context

This affects any user running Claude Code in an external terminal (tmux pane, wezterm
split, etc.) rather than a managed provider. A callback-based API would make this
first-class without requiring the plugin to know about specific terminal emulators:

require("claudecode").setup({
  focus_after_send = function()
    -- user-defined focus logic
  end,
})

-- Workaround: wrap the send keymap in a Lua function that manually triggers a tmux command
after sending:

local function send_and_focus_claude()
  vim.cmd("ClaudeCodeSend")
  local pane = vim.fn.system(
    "tmux list-panes -F '#{pane_index}:#{pane_current_command}' | grep -i claude | cut -d:
-f1 | head -1 | tr -d '\n'"
  )
  if pane ~= "" then
    vim.fn.system("tmux select-pane -t " .. pane)
  end
end

{ "<leader>cs", send_and_focus_claude, mode = "v" }

-- Works but requires every external terminal user to reimplement this themselves.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions