Documentation

Keyboard Shortcuts & Keymaps

Effective use of keyboard shortcuts can significantly improve your productivity in ThinkCode. This guide explains how to view, customize, and create your own keymaps to match your workflow.

Default Keyboard Shortcuts

ThinkCode comes with a comprehensive set of default keyboard shortcuts for common operations. Here are some essential shortcuts to get you started:

General

ActionWindows/LinuxmacOS
Command PaletteCtrl+Shift+PCmd+Shift+P
Quick OpenCtrl+PCmd+P
SettingsCtrl+,Cmd+,
SaveCtrl+SCmd+S
Save AllCtrl+K SCmd+Option+S
Close EditorCtrl+WCmd+W
Toggle Terminal`Ctrl+```Ctrl+``

Editing

ActionWindows/LinuxmacOS
CutCtrl+XCmd+X
CopyCtrl+CCmd+C
PasteCtrl+VCmd+V
UndoCtrl+ZCmd+Z
RedoCtrl+YCmd+Shift+Z
FindCtrl+FCmd+F
ReplaceCtrl+HCmd+Option+F
Multi-CursorAlt+ClickOption+Click
Format DocumentShift+Alt+FShift+Option+F

AI Features

ActionWindows/LinuxmacOS
AI Explain CodeAlt+Shift+EOption+Shift+E
Generate CodeAlt+Shift+GOption+Shift+G
Refactor with AIAlt+Shift+ROption+Shift+R
AI ChatAlt+Shift+COption+Shift+C
Context PanelAlt+Shift+XOption+Shift+X

Keymap Presets

ThinkCode includes several keymap presets to match your experience with other editors:

  • ThinkCode Default - The standard keymap
  • VS Code Compatible - For those transitioning from VS Code
  • Vim - For Vim enthusiasts
  • Emacs - For Emacs users
  • Sublime Text - For Sublime Text users
  • JetBrains IDEs - For users coming from IntelliJ, PyCharm, etc.

To change the keymap preset:

  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
  2. Search for "Preferences: Keymap"
  3. Select a preset from the dropdown menu

Customizing Keyboard Shortcuts

ThinkCode allows full customization of keyboard shortcuts to suit your workflow:

  1. Open Keyboard Shortcuts Editor:

    • Navigate to SettingsKeyboard Shortcuts
    • Or use the Command Palette to search for "Keyboard Shortcuts"
  2. Search for Commands:

    • Use the search box to find specific commands
    • Browse by category using the dropdown filter
  3. Edit a Shortcut:

    • Click on the pencil icon next to a command
    • Press the desired key combination
    • Click the checkmark to save
  4. Remove a Shortcut:

    • Click the "X" icon next to the shortcut
  5. Add a New Shortcut:

    • Click the "+" icon to add an additional binding to a command

Creating a Custom Keymap File

For advanced customization, you can create and edit your keymap file directly:

  1. Open the Command Palette and search for "Open Keyboard Shortcuts (JSON)"
  2. Edit the keybindings.json file:
[
  {
    "key": "ctrl+shift+a",
    "command": "thinkcode.aiExplain",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+shift+c",
    "command": "thinkcode.generateCode",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+k ctrl+m",
    "command": "workbench.action.toggleMaximizedPanel"
  }
]

Each keybinding consists of:

  • key: The keyboard shortcut
  • command: The command to execute
  • when: Optional context when the shortcut is active
  • args: Optional arguments for the command

Context-Aware Keybindings

ThinkCode supports context-aware keyboard shortcuts that only apply in specific situations using the when clause:

{
  "key": "ctrl+k",
  "command": "thinkcode.aiSummarize",
  "when": "editorHasSelection"
}

Common context conditions include:

  • editorFocus: When the editor has focus
  • terminalFocus: When the terminal has focus
  • editorHasSelection: When text is selected
  • aiPanelVisible: When the AI panel is visible
  • inCodeLensMode: When code lens mode is active

Chord Keybindings

You can create multi-step shortcuts (chord keybindings) for advanced workflows:

{
  "key": "ctrl+k ctrl+i",
  "command": "thinkcode.executeAiWorkflow"
}

This requires pressing Ctrl+K followed by Ctrl+I.

Language-Specific Shortcuts

Create shortcuts that only apply to specific programming languages:

{
  "key": "ctrl+shift+t",
  "command": "thinkcode.generateTest",
  "when": "editorLangId == 'typescript' || editorLangId == 'javascript'"
}

Importing and Exporting Keymaps

Share your customized keymaps with teammates or across devices:

  1. Export:

    • Command Palette → "Export Keyboard Shortcuts"
    • Save the .keymap file
  2. Import:

    • Command Palette → "Import Keyboard Shortcuts"
    • Select a .keymap file

Managing Conflicts

When keyboard shortcuts conflict:

  1. ThinkCode will highlight conflicts in the Keyboard Shortcuts editor
  2. Prioritization depends on context specificity (more specific contexts win)
  3. Use the Command Palette's "Show Conflicts" option to find and resolve issues

Best Practices

  • Focus on customizing shortcuts for your most frequent actions
  • Create a consistent mental model (e.g., use Ctrl+Shift for AI features)
  • Avoid overriding standard system shortcuts
  • Document custom shortcuts for team use
  • Periodically review and refine your keymaps

Troubleshooting

If keyboard shortcuts aren't working as expected:

  1. Check for conflicts with system-wide shortcuts
  2. Verify the context condition in the when clause
  3. Restart ThinkCode to apply complex changes
  4. Reset to default keymap and gradually add customizations
  5. Ensure extensions haven't overridden your shortcuts

For more advanced keymap customization, refer to the ThinkCode API documentation.