having working window always on top

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

having working window always on top

jose isaias cabrera-2

Greetings!

So, I am working with at least two files in two windows.  The CTLR-w moves
me around the different text files.  I would like to have the working
windows always on top of the others. C = cursor.  Imagine this:

------------
|C         |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
------------
| 1.txt    |
------------
| 2.txt    |
------------

if I hit CTRL-w, I would get this:

------------
| 1.txt    |
------------
| C        |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
------------
| 2.txt    |
------------

But I would like to have this instead,

------------
|C         |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
------------
| 2.txt    |
------------
| 1.txt    |
------------

meaning, that I work on top of the other open windows.  Is this even
possible?

thanks,

jos?

Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

A.J.Mechelynck
----- Original Message -----
From: "jose isaias cabrera" <[hidden email]>
To: <[hidden email]>
Sent: Saturday, August 20, 2005 10:34 PM
Subject: having working window always on top


>
> Greetings!
>
> So, I am working with at least two files in two windows.  The CTLR-w moves
> me around the different text files.  I would like to have the working
> windows always on top of the others. C = cursor.  Imagine this:
>
> ------------
> |C         |
> |          |
> |          |
> |          |
> |          |
> |          |
> |          |
> |          |
> ------------
> | 1.txt    |
> ------------
> | 2.txt    |
> ------------
>
> if I hit CTRL-w, I would get this:
>
> ------------
> | 1.txt    |
> ------------
> | C        |
> |          |
> |          |
> |          |
> |          |
> |          |
> |          |
> |          |
> ------------
> | 2.txt    |
> ------------
>
> But I would like to have this instead,
>
> ------------
> |C         |
> |          |
> |          |
> |          |
> |          |
> |          |
> |          |
> |          |
> ------------
> | 2.txt    |
> ------------
> | 1.txt    |
> ------------
>
> meaning, that I work on top of the other open windows.  Is this even
> possible?
>
> thanks,
>
> jos?

    autocmd WinEnter * 1wincmd x

(untested)

HTH,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

jose isaias cabrera-2

----- Original Message -----
From: "Tony Mechelynck" <[hidden email]>
To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
Sent: Saturday, August 20, 2005 4:41 PM
Subject: Re: having working window always on top


>> meaning, that I work on top of the other open windows.  Is this even
>> possible?
>>
>> thanks,
>>
>> jos?
>
>    autocmd WinEnter * 1wincmd x
>
> (untested)

Tony,

where do I put this?  On the _vimrc?

Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

A.J.Mechelynck
----- Original Message -----
From: "jose isaias cabrera" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; <[hidden email]>
Sent: Saturday, August 20, 2005 10:50 PM
Subject: Re: having working window always on top


>
> ----- Original Message -----
> From: "Tony Mechelynck" <[hidden email]>
> To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
> Sent: Saturday, August 20, 2005 4:41 PM
> Subject: Re: having working window always on top
>
>
>>> meaning, that I work on top of the other open windows.  Is this even
>>> possible?
>>>
>>> thanks,
>>>
>>> jos?
>>
>>    autocmd WinEnter * 1wincmd x
>>
>> (untested)
>
> Tony,
>
> where do I put this?  On the _vimrc?

Try it first (with prefixed colon) from the keyboard. If it works, add it to
your vimrc.

-- From reading the help, apparently the above autocommand leaves the cursor
in the wrong window. Maybe the following is better:

    :autocmd WinEnter * 1wincmd x | 1wincmd w

or

    :autocmd WinEnter * wincmd K

The latter has the side-effect that if the selected window was vertically
split, it will be placed full-width at top; the former exchanges the
selected window with window 1. In both cases there may be problems with
vertically split windows but the problems are different.


Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

jose isaias cabrera-2

----- Original Message -----
From: "Tony Mechelynck" <[hidden email]>
To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
Sent: Saturday, August 20, 2005 5:14 PM
Subject: Re: having working window always on top



>>>> meaning, that I work on top of the other open windows.  Is this even
>>>> possible?
>>>>
>>>> thanks,
>>>>
>>>> jos?
>>>
>>>    autocmd WinEnter * 1wincmd x
>>>
>>> (untested)
>>
>> Tony,
>>
>> where do I put this?  On the _vimrc?
>
> Try it first (with prefixed colon) from the keyboard. If it works, add it
> to your vimrc.
>
> -- From reading the help, apparently the above autocommand leaves the
> cursor in the wrong window. Maybe the following is better:
>
>    :autocmd WinEnter * 1wincmd x | 1wincmd w
>
> or
>
>    :autocmd WinEnter * wincmd K
>
> The latter has the side-effect that if the selected window was vertically
> split, it will be placed full-width at top; the former exchanges the
> selected window with window 1. In both cases there may be problems with
> vertically split windows but the problems are different.

Yeah... neither work.

thanks for trying.

jos?

Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

A.J.Mechelynck
----- Original Message -----
From: "jose isaias cabrera" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; <[hidden email]>
Sent: Saturday, August 20, 2005 11:24 PM
Subject: Re: having working window always on top
[...]
> Yeah... neither work.
>
> thanks for trying.
>
> jos?

what happens when you try them?


Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

jose isaias cabrera-2

----- Original Message -----
From: "Tony Mechelynck" <[hidden email]>
To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
Sent: Saturday, August 20, 2005 5:27 PM
Subject: Re: having working window always on top



>> Yeah... neither work.
>>
>> thanks for trying.
>>
>> jos?
>
> what happens when you try them?

Woah Nelly.  Spoke too soon.  Sorry about that.  Perhaps, since I had the
other command on memory, everything was not working.  After closing all
windows, and trying this one again,

autocmd WinEnter * K

it now works, but it only works with two windows.  Meaning, that if I have
three files, just the top two change.  The third one does not switch.  So,
what would be the command to have them all switch?

Again, thanks.

jic

Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

X. Y. Zhao
Try:

     1wincmd x | 100wincmd k | wincmd _

On 20-Aug-05, at 174314, jose isaias cabrera wrote:

>
> ----- Original Message ----- From: "Tony Mechelynck"  
> <[hidden email]>
> To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
> Sent: Saturday, August 20, 2005 5:27 PM
> Subject: Re: having working window always on top
>
>
>
>
>>> Yeah... neither work.
>>>
>>> thanks for trying.
>>>
>>> josé
>>>
>>
>> what happens when you try them?
>>
>
> Woah Nelly.  Spoke too soon.  Sorry about that.  Perhaps, since I  
> had the other command on memory, everything was not working.  After  
> closing all windows, and trying this one again,
>
> autocmd WinEnter * K
>
> it now works, but it only works with two windows.  Meaning, that if  
> I have three files, just the top two change.  The third one does  
> not switch.  So, what would be the command to have them all switch?
>
> Again, thanks.
>
> jic
>

Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

A.J.Mechelynck
In reply to this post by jose isaias cabrera-2
----- Original Message -----
From: "jose isaias cabrera" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; <[hidden email]>
Sent: Saturday, August 20, 2005 11:43 PM
Subject: Re: having working window always on top


>
> ----- Original Message -----
> From: "Tony Mechelynck" <[hidden email]>
> To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
> Sent: Saturday, August 20, 2005 5:27 PM
> Subject: Re: having working window always on top
>
>
>
>>> Yeah... neither work.
>>>
>>> thanks for trying.
>>>
>>> jos?
>>
>> what happens when you try them?
>
> Woah Nelly.  Spoke too soon.  Sorry about that.  Perhaps, since I had the
> other command on memory, everything was not working.  After closing all
> windows, and trying this one again,
>
> autocmd WinEnter * K
>
> it now works, but it only works with two windows.  Meaning, that if I have
> three files, just the top two change.  The third one does not switch.  So,
> what would be the command to have them all switch?
>
> Again, thanks.
>
> jic

it's not K it's wincmd K

":wincmd K" is equivalent to the Normal-mode command Ctrl-W K. That's
supposed to move the current window (i.e. the new one) to the very top,
full-width


Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

jose isaias cabrera-2

----- Original Message -----
From: "Tony Mechelynck" <[hidden email]>
To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
Sent: Saturday, August 20, 2005 6:29 PM
Subject: Re: having working window always on top



> it's not K it's wincmd K
>
> ":wincmd K" is equivalent to the Normal-mode command Ctrl-W K. That's
> supposed to move the current window (i.e. the new one) to the very top,
> full-width

This works fine if there were only two windows.  However, if there is more
than two, it only changes the top two windows.  The third one stays put and
never moves to second. ie. C = cursor:

C
w1
w2
w3
w4

with your fix, CTRL-w would do this,

C
w2
w1
w3
w4

but the others will not change position.

jos?


Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

jose isaias cabrera-2
In reply to this post by X. Y. Zhao

tried it and nothing changes...CTRL'w works normally.



----- Original Message -----
From: "XYZ" <[hidden email]>
To: <[hidden email]>
Sent: Saturday, August 20, 2005 6:22 PM
Subject: Re: having working window always on top


Try:

     1wincmd x | 100wincmd k | wincmd _

On 20-Aug-05, at 174314, jose isaias cabrera wrote:

>
> ----- Original Message ----- From: "Tony Mechelynck"
> <[hidden email]>
> To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
> Sent: Saturday, August 20, 2005 5:27 PM
> Subject: Re: having working window always on top
>
>
>
>
>>> Yeah... neither work.
>>>
>>> thanks for trying.
>>>
>>> jos?
>>>
>>
>> what happens when you try them?
>>
>
> Woah Nelly.  Spoke too soon.  Sorry about that.  Perhaps, since I  had the
> other command on memory, everything was not working.  After  closing all
> windows, and trying this one again,
>
> autocmd WinEnter * K
>
> it now works, but it only works with two windows.  Meaning, that if  I
> have three files, just the top two change.  The third one does  not
> switch.  So, what would be the command to have them all switch?
>
> Again, thanks.
>
> jic
>


Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

A.J.Mechelynck
In reply to this post by jose isaias cabrera-2
----- Original Message -----
From: "jose isaias cabrera" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; <[hidden email]>
Sent: Sunday, August 21, 2005 12:59 AM
Subject: Re: having working window always on top


>
> ----- Original Message -----
> From: "Tony Mechelynck" <[hidden email]>
> To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
> Sent: Saturday, August 20, 2005 6:29 PM
> Subject: Re: having working window always on top
>
>
>
>> it's not K it's wincmd K
>>
>> ":wincmd K" is equivalent to the Normal-mode command Ctrl-W K. That's
>> supposed to move the current window (i.e. the new one) to the very top,
>> full-width
>
> This works fine if there were only two windows.  However, if there is more
> than two, it only changes the top two windows.  The third one stays put
> and never moves to second. ie. C = cursor:
>
> C
> w1
> w2
> w3
> w4
>
> with your fix, CTRL-w would do this,
>
> C
> w2
> w1
> w3
> w4
>
> but the others will not change position.
>
> jos?

With my fix, starting with

    w1 <-- current
    w2
    w3
    w4

if you do 3^Ww you get

    w3 <-- current
    w1
    w2
    w4

If now you do ^WW (Ctrl-w Shift-w) you get

    w4 <-- current
    w3
    w1
    w2

This answers your initial question (always place the current window on top).
You didn't say you wanted to keep the (round-robin) sequence of the windows.
It is possible to do that but it's harder. Let's try though.

    autocmd WinEnter * while winnr() != 1 | wincmd R | endwhile

You might want to look at ":help CTRL-W" and at ":help windows.txt".

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

jose isaias cabrera-2

Yes!  This works!  Woowoowoowooooo!

Thanks!


----- Original Message -----
From: "Tony Mechelynck" <[hidden email]>
To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
Sent: Saturday, August 20, 2005 7:35 PM
Subject: Re: having working window always on top


> ----- Original Message -----
> From: "jose isaias cabrera" <[hidden email]>
> To: "Tony Mechelynck" <[hidden email]>; <[hidden email]>
> Sent: Sunday, August 21, 2005 12:59 AM
> Subject: Re: having working window always on top
>
>
>>
>> ----- Original Message -----
>> From: "Tony Mechelynck" <[hidden email]>
>> To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
>> Sent: Saturday, August 20, 2005 6:29 PM
>> Subject: Re: having working window always on top
>>
>>
>>
>>> it's not K it's wincmd K
>>>
>>> ":wincmd K" is equivalent to the Normal-mode command Ctrl-W K. That's
>>> supposed to move the current window (i.e. the new one) to the very top,
>>> full-width
>>
>> This works fine if there were only two windows.  However, if there is
>> more than two, it only changes the top two windows.  The third one stays
>> put and never moves to second. ie. C = cursor:
>>
>> C
>> w1
>> w2
>> w3
>> w4
>>
>> with your fix, CTRL-w would do this,
>>
>> C
>> w2
>> w1
>> w3
>> w4
>>
>> but the others will not change position.
>>
>> jos?
>
> With my fix, starting with
>
>    w1 <-- current
>    w2
>    w3
>    w4
>
> if you do 3^Ww you get
>
>    w3 <-- current
>    w1
>    w2
>    w4
>
> If now you do ^WW (Ctrl-w Shift-w) you get
>
>    w4 <-- current
>    w3
>    w1
>    w2
>
> This answers your initial question (always place the current window on
> top). You didn't say you wanted to keep the (round-robin) sequence of the
> windows. It is possible to do that but it's harder. Let's try though.
>
>    autocmd WinEnter * while winnr() != 1 | wincmd R | endwhile
>
> You might want to look at ":help CTRL-W" and at ":help windows.txt".
>
> Best regards,
> Tony.
>
>

Reply | Threaded
Open this post in threaded view
|

Rolodex Vim with all tabs at top (Was: having working window always on top)

A.J.Mechelynck
----- Original Message -----
From: "jose isaias cabrera" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; <[hidden email]>
Sent: Sunday, August 21, 2005 2:17 AM
Subject: Re: having working window always on top


>
> Yes!  This works!  Woowoowoowooooo!
>
> Thanks!
>
>
> ----- Original Message -----
> From: "Tony Mechelynck" <[hidden email]>
> To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
> Sent: Saturday, August 20, 2005 7:35 PM
> Subject: Re: having working window always on top
[...]
>>    autocmd WinEnter * while winnr() != 1 | wincmd R | endwhile
>>
>> You might want to look at ":help CTRL-W" and at ":help windows.txt".
>>
>> Best regards,
>> Tony.

A slight variation of that, together with "Rolodex Vim", will move the
current window to the bottom (and have all "Rolodex tabs" at top):

    " Rolodex Vim
    set noequalalways winminheight=0 winheight=99999
    " always move current window to bottom
    autocmd WinEnter *
    \   while winnr() != winnr('$') | wincmd R | endwhile

However, in both cases an infinite loop may result if, with vertically split
windows, the current window is not in the same row or column as the target
window (first if moving the current window to the top, last if moving to the
bottom). For example, with

    window 1 (full-width)
    window 2 | window 3
    window 4 (full-width)

Let's say window 1 is current. ^Ww moves to window 2, then the autocommand
repeatedly swaps windows 2 and 3, and the "while" loop never ends. I don't
have a ready-made solution for that (except avoiding vertically split window
other than in the row where we want the current window to be).

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: Rolodex Vim with all tabs at top (Was: having working window always on top)

jose isaias cabrera-2

I don't use vertical split windows, yet. ;-)

Thanks.


----- Original Message -----
From: "Tony Mechelynck" <[hidden email]>
To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
Sent: Saturday, August 20, 2005 8:46 PM
Subject: Rolodex Vim with all tabs at top (Was: having working window always
on top)


> ----- Original Message -----
> From: "jose isaias cabrera" <[hidden email]>
> To: "Tony Mechelynck" <[hidden email]>; <[hidden email]>
> Sent: Sunday, August 21, 2005 2:17 AM
> Subject: Re: having working window always on top
>
>
>>
>> Yes!  This works!  Woowoowoowooooo!
>>
>> Thanks!
>>
>>
>> ----- Original Message -----
>> From: "Tony Mechelynck" <[hidden email]>
>> To: "jose isaias cabrera" <[hidden email]>; <[hidden email]>
>> Sent: Saturday, August 20, 2005 7:35 PM
>> Subject: Re: having working window always on top
> [...]
>>>    autocmd WinEnter * while winnr() != 1 | wincmd R | endwhile
>>>
>>> You might want to look at ":help CTRL-W" and at ":help windows.txt".
>>>
>>> Best regards,
>>> Tony.
>
> A slight variation of that, together with "Rolodex Vim", will move the
> current window to the bottom (and have all "Rolodex tabs" at top):
>
>    " Rolodex Vim
>    set noequalalways winminheight=0 winheight=99999
>    " always move current window to bottom
>    autocmd WinEnter *
>    \   while winnr() != winnr('$') | wincmd R | endwhile
>
> However, in both cases an infinite loop may result if, with vertically
> split windows, the current window is not in the same row or column as the
> target window (first if moving the current window to the top, last if
> moving to the bottom). For example, with
>
>    window 1 (full-width)
>    window 2 | window 3
>    window 4 (full-width)
>
> Let's say window 1 is current. ^Ww moves to window 2, then the autocommand
> repeatedly swaps windows 2 and 3, and the "while" loop never ends. I don't
> have a ready-made solution for that (except avoiding vertically split
> window other than in the row where we want the current window to be).
>
> Best regards,
> Tony.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: having working window always on top

A.J.Mechelynck
----- Original Message -----
From: "jose isaias cabrera" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>; <[hidden email]>
Sent: Sunday, August 21, 2005 2:55 AM
Subject: Re: Rolodex Vim with all tabs at top (Was: having working window
always on top)


>
> I don't use vertical split windows, yet. ;-)
>
> Thanks.

For those who do, I think I found the solution:

    function! WindowToMargin()
        let i = 0
        let j = winnr()
        while j > i
            wincmd r
            let i = j
            let j = winnr()
        endwhile
    endfunction
    autocmd WinEnter * call WindowToMargin()

If I didn't goof, this will move the current window to the top if all splits
are horizontal, to the far left if all splits are vertical, and to the top
or left of its row or column if mixing vertical and horizontal splits.

Best regards,
Tony.