# Tip for 1-click indentation settings changes in Visual Studio

DevFeed: [Tip for 1-click indentation settings changes in Visual Studio](<https://devfeed.tech/articles/tip-for-1-click-indentation-settings-changes-in-visual-studio-38406.md>)

Original publisher: [Read original article](<https://khmylov.com/2011/02/tip-for-1-click-indentation-settings-changes-in-visual-studio/>)

Author: Andrew Khmylov

Published: 2011-02-27T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Visual Studio](<https://devfeed.tech/topics/visual-studio.md>), [code style](<https://devfeed.tech/topics/code-style.md>), [Automation](<https://devfeed.tech/topics/automation.md>), [ide](<https://devfeed.tech/topics/ide.md>), [C#](<https://devfeed.tech/topics/csharp.md>)

Tags: [automation](<https://devfeed.tech/tags/automation.md>), [change](<https://devfeed.tech/tags/change.md>), [code](<https://devfeed.tech/tags/code.md>), [code-style](<https://devfeed.tech/tags/code-style.md>), [csharp](<https://devfeed.tech/tags/csharp.md>), [ide](<https://devfeed.tech/tags/ide.md>), [macros](<https://devfeed.tech/tags/macros.md>), [spaces](<https://devfeed.tech/tags/spaces.md>), [style](<https://devfeed.tech/tags/style.md>), [visual-studio](<https://devfeed.tech/tags/visual-studio.md>)

## AI overview

A tutorial explains how to create a Visual Studio macro that toggles the C# indentation setting between tabs and spaces. It uses the DTE TextEditor CSharp InsertTabs property and provides keyboard-accessible macro commands.

## Source excerpt

I work at several projects at a time, and I have different settings/requirements concerning the code style for each of them. The main issue is 'Tabs vs. Spaces' option - the first project requires using tabs, the second - spaces. It's obvious that going Tools -> Settings -> ... is not an option for everyday use. Sounds like a good task for the automation macros, right? Navigate to Tools -> Macros -> Macros IDE (or use Alt+F11) Create new macros in Project Explorer (Project - Add Module) Write a method that changes the indentation settings: Public Module TabsModule Public Sub ToggleTabs() Dim currentSetting As Boolean = DTE.Properties("TextEditor", "CSharp").Item("InsertTabs").Value DTE.Properties("TextEditor", "CSharp").Item("InsertTabs").Value = Not currentSetting End Sub End Module Now you can use Macros Explorer (Alt+F8, also you can dock it as one of your panels) to quickly change settings (by double-clicking on the corresponding item name in the macros tree)