在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
答案 0 :(得分:47)
关闭'wrapscan'
选项。
set nowrapscan