Keyboard shortcut to get to the end of any given line my cursor is on?

So I'm working my way through the BNR book on Swift coding, so for instance I type in a playground print("Fire blasters!"). After I type the first (" it auto populates the terminating corresponding ") but they are to the right of my cursor, and I have yet to find a means to get to the end of line so I can hit return without using the right arrow key two times, surely there is a shortcut to get to the end of the line my cursor is on.

Thanks in advance

Control - E will move to the end of line, as will Option - Right Arrow.

1 Like

OMG bless you my child, Thank you very much.

Hmm that was my first post on these forums is there no means of marking this post as answered?

Jon_Shier's answered your direct question, but you might also find it useful to know that Xcode supports “type-over” for the characters ", ), }, and ]. If the cursor is immediately before a " and you type ", Xcode advances the cursor past the " rather than inserting another ". Similarly for ), }, and ].

So you can just type all the characters in print("Fire blasters!"), including the closing "), and Xcode will not insert an extra ").

This behavior is controlled by the “Enable type-over completions” checkbox in Xcode > Preferences > Text Editing > Editing.

Ah that is very useful information as well Thank you.

Also, Xcode allows you to edit key bindings for a wide-ranging set of behaviors, including moving to the end or beginning of the line. So, for example, you can set the End key to move to end-of-line If you consider this the civilized thing for the End key to do. These options are available at Xcode > Preferences > Key Bindings. (Note you will also have to remove the existing binding of End for it to work.)

That's what I was looking for Thank you.

1 Like