On Sunday, September 1, 2013 6:42:25 PM UTC-7, Geoff Greer wrote:
> This patch adds asynchronous functions to vimscript. If you want to perform 
> an action in 700ms, simply:
> 
> let timeout_id = settimeout(700, 'echo("hello")')
> 
> To cancel the timeout before it's fired:
> 
> canceltimeout(timeout_id)
> 
> setinterval() also returns an id that can be used with canceltimeout.
> 
> The reason for this patch is simple: asynchronous functionality is needed to 
> implement real-time collaborative editing in Vim. This is one of the most 
> voted-for features (see http://www.vim.org/sponsor/vote_results.php).
> 
> Along with Matt Kaniaris, I founded Floobits to build real-time collaboration 
> into every editor. We wrote a plugin for Vim, but we had to use hacks to get 
> async behavior (abusing feedkeys or client-server). These methods had 
> side-effects such as breaking leaderkeys or other shortcuts. After a lot of 
> experimenting, we decided to try patching Vim.
> 
> Since Vim is character-driven, we had to munge some low-level input functions 
> to get the desired behavior. We changed gui_wait_for_chars() and mch_inchar() 
> so that call_timeouts() is run every ticktime milliseconds. The default 
> ticktime is 100ms.
> 
> This patch isn't finished yet, but it works on unix-based OSes. If the 
> reaction is positive, our intention is to change mch_inchar() (or something 
> similar) in other OS-specific files. That will get async functions working 
> for everyone.
> 
> Even if our patch isn't the best approach, we'd love to help get async 
> functions in Vim. Doing so will open the door to a lot of cool plugins.
> 
> Oh, and this is the first time either myself or Matt have submitted a patch 
> to Vim, so please be gentle.
> 
> Sincerely,
> 
> Geoff Greer

Dear God, I really want to see this in action. I could imagine JavaScript 
somehow playing a role in this...

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui