Home Download Buy Blog Forum Support

Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Postby mint on Fri Jun 15, 2012 3:29 pm

Hi

I must say I am starting to like Sublime Text 2 as an editor, discovering more and more powerful functionality. However, I am having issues with keyboard shortcuts all the time. A lot of things seem to not work properly.

The two shortcuts that are currently not working are:

- Ctrl+/ and Ctrl+Shift+/ to toggle comments (tried in HTML file, JS file) -> Nothing happens
- Ctrl+u after doing a multi-selection and wanting to go back 1 (described here: http://www.sublimetext.com/docs/2/multi ... board.html) --> the whole multi selection is canceled instead

I am using Swiss-German keyboard layout. Not sure if that has any effect. I had problems playing Starcraft 2 because the game confused z and y, but only sometimes. So for playing I had to switch to US english layout :roll:

The configuration seems to be fine:
{ "keys": ["ctrl+/"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+/"], "command": "toggle_comment", "args": { "block": true } },

{ "keys": ["ctrl+u"], "command": "soft_undo" },

I am using Sublime Text 2, Build 2181 on Windows 8 Consumer Preview
mint
 
Posts: 7
Joined: Fri Jun 15, 2012 11:02 am

Re: Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Postby quarnster on Fri Jun 15, 2012 3:44 pm

Run:
Code: Select all
sublime.log_input(True)
sublime.log_commands(True)

in the Sublime Console and it'll print out what keys it gets and the commands that it runs. This should aid you in debugging and changing the key bindings to something that works for you.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Postby mint on Fri Jun 15, 2012 4:23 pm

Hello quarnster

Thank you, this brings me one step closer to finding and fixing the problems I had. I already figured out why Ctrl+Shift+N wasn't opening a new window in html files --> Because it was conflicting with ZenCoding.

However, for the problems described in this thread I still haven't found a fix:

Ctrl+/

Turns out that Sublime doesn't receive Ctrl+/, but instead key evt: control+keypad_divide. As I am using the / on the NumPad (haven't got another). I have tried to add the following lines to the user keymap:

{ "keys": ["control+keypad_divide"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+keypad_divide"], "command": "toggle_comment", "args": { "block": true } },

Unfortunately, this doesn't trigger the command. The result in the console log is exactly the same. key evt: control+keypad_divide. No output for any command in sight.
Am I missing something? Of course I restarted Sublime before trying again.

Ctrl + U with multi selections

As far as this goes, the keystroke and the control seem to be triggered correctly:

key evt: control+u
command: soft_undo


Maybe it is by design that when hitting this soft undo with multi selections, that it cancels the whole multi selection. Pity realy, because Esc does the same.

Cheers
mint
 
Posts: 7
Joined: Fri Jun 15, 2012 11:02 am

Re: Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Postby C0D312 on Fri Jun 15, 2012 4:34 pm

Try ctrl instead of control
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Postby mint on Fri Jun 15, 2012 4:49 pm

C0D312 wrote:Try ctrl instead of control


You nailed it! Thanks.

I think it's time for me to start the weekend.. :roll:
mint
 
Posts: 7
Joined: Fri Jun 15, 2012 11:02 am

Re: Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Postby fmf on Wed Jun 27, 2012 3:50 pm

I just faced a similar issue, but I have a German keyboard, meaning the toggle shortcuts are ctrl+7 and ctrl+shift+7.
I tried leaving the defaults:

Code: Select all
   { "keys": ["ctrl+/", "ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
   { "keys": ["ctrl+shift+/", "ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } },


but it does not work, had to replace them all together with only one key:

Code: Select all
   { "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
   { "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } },


Many other european keyboards use the same layout. Can't sublime add these bindings out of the box?

I'm curious to how other applications handle these keyboard discrepancies.
fmf
 
Posts: 3
Joined: Wed Jun 27, 2012 1:35 pm

Re: Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Postby pedrober on Sat Jul 07, 2012 12:26 pm

Similar problems with Spanish-Spain keyboard.
For example:
To get Ctrl+` it's necessary to press Ctrl+Ñ.
Ctrl+Shift`+[ is Ctrl+Shift+'
Ctrl+Shift`+] is Ctrl+Shift+¡
Ctrl+Shift+; is Ctrl+Shift+`
pedrober
 
Posts: 40
Joined: Thu Jun 28, 2012 6:21 pm

Re: Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Postby allyourbase on Tue Nov 06, 2012 9:55 am

Hello there,

just registered to share my knowledge: users who have a german keyboard and want to uncomment:
  • use "ctrl"+ "-" to uncomment the current line
  • use "ctrl" + "shift" + "-" to uncomment the currently selected text
I guess this is because an english keyboard has its slash ("/") next to the right shift key, where the german ones have the minus...?

Greets!

Edit:
Sorry, somehow i had a russian keyboard layout set (maybe some shortcut pressed mistakenly). So Ctrl+- does not work in german keyboard layout. Nevermind.
allyourbase
 
Posts: 1
Joined: Tue Nov 06, 2012 9:52 am

Re: Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Postby Peter Parks on Thu Dec 13, 2012 9:10 pm

Hey guys,

most of you may figured it out already, but the Key Combo to toggle_comment is "ctrl+#" just hit it by accident, when trying the + and - combos described in the post above. :D

Hope this helps.

Greets
Peter

@ just started using sublime to learn programming and i love it. I had to add this. :)
Peter Parks
 
Posts: 1
Joined: Thu Dec 13, 2012 9:06 pm

Re: Shortcuts not working (Ctrl+U, Ctrl+/, etc.)

Postby Andrea on Tue Jan 22, 2013 11:32 am

I'm scratching my head trying to figure out why "CMD+/" and "CMD+ALT+/" for comments won't work on my mac. I tried to type:
Code: Select all
sublime.log_input(True)
sublime.log_commands(True)
to have an understanding, but it looks like those combos are the only ones that won't do nothing. They don't even get logged.

These are my defaults:
Code: Select all
{ "keys": ["super+forward_slash"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["super+alt+forward_slash"], "command": "toggle_comment", "args": { "block": true } },
Any suggestion, please?

I already tried reinstalling from scratch and getting rid of both packages and support files with Hazel. Both latest stable version (2217) and nightly (2219) won't notice these key combinations.
Andrea
 
Posts: 1
Joined: Tue Jan 22, 2013 11:25 am


Return to Technical Support

Who is online

Users browsing this forum: becker101, diesirae, rgidney and 20 guests