vim增量搜索在文件末尾停止

syn*_*tik 36 vim search

在Vim中,当我通过输入/xI 进行增量搜索"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
Run Code Online (Sandbox Code Playgroud)

Jos*_*Lee 51

关闭'wrapscan'选项.

set nowrapscan
Run Code Online (Sandbox Code Playgroud)

  • 我刚把这行添加到我的`〜/ .vimrc`中.当我需要换行时,我会做一个`:1` (2认同)