Notepad++ 中的自动缩进 HTML / Javascript

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13743348/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 19:40:41  来源:igfitidea点击:

Auto indent HTML / Javascript in Notepad++

javascripthtmlnotepad++auto-indent

提问by Barney

So it seems this issue has been raised before, a couple of years ago but none of the responses seemed to work on the newest version of Notepad++ 6.2.2

所以这个问题似乎是在几年前提出的,但似乎没有一个回应适用于最新版本的 Notepad++ 6.2.2

I've also tried using the NppAutoIndent plugin to no avail.

我也试过使用 NppAutoIndent 插件无济于事。

采纳答案by dragonloverlord

Try the Notepad# plugin just go to settings then click preferences then click misc then disable Clickable link settings to get rid of crash on scroll hope that helps.

尝试使用 Notepad# 插件只需转到设置,然后单击首选项,然后单击其他,然后禁用可点击链接设置以消除滚动时崩溃希望有帮助。

Here is the plugin info if you need it

如果您需要,这是插件信息

General plugin (proper new line handling, comments, indenting etc)

通用插件(正确的换行处理、注释、缩进等)

Implemented so far:

目前已实施:

  • Proper new line inside CommentDo//DocBlock for C, C++, Javascript, PHP
  • Proper new line for # comment in Ruby
  • Indent after opening curly brace for C-like languages, CSS
    and proper indenting for closing curly brace
  • Delete current line keeping the column
  • Undo closed tab
  • Switching tabs with ALT + LEFT/RIGHT
  • Wrap selection with Open/Close tag
  • Url encode/decode selection
  • Autoclose embeded script tags for ruby and php (<% |
  • Column ruler
  • Indent after opened tag - XML, HTML and PHP
  • Close last open tag
  • Autonumbering inside CommentDoc/DocBlock and # comment
  • Indent after instruction for Ruby - module|class|def|do|if|else|elsif|private
  • Match "end" indentation for Ruby
  • Autocomplete CommentDoc/DocBlock keywords
  • Peek CSS hex colors
  • Scroll past end of file
  • Convert leading TABS to Spaces and reverse
  • Paste indented
  • Double click edit tag Author: jvdanilo Source: https://github.com/jvdanilo/NotepadSharpHomepage: https://github.com/jvdanilo/NotepadSharp
  • CommentDo//DocBlock for C、C++、Javascript、PHP 中的适当新行
  • Ruby 中 # 注释的正确新行
  • 为类 C 语言打开大括号后缩进,CSS
    和正确缩进关闭大括号
  • 删除当前行保留列
  • 撤消关闭的选项卡
  • 使用 ALT + LEFT/RIGHT 切换标签
  • 用打开/关闭标签包裹选择
  • 网址编码/解码选择
  • 自动关闭 ruby​​ 和 php 的嵌入脚本标签 (<% |
  • 列标尺
  • 打开标签后缩进 - XML、HTML 和 PHP
  • 关闭最后打开的标签
  • 在 CommentDoc/DocBlock 和 # comment 中自动编号
  • 在 Ruby 指令后缩进 - module|class|def|do|if|else|elsif|private
  • 匹配 Ruby 的“结束”缩进
  • 自动完成 CommentDoc/DocBlock 关键字
  • 查看 CSS 十六进制颜色
  • 滚动到文件末尾
  • 将前导 TABS 转换为空格并反转
  • 粘贴缩进
  • 双击编辑标签 作者:jvdanilo 来源:https: //github.com/jvdanilo/NotepadSharp主页:https: //github.com/jvdanilo/NotepadSharp

回答by Sun Junwen

For javascript, you can try JsMin (JsTool) plugin. It has jsformatter function.

对于 javascript,您可以尝试 JsMin (JsTool) 插件。它具有 jsformatter 功能。