Copy File Content is a plugin that enhances your workflow by allowing you to quickly copy the contents of selected files and directories to the clipboard, formatted according to customizable settings.
Perfect for:
- π Sharing code snippets via chat or email
- π€ Building context for LLM apps (ChatGPT, Claude, Gemini, etc.)
- π Code reviews and documentation
- π Quickly gathering code from multiple files
- π Copy from Project Tree: Right-click files or directories in the project explorer to copy their content
- π Copy All Open Tabs: Copy content from all currently open editor tabs at once
- π VCS Integration: Copy files directly from the Git Changes/Commit window and VCS Log
- πΎ In-Memory Reading: Automatically captures unsaved changes from open files
- π Statistics: Shows file count, lines, words, and estimated tokens after copying
- π¨ Customizable Formatting: Configure headers, pre/post text, and line spacing
- π― Smart Filtering: Filter by file extension and set maximum file count limits
- β‘ Performance Options: Choose between strict memory reading or cached reading for better performance
- Open IntelliJ IDEA
- Go to Settings/Preferences > Plugins > Marketplace
- Search for "Copy File Content"
- Click Install
- Download the latest release
- Go to Settings/Preferences > Plugins > βοΈ > Install plugin from disk...
- Select the downloaded ZIP file
- Select one or more files/directories in the Project explorer
- Right-click on the selection
- Choose "Copy File Content to Clipboard"
- Content is now in your clipboard with formatted headers!
- Open multiple files in editor tabs
- Right-click on any tab
- Choose "Copy All Open Tabs Content to Clipboard"
- Enable VCS (Git, SVN, etc.)
- Make changes to files
- Open the Commit window (left sidebar or Alt+0)
- Right-click on changed files
- Choose "Copy File Content to Clipboard"
Access settings at: Settings/Preferences > Search for "Copy File Content Settings"
- Default:
// file: $FILE_PATH - Description: Template for file headers in the output
- Variables:
$FILE_PATH- relative path from project root - Example: Change to
### $FILE_PATH ###for Markdown headers
- Default: (empty)
- Description: Text added at the very beginning of the copied content
- Use case: Add context like "=== CODE CONTEXT ===" or project information
- Default: (empty)
- Description: Text added at the very end of the copied content
- Use case: Add footers or closing markers
- Default: Enabled β
- Description: Adds an empty line between each file's content for better readability
- Default: Enabled β (30 files)
- Description: Limits the maximum number of files to copy
- Purpose: Prevents excessive memory usage and clipboard overflow
- Recommendation: Keep enabled for safety
- Default: 500 KB
- Description: Sets the maximum size (in kilobytes) for individual files to be copied
- Purpose: Prevents copying very large files that could cause performance issues or memory problems
- Range: Any positive integer (recommended: 100-10,000 KB)
- Use cases:
- 500 KB (default) - Handles most source files including large CSS/JS files
- 1000 KB (1 MB) - For projects with large generated files
- 100 KB - Conservative setting for better performance with large codebases
- Note: Files larger than this limit are silently skipped and logged
- Default: Disabled
- Description: When enabled, only copies files with specified extensions
- How to use:
- Check "Enable file extension filtering"
- Click Add to add extensions
- Enter extensions like
.java,.kt,.md, etc. - Use Remove to delete unwanted filters
- Default: Enabled β (Strict mode)
- Description: Controls how the plugin reads file content
Strict Mode (Enabled):
- β Only reads from memory if file is currently open in an editor tab
- β Reads from disk if file is closed
- β More predictable behavior
- β Slightly slower for closed files
Non-Strict Mode (Disabled):
- β Reads from IntelliJ's document cache even if tab is closed
- β Better performance (avoids disk I/O)
- β Still captures unsaved changes from recently edited files
- β May read cached version instead of disk version for closed files
Recommendation: Keep strict mode enabled unless you need the extra performance and understand the caching behavior.
- Default: Enabled β
- Description: Shows a notification balloon with copy statistics
- Statistics shown:
- Number of files copied
- Total characters
- Total lines
- Total words
- Estimated token count (useful for LLM context limits)
Input: Right-click on Main.java
Output:
// file: src/Main.java
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
Settings: Header format = ### File: $FILE_PATH
Input: Select Main.java and Helper.java
Output:
### File: src/Main.java
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
### File: src/utils/Helper.java
public class Helper {
public static String format(String text) {
return text.trim();
}
}
Settings:
- Pre-text:
=== PROJECT CONTEXT === - Post-text:
=== END OF CONTEXT ===
Output:
=== PROJECT CONTEXT ===
// file: src/Main.java
[file content]
=== END OF CONTEXT ===
Scenario:
- Open
Main.javain editor - Add line:
// TODO: implement feature - Don't save (white dot on tab)
- Right-click file in project tree β Copy
Result: β Unsaved changes are included in the output!
- Java 21 or higher
- Gradle 9.0+
./gradlew buildOutput: build/distributions/Copy_File_Content-{version}.zip
./gradlew runIdeThis launches a sandboxed IntelliJ IDEA with the plugin installed for testing.
./gradlew test./gradlew koverXmlReport./gradlew verifyPluginVerifies compatibility with multiple IntelliJ IDEA versions.
Use the version update script:
./scripts/update_version.shThe script will:
- Prompt to confirm change notes are updated in
plugin.xml - Increment version (or accept custom version)
- Update
plugin.xmlandgradle.properties - Commit changes
- Build the project
- Create a git tag
- Optionally push to origin
- Update
<change-notes>insrc/main/resources/META-INF/plugin.xml - Update version in
gradle.properties - Update version in
plugin.xml - Build:
./gradlew build - Upload
build/distributions/Copy_File_Content-{version}.zipto JetBrains Marketplace
Perfect for ChatGPT, Claude, Gemini, etc.:
- Select relevant files
- Copy with one click
- Paste into LLM chat
- Token count helps manage context limits
- Select files in pull request
- Copy content
- Paste into review comments
- Include file paths automatically
- Copy code examples from multiple files
- Formatted headers make it clear which file each snippet is from
- Add custom pre/post text for context
- Copy files
- Share formatted code with teammates
- Recipients can see exactly which files the code is from
- Configurable File Size Limit: Set maximum file size (KB) for copying individual files (default 500 KB, previously hardcoded to 100 KB)
- Allows copying larger CSS, JS, and generated files
- Prevents performance issues with extremely large files
- Fully customizable in settings
- Strict Memory Reading Mode: Control whether files are read only when open in editor (strict) or from document cache (non-strict)
- VCS Integration: Copy files from VCS Changes/Commit window and VCS Log
- In-Memory File Reading: Automatically captures unsaved changes in open files
- Enhanced settings UI with "File Reading Behavior" section
- Fixed action group warnings for better IDE compatibility
- IntelliJ IDEA (Community & Ultimate)
- WebStorm
- PyCharm
- PhpStorm
- RubyMine
- CLion
- GoLand
- Rider
- Android Studio
- And all other JetBrains IDEs!
- Minimum version: IntelliJ IDEA 2022.3.3 (Build 223)
- Tested up to: IntelliJ IDEA 2025.2
- JVM: Requires Java 21 runtime (automatically provided by IDE)
- Language: Kotlin
- Build System: Gradle with IntelliJ Platform Plugin 2.x
- Plugin SDK: IntelliJ Platform SDK
This plugin is licensed under the MIT License.
- Issues: GitHub Issues
- Feature Requests: GitHub Issues
- Discussions: GitHub Discussions
Marcelo W. Guerra
- Email: [email protected]
- Website: mwguerra.com
Thank you to all contributors who have helped make this plugin better!
See the Contributors page for the full list.
Plugin based on the IntelliJ Platform Plugin Template