您的位置:首页 > 其它

No Space Please, Only Tabs for Indentation

2014-07-07 17:07 711 查看
Generally, most of code editors provide two options for indentation: space and tab. And I don't quite understand under what condition one should use spaces for indentation purpose instead of tabs; to me, that just makes your
code less readable, nothing else.

Visual Studio:

You might need to visualize the space symbols before you can do anything to them:



To make VS apply tabs for indent automatically when you press 'Enter' key, you need to go Tools->Options:



In the dialog brought up, select Text Editor->C#->Tabs, and there you go. You can also specify other configuration of how the text editor perform the indentation, like 'Tab size', which indicates how many spaces' width should
a tab occupy.



But what about the spaces that left behind by your stupid predecessor? Most of the text editors coming with IDEs provide a tool to convert indent from space to tab and vice versa, however, you need to highlight the lines before
proceeding:



WebStorm:

Go to File->Settings: Expand 'Code Style', Select the language, tick 'Use tab character'



To convert indents:



To view the space symbols: go to View->Active Editor->Show Whitespaces



Notepad++:





SubLime 2

This editor has a wonderful function, which is to convert all the leading spaces in the opening file as indent to tabs:



NetBeans 8.0

Tab Setting:



Install themes:



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐