7

Trying desperately to customize Xcode 4 keybindings.

I'm editing the user .idekeybindings file (which xcode sometimes wipes out when modified while open and then subsequently attempting to update through the key bindings interface - lovely)

My understanding is that providing an of s commands (selectors) instead of just a single string should execute all those commands.

<key>Text Key Bindings</key>
<dict>
    <key>Key Bindings</key>
    <dict>
        <key>@L</key>
        <string>selectLine:</string>
        <key>@d</key>
        <array>
            <string>selectLine:</string>
            <string>deleteBackward:</string>
        </array>
    </dict>
    <key>Version</key>
    <integer>3</integer>
</dict>

In this particular case, my selectLine: for the command-shift-l works properly.

My command-d beeps at me and fails. If I remove either command in the array, but leave it inside the array, that command works (doesn't matter which one). But as soon as I combine them it fails miserably.

Anyone know what I'm doing wrong here? The lack of knowledge provided on how to do this is frustrating.

gcamp
  • 14,622
  • 4
  • 54
  • 85
Bob Spryn
  • 17,742
  • 12
  • 68
  • 91

2 Answers2

0

What you're looking to do is absolutely possible. (at least in XCode 10, which is what I'm using at the time of writing)

Instead of putting your commands into an array:

<array>
  <string>selectLine:</string>
  <string>deleteBackward:</string>
</array>

simply put them into one string entry and make sure they're comma-separated like so:

<string>selectLine:, deleteBackward:</string>

Cheers!

Cary Meskell
  • 312
  • 2
  • 10
0

Just because you can add an array with two functions to the xml structure, doesn't mean that Xcode is looking for it when it parses the file.

If the code that reads the file checked if the value was an array or a string, then did some looping, this would behave the way you believe it should. My guess is that Xcode is reading the value associated with the key, seeing that it isn't a string, and serenading you with that lovely beep.

brysgo
  • 838
  • 1
  • 8
  • 20
  • 1
    You used to be able to do this with XCode 3. I'm not pulling it out of thin air. :) When I have an array of 1 command it reads it and executes. When I add the second command to the array is when it chokes. – Bob Spryn May 14 '11 at 23:36
  • While Xcode 4 supports Xcode 3 files, it was rewritten for Xcode 4. I would file a bug if you have a project file that only works with one of the two. – brysgo Jun 13 '11 at 16:26
  • 1
    Project file? That's not really related to the question here. – Bob Spryn Jun 16 '11 at 16:39
  • @Bob My bad, but that doesn't change anything, it is still a legacy format reimplemented. I don't want Apple legal coming after me so I am purposely not looking too deep into the specifics of the problem. I spent a summer working on Xcode 4. – brysgo Jul 02 '11 at 04:55