Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs, nxhtml how to highlight or jump to the closing html tag?

Tags:

emacs

nxhtml

I'm using emacs with nxhtml to edit my HTML files but I can't find out how to highlight or jump to the closing HTML tag?

It sounds like an easy and stupid question but i really can't find it. Maybe I'm not looking for the right thing.

like image 401
yokoloko Avatar asked Aug 11 '11 07:08

yokoloko


1 Answers

In nxhtml-mode, C-hm should indicate the following bindings:

<C-M-down>  nxml-down-element
<C-M-left>  nxml-backward-element
<C-M-right> nxml-forward-element
<C-M-up>    nxml-backward-up-element

The forward and backward functions are what you're asking about, while the up and down functions let you move to the parent or child element in the hierarchy.

The sgml-mode answer is more robust for HTML (as opposed to well-formed XHTML), but you may want to add autoloads for those functions if you'll be using them in nxhtml-mode, as the latter does not require the former.

(autoload 'sgml-skip-tag-forward "sgml-mode"
  "Skip to end of tag or matching closing tag if present.
With prefix argument ARG, repeat this ARG times.
Return t if after a closing tag." t)

(autoload 'sgml-skip-tag-backward "sgml-mode"
  "Skip to beginning of tag or matching opening tag if present.
With prefix argument ARG, repeat this ARG times.
Return non-nil if we skipped over matched tags." t)
like image 53
phils Avatar answered Oct 04 '22 02:10

phils