You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
merge: Integrate PR coder#117 with add-unsafe-command branch features
- Merged external terminal provider support from PR coder#117
- Preserved add-unsafe-command branch features (monitoring, notifications, anti-flicker)
- Combined terminal integration improvements from both branches
- Maintained backward compatibility with existing configurations
- Added mini.files integration support
- Enhanced documentation with new terminal providers and integration fixtures
- Resolved conflicts by keeping the best features from both branches
@@ -66,7 +84,7 @@ Is it about viewing CODE with syntax? use 'bat'
66
84
3.**Lock File System** (`lua/claudecode/lockfile.lua`) - Creates discovery files for Claude CLI at `~/.claude/ide/`
67
85
4.**Selection Tracking** (`lua/claudecode/selection.lua`) - Monitors text selections and sends updates to Claude
68
86
5.**Diff Integration** (`lua/claudecode/diff.lua`) - Native Neovim diff support for Claude's file comparisons
69
-
6.**Terminal Integration** (`lua/claudecode/terminal.lua`) - Manages Claude CLI terminal sessions
87
+
6.**Terminal Integration** (`lua/claudecode/terminal.lua`) - Manages Claude CLI terminal sessions with support for internal Neovim terminals and external terminal applications
70
88
7.**Session Management** (`lua/claudecode/session_manager.lua`) - Parses and manages Claude CLI session files for resume functionality
71
89
72
90
### WebSocket Server Implementation
@@ -138,6 +156,28 @@ The WebSocket server implements secure authentication using:
138
156
<leader>ax " Default key mapping for session selection
139
157
```
140
158
159
+
### Terminal Integration Options
160
+
161
+
**Internal Terminals** (within Neovim):
162
+
163
+
-**Snacks.nvim**: `terminal/snacks.lua` - Advanced terminal with floating windows
164
+
-**Native**: `terminal/native.lua` - Built-in Neovim terminal as fallback
165
+
166
+
**External Terminals** (separate applications):
167
+
168
+
-**External Provider**: `terminal/external.lua` - Launches Claude in external terminal apps
169
+
170
+
**Configuration Example**:
171
+
172
+
```lua
173
+
opts= {
174
+
terminal= {
175
+
provider="external", -- "auto", "snacks", "native", or "external"
176
+
external_terminal_cmd="alacritty -e %s" -- Required for external provider
177
+
}
178
+
}
179
+
```
180
+
141
181
### Key File Locations
142
182
143
183
-`lua/claudecode/init.lua` - Main entry point and setup
@@ -286,7 +326,36 @@ Enable detailed authentication logging by setting:
286
326
287
327
```lua
288
328
require("claudecode").setup({
289
-
log_level="debug" -- Shows auth token generation, validation, and failures
329
+
log_level="debug", -- Shows auth token generation, validation, and failures
330
+
diff_opts= {
331
+
keep_terminal_focus=true, -- If true, moves focus back to terminal after diff opens
332
+
},
333
+
})
334
+
```
335
+
336
+
### Configuration Options
337
+
338
+
#### Diff Options
339
+
340
+
The `diff_opts` configuration allows you to customize diff behavior:
341
+
342
+
-`keep_terminal_focus` (boolean, default: `false`) - When enabled, keeps focus in the Claude Code terminal when a diff opens instead of moving focus to the diff buffer. This allows you to continue using terminal keybindings like `<CR>` for accepting/rejecting diffs without accidentally triggering other mappings.
343
+
-`open_in_new_tab` (boolean, default: `false`) - Open diffs in a new tab instead of the current tab.
344
+
-`hide_terminal_in_new_tab` (boolean, default: `false`) - When opening diffs in a new tab, do not show the Claude terminal split in that new tab. The terminal remains in the original tab, giving maximum screen estate for reviewing the diff.
345
+
346
+
**Example use case**: If you frequently use `<CR>` or arrow keys in the Claude Code terminal to accept/reject diffs, enable this option to prevent focus from moving to the diff buffer where `<CR>` might trigger unintended actions.
347
+
348
+
```lua
349
+
require("claudecode").setup({
350
+
diff_opts= {
351
+
keep_terminal_focus=true, -- If true, moves focus back to terminal after diff opens
352
+
open_in_new_tab=true, -- Open diff in a separate tab
353
+
hide_terminal_in_new_tab=true, -- In the new tab, do not show Claude terminal
354
+
auto_close_on_accept=true,
355
+
show_diff_stats=true,
356
+
vertical_split=true,
357
+
open_in_current_tab=true,
358
+
},
290
359
})
291
360
```
292
361
@@ -351,7 +420,7 @@ Key configuration options available in `require("claudecode").setup({})`:
351
420
### Integration Support
352
421
353
422
- Terminal integration supports both snacks.nvim and native Neovim terminal
354
-
- Compatible with popular file explorers (nvim-tree, oil.nvim, neo-tree)
423
+
- Compatible with popular file explorers (nvim-tree, oil.nvim, neo-tree, mini.files)
355
424
- Visual selection tracking across different selection modes
356
425
357
426
### Common Troubleshooting
@@ -425,6 +494,23 @@ rg "0\.1\.0" . # Should only show CHANGELOG.md historical entries
0 commit comments