CopyKit is a Visual Studio Code extension that enhances your file copying capabilities. It allows you to easily copy files and folders with right-click actions, respecting gitignore rules and applying custom filtering.
Features
Copy files and folders to a temporary file or clipboard
Support for multiple file selection
Respect .gitignore rules
Custom file type filtering
Size limit warnings for large files/folders
Option to include or exclude file paths in copied content
Dynamic context menu options based on the existence of a temporary file
Installation
Open Visual Studio Code
Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on macOS)
Search for "CopyKit"
Click Install
Usage
Copying Files or Folders
Right-click on a file or folder in the Explorer view
Select one of the following options:
"CopyKit: Copy to Temp File" (when no temp file exists)
"CopyKit: Copy to New Temp File" (when a temp file exists)
"CopyKit: Add to Existing Temp File" (when a temp file exists)
"CopyKit: Copy to Clipboard"
For multiple files, select them while holding Ctrl (or Cmd on macOS), then right-click and choose your desired CopyKit action
Configuration
CopyKit can be configured through VS Code's settings. Here are the available options:
copykit.sizeLimit: Size limit in MB for files/folders to copy without warning (default: 10)
copykit.enableCopyToTempFile: Enable temp file operations in the context menu (default: true)
copykit.enableCopyToClipboard: Enable 'Copy to Clipboard' in the context menu (default: true)
copykit.includeFilePath: Include file path at the beginning of each copied file (default: true)
copykit.respectGitignore: Respect .gitignore rules when copying (default: true)
copykit.fileTypeFiltering: File type filtering settings
mode: Filtering mode (includeAll, includeSpecified, or excludeSpecified)
include: File types to include (e.g., ['js', 'ts', 'json'])
exclude: File types or patterns to exclude (e.g., ['exe', 'dll', 'node_modules'])
To modify these settings:
Go to File > Preferences > Settings (or Code > Preferences > Settings on macOS)
Search for "CopyKit"
Adjust the settings as needed
Examples
Copying specific file types
To copy only JavaScript and TypeScript files:
Open VS Code settings
Find "CopyKit: File Type Filtering"
Set "Mode" to "includeSpecified"
Add "js" and "ts" to the "Include" array
Excluding certain directories
To exclude "node_modules" and ".git" directories:
Open VS Code settings
Find "CopyKit: File Type Filtering"
Set "Mode" to "excludeSpecified"
Add "node_modules" and ".git" to the "Exclude" array
Troubleshooting
If the CopyKit options don't appear in the context menu, ensure that copykit.enableCopyToTempFile and copykit.enableCopyToClipboard are set to true in your settings.
If files aren't being copied as expected, check your file type filtering settings and ensure that copykit.respectGitignore is set correctly.
If you don't see the "Copy to New Temp File" or "Add to Existing Temp File" options, it's because no temporary file exists yet. Use "Copy to Temp File" first to create a temporary file.
Contributing
Contributions to CopyKit are welcome! Please feel free to submit a Pull Request.