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.
- 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
- You can define snippet like
- Nested snippet expansion
- You can expand snippet even if you already activated other snippet.
[usestate]
prefix = 'usestate'
body = "const [${1:state}, set${1/(.*)/${1:/capitalize}/}] = useState($2)"
[if]
prefix = 'if'
body = """
if ($1) {
$0
}\
"""
import { TSSnippet } from "https://deno.land/x/[email protected]/loader.ts";
import { fn } from "https://deno.land/x/[email protected]/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",
];
},
},
};