Geek
Geek

Reputation: 8320

Xcode 5 indentation issue

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.

enter image description here

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.

enter image description here

enter image description here

Do anybody see anything wrong in above settings?

Upvotes: 5

Views: 2113

Answers (5)

Nike Kov
Nike Kov

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

user1772388
user1772388

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

Geek
Geek

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

smartfuse
smartfuse

Reputation: 51

Try turning off Auto-Indentation. That way, Xcode doesn't remove formatting.

Upvotes: 0

Khaled Barazi
Khaled Barazi

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

Related Questions