Skip to content

Commit 782cd56

Browse files
blink-so[bot]ThomasK33
andcommitted
chore: apply nix fmt formatting
- Format files with nix fmt as per project requirements - All checks pass: nix fmt βœ“, make check βœ“, make test βœ“ Co-authored-by: ThomasK33 <[email protected]>
1 parent 6496440 commit 782cd56

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

β€ŽREADME.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ That's it! For more configuration options, see [Advanced Setup](#advanced-setup)
6262
## Usage
6363

6464
1. **Launch Claude**: Run `:ClaudeCode` to open Claude in a split terminal
65-
2. **Send context**:
65+
2. **Send context**:
6666
- Select text in visual mode and use `<leader>as` to send it to Claude
6767
- In `nvim-tree` or `neo-tree`, press `<leader>as` on a file to add it to Claude's context
6868
3. **Let Claude work**: Claude can now:
@@ -80,12 +80,14 @@ That's it! For more configuration options, see [Advanced Setup](#advanced-setup)
8080
### Tree Integration
8181

8282
The `<leader>as` keybinding has context-aware behavior:
83+
8384
- **In normal buffers (visual mode)**: Sends selected text to Claude
8485
- **In nvim-tree/neo-tree buffers**: Adds the file under cursor (or selected files) to Claude's context
8586

8687
This allows you to quickly add entire files to Claude's context for review, refactoring, or discussion.
8788

8889
#### Features:
90+
8991
- **Single file**: Place cursor on any file and press `<leader>as`
9092
- **Multiple files**: Select multiple files (using tree plugin's selection features) and press `<leader>as`
9193
- **Smart detection**: Automatically detects whether you're in nvim-tree or neo-tree

β€Žlua/claudecode/init.lua

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,28 +301,28 @@ function M._create_commands()
301301

302302
local integrations = require("claudecode.integrations")
303303
local files, error = integrations.get_selected_files_from_tree()
304-
304+
305305
if error then
306306
logger.warn("command", "ClaudeCodeTreeAdd: " .. error)
307307
vim.notify(error, vim.log.levels.WARN, { title = "ClaudeCode" })
308308
return
309309
end
310-
310+
311311
if not files or #files == 0 then
312312
logger.warn("command", "ClaudeCodeTreeAdd: No files selected")
313313
vim.notify("No files selected", vim.log.levels.WARN, { title = "ClaudeCode" })
314314
return
315315
end
316-
316+
317317
-- Send each file as an at_mention (full file, no line numbers)
318318
local success_count = 0
319319
for _, file_path in ipairs(files) do
320320
local params = {
321321
filePath = file_path,
322-
lineStart = nil, -- No line numbers for full file
323-
lineEnd = nil -- No line numbers for full file
322+
lineStart = nil, -- No line numbers for full file
323+
lineEnd = nil, -- No line numbers for full file
324324
}
325-
325+
326326
local broadcast_success = M.state.server.broadcast("at_mentioned", params)
327327
if broadcast_success then
328328
success_count = success_count + 1
@@ -331,10 +331,9 @@ function M._create_commands()
331331
logger.error("command", "ClaudeCodeTreeAdd: Failed to add file " .. file_path)
332332
end
333333
end
334-
334+
335335
if success_count > 0 then
336-
local message = success_count == 1
337-
and "Added 1 file to Claude context"
336+
local message = success_count == 1 and "Added 1 file to Claude context"
338337
or string.format("Added %d files to Claude context", success_count)
339338
vim.notify(message, vim.log.levels.INFO, { title = "ClaudeCode" })
340339
else

β€Žlua/claudecode/integrations.lua

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local logger = require("claudecode.logger")
1111
--- @return string|nil error Error message if operation failed
1212
function M.get_selected_files_from_tree()
1313
local current_ft = vim.bo.filetype
14-
14+
1515
if current_ft == "NvimTree" then
1616
return M._get_nvim_tree_selection()
1717
elseif current_ft == "neo-tree" then
@@ -31,9 +31,9 @@ function M._get_nvim_tree_selection()
3131
logger.warn("integrations", "nvim-tree API not available")
3232
return {}, "nvim-tree not available"
3333
end
34-
34+
3535
local files = {}
36-
36+
3737
-- Check for multi-selection first (marked files)
3838
local marks = nvim_tree_api.marks.list()
3939
if marks and #marks > 0 then
@@ -48,7 +48,7 @@ function M._get_nvim_tree_selection()
4848
return files, nil
4949
end
5050
end
51-
51+
5252
-- Fall back to node under cursor
5353
local node = nvim_tree_api.tree.get_node_under_cursor()
5454
if node then
@@ -59,7 +59,7 @@ function M._get_nvim_tree_selection()
5959
return {}, "Cannot add directory to Claude context. Please select a file."
6060
end
6161
end
62-
62+
6363
return {}, "No file found under cursor"
6464
end
6565

@@ -73,15 +73,15 @@ function M._get_neotree_selection()
7373
logger.warn("integrations", "neo-tree manager not available")
7474
return {}, "neo-tree not available"
7575
end
76-
76+
7777
local state = manager.get_state("filesystem")
7878
if not state then
7979
logger.warn("integrations", "neo-tree filesystem state not available")
8080
return {}, "neo-tree filesystem state not available"
8181
end
82-
82+
8383
local files = {}
84-
84+
8585
-- Check for multi-selection first
8686
if state.tree and state.tree.get_selection then
8787
local selection = state.tree:get_selection()
@@ -98,7 +98,7 @@ function M._get_neotree_selection()
9898
end
9999
end
100100
end
101-
101+
102102
-- Fall back to current node under cursor
103103
if state.tree then
104104
local node = state.tree:get_node()
@@ -111,8 +111,8 @@ function M._get_neotree_selection()
111111
end
112112
end
113113
end
114-
114+
115115
return {}, "No file found under cursor"
116116
end
117117

118-
return M
118+
return M

0 commit comments

Comments
Β (0)