🚀 CodeShortcuts — Reuse Code in Seconds!
CodeShortcuts is a simple and efficient VS Code extension that helps you save, manage, and reuse your personal code snippets using easy-to-remember shortcut names.
No more copying and pasting the same functions over and over! Define once, reuse forever — directly in your editor. ⚡
✨ Features
- 🔖 Add your own code snippets per language (C++, Python, Java, Javascript etc.)
- ⌨️ Insert them instantly using
@@shortcut + shortcut key
- 💾 Stores snippets locally in a JSON file (
snippets.json)
- 📁 Keeps separate versions of a snippet per language
- 🧩 Works in any file type supported by VS Code
Requirements
No external dependencies or servers required. Works fully offline.
However, for best experience:
- Ensure your VS Code has language extensions for the file types you use (
cpp, python, java, etc.)
- Node.js (only for development and packaging)
Extension Settings
This extension does not currently contribute any settings through contributes.configuration.
All functionality is accessible through:
- The Command Palette
- Keyboard shortcuts
🧠 How It Works (Step-by-Step)
📝 1. Add a New Snippet
Open the Command Palette:
Ctrl + Shift + P
Select:
CodeShortcuts: Add New Snippet
You'll be prompted to enter:
- A shortcut name (e.g.,
binarysearch)
- A language ID extension type (e.g.,
cpp, py, java, js)
A temporary file will open:
binarysearch_cpp_snippet.cpp (or .py, .java)
Paste your snippet and click Save Snippet Now from the popup.
✅ Snippet saved per language in your local snippets.json!
⚡ 2. Expand a Snippet
In your code file (e.g., .cpp, .py, .java), go to a new line and type:
@@binarysearch
Press:
Ctrl + Shift + .
The shortcut line will be replaced with your actual code snippet for that language.
🎉 You're done! Snippet inserted instantly.
♻️ 3. Update a Snippet
Command Palette →
CodeShortcuts: Update Snippet
Choose the shortcut you want to update.
A temp file opens with the current snippet.
Modify the code and click Save Snippet Now.
✅ Snippet updated immediately!
🗑️ 4. Delete a Snippet
Command Palette →
CodeShortcuts: Delete Snippet
Select the shortcut and language you want to delete.
Confirm deletion when prompted.
✅ Snippet deleted from your collection.
Each top-level key is a shortcut name, and each language variant is nested under it. This way, you can use the same shortcut across languages — it automatically detects based on your current file type.
You can:
- Manually backup this file
- Edit it directly if needed
- Share it across systems
⌨️ Default Keyboard Shortcuts
| Action |
Shortcut |
| ➕ Add Snippet |
Ctrl + Shift + P |
| ⚡ Expand Snippet |
Ctrl + Shift + . |
| ♻️ Update Snippet |
Ctrl + Shift + P |
| 🗑️ Delete Snippet |
Ctrl + Shift + P |
You can customize these keys in VS Code:
File → Preferences → Keyboard Shortcuts
🧪 Example Usage
Step 1: Save a snippet for C++
- Shortcut name:
binarysearch
- Language extension:
cpp
- Code to paste:
int binarySearch(int arr[], int l, int r, int x) {
while (l <= r) {
int m = l + (r - l) / 2;
if (arr[m] == x) return m;
if (arr[m] < x) l = m + 1;
else r = m - 1;
}
return -1;
}
Step 2: Use it
In your C++ file:
@@binarysearch
Then press:
Ctrl + Shift + .
Result:
🔁 Replaced with full snippet code instantly.
💡 Tips & Tricks
- ✅ Use the same shortcut (
binarysearch) for different languages (e.g., C++, Python, Java). The extension automatically detects the current language.
- 🔄 Backup and sync your
snippets.json file for portability.
- 🔒 All snippets are stored locally, so no internet is required.
- ⚡ Use
@@shortcutName on an empty line to trigger insertion.
- 🧪 Temporary snippet editor supports full syntax highlighting.
🚀 How It Works (with Screenshots)
➕ Step 1: Add a New Snippet
Open the Command Palette (ctrl+shift+p) and select:
CodeShortcuts: Add New Snippet

📝 Step 2: Paste Your Code
- Enter shortcut name and language.
- A temp file opens.
- Paste your snippet and press
Ctrl + S to save.

⚡ Step 3: Expand a Snippet
@@yourshortcut
The shortcut is replaced with the actual snippet for your file’s language.

♻️ Update Snippet
Select an existing shortcut → Edit → Click “Save Snippet Now”

🗑️ Delete Snippet
Choose what to remove — clean and fast

🔒 Offline & Secure
- ✅ Stored locally — nothing is uploaded
- ✅ 100% works offline
- ✅ No dependencies or tracking
Built with ❤️ by Debesh Maheshwari
Made to save you time. Open to ideas
GitHub: @debesh00800
snippets, code reuse, shortcuts, developer productivity, template, multi-language, vs code extension