【发布时间】:2012-10-28 01:10:04
【问题描述】:
我如何得到这个:
<body>
<div>[cursor here]</div>
</body>
到这里:
<body>
<div>
[cursor here]
</div>
</body>
在一个命令中?我安装了 sparkup 插件,但没有遇到任何执行此操作的操作
【问题讨论】:
-
您想为此映射一些键吗?
我如何得到这个:
<body>
<div>[cursor here]</div>
</body>
到这里:
<body>
<div>
[cursor here]
</div>
</body>
在一个命令中?我安装了 sparkup 插件,但没有遇到任何执行此操作的操作
【问题讨论】:
怎么样:
inoremap <c-k> <cr><esc>O
然后 ofc 将 <c-k> 更改为您喜欢的任何内容..
【讨论】:
.vimrc 中没有filetype indent on 或类似的东西吗?
:%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
【讨论】: