Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
docs: add snacks.explorer to supported file explorers
  • Loading branch information
andresthor committed Jul 3, 2025
commit addff9e3eb647916c61f5058c564a450871d1e90
29 changes: 29 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,33 @@ vim.api.nvim_create_autocmd("VimLeavePre", {
})
```

### 7. File Explorer Integrations (`integrations.lua`)

Unified interface for popular file explorers:

```lua
-- Supports nvim-tree, neo-tree, oil.nvim, and snacks.explorer
function M.get_selected_files_from_tree()
local current_ft = vim.bo.filetype

if current_ft == "NvimTree" then
return M._get_nvim_tree_selection()
elseif current_ft == "neo-tree" then
return M._get_neotree_selection()
elseif current_ft == "oil" then
return M._get_oil_selection()
elseif current_ft == "snacks_picker_list" then
return M._get_snacks_explorer_selection()
end
end
```

Key features across all integrations:
- **Visual mode support**: Select multiple files using vim visual mode
- **Security protection**: Filters out root-level files (`/etc/passwd`, `/usr/bin/vim`)
- **Directory handling**: Adds trailing slashes to directories for consistency
- **Fallback behavior**: Selected items → current item → error

## Module Structure

```
Expand All @@ -197,6 +224,8 @@ lua/claudecode/
│ ├── client.lua # Connection management
│ └── utils.lua # Pure Lua SHA-1, base64
├── tools/init.lua # MCP tool registry
├── integrations.lua # File explorer integrations
├── visual_commands.lua # Visual mode handling
├── diff.lua # Native diff support
├── selection.lua # Selection tracking
├── terminal.lua # Terminal management
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ When Anthropic released Claude Code, they only supported VS Code and JetBrains.
"<leader>as",
"<cmd>ClaudeCodeTreeAdd<cr>",
desc = "Add file",
ft = { "NvimTree", "neo-tree", "oil" },
ft = { "NvimTree", "neo-tree", "oil", "snacks_picker_list" },
},
-- Diff management
{ "<leader>aa", "<cmd>ClaudeCodeDiffAccept<cr>", desc = "Accept diff" },
Expand Down Expand Up @@ -80,7 +80,7 @@ That's it! The plugin will auto-configure everything else.
1. **Launch Claude**: Run `:ClaudeCode` to open Claude in a split terminal
2. **Send context**:
- Select text in visual mode and use `<leader>as` to send it to Claude
- In `nvim-tree`/`neo-tree`/`oil.nvim`, press `<leader>as` on a file to add it to Claude's context
- In `nvim-tree`/`neo-tree`/`oil.nvim`/`snacks.explorer`, press `<leader>as` on a file to add it to Claude's context
3. **Let Claude work**: Claude can now:
- See your current file and selections in real-time
- Open files in your editor
Expand Down