如何在vim中分离合并的html标记?

如何在vim中分离合并的html标记?,html,vim,sparkup,Html,Vim,Sparkup,我如何得到这个: <body> <div>[cursor here]</div> </body> [光标在此] 为此: <body> <div> [cursor here] </div> </body> [光标在此] 在一个命令中?我安装了sparkup插件,但没有遇到任何这样做的操作关于: inoremap <c-k> <cr&g

我如何得到这个:

<body>
    <div>[cursor here]</div>
</body>

[光标在此]
为此:

<body>
    <div>
        [cursor here]
    </div>
</body>

[光标在此]
在一个命令中?我安装了sparkup插件,但没有遇到任何这样做的操作

关于:

inoremap <c-k> <cr><esc>O
inoremap O
和ofc更改为您喜欢的任何内容。

关于:

inoremap <c-k> <cr><esc>O
    :%s/\(>\_\s\+<div>\)\([^<]*\)\(.*\)/\1\r\t\t\2\r\t\3/g

    : .................. command line
    % .................. whole file
    / .................. start search pattern
    \( ................. start group -- see \) closing at the end
    > .................. one close tag
    \_ ................. multiline search
    \s ................. one space
    \+ ................. or more
    <div> .............. one div
    \) ................. closing group one
    \( ................. open the second group
    [^<]* .............. denied list in wich no has open tag <  (everything less <)
    \) ................. closing the second group
    \( ................. opening the third group (everything else) in the next line
    .* ................. the rest of line, including the close </div>
    / .................. start of substitution pattern
    \1 ................. back reference to the group one (place them here)
    \r ................. carriage return (or simply <enter>)
    \t\t ............... 2 tabs
    \2 ................. place second group here
    \r ................. another <enter>
    \t ................. one more tab
    \3 ................. palce third group here
    / .................. end of substituition
    g .................. global command
inoremap O
和ofc将
更改为您喜欢的任何内容。

:%s/\(>\\\\\s\+\)\([^………..一个关闭标记
    :%s/\(>\_\s\+<div>\)\([^<]*\)\(.*\)/\1\r\t\t\2\r\t\3/g

    : .................. command line
    % .................. whole file
    / .................. start search pattern
    \( ................. start group -- see \) closing at the end
    > .................. one close tag
    \_ ................. multiline search
    \s ................. one space
    \+ ................. or more
    <div> .............. one div
    \) ................. closing group one
    \( ................. open the second group
    [^<]* .............. denied list in wich no has open tag <  (everything less <)
    \) ................. closing the second group
    \( ................. opening the third group (everything else) in the next line
    .* ................. the rest of line, including the close </div>
    / .................. start of substitution pattern
    \1 ................. back reference to the group one (place them here)
    \r ................. carriage return (or simply <enter>)
    \t\t ............... 2 tabs
    \2 ................. place second group here
    \r ................. another <enter>
    \t ................. one more tab
    \3 ................. palce third group here
    / .................. end of substituition
    g .................. global command
\_多行搜索 \一个空格 \+……或更多 一个分区 \)结束第一组 \(……..打开第二组 [^
:%s/\(>\\\\s\+\)\([^………..一个结束标记
\_多行搜索
\一个空格
\+……或更多
一个分区
\)结束第一组
\(……..打开第二组

[^你想为它映射一些键吗?你想为它映射一些键吗?这似乎创建了一个新行,但没有缩进光标或结束符。你的
中没有
文件类型缩进或类似的
.vimrc
?我没有。添加之后,你建议的映射工作正常。谢谢!这似乎创建了一个new行,但不缩进光标或结束符您的
文件中没有
文件类型缩进
或类似的东西吗
.vimrc
?我没有。添加后,您建议的映射有效。谢谢!