Hi
I have seen two different 'move caret by word' behaviors in TextMate: the first stops the caret at capital letters, underscores, and after every number, such that moving the caret across "aB_911" is 5 movements the second *doesn't* stop the caret at any of the above, so moving across "aB_911" is one movement
On my setup (see below) the former is bound to ctrl-arrow and the latter to alt-arrow.
I would like to change the bindings of ctrl-arrow to do the latter, but I don't know the name of the command to bind to in DefaultKeyBinding.dict (the former seems to be MoveWordLeft/Right or MoveWordForward/Backward).
Any help appreciated Thanks!
Mac OS X Snow Leopard External Kinesis ergonomic keyboard Custom DefaultKeyBinding.dict
On 15 Jul 2010, at 04:29, ijmcf wrote:
[...] I would like to change the bindings of ctrl-arrow to do the latter, but I don't know the name of the command to bind to in DefaultKeyBinding.dict (the former seems to be MoveWordLeft/Right or MoveWordForward/Backward).
You can start a macro recording then use ⌃→ followed by stopping the macro recording and saving it. Here you can then see the selector recorded, which is moveSubWordRight:.
Allan
Thank you for your prompt response. I now have something of a puzzle:
1) I recorded both the desired and undesired keystrokes in a macro. As you suggested, the one I want is 'moveWordLeft:', and the other is 'moveSubWordLeft:'.
2) However, I already bound the ctrl-arrow combinations to 'moveWordLeft/Right:' in ~/Library/KeyBindings/DefaultKeyBinding.dict, as follows: "^\UF702" = "moveWordLeft:"; /* Ctrl + LeftArrow */ "^\UF703" = "moveWordRight:"; /* Ctrl + RightArrow */
3) But when I use ctrl-arrow in TextMate, I get instead 'moveSubWordLeft/Right:' (as proved by the macro recording)
4) If I create a custom command through 'Bundle Editor' for 'moveWordLeft/Right:' and bind it to the ctrl-arrows, those keys now do nothing
5) If I bind alt-arrow to "moveSubWordLeft/Right:", I still get "moveWordLeft/Right:".
So, the problem seems to be that the bindings in DefaultKeyBinding.dict are not sticking. But other commands I have assigned *are* working, for example: "\UF72C" = "pageUp:"; /* PageUp */ "~\UF72C" = "scrollPageUp:"; /* Option + PageUp */ "\UF729" = "moveToBeginningOfLine:"; /* Home */ "@\UF729" = "moveToBeginningOfDocument:"; /* Cmd + Home */
Any suggestions as to what I might be doing wrong? All help is much appreciated.
Thanks! Iain
Allan Odgaard-4 wrote:
On 15 Jul 2010, at 04:29, ijmcf wrote:
[...] I would like to change the bindings of ctrl-arrow to do the latter, but I don't know the name of the command to bind to in DefaultKeyBinding.dict (the former seems to be MoveWordLeft/Right or MoveWordForward/Backward).
You can start a macro recording then use ⌃→ followed by stopping the macro recording and saving it. Here you can then see the selector recorded, which is moveSubWordRight:.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 19 Jul 2010, at 20:41, ijmcf wrote:
[...] So, the problem seems to be that the bindings in DefaultKeyBinding.dict are not sticking. But other commands I have assigned *are* working [...]
I am a little confused as to what exactly you tried, and I forgot what your exact goal is. I would suggest you reset everything to defaults, then record macros for the desired actions and then bind the keys you want to these macros afterwards.
The key bindings stuff is tricky because TM has its own file¹ which is also referenced, and because control + arrow keys actually is buggy (according to me, by design according to Apple), so these events are resolved differently (and often wrongly) — TextMate does what it can to workaround it, maybe your setup has exposed an unhandled case, wouldn’t think so though.
¹ http://manual.macromates.com/en/key_bindings#text_move_edit_actions
Allan
I deleted the entries I had in DefaultKeyBindings.dict, recorded the macros, and hey presto! It works perfectly.
Obviously the entries in DefaultKeyBindings.dict not only didn't work, but conflicted with the key bindings I attempted to assign in the Bundle Editor.
I didn't consider that there might be a conflict between the two. Thanks so much for all your help!
Allan Odgaard-4 wrote:
On 19 Jul 2010, at 20:41, ijmcf wrote:
[...] So, the problem seems to be that the bindings in DefaultKeyBinding.dict are not sticking. But other commands I have assigned *are* working [...]
I am a little confused as to what exactly you tried, and I forgot what your exact goal is. I would suggest you reset everything to defaults, then record macros for the desired actions and then bind the keys you want to these macros afterwards.
The key bindings stuff is tricky because TM has its own file¹ which is also referenced, and because control + arrow keys actually is buggy (according to me, by design according to Apple), so these events are resolved differently (and often wrongly) — TextMate does what it can to workaround it, maybe your setup has exposed an unhandled case, wouldn’t think so though.
¹ http://manual.macromates.com/en/key_bindings#text_move_edit_actions
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate