Vim 的 ex 模式用惯了真的让人对正则表达式乐不思蜀,比如我想用 stylus 改一个网站的字体,需要从原始 CSS 里找出所有指定了 font-family 的 selector,如果用正则表达式还要磨叽一会,但是用 vim 都不要动脑子:
:g/family/norm k0yt ggpa,
(找到所有包含 family 的行,光标移到上一行行首,选中到第一个空格之前的位置,复制,光标移到文件开头,粘贴,结尾追加一个逗号)
现成的 selector 就给我写好了
Please be advised that this post was written or last updated a while ago and may therefore contain outdated information or opinions I no longer hold.
请知悉本文自写作或上次更新已届相当时限,或包含过时信息及观点。