Skip to content

bug: opencode.nvim not connecting to existing opencode session #165

@ridwanyinus

Description

@ridwanyinus

Did you check docs and existing issues?

  • I have read the plugin docs
  • I have read the opencode docs
  • I have searched the existing plugin issues
  • I have searched the existing opencode issues

:checkhealth opencode output

============================================================================== opencode: 1 ❌ - ❌ ERROR No healthcheck found for "opencode" plugin.

Describe the bug

When I have an existing opencode session running, opencode.nvim starts a new session instead of connecting to the existing one.

Steps To Reproduce

Start opencode manually in Kitty terminal with command: opencode
Open Neovim from the same directory
Trigger opencode.nvim with oc
Observe: A new opencode session starts instead of connecting to existing one

Expected Behavior

According to the config documentation:
If nil, searches for an opencode process in Neovim's CWD.
I expected opencode.nvim to automatically detect and connect to my existing opencode process.

Configuration

return {
   "nickjvandyke/opencode.nvim",
   dependencies = {
      -- Recommended for `ask()` and `select()`.
      -- Required for `snacks` provider.
      ---@module 'snacks' <- Loads `snacks.nvim` types for configuration intellisense.
      { "folke/snacks.nvim", opts = { input = {}, picker = {}, terminal = {} } },
   },
   config = function()
      ---@type opencode.Opts
      vim.g.opencode_opts = {
         -- Your configuration, if any — see `lua/opencode/config.lua`, or "goto definition" on the type or field.
      }

      -- Required for `opts.events.reload`.
      vim.o.autoread = true
   end,
}

Environment

OS: linux [cachy os]
Neovim version: v0.11.5
opencode.nvim version: a13db1c
opencode version: 1.0.203
Terminal: Kitty
shell: fish

Additional info

Running ss -tlnp | grep opencode shows:

  • Manual instance (pid=364834): Port 4096
  • Plugin instance (pid=365202): Port 39801

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions