Is there a way to get the cursor to the end of the current line? That is, without using the End key, Ctrl + Left/Right or the mouse. It’s time consuming to get to the end of the line when there’s some code after the cursor. eg.
In a strings.xml file, the end tag is automatically generated and after inserting the value in between the tags, how would one get to the end of that line in order to press return and go to the new line?
<string name="hello_world"> Hello World | </string>
here, “|” = cursor
Similarly, despite android-studio’s smart code auto-completion feature, it’s common to get stuck behind a semi-colon/pair of parenthesis. In such cases, is there a quicker way to get to the end of the statement/block?
Advertisement
Answer
tl;dr use Shift
+Enter
The title of your question asks how to get to the end of a line but in your question you mention wanting to get to the end of a line because automatically inserted characters are preventing you from hitting return to get to the next line.
All the other answers only solve half your problem. This command starts a new line and puts your cursor on it regardless of your cursor’s current position in the line:
Shift
+Enter
Here’s an example of it being used: