Skip to content

Commit ece7e05

Browse files
blink-so[bot]ThomasK33
andcommitted
revert: restore original ClaudeCodeSend command behavior
- Revert ClaudeCodeSend to handle visual selections as originally intended - Remove ClaudeCodeTreeAddFile and ClaudeCodeSendSelection commands - Remove integrations.lua file - Restore original keybinding configuration in README Co-authored-by: ThomasK33 <[email protected]>
1 parent 4808410 commit ece7e05

File tree

3 files changed

+3
-77
lines changed

3 files changed

+3
-77
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,8 @@ Using [lazy.nvim](https://github.com/folke/lazy.nvim):
4949
"coder/claudecode.nvim",
5050
config = true,
5151
keys = {
52-
{ "<leader>a", nil, desc = "AI/Claude Code" },
5352
{ "<leader>ac", "<cmd>ClaudeCode<cr>", desc = "Toggle Claude" },
54-
{ "<leader>av", "<cmd>ClaudeCodeSendSelection<cr>", mode = "v", desc = "Send Visual Selection" },
55-
-- Add file from nvim-tree or neo-tree
56-
{ "<leader>as", "<cmd>ClaudeCodeTreeAddFile<cr>", desc = "Send File From Tree", ft = { "NvimTree", "neo-tree" } },
53+
{ "<leader>as", "<cmd>ClaudeCodeSend<cr>", mode = "v", desc = "Send to Claude" },
5754
},
5855
}
5956
```
@@ -63,9 +60,7 @@ That's it! For more configuration options, see [Advanced Setup](#advanced-setup)
6360
## Usage
6461

6562
1. **Launch Claude**: Run `:ClaudeCode` to open Claude in a split terminal
66-
2. **Send context**:
67-
- Select text in visual mode and use `<leader>av` to send it to Claude
68-
- In `nvim-tree` or `neo-tree`, press `<leader>as` on a file to add it to the context
63+
2. **Send context**: Select text and run `:'<,'>ClaudeCodeSend` to send it to Claude
6964
3. **Let Claude work**: Claude can now:
7065
- See your current file and selections in real-time
7166
- Open files in your editor

lua/claudecode/init.lua

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -246,47 +246,6 @@ function M._create_commands()
246246
})
247247

248248
vim.api.nvim_create_user_command("ClaudeCodeSend", function(opts)
249-
if not M.state.server then
250-
logger.error("command", "ClaudeCodeSend: Claude Code integration is not running.")
251-
return
252-
end
253-
254-
local terminal = require("claudecode.terminal")
255-
local bufnr = terminal.get_active_terminal_bufnr()
256-
if not bufnr then
257-
logger.error("command", "ClaudeCodeSend: Could not find terminal buffer.")
258-
return
259-
end
260-
261-
if opts.fargs and #opts.fargs > 0 then
262-
local file_path = table.concat(opts.fargs, " ")
263-
local formatted_path = "@file " .. file_path
264-
local last_line = vim.api.nvim_buf_line_count(bufnr)
265-
vim.api.nvim_buf_set_lines(bufnr, last_line, -1, false, { formatted_path })
266-
else
267-
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
268-
local content = table.concat(lines, "\n")
269-
M.state.server.send(content)
270-
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "" })
271-
end
272-
end, {
273-
desc = "Send the content of the input buffer to Claude Code. Optionally add a file path.",
274-
nargs = "*",
275-
})
276-
277-
vim.api.nvim_create_user_command("ClaudeCodeTreeAddFile", function()
278-
local integrations = require("claudecode.integrations")
279-
local file_path = integrations.get_path_from_tree()
280-
if file_path then
281-
vim.cmd("ClaudeCodeSend " .. file_path)
282-
else
283-
logger.warn("command", "ClaudeCodeTreeAddFile: Could not determine file path from the tree.")
284-
end
285-
end, {
286-
desc = "Add the selected file from a tree explorer to the Claude Code input buffer.",
287-
})
288-
289-
vim.api.nvim_create_user_command("ClaudeCodeSendSelection", function(opts)
290249
if not M.state.server then
291250
logger.error("command", "ClaudeCodeSend: Claude Code integration is not running.")
292251
vim.notify("Claude Code integration is not running", vim.log.levels.ERROR)
@@ -333,6 +292,7 @@ function M._create_commands()
333292
range = true, -- Important: This makes the command expect a range (visual selection)
334293
})
335294

295+
336296
local terminal_ok, terminal = pcall(require, "claudecode.terminal")
337297
if terminal_ok then
338298
vim.api.nvim_create_user_command("ClaudeCode", function(_opts)

lua/claudecode/integrations.lua

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)