Pergunta

I have defined/customized some keyboard bindings in Xcode 4.5 in order to give me a better typing experience.

Only the short-cut for selectWord: is originally defined by Xcode, others are added by me. They work fine in Xcode 4.5. But after I update the Xcode to 4.6, they no longer work except the selectedWord which is defined by Xcode.

The key binding file is at /Users/jason/Library/Developer/Xcode/UserData/KeyBindings/Default.idekeybindings

<key>Text Key Bindings</key>
    <dict>
        <key>Key Bindings</key>
        <dict>
            <key>@
</key>
            <array>
                <string>moveToEndOfLine:</string>
                <string>insertNewline:</string>
            </array>
            <key>^$D</key>
            <array>
                <string>selectLine:</string>
                <string>copy:</string>
                <string>moveToEndOfLine:</string>
                <string>insertNewline:</string>
                <string>paste:</string>
                <string>deleteBackward:</string>
            </array>
            <key>^$K</key>
            <array>
                <string>deleteToBeginningOfLine:</string>
                <string>moveToEndOfLine:</string>
                <string>deleteToBeginningOfLine:</string>
                <string>deleteBackward:</string>
                <string>moveDown:</string>
                <string>moveToBeginningOfLine:</string>
            </array>
            <key>~w</key>
            <string>selectWord:</string>
        </dict>
Foi útil?

Solução

It seems that when Xcode is updated, the short-cut function defined by ourself will be overwritten by the default short cut function defined by the new version of Xcode. In short, the short-cuts function defined by ourself will disappear, and we need to do it once again.

1.I added back the following code into /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist to define the short-cuts function again.

  <key>Customerized</key>
  <dict>
    <key>Insert new line in middle</key>
    <string>moveToEndOfLine:, insertNewline:</string>
    <key>Duplicate Current Line</key>
    <string>selectLine:, copy:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward:</string>
    <key>Delete Current Line</key>
    <string>deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToBeginningOfLine:</string>
  </dict>

2.Go to the key binding settings in Xcode, and type the new short-cut key for them. enter image description here

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top