Vim Tips Wiki
Register
(Change to TipImported template + severe manual clean)
({{delete|{{script|1062}} does the same thing but better}})
Line 1: Line 1:
  +
{{delete|{{script|1062}} does the same thing but better}}
  +
 
{{review}}
 
{{review}}
 
{{TipImported
 
{{TipImported

Revision as of 00:49, 17 April 2008



Tip 950 Printable Monobook Previous Next

created June 15, 2005 · complexity basic · author Bill Weir · version 5.7


When editing multiple files I like to have a search operation that behaves a bit like "/*" in less (to search multiple buffers looking for the next match). The Nextmatch function (below) does this, although it doesn't behave quite as I would like.

function! Nextmatch()
  let v:errmsg = "X"
  let s:x = bufnr("%")
  while v:errmsg != ""
    bnext
    if bufnr("%") == s:x
      break
    endif
    1
    let v:errmsg = ""
    silent! /
  endwhile
endfunction

Comments