vim-denops / deno-denops-std

📚 Standard module for denops.vim
https://jsr.io/@denops/std
MIT License
57 stars 16 forks source link

Add `eval` module #243

Closed Milly closed 2 months ago

Milly commented 6 months ago

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" })
  }`);
}
lambdalisue commented 2 months ago

Closed via #260