- Notifications
You must be signed in to change notification settings - Fork35
feat: ability to pick a model when launching claude#18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -299,7 +299,7 @@ function M._create_commands() | ||
if current_mode == "v" or current_mode == "V" or current_mode == "\22" then -- \22 is CTRL-V (blockwise visual mode) | ||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "n", false) | ||
end | ||
terminal.toggle({}, nil) -- `opts.fargs` can be used for future enhancements. | ||
end, { | ||
nargs = "?", | ||
desc = "Toggle the Claude Code terminal window", | ||
@@ -323,6 +323,40 @@ function M._create_commands() | ||
"Terminal module not found. Terminal commands (ClaudeCode, ClaudeCodeOpen, ClaudeCodeClose) not registered." | ||
) | ||
end | ||
vim.api.nvim_create_user_command("ClaudeSelectModel", function() | ||
M.open_with_model() | ||
end, { | ||
desc = "Select and open Claude terminal with chosen model", | ||
}) | ||
end | ||
M.open_with_model = function() | ||
local models = { | ||
{ name = "Claude Opus 4 (Latest)", value = "claude-opus-4-20250514" }, | ||
{ name = "Claude Sonnet 4 (Latest)", value = "claude-sonnet-4-20250514" }, | ||
{ name = "Claude 3.7 Sonnet (Latest)", value = "claude-3-7-sonnet-latest" }, | ||
{ name = "Claude 3.5 Haiku (Latest)", value = "claude-3-5-haiku-latest" }, | ||
} | ||
Comment on lines +335 to +340 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Do you think we can make this a user-configurable table? | ||
vim.ui.select(models, { | ||
prompt = "Select Claude model:", | ||
format_item = function(item) | ||
return item.name | ||
end, | ||
}, function(choice) | ||
if not choice then | ||
return -- User cancelled | ||
end | ||
local terminal_ok, terminal = pcall(require, "claudecode.terminal") | ||
if not terminal_ok then | ||
vim.notify("Terminal module not available", vim.log.levels.ERROR) | ||
return | ||
end | ||
terminal.toggle({}, "--model " .. choice.value) | ||
end) | ||
end | ||
--- Get version information | ||