Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>CodeShortcutsNew to Visual Studio Code? Get it now.
CodeShortcuts

CodeShortcuts

debeshmaheshwari

|
32 installs
| (21) | Free
Save and reuse code snippets using @@shortcut for any language (C++, Python, Java, etc.)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

🚀 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

  1. Open the Command Palette:

    Ctrl + Shift + P
    
  2. Select:

    CodeShortcuts: Add New Snippet
    
  3. You'll be prompted to enter:

    • A shortcut name (e.g., binarysearch)
    • A language ID extension type (e.g., cpp, py, java, js)
  4. A temporary file will open:

    binarysearch_cpp_snippet.cpp (or .py, .java)
    
  5. Paste your snippet and click Save Snippet Now from the popup.

✅ Snippet saved per language in your local snippets.json!


⚡ 2. Expand a Snippet

  1. In your code file (e.g., .cpp, .py, .java), go to a new line and type:

    @@binarysearch
    
  2. Press:

    Ctrl + Shift + .
    
  3. The shortcut line will be replaced with your actual code snippet for that language.

🎉 You're done! Snippet inserted instantly.


♻️ 3. Update a Snippet

  1. Command Palette →

    CodeShortcuts: Update Snippet
    
  2. Choose the shortcut you want to update.

  3. A temp file opens with the current snippet.

  4. Modify the code and click Save Snippet Now.

✅ Snippet updated immediately!


🗑️ 4. Delete a Snippet

  1. Command Palette →

    CodeShortcuts: Delete Snippet
    
  2. Select the shortcut and language you want to delete.

  3. 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

Add Snippet


📝 Step 2: Paste Your Code

  • Enter shortcut name and language.
  • A temp file opens.
  • Paste your snippet and press Ctrl + S to save.

Enter Snippet


⚡ Step 3: Expand a Snippet

  • In your code, type:
@@yourshortcut
  • Press Ctrl + Shift + .

The shortcut is replaced with the actual snippet for your file’s language.

Expand Snippet


♻️ Update Snippet

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

Update Snippet


🗑️ Delete Snippet

Choose what to remove — clean and fast

Delete Snippet


🔒 Offline & Secure

  • ✅ Stored locally — nothing is uploaded
  • ✅ 100% works offline
  • ✅ No dependencies or tracking

📬 Contact

Built with ❤️ by Debesh Maheshwari Made to save you time. Open to ideas GitHub: @debesh00800


🏷️ Tags

snippets, code reuse, shortcuts, developer productivity, template, multi-language, vs code extension

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft