Atom编辑器:如何将select-grammar绑定到Ctrl+Shift+J快捷键?
Fixing Ctrl+Shift+J for
editor:select-grammar in Atom Hey there, let's get that Ctrl+Shift+J shortcut working for editor:select-grammar in Atom! The issue here is that your current keymap.cson configuration has incorrect syntax—CSON (CoffeeScript Object Notation) requires proper indentation and line structure for keybindings to be parsed correctly.
Here's the corrected configuration you need to use:
Open your keymap.cson file (you can access it via File > Keymap... in Atom's menu), then replace your existing code block with this properly formatted version:
'atom-text-editor': 'ctrl-shift-L': 'editor:split-selections-into-lines' 'ctrl-shift-J': 'editor:select-grammar'
Notice the key syntax fixes:
- The
atom-text-editorselector sits on its own line, followed by a colon - Each shortcut is indented (2 spaces is standard) under the selector, with each key-value pair on a separate line
- This follows CSON's strict indentation rules, which Atom depends on to read keybindings correctly
Additional checks to ensure it works:
- Check for conflicting keybindings:
Open Atom's Settings > Keybindings tab, then search forctrl-shift-jin the search bar. If another command is already using this shortcut, you'll need to either:- Disable the third-party package that's using the conflicting shortcut
- Adjust the conflicting shortcut to a different key combination
- Reload Atom:
After saving the correctedkeymap.cson, either restart Atom completely or use the Window: Reload command (pressCtrl+Shift+F5by default) to apply the new keybindings right away.
Once you make these changes, Ctrl+Shift+J should trigger the select-grammar function as expected, while Ctrl+Shift+L will keep working for split-selections-into-lines.
内容的提问来源于stack exchange,提问作者stackinator
相关产品推荐
相关产品推荐

