Skip to content

Instantly share code, notes, and snippets.

@b-outlaw
Created May 1, 2019 20:58
Show Gist options
  • Save b-outlaw/4fe1e3ee3dd21e14f43cf7aade98677f to your computer and use it in GitHub Desktop.
Save b-outlaw/4fe1e3ee3dd21e14f43cf7aade98677f to your computer and use it in GitHub Desktop.
Xcode – Insert Newline Before/After
  1. Open below directory in Finder with Cmnd + Shift + G
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/
  1. Open IDETextKeyBindingSet.plist with a text editor (not Xcode's plist editor).

  2. Add this in:

<key>Insert Newline Before</key>
<string>moveUp:, moveToEndOfLine:, insertNewline:</string>
<key>Insert Newline After</key>
<string>moveToEndOfLine:, insertNewline:</string>
  1. Open Xcode and go to Xcode preferences -> Key Bindings Search for "insert newline"

  2. Add shortcuts for new commands.

@mikelluzuriaga
Copy link

mikelluzuriaga commented May 1, 2023

@mahiznan You have to give edit permission to that file (not sure how to do that, chmod on terminal I guess), or copy it and paste to other location (like desktop), open and edit, then paste into the same location (it will ask for the password of the root user), or you can do "sudo nano IDETextKeyBindingSet.plist" with terminal.

@kollein
Copy link

kollein commented Sep 27, 2023

Thanks @mikelluzuriaga , It works well when i copy to another place > edit > replace file in the destination.

@vladmircan
Copy link

Besides chmod, you can give permission to a file by opening its info and modifying the Sharing & Permissions section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment