Ⅰ. 插件描述
Craft CMS snippets for Vim. Compatible with NeosnippetⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'hungle88/vim-craft-snippets'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'hungle88/vim-craft-snippets'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'hungle88/vim-craft-snippets'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/hungle88/vim-craft-snippets
Ⅳ. 文档说明
# Craft CMS Snippets for Vim.
This repository contains most of frequently used code snippets during Craft CMS development.
It is compatible with Utilsnips and neosnippet (with minimal configuration).

Installation
This repo is compatible with most Vim Plugins Manager. Since I use Vim Plug, my configuration looks like this:
Utilsnips
...
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Completion framework for neovim
Plug 'SirVer/ultisnips' " Snippet Engine
Plug 'honza/vim-snippets' " Default Snippets Source
Plug 'hungle88/vim-craft-snippets' " Craft CMS snippets
...Neosnippet
...
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Completion framework for neovim
Plug 'Shougo/neosnippet' " Snippets Engine
Plug 'Shougo/neosnippet-snippets' " Default Snippets Source
Plug 'hungle88/vim-craft-snippets' " Craft CMS snippet
...Configurations
Since Craft templates use twig which has its own snippets that come with neosnippet-snippets and vim-snippets by default, we need to
tell vim to look for craft.snippets when editing *.twig templates by adding these lines to your vimrc
Utilsnips
...
" Load CraftCMS Snippets
autocmd FileType twig UltiSnipsAddFiletypes craft
...Neosnippet
...
" Load CraftCMS Snippets
let g:neosnippet#scope_aliases = {}
let g:neosnippet#scope_aliases['twig'] = 'twig,html,js,css,craft'
...Roadmap
Don't really have one but I'll be adding new snippets as I will be continue working with Craft.
Any PR is welcome!
License
MIT