1.2.6 • Published 3 years ago
coc-template v1.2.6
coc-template
Language template or fileheader-like extension for coc.nvim
A simple plugin that will allow you to have a set of templates for certain file types. It is useful to add boilerplate code like guards in C/C++ headers, gitignore templates, or license disclaimers.
Install
:CocInstall coc-template
Configuration
"template.email": {
"type": "string",
"default": null,
"description": "If null, will use the value from `git config --global user.email`"
},
"template.username": {
"type": "string",
"default": null,
"description": "If null, will use the value from `git config --global user.username`"
},
"template.license": {
"type": "string",
"default": "MIT",
"description": ""
},
"template.templatesDirectory": {
"type": "string",
"default": null,
"description": "Directory of template files"
}
You can read doc to see how to writing a template file
Keymaps
- normal mode:
<Plug>(coc-template)
Append language template to the current line - normal mode:
<Plug>(coc-template-top)
Insert language template to the first line - normal mode:
<Plug>(coc-template-bottom)
Append language template to the last line
Commands
:CocCommand template.template
Insert language template to the current line:CocCommand template.templateTop
Insert language template to the first line:CocCommand template.templateBottom
Append language template to the last line
CocList
Run :CocList template
to open the translation list.
- Filter your translation items and perform operations via
<Tab>
- Use
append
to append the template to current buffer - Use
open
to edit your template file
F.A.Q
- How to make coc-template add template automatically while an empty buffer is being created?
Use
autocmd
, e.g.autocmd BufNewFile .gitignore CocCommand template.templateTop
Reference
License
MIT