-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Feature Description
Provide a way to set a static cwd for :ClaudeCode
command
Use Case
I use claudecode.nvim
with the new noop terminal provider, see: #90 (comment).
I run claude with claude --ide
, but I also have this setting in my config:
vim.opt.autochdir = true -- Change CWD when I open a file
So when I run :ClaudeCode
from any file, the CWD is different. Claude complains with:

Proposed Solution
have a configuration, where you can enable the CWD deducted automatically from an existing Git repository
{
"coder/claudecode.nvim",
dependencies = { "folke/snacks.nvim" },
opts = {
-- set CWD always to the git root directory
git_repo_cwd = true
},
}
Alternatives Considered
For now I created a override for my ClaudeCode command:
vim.api.nvim_create_user_command("ClaudeCode", function(opts)
-- Change to git root directory
local git_root = vim.fn.system("git rev-parse --show-toplevel 2>/dev/null"):gsub("\n", "")
if vim.v.shell_error == 0 and git_root ~= "" then
vim.cmd("cd " .. git_root)
end
-- Call the original ClaudeCode command
require("claudecode.terminal").simple_toggle({}, opts.args)
end, {
nargs = "*",
desc = "Toggle Claude Code terminal from git root"
})
Metadata
Metadata
Assignees
Labels
No labels