我找到了这个
:%g/<h[12]>/ t$
它说
This command searches our file for the lines starting with
<h1>
or<h2>
and copies them to the end of the file.
但我无法理解部分/ t $,这是什么意思?
解决方法
如果在vim中运行此帮助命令:
:help copy
:[range]co[py] {address} *:co* *:copy* copy the lines given by [range] to below the line given by {address}. *:t* :t Synonym for copy.
详细信息:
>:g:全局搜索
>< h [12]>:搜索< h1>或者< h2>
> t $或copy $:将[range]给出的行复制到{address}给出的行以下.
你可以把它变得更加冗长.但使用此等效命令更具可读性:
:%g/<h[12]>/ copy$
或这个:
:%g/<h[12]>/ co$
要在文件中复制匹配行,请使用:
:%g/<h[12]>/ copy0
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。