问题
After installing Sublime Text 3 (Build 3059) I tried to configure some key bindings as I usually did in the past. So I configured this in "Preferences \ Key Bindings - User":
[
{ "keys": ["ctrl+space"], "command": "toggle_comment", "args": { "block": false } }
]
Well, this simply does not work. I can see the key binding is registered when I hover over to "Edit \ Comment \ Toggle Comment" as there is the key binding shown in grey right next to the "Toggle Comment" text. Commenting works when I click the Toggle Comment menu item, but not with the key binding.
When binding shift+space
commenting works as expected. So, why won't ctrl+space
do?
回答1:
It's work only when file Syntax
is defined.
Press Ctrl+Shift+P and type name of syntax, like Java
, C++
, PHP
, Ruby
, SQL
etc...
Default (Linux) settings:
{ "keys": ["ctrl+/"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+/"], "command": "toggle_comment", "args": { "block": true } },
Line comment:
Ctrl+/
Block comment:
Ctrl+Shift+/
回答2:
Maybe not a Sublime Text 3 problem.
Something is grabbing the keyboard shortcut before it reaches the editor.
As you are on ubuntu 14.04 my best guess is ibus.
See the issue on their launchpad: ibus breaks emacs and eclipse control-space keybinding
Maybe the given workaround run "ibus exit" in .config/lxsession/Lubuntu/ suites you.
cheers,
Martin
回答3:
So, it had to do with ibus. I could fix it by following these steps:
$ sudo apt-get install dconf-editor
$ dconf-editor
- Go to
desktop \ ibus \ general \ hotkey
- Change the value for
triggers
from['<Control>space']
to[]
来源:https://stackoverflow.com/questions/24905104/ctrlspace-key-binding-not-working-for-commenting-in-sublime-text-3