I've been programming on a Windows machine for quite a while using Jet Brains IDEs (IntelliJ, Android Studio, WebStorm). I just bought a Macbook and I'm trying to use Xcode to develop on it. My most used hotkey by far is Shift-Enter to start a new line underneath the line where the cursor is. Without the shortcut, I have to CMD-rightarrow, add a semicolon if needed, and then press enter. Is there a shortcut like this in Xcode? If not and thousands of developers use xcode, am I just lazy and have a bad habit? Is there a easier way to do this?
Thanks a bunch
Such a hotkey is not available in Xcode. Since you are new to OS X, I should tell you that emacs shortcuts are available in Xcode and throughout the OS. So, for example, in your case the quickest way to get what you want would be Ctrl-E (move to end of line) followed by enter. You can switch your caps lock and control key easily in System Preferences to make this easier. Check this link for a full list of these bindings. I have found them supremely useful.
Try this:
Copy '/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
' to desktop.
Add following contents into the .plist file:
<key>My Custom Actions</key>
<dict>
<key>Insert Line Below</key>
<string>moveToEndOfLine:, insertNewline:</string>
<key>Insert Line Above</key>
<string>moveUp:, moveToEndOfLine:, insertNewline:</string>
</dict>
Copy back the modified file.
sudo cp ~/Desktop/IDETextKeyBindingSet.plist /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
Restart the Xcode and perform key binding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With