1

I'm using emmet-vim which says that it can work in xml files but I can't seem to navigate between tags.

Say I have this structure:

<dependency>
  <groupId>com.google</groupId>
  <artifactId>slides</artifactId>
  <version>1.0</version>
  <scope>system</scope>
  <systemPath>${basedir}/lib/lib.jar</systemPath>
</dependency>

How do I jump forwards to the next tag? E.g., with my cursor on the 1 in the version tag how can I move to the second s in the next line? (The first s of system.)

I already tried <C-y> n which is the "move to next edit point" but it doesn't seem to work.

1
  • 1
    so you don't want to jump to the next tag, but to the next tag content? Aug 23, 2018 at 9:11

1 Answer 1

0

record the following to a macro

/\(<\/[^<]*>\n*\s*<[^<]*>\)\@<=.^M:noh

and you can type "n" to go to the second tag ahead, and so on.

/ start search

\( start pattern (\ is to escape the ()

< <

\/ / (\ is for escaping)

[^<]* zero or more of any characters except < ([^<] not < * zero or more)

> >

\n* zero or more newlines

\s* zero or more spaces

< <

[^<]* zero or more of any characters except <

> >

\) end pattern

\@<=. any character (.) that comes after the previous pattern (\ is for escaping)

1
  • 1
    This answer would be strongly improved by an explanation of the pattern.
    – D. Ben Knoble
    Oct 18, 2021 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.