How to get smart tabs (“indent with tabs, align with spaces”) behavior in Xcode?

前端 未结 3 1091
刺人心
刺人心 2021-01-01 09:14

I used to use tabs for indentation and spaces for alignment. Like so (arrows show tabs and dots show spaces).

\

相关标签:
3条回答
  • In Xcode > Preferences (,):

    > Text Editing > Indentation

    If I understand your question correctly, this should do it for you.

    0 讨论(0)
  • 2021-01-01 09:34

    In XCode
    Xcode > Preferences or use ⌘ , to open Preferences
    now click on the Text Edit tab and then there is sub tab bar click on Indentation and you can change setting of the Indentation as you need

    0 讨论(0)
  • 2021-01-01 09:38

    If you want to remap the standard Xcode's +[ to TAB, you can do the following:

    1. Install a program called "Karabiner".

    2. Go to Preferences ~> "Misc and Uninstall"

    3. In "Custom Setting" section click on the "Open private.xml" button

    4. Open the file and replace its content with the following code:

      <?xml version="1.0"?> 
      <root>
          <item>
              <name>Tab instead of Command+[</name>
              <identifier>private.swap_tab_and_cmnd+[</identifier>
              <autogen>
                  __KeyToKey__
                  KeyCode::TAB, ModifierFlag::NONE,
                  KeyCode::BRACKET_RIGHT, ModifierFlag::COMMAND_L | ModifierFlag::NONE
              </autogen>
          </item> 
      </root>
      
    5. Go to Preferences ~> "Change Key" ~> click on "Reload XML" button

    6. Put a tick in the checkbox which is called "Tab instead of Command+["

    7. Enjoy

    PS: Please note that this setting works globally on your machine, not just in Xcode. However, I am sure that google might help you to find a solution how to customize it even further, applying the changes only to Xcode.

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