Reputation: 2964
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?
Upvotes: 4
Views: 9145
Reputation: 6202
File > Settings > Keymap (Ctl+Alt+S)
Try some key combinations
Replace an existing one, or compromise
Note: Remapping "Move Caret to Next Word" may also help (i.e. for hopping over closing parentheses).
Upvotes: 0
Reputation: 927
Just Press End key on keyboard. and cursor will jump to end of line.
Upvotes: 11
Reputation: 79
This will take you to the end of the line and automatically add a semicolon CTRL + SHIFT + Enter
Upvotes: 1
Reputation: 620
On a Windows Laptop the commands to go to the beginning and end of a line are:
Fn + ←
Fn + →
Upvotes: 0
Reputation: 2869
Shift + End is the shortcut to move cursor to the end of line.
Upvotes: 0
Reputation: 14318
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:
Upvotes: 13