Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent the "You have mixed tabs and spaces. Fix this?" message?

Any time I paste code into my .cs file, I get the dreaded "You have mixed tabs and spaces. Fix this?" message. It has three options:

Tabify
Untabify
Don't show again

I first tried "Tabify" a few times, until I was finally fed up and selected "Don't show again"; but that was a psyche - I still get it. I even tried "Untabify" but to no avail. Is there some setting I can tweak to prevent this re[o]curring problem?

VisualStudio2013 tabify untabify

like image 573
B. Clay Shannon-B. Crow Raven Avatar asked Jun 02 '14 18:06

B. Clay Shannon-B. Crow Raven


4 Answers

Sounds like you have the Visual Studio Productivity Power Tools 2013 installed. Go into its settings and turn off "Fix Mixed Tabs"...

Tools -> Options -> Productivity Power Tools -> Turn Extensions On/Off

If you have the default VS settings, tabs in the editor are converted to spaces. So (in theory) if you clicked Untabify when the message comes up, it should convert all tabs to spaces and the errors should not appear next time. Are you working with other developers who have different tab settings in their IDE?

UPDATE: In Visual Studio 2017 and onward, this is a stand-alone extension named "Fix Mixed Tabs" that can be disabled or uninstalled from "Extensions and Updates" window (Tools > Extensions and Updates).

enter image description here

like image 94
Anthony Chu Avatar answered Nov 28 '22 03:11

Anthony Chu


Update for Visual Studio 2017. If you want to disable the "You have mixed tabs and spaces. Fix this?" message, you should go to

Tools → Extensions and Updates…

In windows which popped up, locate Fix Mixed Tabs (image below) and either click on Disable or Uninstall based on what you want.

Disabling Mixed tabs

like image 29
Milan Leškanič Avatar answered Nov 28 '22 03:11

Milan Leškanič


Related: If you do want Productivity Power Tools to notify you of tabs/spaces, but you keep getting the message right after you clicked Fix this then look in Tools > Options > Text Editor > [language] > Tabs.

Set this to Keep tabs

If you have it set to Insert spaces and you click Keep tabs on the Power Tools notification then VS will re-insert spaces after save, causing the notification to immediately pop up again...aaand now you're stuck in a loop.

like image 21
Koert van Kleef Avatar answered Nov 28 '22 02:11

Koert van Kleef


Edit file with vim run :retab and save the file and it is done !.

vim file 
:retab
:wq

with :retab you can convert all tabs in spaces , if you set expandtab (:set expandtab ) it means that expand all tabs in spaces or vice-versa (:set noexpandtab) and all tabs made with space will be converted to tabs.

like image 35
Sérgio Avatar answered Nov 28 '22 02:11

Sérgio