简体   繁体   English

在Atom编辑器中重新格式化代码?

[英]Reformat code in Atom editor?

I want to try Atom editor, and install it, install atom beautify also, to reformat php/html/js code. 我想尝试Atom编辑器,并安装它,也安装atom美化,重新格式化php / html / js代码。 But I can't find shortcut and I don't now how to use it. 但我找不到快捷方式,现在我不知道如何使用它。 I want to mark all code and to click some shortcut and reformat it (like most IDEs). 我想标记所有代码并单击某些快捷方式并重新格式化(与大多数IDE一样)。 Any ideas? 有任何想法吗?

You can call the auto indent command from the command palette cmd-shift-p or you can follow these instructions to make a key binding: 您可以从命令选项板cmd-shift-p调用auto indent命令,也可以按照这些说明进行键绑定:

A shortcut for formatting the file content or a portion of code can be made by putting this in your keymap file: 格式化文件内容或部分代码的快捷方式可以通过将其放在您的keymap文件中来实现:

`'.editor:not(.mini)': 'alt-cmd-l': 'editor:auto-indent'`

You could try to add a key mapping (Atom > Open Your Keymap [on Windows: File > Settings > Keybindings > "your keymap file"]) like this 您可以尝试添加键映射(在Windows上打开您的键盘映射:文件>设置>键绑定>“您的键映射文件”])

'atom-text-editor':
  'ctrl-alt-l': 'editor:auto-indent'

Now ctrl-alt-l will be your shortcut once you set 现在,设置后,ctrl-alt-l将成为您的快捷方式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM