Ⅰ. 插件描述
The neo-snippet plugin contains the neocomplcache snippet completionⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/neosnippet'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/neosnippet'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/neosnippet'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/neosnippet
Ⅳ. 文档说明
Neosnippet
The Neosnippet plug-In adds snippet support to Vim. Snippets are
small templates for commonly used code that you can fill in on the
- To use snippets can increase your productivity in Vim a lot.
The functionality of this plug-in is quite similar to plug-ins like
snipMate.vim or snippetsEmu.vim. But since you can choose snippets with the
Neocomplecache interface, you might
have less trouble using them, because you do not have to remember each snippet
name.
Note: neocomplecache is NOT required! But recommended.
Configuration
This is an example ~/.vimrc configuration for Neosnippet. It is assumes you
already have Neocomplecache configured. With the settings of the example, you
can use the following keys:
C-kto select-and-expand a snippet from the Neocomplecache popup (UseC-n
andC-pto select it).C-kcan also be used to jump to the next field in
the snippet.
Tabto select the next field to fill in the snippet.
" Plugin key-mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
" SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? "<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "<C-n>" : "<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "<Plug>(neosnippet_expand_or_jump)" : "<TAB>"
" For snippet_complete marker.
if has('conceal')
set conceallevel=2 concealcursor=i
endif
If you want to use a different collection of snippets than the
built-in ones, then you can set a path to the snippets with
the g:neosnippet#snippets_directory variable (e.g [Honza's
Snippets](https://github.com/honza/snipmate-snippets))
" Tell Neosnippet about the other snippets
let g:neosnippet#snippets_directory='~/.vim/bundle/snipmate-snippets/snippets'