Skip to content

Instantly share code, notes, and snippets.

@ivmirx
Created December 28, 2020 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivmirx/1042692896d1eefbc36612160af4fb2a to your computer and use it in GitHub Desktop.
Save ivmirx/1042692896d1eefbc36612160af4fb2a to your computer and use it in GitHub Desktop.
Key bindings to duplicate and delete lines in Xcode
<!--
Nowadays Xcode has a "Delete Line" key binding, but it jumps to the beginning of the next line after deletion.
The custom one jumps to the end of the next line.
Custom key bindings have to be added after every Xcode update.
Open the following file with any text editor:
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
…and insert the following:
-->
<key>Custom</key>
<dict>
<key>Custom Delete Line</key>
<string>selectLine:, deleteBackward:, moveToEndOfLine:</string>
<key>Custom Duplicate Line</key>
<string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:</string>
</dict>
<!--
…right before the closing tags:
-->
</dict>
</plist>
<!--
You will need to enter your admin password to save this file.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment