2012-06-01 12 views
25

En Vim, cuando estoy haciendo una búsqueda incremental de "x" al ingresar /x, presiono n para pasar a la siguiente aparición. Si acabo de coincidir con la última ocurrencia en el archivo, cuando presiono n, el cursor comenzará a buscar una coincidencia al principio del archivo; volverá al principio. No quiero que vuelva al principio. Quiero n para simplemente no encontrar más coincidencias después de que llegue a la ocurrencia final. La razón por la que deseo este comportamiento es para que pueda ver fácilmente cuando busqué en todo el archivo.vim búsqueda incremental detener al final del archivo

¿Alguien sabe cómo llevar a cabo este comportamiento?

FYI: Estoy utilizando las siguientes opciones .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 

Respuesta

36

desactivar la opción 'wrapscan'.

set nowrapscan 
+0

Gracias, sabía que tenía que ser algo directo y sencillo :) – synaptik

+2

simplemente he añadido esta línea para mi '~/.vimrc'. Cuando deba envolver haré un ': 1' –

Cuestiones relacionadas