Vim 如何在`{`和`}`之间的行中添加四个空格?
目标文本文件Vim 如何在`{`和`}`之间的行中添加四个空格?,vim,format,Vim,Format,目标文本文件 <style type="text/css"> #wrap{ height: 550px; width: 660px; } #wrap ul{ list-style: none; } #wrap li{ border-radius:3px; cursor:pointer; } #wrap{ height: 550px; width: 660px; } #wrap ul{ list
<style type="text/css">
#wrap{
height: 550px;
width: 660px;
}
#wrap ul{
list-style: none;
}
#wrap li{
border-radius:3px;
cursor:pointer;
}
#wrap{
height: 550px;
width: 660px;
}
#wrap ul{
list-style: none;
}
#wrap li{
border-radius:3px;
cursor:pointer;
}
</style>
也许执行所有的公共任务是愚蠢的
3,4s/^/ /g
7s/^/ /g
10,11s/^/ /g
14,15s/^/ /g
18s/^/ /g
21,22s/^/ /g
还有更简单、更智能的方法吗?假设文档的文件类型已正确设置为html,并且制表设置正确,以下内容就足够了:
:2,23norm ==
但是,要直接回答您的问题,您应该针对以下行:
如果不想手动定义范围,可以执行以下操作:
vit:g/:/s/^/ /
其中插入了
这意味着返回
:2,23g/:/s/^/ /
vit:g/:/s/^/ /
:g/^[^<#}]/ normal >>
: ........... command
g ........... global command (executes on the following pattern
/ ........... start search pattern
^ ........... beginning of line
[^ ] ........ denied list
<#} ......... denied chars
/ ........... search pattern's end
normal ...... execute in normal mode
>> .......... indentation
map <F2> <esc>:g/^[^<#}]/ normal >><cr>