Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[BUG] File paths sent to Claude Code do not respect running Claude from a different CWD

未关闭
#151 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
lua
领域
cli, devtools

调研方向

使用所示的 cwd_provider 重现问题,然后跟踪 ClaudeCodeOpen、ClaudeCodeAdd % 和 ClaudeCodeSend 入口点,以及 claudecode.cwd 周围的路径处理。在 Neovim 的 CWD 与 Claude 配置的 CWD 不同时,比较发送的路径,包括首次发送的情况。完成标准是缓冲区路径和可视选择路径始终相对于 Claude 的 CWD 进行解析。

由索引模型根据 Issue 内容生成。

描述

Bug Description

When using a cwd_provider, buffer paths sent to Claude Code are relative to Neovim's CWD instead of the directory that Claude is running in.

To Reproduce

Steps to reproduce the behavior:

Use a plugin configuration similar to

require("claudecode").setup({
  terminal = {
    cwd_provider = function(ctx)
      -- Prefer repo root; fallback to file's directory
      local cwd = require("claudecode.cwd").git_root(ctx.file_dir or ctx.cwd) or ctx.file_dir or ctx.cwd
      return cwd
    end,
  },
})

Using this repository

  1. cd plugin
  2. nvim claudecode.lua
  3. Run ClaudeCodeOpen
  4. Run ClaudeCodeAdd % or make a visual selection and run ClaudeCodeSend

Note that the path sent is claudecode.lua but since Claude Code is running from the git root, it should be plugin/claudecode.lua for Claude to properly resolve it.

Oddly, sometimes, the first time I send the path it works properly but then after that the bug occurs. Not sure why but it might be linked to whether the path is calculated before or after Claude is finished opening?

Expected Behavior

The buffer path sent to Claude is relative to Claude's CWD from the cwd_provider instead of relative to Neovim's CWD.

Environment

  • Neovim version: 0.11.4
  • Claude Code CLI version: 2.0.26
  • OS: MacOS 26.0
  • Plugin version: latest git
主要语言
Lua
星标
3.1k
派生
217
PR 合并指标
30 天内没有已合并 PR

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

coder/claudecode.nvim 的其他 Issue

查看 coder/claudecode.nvim 的全部 Issue

相似的 Issue

更多 Lua Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。