We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
这取决于你使用的是什么。例如,在最新版本的 Visual Studio 中,ctrl-k、ctrl-d 将格式化整个文档你正在努力。
Vim 中的几个快速命令会将文档中的所有制表符转换为空格。
在命令行中,
indent
将重新格式化 C 源代码。It depends on what you're using. In recent versions of Visual Studio, for instance, ctrl-k,ctrl-d will format the entire document you're working on.
A couple quick commands in Vim will convert all the tabs in a document to spaces.
At the command line,
indent
will reformat C source code.UltraEdit 是一个文本编辑器,具有出色的搜索/替换功能,此外您还可以切换空白字符的可见性。将 4 个空格转换为制表符很容易,反之亦然。然而,您可能不希望经常使用它来转换文件,它更像是一个增强型文本编辑器,而不是仅用于制表符/空格重构目的的工具。
UltraEdit is a text editor that has some excellent search/replace capability, plus you can toggle the visibility of whitespace characters. It's easy to convert 4 spaces to a tab, and vice versa. However, it's not something you would probably want to convert files in often, it's more of a text editor on steroids than a tool for just tab/space refactoring purposes.
对于C、C++、C#和Java代码,您可以使用艺术风格(astyle)来美化/风格化根据您的喜好设置代码。制表符与空格(以及多少个空格)是许多可用选项之一。
For C, C++, C#, and Java code, you can use Artistic Style (astyle) to beautify/stylize the code according to your preferences. Tabs vs. spaces (as well as how many spaces) are one of many available options.
你没有说你用哪种语言开发,但我以前用过 Java 的 jalopy 和 Perl 的 perltidy 。
这两个工具都可以设置缩进量和大括号样式等。
You don't say which language your developing in but I've used jalopy for Java and perltidy for Perl before.
Both of these tools you can set indent amount and brace style etc.
这里有一些特定于语言的重新格式化程序。
Here are a bunch of language-specific reformatters.