Before using eclipse to write Java, there are several commonly used shortcut keys, such as delete the current line, insert a blank line below the current line, move up/down the current line and so on, to xcode how can not find these shortcuts, always feel that Xcode comes with the shortcut key is not strong enough, Until today we know that without a third-party plug-in, you can fully implement these functions under Xcode, and here's how to do it.
First find your own configuration file in Xcode
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
This file is configured with some shortcuts that can be set up and opened with a common editor (requires root access).
Then look at the following configuration, (from gist, thanks to the author @gdavis)
<key>gdi Commands</key><dict><key>gdi Duplicate</key><string>selectline:, copy:, Movetoendofline:, Insertnewline:, Paste:, Deletebackward:</string><key>gdi Delete Current Line</key><string>movetoendofline:, Deletetobeginningofline:, Deletebackward:, MoveDown:, Movetoendofline:</string><key>gdi Move current line Up</key> <string> SelectLine:, Cut:, MoveUp:, Movetobeginningofline:, Insertnewline:, paste:, Movebackward:</ String> <key>gdi Move current line Down</key> < String>selectline:, Cut:, MoveDown:, Movetobeginningofline:, Insertnewline:, Paste:, Movebackward: </string> <key>gdi Insert line Above</key> Span class= "NT" ><string>moveup:, Movetoendofline:, Insertnewline:</string> <key>gdi Insert line Below</key> <string> Movetoendofline:, Insertnewline:</string></DICT>
This dict is a set of shortcut keys can be set operation, the key is the name, the corresponding string is a corresponding set of operations, from the name itself can be seen what the meaning, and can also be based on these free to assemble their own other shortcut operations.
- GDI Duplicate Current line copy the row to the following line
- GDI Delete Current Line delete when moving forward
- GDI move current lines up to move a row upward
- GDI move current lines down move row down
- GDI Insert Line Above Adds a blank row above the current line
- GDI Insert Line Below adds a blank row below the current line (regardless of whether the cursor is at the end of the row)
Put this configuration in the above mentioned IDETextKeyBindingSet.plist
, before the last two lines of the file:
</dict></plist>
Restart Xcode, in the Xcode menu, open Preferences
, select Key Binding
, search in the top right GDI
, there will be a similar display, if not, please check each step above.
Double-click on the right side of the space, you can set different shortcuts for each function, I set the same with Eclipse, feel the next, very cool, cooool
Have fun!~
Xcode custom shortcut keys used in eclipse