Vim的snipMate插件
介绍
终于发现了一个插件,对于Vim下代码块的自动补全支持的很好。给大家推荐snipMate。
snipMate可以帮助您在vim上实现类似Textmate的功能,自动代码块的能力非常强大,而且代码块是可定制的。我们只需编辑~/.vim/snippets/目录下的*.snippets文件就可以根据自己的要求自动产生代码。
使用
下载
snipMate,解压到你的Vim目录。
完成之后,新建一个测试文件snipMateTest.php准备测试
vim snipMateTest.php
然后按照下面的方式开始测试snipMate:
输入for,再按tab键
输入foreach,再按tab键
输入class,再按tab键
输入fun,再按tab键
效果如图
http://www.ccvita.com/481.html
snipMate插件php自动补全配置文件:
snippet php
<?php
${1}
snippet ec
echo "${1:string}"${2};
snippet inc
include '${1:file}';${2}
snippet inc1
include_once '${1:file}';${2}
snippet req
require '${1:file}';${2}
snippet req1
require_once '${1:file}';${2}
# $GLOBALS['...']
snippet globals
$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5}
snippet $_ COOKIE['...']
$_COOKIE['${1:variable}']${2}
snippet $_ ENV['...']
$_ENV['${1:variable}']${2}
snippet $_ FILES['...']
$_FILES['${1:variable}']${2}
snippet $_ Get['...']
$_GET['${1:variable}']${2}
snippet $_ POST['...']
$_POST['${1:variable}']${2}
snippet $_ REQUEST['...']
$_REQUEST['${1:variable}']${2}
snippet $_ SERVER['...']
$_SERVER['${1:variable}']${2}
snippet $_ SESSION['...']
$_SESSION['${1:variable}']${2}
# Start Docblock
snippet /*
/**
* ${1}
**/
# Class - post doc
snippet doc_cp
/**
* ${1:undocumented class}
*
* @package ${2:default}
* @author ${3:`g:snips_author`}
**/${4}
# Class Variable - post doc
snippet doc_vp
/**
* ${1:undocumented class variable}
*
* @var ${2:string}
**/${3}
# Class Variable
snippet doc_v
/**
* ${3:undocumented class variable}
*
* @var ${4:string}
**/
${1:var} $${2};${5}
# Class
snippet doc_c
/**
* ${3:undocumented class}
*
* @packaged ${4:default}
* @author ${5:`g:snips_author`}
**/
${1:}class ${2:}
{${6}
} // END $1class $2
# Constant Definition - post doc
snippet doc_dp
/**
* ${1:undocumented constant}
**/${2}
# Constant Definition
snippet doc_d
/**
* ${3:undocumented constant}
**/
define(${1}, ${2});${4}
# Function - post doc
snippet doc_fp
/**
* ${1:undocumented function}
*
* @return ${2:void}
* @author ${3:`g:snips_author`}
**/${4}
# Function signature
snippet doc_s
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6:`g:snips_author`}
**/
${1}function ${2}(${3});${7}
# Function
snippet doc_f
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6:`g:snips_author`}
**/
${1}function ${2}(${3})
{${7}
}
# Header
snippet doc_h
/**
* ${1}
*
* @author ${2:`g:snips_author`}
* @version ${3:$Id$}
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
* @package ${5:default}
**/
/**
* Define DocBlock
*//
# Interface
snippet doc_i
/**
* ${2:undocumented class}
*
* @package ${3:default}
* @author ${4:`g:snips_author`}
**/
interface ${1:}
{${5}
} // END interface $1
# class ...
snippet class
/**
* ${1}
**/
class ${2:ClassName}
{
${3}
function ${4:__construct}(${5:argument})
{
${6:// code...}
}
}
# define(...)
snippet def
define('${1}'${2});${3}
# defined(...)
snippet def?
${1}defined('${2}')${3}
snippet wh
while (${1:/* condition */}) {
${2:// code...}
}
# do ... while
snippet do
do {
${2:// code... }
} while (${1:/* condition */});
snippet if
if (${1:/* condition */}) {
${2:// code...}
}
snippet ife
if (${1:/* condition */}) {
${2:// code...}
} else {
${3:// code...}
}
${4}
snippet else
else {
${1:// code...}
}
snippet elseif
elseif (${1:/* condition */}) {
${2:// code...}
}
# Tertiary conditional
snippet t
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
snippet switch
switch ($${1:variable}) {
case '${2:value}':
${3:// code...}
break;
${5}
default:
${4:// code...}
break;
}
snippet case
case '${1:value}':
${2:// code...}
break;${3}
snippet for
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4: // code...}
}
snippet foreach
foreach ($${1:variable} as $${2:key}) {
${3:// code...}
}
snippet fun
${1:public }function ${2:FunctionName}(${3})
{
${4:// code...}
}
# $... = array (...)
snippet array
$${1:arrayName} = array('${2}' => ${3});${4}
- 大小: 46.8 KB
分享到:
相关推荐
vim官方脚本snipmate绿色覆盖更新到0.83版本后停止更新了。 新版vim-snipmate0.87,官方下载更新地址如下 https://github.com/garbas/vim-snipmate 由于新手可能不会安装,现在制作了如vim官方的绿色版本直接覆盖目录...
本文件含有的插件有:AutoComplPop,BufExplorer,EchoFunc,Genutils,LookupFile,MRU,NERD_Commenter,NERD_Tree,OmniCppComplete,snipMate,Taglist,ZoomWin,getscript.vim。个别用户会提示ctags未安装,请...
gvim补全插件snipmate使用 一.此版本已经修正了在php文件中书写html代码时的缩进问题,希望能和大家一起努力! 你把这个文件夹和vim配置文件直接拷贝覆盖到你的gvim安装目录下,你简单的看一下你的gvim安装目录就...
VIM编辑器+自定义配置+snipMate插件
Vim优化各种常用插件的组合安装,调整了字体和背景,加上很好看的语法着色,已经可以成为完整ide环境,对插件的冲突也做了优化,自动补全可使用空格选词,snipmate默认使用Tab,安装zencoding,使用ctrl-e展开,自动匹配符号,...
基于amix.dk/vim/vimrc.txt制作的插件包,包括以下插件。 1. vimwiki 2. snipMate 3. vimgtd 4. taglist 5. nerdcommenter 6. DoxygenToolkit 7. mark 8. omnicppcomplete 9. authorinfo 10. a 11. pyflakes 12. ...
安装如果您正在为Vim使用,只需将〜/ .vimrc文件放入: Bundle 'jakezhaojb/vim-torch-snipmate'然后执行“:BundleInstall”,然后全部设置!用法例如,您将不再需要键入“ SpatialMaxPooling”。 而是使用“ sp + ...
但是配置vim的众多插件资源分散 vim.org,反正我是上不去 github一般家庭网络不是很稳定 花了好多时间,攒下的vim插件大集合。 网上有一键安装vim配置的包,但是窃以为,还是自己一层一层堆砌出来的编辑器更好,就像...
所安装的插件: authorinfo.vim conque_term.vim EnhancedCommentify.vim minibufexpl.vim mru.vim per-support.vim python_fold.vim snipMate.vi tagbar.vim taglist.vim TeTrIs.vim winfileexplorer.vim ...
snipMate - Plugin for using TextMate-style snippets in Vim. supertab - Perform all your vim insert mode completions with Tab. delimitMate - Provides auto-balancing and some expansions for parens, ...
acp.vim perlsupportgui.vim perlsupportprofiling.vim perlsupportregex.vim snipMate.vim .vim/colors: desertEx.vim peachpuff.vim zenburn.vim .vim/compiler: tex.vim .vim/c-support: codesnippets doc rc ...
snipMate.vim - 自动生成代码块,for即可感受 autoload_cscope.vim - 专门为懒人准备的cscope索引自动加载插件,超cool,我绑定了F3,F2快捷键 lookupfile.vim - 快速查找文件,绑定F5 genutils.vim - lookupfile...
vim不可或缺的一个插件
所安装的插件: authorinfo.vim conque_term.vim EnhancedCommentify.vim minibufexpl.vim mru.vim per-support.vim python_fold.vim snipMate.vi tagbar.vim taglist.vim TeTrIs.vim winfileexplorer.vim ...
依赖vim-snipmate。我支持了Go,Python和JavaScript的语法补全。安装任选Pathogen,Vundle等出色的插件管理器,以Pathogen作为选择:-基于 (VIM 8)同时安装EasyComplete,vim-dictionary cd ~/.vim/bundle/git ...
VIM - Vi 改进 不确定你想潜入吗? 入门: :snail: :turtle: : 在获得 swol Vim到 7.4 ...插件 'w1zeman1p/vim-snipmate' -> 使用textmate片段 插件 'tpope/vim-rails' -> 像老板一样导航 rails 插
Linux下vim集成环境,集成了常用插件.直接解压到宿主目录即可用. 以下是插件列表 acp a bufexplorer command-t c DoxygenToolkit fuf JavascriptLint jsbeautify minibufexpl mru NERD_commenter NERD_tree peepopen ...
要安装twig.vim和其他Vim插件,建议使用一种流行的Vim软件包管理器,而不是通过将所有必需的文件拖放到.vim文件夹中进行安装。 Neobundle(推荐) 设置软件包管理器 设置的捆绑包 NeoBundle ' nelsyeung/twig.vim '...
片段 该存储库包含用于vim的著名插件的各种编程语言的摘录文件。 该存储库由社区维护,许多人已经贡献了摘录文件和其他改进功能。...就像原始的snipMate插件一样,所有代码段均按照MIT许可的条款进行许可。
vim custom是一个集合了官方版本+实用插件+经典配置的自定义版本vim.它可以为php程序员提供极大的便利,让...aliz 贡献了superTab和snipMate两个插件。欢迎其他童鞋贡献更多实用的插件,让我们齐心协力,打造完美的vim.