Move to beginning of text in Xcode

前端 未结 9 2196
说谎
说谎 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:12

    I'm using Xcode 7.2 and was able to make my own macro to automate those 3 commands you mentioned above (cmd <-, opt ->, opt <-). You can edit the IDETextKeyBindingSet.plist file which defines all the key-bindings to add your own.

    Mine was located at /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist

    Add the following to create your own macro

    Custom Keys
    
        Move to non-whitespace beginning of line
        moveToBeginningOfLine:, moveSubWordForward:, moveSubWordBackward:
    
    

    Relaunch xcode and in your Preferences > Key Bindings tab, search for your custom macro and set it to cmd <-. Now it will run those 3 commands and effectively moves your cursor to the beginning of the text in the line.

提交回复
热议问题