Did you check docs and existing issues?
Operating system/version
Macos
:checkhealth opencode output
opencode.nvim ~ - ✅ OK nvim version: 0.11.5. - ✅ OK opencode.nvim git commit hash: dfca5bb214d78a600781d50da350238b3e6e2621. - ✅ OK vim.g.opencode_opts: {} opencode.nvim [binaries] ~ - ✅ OK opencode available with version 1.0.202. - ✅ OK curl available. - ✅ OK pgrep available: it will be used to auto-find opencode if vim.g.opencode_opts.port is not set. - ✅ OK lsof available: it will be used to auto-find opencode if vim.g.opencode_opts.port is not set. opencode.nvim [snacks] ~ - ✅ OK snacks.input is enabled: ask() will be enhanced. - ✅ OK blink.cmp is available: opts.ask.blink_cmp_sources will be registered in ask(). - ✅ OK snacks.picker is enabled: select() will be enhanced. opencode.nvim [providers] ~ - ✅ OK Configured opencode provider: snacks. - ✅ OK The snacks provider is available. - ⚠️ WARNING The kitty provider is not available — KITTY_LISTEN_ON environment variable is not set. - ADVICE: - Enable remote control in kitty. - ⚠️ WARNING The wezterm provider is not available — wezterm executable not found in $PATH. - ADVICE: - Install wezterm and ensure it's in your $PATH. - ⚠️ WARNING The tmux provider is not available — Not running inside a tmux session. - ADVICE: - Launch Neovim inside a tmux session. - ✅ OK The terminal provider is available.
Describe the bug
When opencode is launched, it uses the working directory from the moment Neovim starts (where the nvim command was executed), rather than tracking Neovim's actual current working directory. This causes a mismatch when:
- Using
nvim <folder> to open a different directory
- Navigating to a project via a dashboard plugin (like alpha-nvim, dashboard-nvim, etc.)
- Changing directories within Neovim using
:cd, :tcd, or :lcd
Steps To Reproduce
Steps to Reproduce
Scenario 1: Using dashboard
- Run
nvim from ~/ (home directory)
- Use a dashboard plugin to open a project at
~/projects/my-app
- Trigger opencode (e.g.,
:lua require("opencode").toggle())
- Expected: opencode opens in
~/projects/my-app
- Actual: opencode opens in
~/
Scenario 2: Using nvim <folder>
- From
~/, run nvim ~/projects/my-app
- Trigger opencode
- Expected: opencode opens in
~/projects/my-app
- Actual: opencode may open in
~/ (depends on timing)
Scenario 3: Changing directory after opencode starts
- Start Neovim in
~/project-a
- Trigger opencode (it correctly opens in
~/project-a)
- Use
:cd ~/project-b to change Neovim's working directory
- Try to interact with opencode
- Expected: opencode should work in
~/project-b or at least detect the mismatch
- Actual: opencode continues working in
~/project-a
Expected Behavior
expected as 'Reproduce' expected
Did you check docs and existing issues?
Operating system/version
Macos
:checkhealth opencodeoutputopencode.nvim ~ - ✅ OK⚠️ WARNING The ⚠️ WARNING The ⚠️ WARNING The
nvimversion:0.11.5. - ✅ OKopencode.nvimgit commit hash:dfca5bb214d78a600781d50da350238b3e6e2621. - ✅ OKvim.g.opencode_opts: {} opencode.nvim [binaries] ~ - ✅ OKopencodeavailable with version1.0.202. - ✅ OKcurlavailable. - ✅ OKpgrepavailable: it will be used to auto-findopencodeifvim.g.opencode_opts.portis not set. - ✅ OKlsofavailable: it will be used to auto-findopencodeifvim.g.opencode_opts.portis not set. opencode.nvim [snacks] ~ - ✅ OKsnacks.inputis enabled:ask()will be enhanced. - ✅ OKblink.cmpis available:opts.ask.blink_cmp_sourceswill be registered inask(). - ✅ OKsnacks.pickeris enabled:select()will be enhanced. opencode.nvim [providers] ~ - ✅ OK Configuredopencodeprovider:snacks. - ✅ OK Thesnacksprovider is available. -kittyprovider is not available — KITTY_LISTEN_ON environment variable is not set. - ADVICE: - Enable remote control inkitty. -weztermprovider is not available —weztermexecutable not found in$PATH. - ADVICE: - Installweztermand ensure it's in your$PATH. -tmuxprovider is not available — Not running inside atmuxsession. - ADVICE: - Launch Neovim inside atmuxsession. - ✅ OK Theterminalprovider is available.Describe the bug
When opencode is launched, it uses the working directory from the moment Neovim starts (where the
nvimcommand was executed), rather than tracking Neovim's actual current working directory. This causes a mismatch when:nvim <folder>to open a different directory:cd,:tcd, or:lcdSteps To Reproduce
Steps to Reproduce
Scenario 1: Using dashboard
nvimfrom~/(home directory)~/projects/my-app:lua require("opencode").toggle())~/projects/my-app~/Scenario 2: Using
nvim <folder>~/, runnvim ~/projects/my-app~/projects/my-app~/(depends on timing)Scenario 3: Changing directory after opencode starts
~/project-a~/project-a):cd ~/project-bto change Neovim's working directory~/project-bor at least detect the mismatch~/project-aExpected Behavior
expected as 'Reproduce' expected