splitting windows

2006-05-11 Thread Raphael Brunner
dear users

How can I open four files (eg: file1.txt, file2.txt, file3.txt and
file4.txt) for a view as following:

VIM

¦file1 ¦file2  ¦
¦  ¦   ¦
¦  ¦   ¦
¦  ¦   ¦
¦  ¦   ¦

¦file3 ¦file4  ¦
¦  ¦   ¦
¦  ¦   ¦
¦  ¦   ¦
¦  ¦   ¦


I tried this: with a modeline with :sp - but it don't works
and a script with -o and -O, but also this don't works.
Has anyone a good idea?

Thanks a lot for your help.
Raphael

-- 
Analog-/ISDN-Nutzer sparen mit GMX SmartSurfer bis zu 70%!
Kostenlos downloaden: http://www.gmx.net/de/go/smartsurfer


Re: splitting windows

2006-05-11 Thread Tim Chase

How can I open four files (eg: file1.txt, file2.txt, file3.txt and
file4.txt) for a view as following:

VIM

¦file1 ¦file2  ¦
¦  ¦   ¦
¦  ¦   ¦
¦  ¦   ¦
¦  ¦   ¦

¦file3 ¦file4  ¦
¦  ¦   ¦
¦  ¦   ¦
¦  ¦   ¦
¦  ¦   ¦


I tried this: with a modeline with :sp - but it don't works
and a script with -o and -O, but also this don't works.
Has anyone a good idea?


Ugly as it may be, the following worked for me:

vi -c 'to sp file1' -c 'bel vsp file2' -c 'wincmd b' -c 'bel 
vsp file4' file3


The items might put in a script and sourced to make it a bit 
cleaner...something like


bash$ cat four.vim
to sp file1
bel vsp file2
wincmd b
bel vsp file4
wincmd h
e file3
wincmd t
bash$ vim -c 'so four.vim'

Both seem to do the trick.  They're kinda hard-coded, to 
those file names, and those window positions, but they work.


Hope this helps,

-tim







Re: splitting windows

2006-05-11 Thread Mark Woodward
Hi Raphael,


On Thu, 11 May 2006 13:22:54 +0200 (MEST)
"Raphael Brunner" <[EMAIL PROTECTED]> wrote:

> dear users
> 
> How can I open four files (eg: file1.txt, file2.txt, file3.txt and
> file4.txt) for a view as following:
> 
> VIM
> 
> ¦file1 ¦file2  ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> 
> ¦file3 ¦file4  ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> 
> 
> I tried this: with a modeline with :sp - but it don't works
> and a script with -o and -O, but also this don't works.
> Has anyone a good idea?
> 
> Thanks a lot for your help.
> Raphael
> 

Sessions might be what your after here. (:h sessions)
Once you have the layout how you'd like it (ie as you've
illustrated above):

   :mksession /path/to/save/to/sessionName.vim

Doesn't help you initially (see Tims reply) but next time you open vim
you can:

   :so /path/to/save/to/sessionName.vim

and the session will be restored.

Doing this you can have the windows different sizes or in vim 7
files 1,2,3,4 on one tab, files 5,6 on another, and file 7 on yet
another. All windows and tabs will be restored when you source
sessionName.vim. (Bram's a Genius!)

One other thing if you change the session and wish to save it, you need
to use:

  :mksession! /path/to/save/to/sessionName.vim
  note the ! to overwrite
  
Of course there nothing stopping you saving it as a different session
if that's preferred.


cheers,


-- 
Mark



Re: splitting windows

2006-05-11 Thread Eric Arnold

On 5/11/06, Tim Chase <[EMAIL PROTECTED]> wrote:

> How can I open four files (eg: file1.txt, file2.txt, file3.txt and
> file4.txt) for a view as following:
>
> VIM
> 
> ¦file1 ¦file2  ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> 
> ¦file3 ¦file4  ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> ¦  ¦   ¦
> 
>
> I tried this: with a modeline with :sp - but it don't works
> and a script with -o and -O, but also this don't works.
> Has anyone a good idea?

Ugly as it may be, the following worked for me:

vi -c 'to sp file1' -c 'bel vsp file2' -c 'wincmd b' -c 'bel
vsp file4' file3

The items might put in a script and sourced to make it a bit
cleaner...something like

bash$ cat four.vim
to sp file1
bel vsp file2
wincmd b
bel vsp file4
wincmd h
e file3
wincmd t
bash$ vim -c 'so four.vim'

Both seem to do the trick.  They're kinda hard-coded, to
those file names, and those window positions, but they work.




You could also create a session with 4 empty window (with :mksession,
or I use my WinWalker.vim to create the layout and save the template
as a session).

Then a script something like the below should fill the windows. I.e.

$ tst.sh file1 file2 file3 file4

However, for some reason I can't find, it seems to eat one of the
windows before it gets going, so instead of 4 windows, it only has 3.
If the .vim script resulting from the below .sh script is "source"d
from inside Vim, it works find.  Odd.


cat > tst.vim
echo 'wincmd w' >> tst.vim
done

#gvim '-c so tst.vim'
gvim -S tst.vim