Christian wrote:
> On Sa, 24 Mär 2018, Bram Moolenaar wrote:
>
> > Job to Vim: JSON API ~
> > *terminal-api*
> > The job can send JSON to Vim, using a special escape sequence. The JSON
> > encodes a command that Vim understands. Example of such a message: >
> > <Esc>]51;["drop", "README.md"]<07>
> >
> > The body is always a list, making it easy to find the end: ]<07>.
> > The <Esc>]51;msg<07> sequence is reserved by xterm for "Emacs shell", which
> > is
> > similar to what we are doing here.
> >
> > Currently supported commands:
> >
> > call {funcname} {argument}
> >
> > Call a user defined function with [argument]. This does not work to
> > call built-in functions to avoid security issues.
> > [argument] is decoded and passed to the function. Thus the function
> > must accept one argument. The user function must sanity check the
> > argument. The function can use |term_sendkeys()| to send back a
> > reply.
> > Example in JSON: >
> > ["call", "Impression", ["play", 14]]
>
>
> I think this is useful. I have just written a small plugin, that allows
> to pipe output from the terminal window into a new Vim buffer. It is
> available here: https://github.com/chrisbra/vpager
>
> If this is interesting enough for Vim, feel free to distribute it with
> Vim.
It's an interesting idea. let's give it some usage.
> > drop {filename} [options]
> >
> > Let Vim open a file, like the `:drop` command.
> > [options], if present, must be a dictionary. For the entries see
> > |++opt|.
> > Example in JSON: >
> > ["drop", "path/file.txt", {"ff": "dos"}]
>
> One thing that is missing I think, how to synchronise the PWD between
> the terminal and Vims window (or the other way around, how can the
> terminal job know, what path to use).
> So Vim does not know, whether PWD for the job changed, but the job also
> does not know whether the PWD of the Vim window changed. So perhaps it
> is best, to amend the documentation and mention it would be best to
> always use absolute paths.
I'll add a remark.
--
[clop clop]
ARTHUR: Old woman!
DENNIS: Man!
ARTHUR: Man, sorry. What knight lives in that castle over there?
DENNIS: I'm thirty seven.
ARTHUR: What?
DENNIS: I'm thirty seven -- I'm not old!
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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/d/optout.