Ⅰ. 插件描述
A Powerful SVG Language Support coc Extension for (neo)vimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'iamcco/coc-svg'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'iamcco/coc-svg'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'iamcco/coc-svg'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/iamcco/coc-svg
Ⅳ. 文档说明
# coc-svg
fork from https://github.com/lishu/vscode-svg
A Powerful SVG Language Support Extension for coc.nvim.
Almost all the features you need to handle SVG.

Install
CocInstall coc-svg
Features
- SVG Elements Auto Completion.
- SVG Attributes Auto Completion.
- Document Symbol with SVG Element [id].
- SVG Preview
Tip: All Completion list is context, will not show all items.
- Rename Tag Name or Id Reference.
Cursor in Tag Name or Id Attribute or
url(#id)orhref="#id"
- In Id Reference Click Goto
id=""element.
Move cursor to a
url(#id)orhref="#id", That it!
- SVG Format Support
Formatting support using SVGO, which can prettify SVGs and sort tag attributes.
SVGO works as a group of plugins that can be activated or desactivated (which is default for most in this extension).
Information on the plugins can be found here.
Commands
svg.prettySvgpretty svg.svg.minifySvgThis will reduce the filesize by removing all unnecessary code from the image.svg.showSvgopen browser to preview current svg.
Config
{
"svg.completion.insertCloseTagSign": {
"title": "Insert close tag sign",
"type": "boolean",
"default": true,
"description": "Specifies whether insert close tag sign '>'"
},
"svg.completion.showAdvanced": {
"title": "Show advanced items in completion list.",
"type": "boolean",
"default": false,
"description": "Specifies whether advanced items that are not commonly used are displayed in the AutoComplete list."
},
"svg.completion.showDeprecated": {
"title": "Show deprecated items in completion list.",
"type": "boolean",
"default": false,
"description": "Specifies whether advanced items that are deprecated are displayed in the AutoComplete list."
},
"svg.disableFormatOnSave": {
"title": "[Experimental]Disable SVGO Format on save",
"type": "boolean",
"default": false,
"description": "Focus Disable SVGO Format On Save event if editor.formatOnSave is true"
},
"svg.format.plugins": {
"title": "SVGO plugins array.",
"type": "object",
"default": {
"sortAttrs": true
},
"description": "Each items corresponds to a plugin that should be enabled, the rest is disabled."
},
"svg.preview.background": {
"title": "Svg Preview Background",
"type": "string",
"enum": [
"transparent",
"white",
"black",
"custom"
],
"default": "transparent",
"description": "Specifies the Svg Preview Background"
},
"svg.preview.backgroundCustom": {
"title": "Svg Preview Custom Background",
"type": "string",
"default": "#eee",
"description": "Specifies the Svg Preview Custom Background"
},
"svg.version": {
"title": "SVG Version",
"enum": [
"1.1",
"2.0"
],
"description": "Specifies the SVG standard version that will be used for autocompletion and validation.",
"default": "1.1"
},
"svg.priority": {
"type": "integer",
"default": 99
}
}Known Issues
SVG Version 2.0 is not included.
For more information
Buy Me A Coffee ☕️
