Allow user to choose which buffers are shared with Claude#23
Allow user to choose which buffers are shared with Claude#23danhorner wants to merge 3 commits intopasky:mainfrom
Conversation
When g:claude_only_send_marked_buffers is set, send only buffers that have been
previously marked. Any buffers that claude creates are automatically
marked.
Commands:
:ClaudeMarkBuffer - Mark this buffer for sending
:ClaudeToggleSendBuffer - Switch between sending marked buffers and
sending all visible buffers
:ClaudeShowMarkedbuffers - List the buffer numbers of marked buffers
Helpers:
Review which buffers are marked using
- The status region lists buffers that will be sent to claude
- Status region updates when cursor moves to a new window, which handles
events that would change the list
Small plug for this PR, which lets you select offscreen buffers and share them in the context :) If you have feedback I'm happy to revise it. |
|
Sorry I missed this! I certainly like the general idea. However, I think it would be more natural to actually control the buffers being sent by editing the Claude Chat buffer? That's how all other lines in the buffer work, they actually fully control the state, and this would be an exception. (I'm not sure if we can hook to new window / close window events to adjust the list dynamically...) (Can you also make sure you use consistent formatting? Spaces around operators, sw=2.) |
|
Great idea. Could definitely parse the status region for buffers, automatically removing them when buffer is closed. Possibly with two settings selecting buffers: Also, new to vimscript. I'll tidy the formatting. Is there a linter you recommend? |
- Per PR feedback, ClaudeMarkBuffer keeps is state in the bulleted list in the chat window.
- You can manually add/delete lines to this list. Valid lines start with
two spaces a dash, and a buffer number
- Autocommand deletes entries for buffers that are deleted
- Autocommand cleans up when claude window is deleted
- Tab handling: By default claude.vim will send buffers open in any tab
where the Claude Chat window is open


Thanks for this great plugin. I want to keep my costs down and also prevent any private information from being shared with claude. Here are two commits that add the ability to select which buffers are uploaded to claude:
ClaudeOnlySendMarkedBuffersto enable this mode and andClaudeMarkBufferto mark a buffer. AlsoClaudeShowMarkedBufferswhich lists the buffer numbers.