问题
The same question has been asked for Xcode 3 But the solution there is said to not work with Xcode4. And no new solution is available there.
How to get a key-binding to move the curser up/down about 10 lines in Xcode 4 ?
回答1:
Eureka! Inspired by the answer on line duplication, this is how you empower Xcode 4 with multiple-line movement:
- Go to the folder
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources
- Open
IDETextKeyBindingSet.plist
. - Add a new dictionary
Customized
and two new command (say,Move Down 10
andMove Up 10
) keys as the screenshot below: - Restart Xcode and go to Preferences - Key Bindings, search for your command.
Set a key combination for both commands:
Free at last from the shackles of the
Jump To
shortcut. Enjoy it!
Bonus: system-wide multiple-line movement
Unleash the cursor outside Xcode following with these steps:
- Go to the folder
~/Library/KeyBindings
- Open
DefaultKeyBinding.dict
. - Enter the following. Customize as appropriate.
{
"^~n" = ("moveUp:", "moveUp:", "moveUp:", "moveUp:", "moveUp:", "moveUp:", "moveUp:", "moveUp:", "moveUp:", "moveUp:");
"^~p" = ("moveDown:", "moveDown:", "moveDown:", "moveDown:", "moveDown:", "moveDown:", "moveDown:", "moveDown:", "moveDown:", "moveDown:");}
- Logout & Login
All of the above works on 10.8.2 with Xcode 4.5.1.
回答2:
Looks like it is impossible. Answering myself to be able to close.
回答3:
Complementing courteous answer, I added two more commands:
Move Up 10 Extending Selection
, with the value moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:
and Move Down 10 Extending Selection
, with the value moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:

then assigned the shortcut in XCode:

来源:https://stackoverflow.com/questions/9224849/multiple-line-cursor-movements-in-xcode-4