Skip to content

Commit e1f71fa

Browse files
committed
feat: make claude command configurable via config option
Allows users to customize the command used to launch Claude Code through the config.command option. Default remains 'claude' for backwards compatibility.
1 parent 9b8f3dd commit e1f71fa

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ require("claude-code").setup({
129129
git = {
130130
use_git_root = true, -- Set CWD to git root when opening Claude Code (if in git project)
131131
},
132+
-- Command settings
133+
command = "claude", -- Command used to launch Claude Code
132134
-- Keymaps
133135
keymaps = {
134136
toggle = {

lua/claude-code/config.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ local M = {}
4141
-- @field window ClaudeCodeWindow Terminal window settings
4242
-- @field refresh ClaudeCodeRefresh File refresh settings
4343
-- @field git ClaudeCodeGit Git integration settings
44+
-- @field command string Command used to launch Claude Code
4445
-- @field keymaps ClaudeCodeKeymaps Keymaps configuration
4546

4647
--- Default configuration options
@@ -65,6 +66,8 @@ M.default_config = {
6566
git = {
6667
use_git_root = true, -- Set CWD to git root when opening Claude Code (if in git project)
6768
},
69+
-- Command settings
70+
command = 'claude', -- Command used to launch Claude Code
6871
-- Keymaps
6972
keymaps = {
7073
toggle = {
@@ -140,6 +143,11 @@ local function validate_config(config)
140143
return false, 'git.use_git_root must be a boolean'
141144
end
142145

146+
-- Validate command settings
147+
if type(config.command) ~= 'string' then
148+
return false, 'command must be a string'
149+
end
150+
143151
-- Validate keymaps settings
144152
if type(config.keymaps) ~= 'table' then
145153
return false, 'keymaps config must be a table'

lua/claude-code/terminal.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ function M.toggle(claude_code, config, git)
6262
vim.cmd('resize ' .. math.floor(vim.o.lines * config.window.height_ratio))
6363

6464
-- Determine if we should use the git root directory
65-
local cmd = 'terminal claude'
65+
local cmd = 'terminal ' .. config.command
6666
if config.git and config.git.use_git_root then
6767
local git_root = git.get_git_root()
6868
if git_root then
69-
cmd = 'terminal claude --cwd ' .. git_root
69+
cmd = 'terminal ' .. config.command .. ' --cwd ' .. git_root
7070
end
7171
end
7272

0 commit comments

Comments
 (0)