autocmd WinEnter call WindowToMargin()

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

autocmd WinEnter call WindowToMargin()

jose isaias cabrera-2

Greetings!

I have this function on my Windows vim:

"this is a function to always keep the working window on top.
    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()
"

which works great.  I also have cygwin installed on the same machine and I
placed this function on cygwin's .vimrc and I get this error message:

Error detected while processing function WindowToMargin:
line    6:
E15: Invalid expression:
E15: Invalid expression:
line    7:
"unixcommand.txt" 679L, 19034C
Hit ENTER or type command to continue

when I try to open a new file using,

sp somefile

attached is the full .vimrc.

Thanks for the help.

jos?


.vimrc (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: autocmd WinEnter call WindowToMargin()

A.J.Mechelynck
----- Original Message -----
From: "jose isaias cabrera" <[hidden email]>
To: "Vim" <[hidden email]>
Sent: Monday, September 05, 2005 7:07 AM
Subject: autocmd WinEnter call WindowToMargin()


>
> Greetings!
>
> I have this function on my Windows vim:
>
> "this is a function to always keep the working window on top.
>    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()
> "
>
> which works great.  I also have cygwin installed on the same machine and I
> placed this function on cygwin's .vimrc and I get this error message:
>
> Error detected while processing function WindowToMargin:
> line    6:
> E15: Invalid expression:
> E15: Invalid expression:
> line    7:
> "unixcommand.txt" 679L, 19034C
> Hit ENTER or type command to continue
>
> when I try to open a new file using,
>
> sp somefile
>
> attached is the full .vimrc.
>
> Thanks for the help.
>
> jos?

The full vimrc (thankfully) wasn't attached; but there should be no line
break between "let j =" and "winnr()": the line before the "endwhile"
statement should be the same as the one before the "while" statement.

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: autocmd WinEnter call WindowToMargin()

jose isaias cabrera-2

DOH!  Thanks Tony.  Would you believe that I spend about 1/2 hour trying to
figure out why it was not working?  Sometimes you just need to work away for
a while and return.

thanks again.


----- Original Message -----
From: "Tony Mechelynck" <[hidden email]>
To: "jose isaias cabrera" <[hidden email]>; "Vim" <[hidden email]>
Sent: Monday, September 05, 2005 5:50 AM
Subject: Re: autocmd WinEnter call WindowToMargin()


> ----- Original Message -----
> From: "jose isaias cabrera" <[hidden email]>
> To: "Vim" <[hidden email]>
> Sent: Monday, September 05, 2005 7:07 AM
> Subject: autocmd WinEnter call WindowToMargin()
>
>
>>
>> Greetings!
>>
>> I have this function on my Windows vim:
>>
>> "this is a function to always keep the working window on top.
>>    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()
>> "
>>
>> which works great.  I also have cygwin installed on the same machine and
>> I
>> placed this function on cygwin's .vimrc and I get this error message:
>>
>> Error detected while processing function WindowToMargin:
>> line    6:
>> E15: Invalid expression:
>> E15: Invalid expression:
>> line    7:
>> "unixcommand.txt" 679L, 19034C
>> Hit ENTER or type command to continue
>>
>> when I try to open a new file using,
>>
>> sp somefile
>>
>> attached is the full .vimrc.
>>
>> Thanks for the help.
>>
>> jos?
>
> The full vimrc (thankfully) wasn't attached; but there should be no line
> break between "let j =" and "winnr()": the line before the "endwhile"
> statement should be the same as the one before the "while" statement.
>
> Best regards,
> Tony.
>
>