如何在Atom编辑器中自动缩进代码?在其他编辑器中,您通常可以选择一些代码并自动缩进。
还有快捷键吗?
如何在Atom编辑器中自动缩进代码?在其他编辑器中,您通常可以选择一些代码并自动缩进。
还有快捷键吗?
当前回答
Ctrl+Shift+i worked for me in PHP under Windows ... but some files did not react. Not being the brightest it took me a while to work out that it was the include files that were the problem. If you are using echo(' ... PHP ...') then the PHP does not get re-formatted. To get over this, create a temporary PHP file, say t.php, copy the PHP part into that, reindent it (Ctrl+Shift+i ... did I mention that?) and then copy the newly reformatted PHP back into the original file. Whilst this is a pain, it does give you correctly formatted PHP.
其他回答
Package auto-indent的存在是为了通过以下快捷方式对整个文件应用自动缩进:
ctrl + shift + i
or
CMD+移位+I
软件包网址:https://atom.io/packages/auto-indent
您可以快速打开命令面板并在那里执行 Cmd + Shift + p搜索编辑器:自动缩进:
这是我找到的最好的帮助:
https://atom.io/packages/atom-beautify
这个包可以安装在Atom中,然后按CTRL+ALT+B解决这个问题。
我在写一些绝妙的代码,保存时不会自动格式化。我所做的是右键单击代码窗格,然后选择ESLint Fix。这就固定了我的凹痕。
我更喜欢使用原子美化,CTRL+ALT+B(在linux中,也可能在windows中)处理更好的各种格式,它也是自定义每个文件格式。
更多详情请访问:https://atom.io/packages/atom-beautify