### About This userscript adds keyboard shortcuts to StackExchange comments. The default ones are: <kbd>Ctrl</kbd>+<kbd>B</kbd> (bold), <kbd>Ctrl</kbd>+<kbd>I</kbd> (italic), <kbd>Ctrl</kbd>+<kbd>K</kbd> (code), and <kbd>Ctrl</kbd>+<kbd>L</kbd> (link). You can yourself extend this with more custom <kbd>Ctrl</kbd> + <kbd>single_key</kbd> shortcuts as required (<kbd>Ctrl</kbd>+<kbd>U</kbd> can give `UNICORNselectionUNICORN` ;) ). This works in all SE site comments, as well as the chatbox on all chat.SE and chat.SO. This extension works the same way as the actual StackExchange editor works: such that pressing <kbd>Ctrl</kbd>+<kbd>B</kbd> with nothing selected inserts a placeholder (`**strong text**`), while pressing <kbd>Ctrl</kbd>+<kbd>B</kbd> with existing bold text un-boldens it. Trailing whitespaces are also handled similarly. For links, this uses the `prompt()` dialog box. It automatically prepends `http://` as a default, otherwise the inline Markdown links don't work. The only difference from the SE editor is that this userscript uses the single underscore (`_`) instead of the single asterisk (`*`) for italics as a default. This is mainly to prevent clashes between bold and italics form (and their wrapping and unwrapping) when they are nested. ###Download GitHub - [**Install link**][1] and [View source][2] ### Platform Tested on Chrome 66 (Tampermonkey) and Firefox 60 (Greasemonkey) on Windows 10 ### Notes: 1. **How to extend this with custom shortcuts?** - open the source with your local monkey and head over to around line 35 at the declaration `var WRAPPERS = ` - each wrapper uses the format: `keycode: ["placeholder", "delimiter"]` which I think is fairly straightforward - so, for the above example, just do `85: ["unicornify!", "UNICORN"]`. Also, don't forget the comma to separate this from the previous wrapper! - you can get the keycode for your key via http://keycode.info 2. This userscript differs from the [previous one][3] as: - it didn't allow custom wrappers - it didn't work the same way the SE editor does (specifically, you needed to press <kbd>Ctrl</kbd>+<kbd>B</kbd> twice, also it had no support for un-boldening) 3. This userscript is currently a beta release, and will be updated as a formal release after a week's testing. ### License Do whatever you wish to do, just don't sell this for money (but may use it in a commercial software's code) or state that you made it yourself. Do post here an answer if you do something cool with this :D ### Contribute Post bugs or feature requests as answers below! [1]: https://gist.github.com/GaurangTandon/860cbdef7355fa2978dc4bd3cb408981/raw/c6075a44bba8d87bc4e602a684fad5fb61a34667/Comment%2520keyboard%2520shortcuts.user.js [2]: https://gist.github.com/GaurangTandon/860cbdef7355fa2978dc4bd3cb408981 [3]: https://stackapps.com/questions/2103/add-keyboard-shortcuts-to-comments