Hi,
This is to announce the release of an ECMAScript scripting interface for Vim. 

Why? Because it seemed like the right thing to do.

The longer backstory is that I recently returned to using Vim as a programming 
editor, when I was left without a computer and it was by far the best editor on 
the iPad. The last time I used Vim for programming, “fe” still stood for 
“fileencoding”. I am aware that I missed around 20 years of Vim history and 
that Vim script is the way it is for good (historical) reasons. I soon 
discovered that Vim it had added control structures to ex scripts, then lists 
and dictionaries, then lambdas. It seemed on track to reinvent ECMAScript. 
Since at the time of writing, ECMAScript is by some measures the most popular 
programming language in the world, with an excellent free, embeddable and 
portable implementation (Duktape), it seems by far the best option to use the 
real thing for future Vim scripting.

Therefore, a Vim fork with a Duktape interface integrated can be found at: 

https://github.com/bobpepin/vim/tree/duktape

Note that it is in the duktape branch of the repository. 

Steps to compile:
1. Download a source release of Duktape from http://duktape.org and unpack
2. Clone the repository above, checkout the duktape branch
    $ git clone -b duktape https://github.com/bobpepin/vim.git
3. Edit vim/src/Makefile, point CONF_OPT_DUKTAPE_PREFIX to the right directory 
in the duktape     
    sources
4. Compile Vim as usual

The API is probably best explained by example:
https://github.com/bobpepin/vim/blob/duktape/runtime/indent/python.js.

The python.js file was generated from indent/python.vim using a cross-compiler 
which can be found at https://github.com/bobpepin/vim2js.

To try it out, in a new buffer do :duk source(‘indent/python.js’) and write 
some python code. It is also instructive to do vim -O python.vim python.js to 
get a side-by-side view of the two APIs.

There is also extensive documentation and further examples under :help duktape, 
or in runtime/doc/if_duk.txt 
(https://github.com/bobpepin/vim/blob/duktape/runtime/doc/if_duk.txt).

In the hope that somebody finds this useful,

Best,

Bob

-- 
-- 
You received this message from the "vim_use" 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_use" 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/d/optout.

Reply via email to