dar*_*ren 182 html code-formatting notepad++
在Notepad ++中是否有用于格式化代码的键盘快捷键?
我主要使用HTML,CSS和Python代码.
例如:
<title>{% block title %} {% endblock %}</title>
<link rel="stylesheet" href="/media/style.css" type="text/css" media="screen" />
</head>
Run Code Online (Sandbox Code Playgroud)
至:
<head>
<title>
{% block title %}
{% endblock %}
</title>
<link rel="stylesheet" href="/media/style.css" type="text/css" media="screen" />
</head>
Run Code Online (Sandbox Code Playgroud)
我记得Visual Studio使用Ctrl+ K+ D和NetBeans也有这个功能但是在Notepad ++中找不到它,如果它甚至可以做到的话.
gab*_*lin 125
TextFX - > HTML Tidy - > Tidy:Reindent XML
在执行此操作之前,请务必选择HTML代码.
Dmi*_*mov 76
有一个像UniversalIndentGUI这样的插件,它可以直接从插件管理器安装,并有可能重新使用最常用的编程语言.
如果您没有所需的功能,您可以定义自己的宏并将它们分配给自定义快捷方式(我不习惯使用宏).
更新:我会在这里发布快捷方式,以防链接失效:
Shortcut Command
Ctrl-C Copy
Ctrl-X Cut
Ctrl-V Paste
Ctrl-Z Undo
Ctrl-Y Redo
Ctrl-A Select All
Ctrl-F Launch Find Dialog
Ctrl-H Launch Find / Replace Dialog
Ctrl-D Duplicate Current Line
Ctrl-L Delete Current Line
Ctrl-T Switch the current line position with the previous line position
F3 Find Next
Shft-F3 Find Previous
Ctrl-Shft-F Find in Files
Ctrl-F3 Find (volatil) Next
Ctrl-Shft-F3 Find (volatil) Previous
Ctrl-Shft-I Incremental Search
Ctrl-S Save File
Ctrl-Alt-S Save As
Ctrl-Shft-S Save All
Ctrl-O Open File
Ctrl-N New File
Ctrl-F2 Toggle Bookmark
F2 Go To Next Bookmark
Shft-F2 Go To Previous Bookmark
Ctrl-G Launch GoToLine Dialog
Ctrl-W Close Current Document
Alt-Shft-Arrow keys or Alt + Left mouse click Column Mode Select
F5 Launch Run Dialog
Ctrl-Space Launch CallTip ListBox
Alt-Space Launch Word Completion ListBox
Tab (selection of several lines) Insert Tabulation or Space (Indent)
Shft-Tab (selection of several lines) Remove Tabulation or Space (outdent)
Ctrl-(Keypad-/Keypad+) or Ctrl + mouse wheel butto Zoom in (+ or up) and Zoom out (- or down)
Ctrl-Keypad/ Restore the original size from zoom
F11 Toggle Full Screen Mode
Ctrl-Tab Next Document
Ctrl-Shft-Tab Previous Document
Ctrl-Shft-Up Move Current Line Up
Ctrl-Shft-Down Move Current Line Down
Ctrl-Alt-F Collapse the Current Level
Ctrl-Alt-Shft-F Uncollapse the Current Level
Alt-0 Fold All
Alt-(1~8) Collapse the Level (1~8)
Alt-Shft-0 Unfold All
Alt-Shft-(1~8) Uncollapse the Level (1~8)
Ctrl-BackSpace Delete to start of word
Ctrl-Delete Delete to end of word
Ctrl-Shft-BackSpace Delete to start of line
Ctrl-Shft-Delete Delete to end of line
Ctrl-U Convert to lower case
Ctrl-Shft-U Convert to UPPER CASE
Ctrl-B Go to matching brace
Ctrl-Shft-R Start to record /Stop recording the macro
Ctrl-Shft-P Play recorded macro
Ctrl-Q Block comment/uncomment
Ctrl-Shft-Q Stream comment
Ctrl-Shft-T Copy current line to clipboard
Ctrl-P Print
Alt-F4 Exit
Ctrl-I Split Lines
Ctrl-J Join Lines
Ctrl-Alt-R Text Direction RTL
Ctrl-Alt-L Text Direction LT
F1 About
Run Code Online (Sandbox Code Playgroud)
截至 2019 年 6 月的答复
XML Tools从插件管理器安装插件(至少在 Notepad++ 7.7 中)
然后单击插件 -> XML 工具 -> 漂亮打印(仅 XML 带换行符)
那是为我做的。
最新的插件是tidy2,可以通过插件>插件管理器>显示插件管理器安装.
我建议编辑config 1并设置quote-marks:no,特别是如果你有使用引号的脚本.
此外,整理不止一次可能会导致第一次插入&符号,然后第二次更换&符号.您可能希望使用配置将其发送到您需要的位置.
这不是你想要的答案,但这是我遇到同样问题时遇到的解决方案.
我是一个非常认真的Notepad ++用户,所以不要采取错误的方式.我已经开始使用NetBeans 8除Notepad ++之外的网站开发,因为您可以将其设置为autoformat,保存所有语言,并且有大量配置选项可用于格式化,最简单的细节.您可以查看它,发现它是与notepad ++结合使用的有用工具.它也是开源的,完全免费的,并且有一堆插件和其他有用的东西,如果你也使用它自动编译Sass.它绝对不如NP ++那么快,因此对于小编辑来说并不是很好,但对于长编码会话来说它可能很好.