Skip to content

Commit e677a15

Browse files
authored
Merge pull request #5 from b0o/configurable-command
feat: make claude command configurable via config option
2 parents 153a977 + 64da5f0 commit e677a15

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ require("claude-code").setup({
112112
git = {
113113
use_git_root = true, -- Set CWD to git root when opening Claude Code (if in git project)
114114
},
115+
-- Command settings
116+
command = "claude", -- Command used to launch Claude Code
115117
-- Keymaps
116118
keymaps = {
117119
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

tests/spec/terminal_spec.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ describe('terminal module', function()
6767

6868
-- Setup test objects
6969
config = {
70+
command = 'claude',
7071
window = {
7172
position = 'botright',
7273
height_ratio = 0.5,

0 commit comments

Comments
 (0)