Monday, July 27, 2020

Re: Opening files in a certain pattern

On Mon, Jul 27, 2020 at 06:32:01PM -0500, Tim Chase wrote:
> You might try something like this:
>
> $ vim -p -c 'set tabpagemax=50' -c 'tabdo exec "vsp ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L", "/A", "")' dir1/*
>
> (there's a space after the "vsp" in case mail between here and there
> decides to eat it)
>
> By default 'tabpagemax' is 10, so you don't need to change that to
> 50 if you have 10 or fewer files. Just set it to the number of files
> you have. The "-p" then opens each dir1/L*.md file in its own tab
> (they're specified on the command-line). It then iterates over each
> of those tabs (tabdo), transforms the current filename into its mate's
> filename (s/dir1/dir2/ and s@/L@/A@) and builds an command to
> vertically split (vsp) as a string, and then :exec's it to do the
> actual vertical split in each tab.
>
> -tim
>
I am sorry, I missed your mail by a minute. That command works
beautifully. I tried it on my directory structure and works.

Thanks everyone for help!
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200727234153.o2vqs3sg3ilqef62%40nitro-5.

No comments: