当我在vim中搜索然后按“ esc”时,光标返回到上一个位置

fri*_*ice 1 vim

我的vim安装似乎发生了某些事情,但我不确定是什么。我是vim的长期用户(尽管我不将其用作主编辑器)。

当我搜索时:

/foo
Run Code Online (Sandbox Code Playgroud)

我想编辑找到的位置,所以按ESC(准备进入插入模式)。vim现在跳回到我从文件开始的位置。例如,如果我在3000行文件的第0行中,我搜索一个特定的字符串,在第1700行中找到它,然后想要对其进行编辑-ESC将我带回到第0行。

这是怎么回事?我是否意外设置了一些奇怪的模式?还是忘记了我应该知道的热键组合?

Jon*_*ely 7

这是带有以下incsearch选项的预期行为:

Note that the match will be shown, but the cursor will return to its
original position when no match is found and when pressing <Esc>.  You
still need to finish the search command with <Enter> to move the
cursor to the match.
Run Code Online (Sandbox Code Playgroud)

如果incsearch没有打开,则光标根本不会跳到第一个匹配项,直到您按为止,光标才会移动<Enter>