如何在 Atom 编辑器中自动缩进代码?
问题描述:
如何在 Atom 编辑器中自动缩进代码?在其他编辑器中,您通常可以选择一些代码并自动缩进.
How do you auto-indent your code in the Atom editor? In other editors you can usually select some code and auto-indent it.
是否也有键盘快捷键?
答
我在菜单中找到了该选项,位于编辑">行">自动缩进"下.它似乎没有默认的键盘映射绑定.
I found the option in the menu, under Edit > Lines > Auto Indent. It doesn't seem to have a default keymap bound.
您可以尝试添加一个键映射(Atom > 打开您的键盘映射 [在 Windows 上:文件 > 设置 > 键绑定 > 您的键盘映射文件"]),如下所示:
You could try to add a key mapping (Atom > Open Your Keymap [on Windows: File > Settings > Keybindings > "your keymap file"]) like this one:
'atom-text-editor':
'cmd-alt-l': 'editor:auto-indent'
它对我有用:)
对于 Windows:
For Windows:
'atom-text-editor':
'ctrl-alt-l': 'editor:auto-indent'