Skip to content

Commit 9156d2a

Browse files
committed
feat: add configurable shell command separator
1 parent ffdf35d commit 9156d2a

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

lua/claude-code/config.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@ local M = {}
4747
-- @field verbose string|boolean Enable verbose logging with full turn-by-turn output
4848
-- Additional options can be added as needed
4949

50+
--- ClaudeCodeShell class for shell configuration
51+
-- @table ClaudeCodeShell
52+
-- @field separator string Command separator used in shell commands (e.g., '&&', ';', '|')
53+
5054
--- ClaudeCodeConfig class for main configuration
5155
-- @table ClaudeCodeConfig
5256
-- @field window ClaudeCodeWindow Terminal window settings
5357
-- @field refresh ClaudeCodeRefresh File refresh settings
5458
-- @field git ClaudeCodeGit Git integration settings
59+
-- @field shell ClaudeCodeShell Shell-specific configuration
5560
-- @field command string Command used to launch Claude Code
5661
-- @field command_variants ClaudeCodeCommandVariants Command variants configuration
5762
-- @field keymaps ClaudeCodeKeymaps Keymaps configuration
@@ -81,6 +86,10 @@ M.default_config = {
8186
use_git_root = true, -- Set CWD to git root when opening Claude Code (if in git project)
8287
multi_instance = true, -- Use multiple Claude instances (one per git root)
8388
},
89+
-- Shell-specific settings
90+
shell = {
91+
separator = '&&', -- Command separator used in shell commands
92+
},
8493
-- Command settings
8594
command = 'claude', -- Command used to launch Claude Code
8695
-- Command variants
@@ -179,6 +188,15 @@ local function validate_config(config)
179188
return false, 'git.multi_instance must be a boolean'
180189
end
181190

191+
-- Validate shell settings
192+
if type(config.shell) ~= 'table' then
193+
return false, 'shell config must be a table'
194+
end
195+
196+
if type(config.shell.separator) ~= 'string' then
197+
return false, 'shell.separator must be a string'
198+
end
199+
182200
-- Validate command settings
183201
if type(config.command) ~= 'string' then
184202
return false, 'command must be a string'

lua/claude-code/terminal.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ function M.toggle(claude_code, config, git)
149149
local git_root = git.get_git_root()
150150
if git_root then
151151
-- Use pushd/popd to change directory instead of --cwd
152-
cmd = 'terminal pushd ' .. git_root .. ' && ' .. config.command .. ' && popd'
152+
local separator = (config.shell and config.shell.separator) or config.shell.separator
153+
cmd = 'terminal pushd ' .. git_root .. ' ' .. separator .. ' ' .. config.command .. ' ' .. separator .. ' popd'
153154
end
154155
end
155156

0 commit comments

Comments
 (0)