开发者

Xcode 4 idekeybindings multiple commands for one keystroke

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&g开发者_开发百科t;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.


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.


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜