Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move to beginning of text in Xcode

Tags:

xcode

I know I can bind keys to "Move to beginning of line", but this ignores the indentation.

What I'm looking for is to move to the beginning of text on a line, so that:

CGRect example = CGRectMake(view.frame.origin.x,                             view.frame.origin.y,| 

pressing a key will move the cursor to the beginning of the "view" word in this example (char | is cursor).

It is extremely annoying that currently I have to press 3 commands to get to the beginning of the text when inside a code block (cmd <-, opt ->, opt <-).

like image 413
lkraider Avatar asked Mar 09 '11 03:03

lkraider


People also ask

How do I move text in Xcode?

1) Moving a full line or many lines of code up or down using: ⌘ ⌥ { to move up and ⌘ ⌥ } to move down. If you have text selected, Xcode will move each line containing your selection; otherwise, it'll move the line the cursor is in.

How do I start a new line in Xcode?

Search for "line" under the Text tab. There are lots of "Insert Newline" commands for which you can set key combos. There's Ctrl+o, Cmd+Enter, Opt+Enter, etc.


1 Answers

There's no standard way to accomplish it in XCode, so I've written an XCode plugin implementing this feature:

https://github.com/insanehunter/XCode4_beginning_of_line

Under the hood it overrides XCode's source editor keyboard action dispatch method and implements beginning/ending of line jumps in enhanced way.

Hope it helped.

like image 187
iHunter Avatar answered Oct 04 '22 08:10

iHunter