deno-denops-std icon indicating copy to clipboard operation
deno-denops-std copied to clipboard

Add `eval` module

Open Milly opened this issue 1 year ago • 0 comments

I want to refactor helper/expr_string and rename it into an eval module. Also, I would like to be able to collaborate with Lambda.

Usage example:

import type { Denops } from "https://deno.land/x/denops_std/mod.ts";
import { evalQuote, exprQuote } from "https://deno.land/x/denops_std/eval/mod.ts";
import * as lambda from "https://deno.land/x/denops_std/lambda/mod.ts";

export async function main(denops: Denops): Promise<void> {
  const a = lambda.add(denops, (cword: unknown, context: unknown) => {
    // nice code
    return exprQuote`\<Ignore>`;
  });
  await denops.cmd(`nmap <expr> <Space> ${
    a.request(evalQuote`expand("<cword>")`, { cid: "foo" })
  }`);
}

Milly avatar May 07 '24 11:05 Milly