Reputation: 8320
I get indentation issues when I copy few lines and paste it. Xcode does not copy indentation properly or applies another indentations.
As shown in below images, I copied first function and pasted which is second function. Indentation are reapplied except for first line.
I played with Xcode indentation settings but could not solve it neither do I have any clue why this happens.
Below are 2 indentation settings I tried.
Do anybody see anything wrong in above settings?
Upvotes: 5
Views: 2113
Reputation: 13698
That was when i customized indentation in Swift and then get back to Obj-C. Nothing with changing preferences helped. Just fully restart xcode.
Upvotes: 0
Reputation: 121
In Xcode preferences, Key Bindings tab, redefine ⌘-V to "Paste and Preserve Formatting" and ⌘-option-shift-V to "Paste". Then ⌘-V will do "Paste and Preserve Formatting" which is what you want.
Upvotes: 6
Reputation: 8320
I just checked Xcode settings in another mac and made changes to match that and solved the issue. Sorry I don't remember what were they as it has been too long.
Upvotes: -3
Reputation: 51
Try turning off Auto-Indentation. That way, Xcode doesn't remove formatting.
Upvotes: 0
Reputation: 8741
With cut and paste, you have to actually tell xcode to indent after the pasting.
⌘ A and then Control I. The first one select the whole class contents (when the cursor is inside) and the second one indents it based on your indent preferences.
Hope this helps.
Upvotes: -1