如何在Atom编辑器中自动缩进代码?在其他编辑器中,您通常可以选择一些代码并自动缩进。

还有快捷键吗?


当前回答

这对我来说很管用:

'atom-workspace atom-text-editor':
    'ctrl-alt-a': 'editor:auto-indent'

你必须先用ctrl-a选择所有。

其他回答

我在菜单中找到了这个选项,在编辑>行>自动缩进下。它似乎没有默认的键映射绑定。

你可以尝试添加一个键映射(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'

您可以快速打开命令面板并在那里执行 Cmd + Shift + p搜索编辑器:自动缩进:

这是我找到的最好的帮助:

https://atom.io/packages/atom-beautify

这个包可以安装在Atom中,然后按CTRL+ALT+B解决这个问题。

如果您习惯于Eclipse IDE或Netbeans,您可以使用Eclipse -keybindings包(https://atom.io/packages/eclipse-keybindings):)

这个Atom包为Atom提供了Eclipse IDE键映射。目前,Eclipse快捷方式直接映射到现有的Atom命令。

要格式化文件中的所有行,只需使用:Ctrl+Shift+F。

这对我来说很管用:

'atom-workspace atom-text-editor':
    'ctrl-alt-a': 'editor:auto-indent'

你必须先用ctrl-a选择所有。