51

在 Vim 中,当我通过输入对“x”进行增量搜索时,/x然后按下n以跳转到下一个匹配项。如果我刚刚匹配了文件中的最后一个匹配项,那么当我按下n光标时,将开始在文件的开头查找匹配项——它将循环回到开头。 我不希望它循环回到开头。 我想n在它到达最终出现后不再找到任何匹配。我想要这种行为的原因是,当我搜索整个文件时,我可以很容易地看到。

有谁知道如何影响这种行为?

仅供参考:我正在使用以下 .vimrc 选项:

colorscheme zenburn   " zenburn colorscheme

set nocompatible      " prevent Vim from emulating Vi's bugs
set scrolloff=5       " keeps cursor away from top/bottom of screen
set nobackup          " don't make automatic backups

set incsearch         " incremental searching
set ignorecase        " case insensitive matching
set smartcase         " smart case matching
set showmatch         " show matching bracket

set autoindent        " indentation
set smartindent       " indentation
set cindent           " indenting for C code
set tabstop=4         " 4-space tabs
set shiftwidth=4      " 4-space tabs

syntax on             " syntax highlighting
filetype on           " behavior based on file type
filetype plugin on    " behavior based on file type
filetype indent on    " behavior based on file type

set visualbell        " replace beeping with flashing screen

set gfn=Lucida_Sans_Typewriter:h10:cANSI
4

1 回答 1

73

关闭该'wrapscan'选项。

set nowrapscan
于 2012-06-01T17:00:04.097 回答