如何在不删除第一个搜索模式的情况下在vi中搜索第二个模式

时间:2016-07-01 03:21:29

标签: search vi

在vi文本编辑器中,假设我想浏览" cheese"的所有实例。在一个文本文件中,所以我键入" / cheese"然后按ENTER键。我可以使用n或N转到下一个/上一个实例。如果我改变了主意,我想搜索" cheesecake",请按" /"将删除" cheese"所以我需要输入" cheesecake"而不只是打字" cake"。

大多数图形文本编辑器都能够保存最后一个搜索模式。 Emacs也具备此功能。我还没有找到如何在vi中做到这一点。

1 个答案:

答案 0 :(得分:0)

I know of no way to make it keep the last command on the line when you open it but you are certainly able to press the up arrow and page through previous commands you've issued. So just type /, hit the up arrow key, type "cake".

PS - This doesn't really belong here. Stackoverflow is about programming questions. You might be better off asking this kind of question over at SuperUser.com.