Re: Executing vimfunctions in background

2007-04-04 Thread A.J.Mechelynck

Chuck Mason wrote:

Well, that sample 'myFunc' was just that- a sample. Imagine now, that it
doesn't depend on cursor location but on a daemon running on your
system.

Chuck


There are also the CursorHold and CursorHoldI autocommands (q.v.), which are 
triggered _once_ when the keyboard has been idle for 'updatetime' milliseconds 
(4000 by default).



Best regards,
Tony.
--
The National Association of Theater Concessionaires reported that in
1986, 60% of all candy sold in movie theaters was sold to Roger Ebert.
-- D. Letterman


RE: Executing vimfunctions in background

2007-04-04 Thread Chuck Mason

Doc states, Not re-triggered   until the user has pressed a key (i.e.
doesn't fire every 'updatetime' ms if you leave Vim to make some coffee.
:)

So this isn't going to work.  How do I put in a feature request for an
autocmd that is trigged every 'repeattime' repeatedly?

Chuck


-Original Message-
From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 04, 2007 1:42 PM
To: Chuck Mason
Cc: Yakov Lerner; vim@vim.org
Subject: Re: Executing vimfunctions in background

Chuck Mason wrote:
 Well, that sample 'myFunc' was just that- a sample. Imagine now, that
it
 doesn't depend on cursor location but on a daemon running on your
 system.
 
 Chuck

There are also the CursorHold and CursorHoldI autocommands (q.v.), which
are 
triggered _once_ when the keyboard has been idle for 'updatetime'
milliseconds 
(4000 by default).


Best regards,
Tony.
-- 
The National Association of Theater Concessionaires reported that in
1986, 60% of all candy sold in movie theaters was sold to Roger Ebert.
-- D. Letterman


RE: Executing vimfunctions in background

2007-04-04 Thread dcuaron
Mr. Yikihiro Nakadaira supplied the following to the list a couple
months ago.
SNIP
In Vim7 feedkeys() can be used.

autocmd CursorHold * call Timer()
function! Timer()
 echo strftime(%c)
 let K_IGNORE = \x80\xFD\x35internal key code that is ignored
 call feedkeys(K_IGNORE)
endfunction
/SNIP

... this pretty much simulates a timed event when you leave the keyboard and
let vim run.  Between this and CursorMoved perhaps you can accomplish what you
want

-dan

On Wed, 4 Apr 2007, Chuck Mason wrote:

 
 Doc states, Not re-triggered until the user has pressed a key (i.e.
 doesn't fire every 'updatetime' ms if you leave Vim to make some coffee.
 :)
 
 So this isn't going to work.  How do I put in a feature request for an
 autocmd that is trigged every 'repeattime' repeatedly?
 
 Chuck
 
 
 -Original Message-
 From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, April 04, 2007 1:42 PM
 To: Chuck Mason
 Cc: Yakov Lerner; vim@vim.org
 Subject: Re: Executing vimfunctions in background
 
 Chuck Mason wrote:
  Well, that sample 'myFunc' was just that- a sample. Imagine now, that
 it
  doesn't depend on cursor location but on a daemon running on your
  system.
  
  Chuck
 
 There are also the CursorHold and CursorHoldI autocommands (q.v.), which
 are 
 triggered _once_ when the keyboard has been idle for 'updatetime'
 milliseconds 
 (4000 by default).
 
 
 Best regards,
 Tony.
 -- 
 The National Association of Theater Concessionaires reported that in
 1986, 60% of all candy sold in movie theaters was sold to Roger Ebert.
   -- D. Letterman
 


Executing vimfunctions in background

2007-04-03 Thread Chuck Mason


I'm interested in writing a plugin that could run in the background as I
do some work in a buffer. For instance I have a function that appends a
line to :copen. I would like to run it in the background continuously.
How could I do this and continue working in the foreground?

func myFunc()
while 1
exe caddexpr expand(%) . : . line(.) .  : .
getline(.)
exe sleep 5
endwhile
endfunc

 how do I launch myFunc() to run continuously in the background?

Chuck



Re: Executing vimfunctions in background

2007-04-03 Thread Yakov Lerner

On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote:



I'm interested in writing a plugin that could run in the background as I
do some work in a buffer. For instance I have a function that appends a
line to :copen. I would like to run it in the background continuously.
How could I do this and continue working in the foreground?

func myFunc()
while 1
exe caddexpr expand(%) . : . line(.) .  : .
getline(.)
exe sleep 5
endwhile
endfunc

 how do I launch myFunc() to run continuously in the background?


Chuhk,
You probably want to give the 'au CursorMoved' autocommand
a try for this task.
Such tasks are normally solved with autocommands in vim.
See:
:help au
:hep CursorMoved

Good luck
Yakov


RE: Executing vimfunctions in background

2007-04-03 Thread Chuck Mason

Yes and no- I think this would work in certain situations, but of course
what happens when I don't move the cursor? 

Actually, why isn't there a Timer autocommand? :)  Feature request? 

-Original Message-
From: Yakov Lerner [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 03, 2007 11:05 AM
To: Chuck Mason
Cc: vim@vim.org
Subject: Re: Executing vimfunctions in background

On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote:


 I'm interested in writing a plugin that could run in the background as
I
 do some work in a buffer. For instance I have a function that appends
a
 line to :copen. I would like to run it in the background continuously.
 How could I do this and continue working in the foreground?

 func myFunc()
 while 1
 exe caddexpr expand(%) . : . line(.) .  : .
 getline(.)
 exe sleep 5
 endwhile
 endfunc

  how do I launch myFunc() to run continuously in the background?

Chuhk,
You probably want to give the 'au CursorMoved' autocommand
a try for this task.
Such tasks are normally solved with autocommands in vim.
See:
:help au
:hep CursorMoved

Good luck
Yakov


Re: Executing vimfunctions in background

2007-04-03 Thread Yakov Lerner

On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote:


Yes and no- I think this would work in certain situations, but of course
what happens when I don't move the cursor?


If you didn't move the cursor -- then why would you
add the same position to the quicfix list again and again ? What's the point ?
How is adding same position again and again (seems meaningless to me)
better than reacting to cursor motion ?

Yakov



Actually, why isn't there a Timer autocommand? :)  Feature request?

-Original Message-
From: Yakov Lerner [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 03, 2007 11:05 AM
To: Chuck Mason
Cc: vim@vim.org
Subject: Re: Executing vimfunctions in background

On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote:


 I'm interested in writing a plugin that could run in the background as
I
 do some work in a buffer. For instance I have a function that appends
a
 line to :copen. I would like to run it in the background continuously.
 How could I do this and continue working in the foreground?

 func myFunc()
 while 1
 exe caddexpr expand(%) . : . line(.) .  : .
 getline(.)
 exe sleep 5
 endwhile
 endfunc

  how do I launch myFunc() to run continuously in the background?

Chuhk,
You probably want to give the 'au CursorMoved' autocommand
a try for this task.
Such tasks are normally solved with autocommands in vim.
See:
:help au
:hep CursorMoved

Good luck
Yakov



RE: Executing vimfunctions in background

2007-04-03 Thread Chuck Mason
Well, that sample 'myFunc' was just that- a sample. Imagine now, that it
doesn't depend on cursor location but on a daemon running on your
system.

Chuck

-Original Message-
From: Yakov Lerner [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 03, 2007 12:44 PM
To: Chuck Mason
Cc: vim@vim.org
Subject: Re: Executing vimfunctions in background

On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote:

 Yes and no- I think this would work in certain situations, but of
course
 what happens when I don't move the cursor?

If you didn't move the cursor -- then why would you
add the same position to the quicfix list again and again ? What's the
point ?
How is adding same position again and again (seems meaningless to me)
better than reacting to cursor motion ?

Yakov


 Actually, why isn't there a Timer autocommand? :)  Feature request?

 -Original Message-
 From: Yakov Lerner [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, April 03, 2007 11:05 AM
 To: Chuck Mason
 Cc: vim@vim.org
 Subject: Re: Executing vimfunctions in background

 On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote:
 
 
  I'm interested in writing a plugin that could run in the background
as
 I
  do some work in a buffer. For instance I have a function that
appends
 a
  line to :copen. I would like to run it in the background
continuously.
  How could I do this and continue working in the foreground?
 
  func myFunc()
  while 1
  exe caddexpr expand(%) . : . line(.) .  : .
  getline(.)
  exe sleep 5
  endwhile
  endfunc
 
   how do I launch myFunc() to run continuously in the background?

 Chuhk,
 You probably want to give the 'au CursorMoved' autocommand
 a try for this task.
 Such tasks are normally solved with autocommands in vim.
 See:
 :help au
 :hep CursorMoved

 Good luck
 Yakov