On Wed, June 10, 2009 9:17 am, Cyril SANTUNE wrote:
> If I make : ":bufdo /abcd". I will obtain something like that :
>
[…]
>
> At the end of the command, I am in the file4.txt. My problem is that I
> would be in file2.txt at the end of the 'bufdo' command.
Try this:
fu! <SID>BufSearch(term)
set hidden
let buf=bufnr('%')
silent! bufdo if (search(a:term ) && !exists("res"))
\ | let res=bufnr("%")
\ | endif
silent exe "b ". ( exists("res") ? res : buf )
redraw!
endfu
com! -nargs=1 BufSearch :call <SID>BufSearch(<q-args>)
regards,
Christian
--
:wq!
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---