multiple file edit

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

multiple file edit

ehannes
Vimmers,

Can i send the results of, say a (unix) find command, to vim and start editing right away with the first file from the resultlist?

Thanks,
Hans


Reply | Threaded
Open this post in threaded view
|

Re: multiple file edit

A.J.Mechelynck
Scholte, J.C.M. wrote:

> Vimmers,
>
> Can i send the results of, say a (unix) find command, to vim and start editing right away with the first file from the resultlist?
>
> Thanks,
> Hans
>
>
>
>
>
>
see ":help quickfix.txt". Several Vim commands, with and without
invocation of an external program, use the quickfix window. In your case
I believe the most useful will be :grep and (version 7 only) :vimgrep


HTH,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: multiple file edit

Tim Chase-2
In reply to this post by ehannes
> Can i send the results of, say a (unix) find command, to vim
> and start editing right away with the first file from the
> resultlist?


Sounds like the common use for xargs:

find / -name "filespec.*" | xargs vim

If you've already put the results in a file with something like

find / -name "filespec.*" > ~/filelist.txt

you can still use xargs like

xargs vim < ~/filelist.txt

Hope this gets you where you want to go,

-tim




Reply | Threaded
Open this post in threaded view
|

RE: multiple file edit

ehannes
In reply to this post by ehannes
Yes, that's exactly what i was looking for!

Hans


-----Oorspronkelijk bericht-----
Van: Tim Chase [mailto:[hidden email]]
Verzonden: maandag 23 mei 2005 15:31
Aan: Scholte, J.C.M.
CC: [hidden email]
Onderwerp: Re: multiple file edit


> Can i send the results of, say a (unix) find command, to vim
> and start editing right away with the first file from the
> resultlist?


Sounds like the common use for xargs:

find / -name "filespec.*" | xargs vim

If you've already put the results in a file with something like

find / -name "filespec.*" > ~/filelist.txt

you can still use xargs like

xargs vim < ~/filelist.txt

Hope this gets you where you want to go,

-tim




Reply | Threaded
Open this post in threaded view
|

Re: multiple file edit

Eric Arnold
In reply to this post by ehannes

Don't forget the basic,

        gvim `find / -name "filespec.*" `

xargs   is especially useful in complicated pipe sequences.  If it's a truely
large list, you can use the quickfix window as already suggested,i.e. this is
what I use to emulate "less file*":

                ls $* >C:/tmp/le.tmp ; gvim -R -c 'set errorformat+=%f nowrapscan readonly
nomodifiable'  -c 'nmap <Space> <C-F>' -c 'nmap q :q!<CR>' -c 'norm L' -c
':copen 15' -c ':norm t' -c ":e $1" -c 'cgetfile C:/tmp/le.tmp' &

there's more to the script but that's the Vim line.



--- Tim Chase <[hidden email]> wrote:

> > Can i send the results of, say a (unix) find command, to vim
> > and start editing right away with the first file from the
> > resultlist?
>
>
> Sounds like the common use for xargs:
>
> find / -name "filespec.*" | xargs vim
>
> If you've already put the results in a file with something like
>
> find / -name "filespec.*" > ~/filelist.txt
>
> you can still use xargs like
>
> xargs vim < ~/filelist.txt
>
> Hope this gets you where you want to go,
>
> -tim
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: multiple file edit

Eric Arnold
In reply to this post by ehannes


Don't forget the basic,

        gvim `find / -name "filespec.*" `

xargs   is especially useful in complicated pipe sequences, or if your OS
bombs with too many files on the arg list.  If it's a truely
large list, you can use the quickfix window as already suggested.

I use this to emulate "less filespec*":

                ls $* >C:/tmp/le.tmp ; gvim -R -c 'set errorformat+=%f nowrapscan readonly
nomodifiable'  -c 'nmap <Space> <C-F>' -c 'nmap q :q!<CR>' -c 'norm L' -c
':copen 15' -c ':norm t' -c ":e $1" -c 'cgetfile C:/tmp/le.tmp' &

there's more to the script but that's the Vim line.




--- Tim Chase <[hidden email]> wrote:

> > Can i send the results of, say a (unix) find command, to vim
> > and start editing right away with the first file from the
> > resultlist?
>
>
> Sounds like the common use for xargs:
>
> find / -name "filespec.*" | xargs vim
>
> If you've already put the results in a file with something like
>
> find / -name "filespec.*" > ~/filelist.txt
>
> you can still use xargs like
>
> xargs vim < ~/filelist.txt
>
> Hope this gets you where you want to go,
>
> -tim
>
>
>
>
>