4coder»Forums»Keyboard Shortcut Chords
8 posts
Keyboard Shortcut Chords
1 year, 4 months ago Edited by McMassiveNZ on May 14, 2019, 8:14 a.m. Reason: Initial post
Hey Allen/Forum,

I want to implement some keyboard shortcuts that are a combination of multiple shortcuts. For instance Visual studio has the following shortcuts to comment out blocks of code (Ctrl+K Ctrl+C) or to format a block (Ctrl+K Ctrl+F) etc

I was just wondering if anyone has already solved this problem and would like to share the best way to do it before I dive in and start hacking something together :)

Simon Anciaux
881 posts
Keyboard Shortcut Chords
1 year, 4 months ago
You can use key maps to do that. See the modal customization layer example in the wiki.

The idea is that your first shortcut (ctrl + k) changes the key map, and the second (crtl + c) call a function in that key map and reset the key map to the default one.