Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open a new line below current line in Xcode

Tags:

xcode

Is there any easy way to open a new line below current line in Xcode text editor? Currently I have to press cmd+right and enter for this purpose. Eclipse (Shift+Enter) and vim (o) can do that with simple key combination.

like image 624
Patrick Tsai Avatar asked Sep 11 '10 13:09

Patrick Tsai


People also ask

Does \n work in Swift?

By default Swift strings can't span more than one line. One simple way around this is to use the new line character \n , but that only works for strings that are displayed – if you're just trying to format your string nicely, you should use multi-line strings instead.

How do I add a new line to text in Swift?

To force a minimum number of lines to a text view, you append a new line character ( \n ) to your text.

How do you move to the next line in Swift?

\n : This is a newline character. It the computer to move to the next line. \t : This is a tab.


1 Answers

You can take a look at this tutorial about how to add custom keyboard shortcut in Xcode ---Xcode duplicate line, then just add a new key-value Insert New Line Below Current Line moveToEndOfLine:, insertNewline: in IDETextKeyBindingSet.plist file, at last config your Key Bindings (like Shift+Enter) in Xcode.

like image 177
c0ming Avatar answered Oct 11 '22 10:10

c0ming