Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to disable the auto-indentation when pasting in Xcode 4?

Tags:

xcode

I like the auto-indentation in XCode 4 when coding/typing, but I want to disable this function when I'm pasting the code. So is there a way to have separate settings for the two situations?

like image 415
Yilei Yang Avatar asked Feb 01 '12 02:02

Yilei Yang


People also ask

How do I change indentation in Xcode?

Choose Xcode > Preferences… from the menu bar (default shortcut: command-comma). Then click the “Text Editing” section. Then choose the “Indentation” tab.

How do I fix indentation in Swift?

Xcode tip #21: If you've copied code from elsewhere, such as Hacking with Swift or Stack Overflow, there's a good chance you'll paste in something with incorrect indentation. Xcode can fix this with one shortcut: select the code you want to fix, then press Ctrl+I to reindent it.

How do I turn off auto indent in vim?

vim" in 'runtimepath'. This disables auto-indenting for files you will open. It will keep working in already opened files. Reset 'autoindent', 'cindent', 'smartindent' and/or 'indentexpr' to disable indenting in an opened file.


2 Answers

Instead of using a normal paste, use "Paste and Preserve Formatting". It's in the Edit menu, and its shortcut is "Alt+Shift+Cmd+V".

like image 109
Dmitri Shuralyov Avatar answered Oct 20 '22 12:10

Dmitri Shuralyov


You can enable or disable in Xcode 11
Xcode > Preferences > Text Editing > switch to Re-indent on paste

enter image description here

like image 21
tetrajen Avatar answered Oct 20 '22 13:10

tetrajen