Jump to matching XML tags in Vim

后端 未结 4 546
别那么骄傲
别那么骄傲 2020-12-07 07:19

Vim % operator jumps to matching parentheses, comment ends and a few other things. It doesn\'t, however, match XML tags (or any other tag, to the best of my kn

4条回答
  •  感情败类
    2020-12-07 08:05

    The OP stated that what he really wanted to do is copy a section of XML without having to find the matching tag. This is easily done in normal mode with yatp, which yanks the text inside and including the matching tags, then pastes it. yitp is almost the same, but it doesn't include the outer tags.

    The 'y' in the string is of course the normal mode "yank" command. (:help y)

    a or i can be used for object selection after an operator such as y or inside a visual selection. The symbol after a or i specifies what should be selected. The object type t used here indicates an SGML tag. (:help object-select).

    Of course just means to move somewhere by the means of your choice and p puts the yanked text at that location.

提交回复
热议问题