chaosifier
chaosifier

Reputation: 2964

How to get to the end of a line in android studio

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

Answers (8)

samus
samus

Reputation: 6202

File > Settings > Keymap (Ctl+Alt+S)

  • Type "end" in search
  • Locate "Move Caret to Line End" under "Editor Actions"
  • Double click assigned mapping (End)
  • Select "Add Keyboard Shortcut"

enter image description here

Try some key combinations

enter image description here

Replace an existing one, or compromise

enter image description here

Note: Remapping "Move Caret to Next Word" may also help (i.e. for hopping over closing parentheses).

Upvotes: 0

The EasyLearn Academy
The EasyLearn Academy

Reputation: 927

Just Press End key on keyboard. and cursor will jump to end of line.

Upvotes: 11

user1297133
user1297133

Reputation: 79

This will take you to the end of the line and automatically add a semicolon CTRL + SHIFT + Enter

Upvotes: 1

mbmc
mbmc

Reputation: 5105

Ctrl + e for end

Ctrl + a for start

Upvotes: 7

bomben
bomben

Reputation: 620

On a Windows Laptop the commands to go to the beginning and end of a line are:

Fn +

Fn +

Upvotes: 0

Simran Singh
Simran Singh

Reputation: 2869

Shift + End is the shortcut to move cursor to the end of line.

Upvotes: 0

chaosifier
chaosifier

Reputation: 2964

Using the keyboard combination Ctrl + [ did the trick.

Upvotes: 4

Patrick
Patrick

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:

enter image description here

Upvotes: 13

Related Questions