背景:中午醒来,饭都没吃,突然想到要给vim增加个代码片段的功能,因为昨天使用了gedit的代码片段,感觉不错。为什么不直接使用gedit呢?因为我相信把时间投入到vim是不会错的,精通vim就好了。。。。就这样的一个想法,让我搞到了快5点。 T_T

1 安装vundle

地址在:https://github.com/gmarik/Vundle.vim,不过不需要在这边下载什么,看看文档就好

git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
#没有git的话 yum install git
#这样就安装好了,不骗你

2 配置 .vimrc  在家目录下,没有就创建一个

然后在.vimrc 的第一行加入如下代码,无脑拷贝就好了

set nocompatible              " be iMproved, required
filetype off " required " set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim' " The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
Plugin 'user/L9', {'name': 'newL9'} " All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

要安装插件就在call vundle#begin()和call vundle#end()之间加入插件名称,比如要安装ultisnips,

Plugin 'SirVer/ultisnips'  #这个是没有现成的代码片段的,自己怎么配置还没研究,但是可以用别人的,看下一行
Plugin 'honza/vim-snippets' #这个就应有就有了,都在 .vim/vundle/vim-snippets/snippets/下面
#然后配置下面3行,没有的话是用不了代码片段功能的。这个是触发设置
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>" #可以自行配置,比如我的<c-l>,作用是跳到下一个占位符
let g:UltiSnipsJumpBackwardTrigger="<c-z>" #我的<c-h>,上一个占位符

这样真的就万事具备,只欠第3步,安装插件了

3 打开vim 执行 :PluginInstall (安装插件的意思), 等完成了会提示 done!

4 使用

先创建文件,比如
$ >test.html
然后打开
$ vim test.html
然后输入
form 按下tab键,。。。。。

vim 代码片段:通过vundle插件管理器安装ultisnips |centos6.5|vim7.2的更多相关文章

  1. Vim Vundle 插件管理器

    /********************************************************************** * Vim Vundle 插件管理器 * 说明: * 话 ...

  2. Vim插件之插件管理器Vundle

    Vim插件之插件管理器Vundle 1.介绍下载 相比Sublime.Text2等现代编辑器,Vim缺乏默认的插件管理器,所有插件的文件都散布在~/.vim下的几个文件夹中,配置Vim的过程, 就是在 ...

  3. vim插件管理器:Vundle的介绍及安装(很全)(转载)

    转载自:https://blog.csdn.net/zhangpower1993/article/details/52184581 背景 Vim缺乏默认的插件管理器,所有插件的文件都散布在~/.vim ...

  4. Vim插件管理器Vundle使用

    参考地址:http://www.linuxidc.com/Linux/2012-12/75684.htm Vundle(Vim bundle) 是一个vim的插件管理器. 其Github地址为: ht ...

  5. 使用Vim-plug作为Vim 插件管理器

    ref: https://www.cnblogs.com/jiftle/p/6918157.html - vundle是一款老款的插件管理工具- vim-plug相对较新,特点是支持异步加载,相比vu ...

  6. vim插件管理器的安装和配置-windows

    # vim插件管理器的安装和配置-windows ### 前言------------------------------ vim做一框功能强大的编辑器,扩展功能令人称奇,插件机制非常灵活- 本篇推荐 ...

  7. Alcatraz插件管理器

    下载地址:https://github.com/supermarin/Alcatraz 虽然能用Alcatraz插件管理器进行管理,但它有时有些插件并不是最新版本,特别是在Xcode更新版本时.这里有 ...

  8. 关于插件管理器Alcatraz

    如何安装插件管理器Alcatraz:去github下载一个Alcatraz安装包,然后运行一下. 会弹出 记得选择左边的Load Bundle 退出Xcode 重新运行一下就OK 了. 然后就可以看到 ...

  9. Confluence 6 关于统一插件管理器

    所有的组件通过 统一插件管理器(Universal Plugin Manager)进行管理,这个也被称为 UPM.UPM 可以在几乎所有的 Atlassian 应用中找到,能够提供完整同意的插件安装管 ...

随机推荐

  1. JS frame 跨域 传值

    1.在index.html 页面定义一个 函数用于接收 子页面的调用. <iframe id="common_iframe" class="common_conte ...

  2. SQLAlchemy技术文档(中文版)(上)

    在学习SQLAlchemy的过程中,好多时候需要查官方Tutorial,发现网上并没有完整的中文版,于是利用这两天空余时间粗略翻译了一下. 翻译效果很差....但也算是强迫自己通读一遍Tutorial ...

  3. P2563 [AHOI2001]质数和分解

    题目描述 任何大于 1 的自然数 n 都可以写成若干个大于等于 2 且小于等于 n 的质数之和表达式(包括只有一个数构成的和表达式的情况),并且可能有不止一种质数和的形式.例如,9 的质数和表达式就有 ...

  4. STL map、set中key为结构体的用法

    下面是map定义的结构: // TEMPLATE CLASS map template<class _Kty, class _Ty, class _Pr = less<_Kty>, ...

  5. BZOJ1407 [Noi2002]Savage 【扩展欧几里得】

    题目链接 BZOJ1407 题解 枚举\(m\)用扩欧判即可 #include<algorithm> #include<iostream> #include<cstrin ...

  6. apache代理服务器配置

    1. 扩展开启,httpd.conf开启一下选项 LoadModule proxy modules/proxy.so LoadModule proxy_connect modules/proxy_co ...

  7. Different Integers 牛客多校第一场只会签到题

    Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (lq, r ...

  8. sls文件

    http://www.ituring.com.cn/article/42238 只是数据而已 深入学习之前,明白SLS文件只是结构化的数据而已是很有用的.看懂和编写SLS文件不需要理解这一点,但会让你 ...

  9. 获取oracle当前系统设置了哪些事件

    ALTER SESSION SET EVENTS '10046 trace name context forever,level 12' 会话已更改. DECLARE EVENT_LEVEL NUMB ...

  10. (转)如何用python抓取网页并提取数据

    最近一直在学这部分,今日发现一篇好文,虽然不详细,但是轮廓是出来了: 来自crifan:http://www.crifan.com/crawl_website_html_and_extract_inf ...