quickly viewing a directory of files

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

quickly viewing a directory of files

Chris Lott
I have a directory of files with names like 'clips-20150101' 'clips-20150102' etc. I need to open a file, jump to a particular string, optionally yank some arbitrary text, and repeat for every file in the directory. What's the quickest way to do this in Vim?

c
--
Chris Lott <[hidden email]>

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: quickly viewing a directory of files

Paul Isambert
Le samedi 04 avril 2015 à 21:21, Chris Lott a écrit:
>    I have a directory of files with names like 'clips-20150101'
>    'clips-20150102' etc. I need to open a file, jump to a particular string,
>    optionally yank some arbitrary text, and repeat for every file in the
>    directory. What's the quickest way to do this in Vim?

What about simply passing the filenames as arguments to Vim, something
like “vim clips-*” (assuming you’re on *nix), then use “n” to repeat
the search (after you’ve defined it once) and jump where you want,
yank your text, then “:next” to the next file?

If the text you want to yank is predictible (I’d guess from the
search), you can automate the whole process with “gn” (visual mode on
the last search) and “y”.

Best,
Paul

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: quickly viewing a directory of files

Chris Lott
On Sat, Apr 4, 2015 at 10:47 PM, Paul Isambert <[hidden email]> wrote:
> What about simply passing the filenames as arguments to Vim, something
> like “vim clips-*” (assuming you’re on *nix), then use “n” to repeat
> the search (after you’ve defined it once) and jump where you want,
> yank your text, then “:next” to the next file?

Great, thanks! Simple is sometimes best...

c
--
Chris Lott <[hidden email]>

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: quickly viewing a directory of files

Charles E Campbell Jr
In reply to this post by Chris Lott
Chris Lott wrote:
> I have a directory of files with names like 'clips-20150101'
> 'clips-20150102' etc. I need to open a file, jump to a particular
> string, optionally yank some arbitrary text, and repeat for every file
> in the directory. What's the quickest way to do this in Vim?
See  :help glob()

Regards,
Chip Campbell

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: quickly viewing a directory of files

Gary Johnson-4
In reply to this post by Chris Lott
On 2015-04-04, Chris Lott wrote:
> I have a directory of files with names like 'clips-20150101' 'clips-20150102'
> etc. I need to open a file, jump to a particular string, optionally yank some
> arbitrary text, and repeat for every file in the directory. What's the quickest
> way to do this in Vim?

What I do is this:

    :grep 'particular string' clips-2015*

Then traverse the resulting quickfix list and yank the desired text
into an upper-case register so that the yanks are accumulated.

Traversing the quickfix list  is made a little faster with these
mappings:

    :nmap <silent> <C-N> :cn<CR>zv
    :nmap <silent> <C-P> :cp<CR>zv

HTH,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.