Monday, July 27, 2020

Re: Opening files in a certain pattern

On Mon, Jul 27, 2020 at 04:19:06PM -0700, Gary Johnson wrote:
> On 2020-07-28, Manas wrote:
> > On Mon, Jul 27, 2020 at 03:08:49PM -0700, Gary Johnson wrote:
> > > How's this for a start? The number n here is fixed, but you could
> > > use a while loop instead of the for loop, increment n in each
> > > iteration, and break when one of the files doesn't exist. See
> > > ":help filereadable()".
> > >
> > > let n = 4
> > > for i in range(n)
> > > exe "tabnew" printf("dir2/A%d.md", i)
> > > exe "vnew" printf("dir1/L%d.md", i)
> > > endfor
> > >
> > That is the idea which I was thinking but opening other windows (after
> > the first one) is giving me troubles.
>
> If it's still giving you troubles, you could post here what you have
> and we could perhaps find the problem. If you do that, please be
> specific about what you mean by giving you troubles.
>
I found `:tabl` which will take me to last tab. So I come up with
opening first 2 panes in starting window as:

$ vim -O2 dir1/L1.md dir2/A1.md

And for opening next 2 panes in new tab after the first tab, first I
opened one file using tab sp and then going to that tab using tabl,
and then vertical splitting second file from dir2. The final command
looked like this:

$ vim -O2 dir1/L1.md dir2/A1.md -c "tab sp dir1/L2.md" -c "tabl" -c "vsp
dir2/A2.md"

It works for me. And I can generate that command in shell script.

Can there be some improvement upon this?

--
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/20200727233330.wljctxf6fisagkmw%40nitro-5.

No comments:

Post a Comment