`:CocCommand snippets.editSnippets`を実行する。 たとえば、`*.ts`を開くと `~/.config/coc/ultisnips/typescript.snippets` が作成され、以下の内容でbufferが開く。 ```shell # A valid snippet should starts with: # # snippet trigger_word [ "description" [ options ] ] # # and end with: # # endsnippet # # Snippet options: # # b - Beginning of line. # i - In-word expansion. # w - Word boundary. # r - Regular expression # e - Custom context snippet # A - Snippet will be triggered automatically, when condition matches. # # Basic example: # # snippet emitter "emitter properties" b # private readonly ${1} = new Emitter<$2>() # public readonly ${1/^_(.*)/$1/}: Event<$2> = this.$1.event # endsnippet # # Online reference: https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt ``` ここに独自のスニペットを追加すればOK。 ```bash snippet cl "console.logデバッグ" console.log(\`${0}: \$\{${0}}\`) endsnippet ``` 文法などは[[Ultisnips]]のドキュメントを参照。 ## 参考 > Q: How could I add custom UltiSnips snippets. > > A: You can create snippet files in folder: $VIMCONFIG/coc/ultisnips, use command :CocCommand snippets.editSnippets to open user snippet of current filetype. > *[neoclide/coc\-snippets: Snippets solution for coc\.nvim](https://github.com/neoclide/coc-snippets) より*