vim 增量搜索在文件末尾停止 [英] vim incremental search stop at end of file

查看:51
本文介绍了vim 增量搜索在文件末尾停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In Vim, when I'm doing an incremental search for "x" by entering /x I then press n to jump to the next occurrence. If I have just matched the last occurrence at the file, when I press n the cursor will start to look for a match at the beginning of the file---it will loop back to the beginning. I do not want it to loop back to the beginning. I want n to simply not find any more matches after it reaches the final occurrence. The reason I want this behavior is so that I can easily see when I have searched through the entire file.

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

Does anyone know how to effect this behavior?

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

FYI: I am using the following .vimrc options:

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

推荐答案

关闭 'wrapscan' 选项.

set nowrapscan

这篇关于vim 增量搜索在文件末尾停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆