在 Vim 中隐藏所有(不)匹配的行 [英] Hide all (not)matching lines in Vim

查看:24
本文介绍了在 Vim 中隐藏所有(不)匹配的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 vi 或 Vim 中显示/隐藏所有匹配的行?不突出显示,只显示那些行.

Is it possible to show/hide all matching lines in vi or Vim? Not highlight but just show only those lines.

例如,我有一个带有单词 ERROR 的文本.如何让它只显示包含 ERROR 的行以及如何只显示没有 ERROR 的行?

For example I have a text with word the word ERROR. How do I make it show only lines containing ERROR and how to show only lines without ERROR?

有没有不删除所有匹配行然后撤消它的解决方案?

Is there a solution without deleting all matching lines and then just undoing it?

推荐答案

你知道 :global 命令吗?这能满足您的需求吗?

Do you know about the :global command? Does this do what you want?

:g/ERROR

反之:

:g!/Error

或等效地:

:v/Error

这篇关于在 Vim 中隐藏所有(不)匹配的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆