Skip to content

uga-rosa/denippet.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • Full JS regular expression support
  • Snippets can be defined in json/toml/yaml/TypeScript
  • Dynamic snippets using TypeScript functions.
  • Nested placeholders
    • You can define snippet like console.log($1${2:, $1})$0
  • Nested snippet expansion
    • You can expand snippet even if you already activated other snippet.

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

About

A snippet plugin for Vim/Neovim, powered by TypeScript

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published