snippet.vim


Ⅰ. 插件描述

Replace a word with any text

Ⅱ. 基本信息

创建日期:  2002-08-09
使用用户:  1
Github星:  2
插件作者:  Timothy Aldrich

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/snippet-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/snippet-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/snippet-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/snippet.vim

Ⅳ. 文档说明

Snippets are fragments of code, usually related to keywords .
For example the C language defines "for" and "do" as keywords,
among others.  Since "for" is usually written
    as :
         for (...;...;...) {
                 //code here
         }
Most users will create an abbreviation for the keyword "for" to add the
parenthesis and curly-braces such as :
         iabb xFor for<space>(<space>;<space>;<space>)<space>{<cr><cr>}

To accomplish this using snippets, create a file with these lines :

for ( <#cursor#>; ; ) {

}

Now when editing a 'c' file, when you type 'for<C-S>' ,for is replaced by the
snippet of code you placed in the file.  Additionally the cursor is placed
between the opening ( and the first ; ... ready for you to begin typing.

添加新评论