简体   繁体   English

Netbeans CSS 自动格式

[英]Netbeans CSS auto format

In Netbeans 6.9.1 (PHP bundle) the code format ( ALT + SHIFT + F ) doesn't seem to work on CSS files, that is when I try to run it nothing happens.在 Netbeans 6.9.1(PHP 包)中,代码格式( ALT + SHIFT + F )似乎不适用于 CSS 文件,也就是说当我尝试运行它时什么也没有发生。 Is it normal or am I missing something?这是正常的还是我错过了什么?

I've check it in my version of Neatbeans (Also 6.9.1) and it seems to work fine.我已经在我的 Neatbeans(也是 6.9.1)版本中检查过它,它似乎工作正常。

If it's not working for you, perhaps you need to check your Keymap settings.如果它不适合您,也许您需要检查您的键盘映射设置。

To do so,为此,

  1. click Tools单击工具

  2. Choose Options选择选项

  3. Select the Keymap tab选择键盘映射选项卡

  4. Perform the Alt+Shift+F keymap in the "Search in shortcuts" input field在“在快捷方式中搜索”输入字段中执行 Alt+Shift+F 键盘映射

  5. Make sure you get the following:确保您获得以下信息:

     Actions = Format Shortcut = Alt+Shift+F Category = Source

Also check that your tabs and indents are setup in the Formatting tab under the Editor Section of the Options panel.还要检查您的选项卡和缩进是否已在“选项”面板的“编辑器”部分下的“格式”选项卡中设置。

Hope that helps, Tom希望有帮助,汤姆

(tested with Netbeans 12.0) You can use regular expressions to add newlines: (使用 Netbeans 12.0 测试)您可以使用正则表达式添加换行符:

  1. press Ctrl + H or click Menu Edit -> Replace...Ctrl + H或单击菜单编辑 -> 替换...
  2. Find What: "([{};])" (without quotes)查找内容:“([{};])”(不带引号)
  3. activate regular expressions (button with caption . * or Alt + G )激活正则表达式(带有标题. * 或Alt + G 的按钮)
  4. Replace With: "$1\\n" (without quotes)替换为:“$1\\n”(不带引号)
  5. Replace All全部替换

Then you can use Alt + Shift + F to auto-indent然后你可以使用Alt + Shift + F来自动缩进

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

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