gpt4 book ai didi

Emacs 中的 HTML 标签不对齐

转载 作者:行者123 更新时间:2023-11-28 00:17:23 25 4
gpt4 key购买 nike

我在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com