Move to beginning of text in Xcode

前端 未结 9 2041
说谎
说谎 2020-12-23 16:18

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 th

相关标签:
9条回答
  • 2020-12-23 17:19

    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.

    0 讨论(0)
  • 2020-12-23 17:20

    As of 7.3 (not sure when it was added), Xcode seems to have turned this on by default. Cmd-left in the Key Bindings preference pane is now bound to "Move to Beginning of Text."

    Personally, this drives me bonkers, so I've changed it back to "Move to Beginning of Line." But for people who want this behavior, it's good to know that there's now a built-in way to get it.

    If you've copied your Key Bindings Set, you may not be seeing the new behavior yet. If not, just search for "beginning" in the Key Bindings preferences and adjust them to your liking.

    0 讨论(0)
  • 2020-12-23 17:20

    It seems that the simplest way, as already mentioned is

    1) Go to the beginning of the line (Cmd + left arrow key)

    2) Jump to right word (Alt + right arrow key)

    3) Jump to left word (Alt + left arrow key)

    Unfortunately (Alt + left arrow key) and (Alt + right arrow key) ignores comments, brackets, etc and therefore the method above will not always work. If this is not a problem, then there is also one solution for the BetterTouchTool users. One can create a sequence of actions (commands) that will be called one after another and assign it to Home button. To do so, open the preferences, go to Keyboard tab, Add new shortcut and assign Home button to the (Cmd + left arrow key). Then click Assign additional actions twice, first one for the (Alt + right arrow key) and the second one for the (Alt + left arrow) key commands.

    Hopefully this helps.

    0 讨论(0)
提交回复
热议问题