Skip to main content
Module

x/denops_std/popup/mod.ts>open

📚 Standard module for denops.vim
Go to Latest
function open
import { open } from "https://deno.land/x/denops_std@v6.3.0/popup/mod.ts";

Open a popup window showing the buffer in Vim/Neovim compatible way.

import type { Denops } from "https://deno.land/x/denops_std@v6.3.0/mod.ts";
import * as popup from "https://deno.land/x/denops_std@v6.3.0/popup/mod.ts";

export async function main(denops: Denops): Promise<void> {
  // Open a popup window
  const popupWindow = await popup.open(denops, {
    relative: "editor",
    width: 20,
    height: 20,
    row: 1,
    col: 1,
  });

  // Do something with the popup window...

  // Close the popup window manually
  await popupWindow.close();
}

Or with await using statement:

import type { Denops } from "https://deno.land/x/denops_std@v6.3.0/mod.ts";
import * as popup from "https://deno.land/x/denops_std@v6.3.0/popup/mod.ts";

export async function main(denops: Denops): Promise<void> {
  // Open a popup window with `await using` statement
  await using popupWindow = await popup.open(denops, {
    relative: "editor",
    width: 20,
    height: 20,
    row: 1,
    col: 1,
  });

  // Do something with the popup window...

  // The popup window is automatically closed, due to `await using` statement
}

Note that this function does NOT work in batch.collect().