我正在使用 Emacs 附带的 HTML 模式并编写一个基本的 index.html 页面(例如,只是一个内部带有 div 的正文)。当我尝试关闭标签时,Emacs 不会自动缩进标签以匹配开始标签。我必须在 .emacs 文件中设置某些内容吗?
问题是:
<div>
content....
</div>
谢谢!
最佳答案
这似乎与您所追求的类似:
Can't change Emacs's default indentation between HTML tags
有关 HTML 缩进的更多信息:
http://www.emacswiki.org/emacs/IndentingHtml
(add-hook 'html-mode-hook
(lambda ()
;; Default indentation is usually 2 spaces, changing to 4.
(set (make-local-variable 'sgml-basic-offset) 4)))
编辑:
这看起来可能是一个很好的解决方案:Can emacs re-indent a big blob of HTML for me?
By default, when you visit a .html file in Emacs (22 or 23), it will put you in html-mode. That is probably not what you want. You probably want nxml-mode, which is seriously fancy. nxml-mode seems to only come with Emacs 23, although you can download it for earlier versions of emacs from the nXML web site. There is also a Debian and Ubuntu package named nxml-mode
关于Emacs 中的 HTML 标签未对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11423588/