Home

Awesome

integration

denippet.vim

Denippet is a Vim/Neovim snippet plugin extended from VSCode's snippets. Powered by denops.vim.

See doc for details.

Click here to read the introduction article in Japanese.

Requirements

Features

GIF

[usestate]
prefix = 'usestate'
body = "const [${1:state}, set${1/(.*)/${1:/capitalize}/}] = useState($2)"

useState

[if]
prefix = 'if'
body = """
if ($1) {
  $0
}\
"""

nested-expand

import { TSSnippet } from "https://deno.land/x/denippet_vim@v0.5.1/loader.ts";
import { fn } from "https://deno.land/x/denippet_vim@v0.5.1/deps/denops.ts";

export const snippets: Record<string, TSSnippet> = {
  "autoload function": {
    prefix: "fn",
    body: async (denops) => {
      const path = await fn.expand(denops, "%:p") as string;
      const match = path.match(/autoload\/(.+)\.vim$/);
      const prefix = match ? match[1].replaceAll("/", "#") + "#" : "";
      return [
        `function ${prefix}$1($2) abort`,
        "\t$0",
        "endfunction",
      ];
    },
  },
};

autoload-function