如何在Atom编辑器中自动缩进代码?在其他编辑器中,您通常可以选择一些代码并自动缩进。
还有快捷键吗?
如何在Atom编辑器中自动缩进代码?在其他编辑器中,您通常可以选择一些代码并自动缩进。
还有快捷键吗?
当前回答
这对我来说很管用:
'atom-workspace atom-text-editor':
'ctrl-alt-a': 'editor:auto-indent'
你必须先用ctrl-a选择所有。
其他回答
Package auto-indent的存在是为了通过以下快捷方式对整个文件应用自动缩进:
ctrl + shift + i
or
CMD+移位+I
软件包网址:https://atom.io/packages/auto-indent
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.
我更喜欢使用原子美化,CTRL+ALT+B(在linux中,也可能在windows中)处理更好的各种格式,它也是自定义每个文件格式。
更多详情请访问:https://atom.io/packages/atom-beautify
您可以快速打开命令面板并在那里执行 Cmd + Shift + p搜索编辑器:自动缩进:
我在菜单中找到了这个选项,在编辑>行>自动缩进下。它似乎没有默认的键映射绑定。
你可以尝试添加一个键映射(Atom > Open Your Keymap[在Windows: File > Settings > Keybindings > " Your Keymap File "),就像这样:
'atom-text-editor':
'cmd-alt-l': 'editor:auto-indent'
这对我很有用:)
Windows:
'atom-text-editor':
'ctrl-alt-l': 'editor:auto-indent'