背景:中午醒来,饭都没吃,突然想到要给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. NOIP模板

    快排 procedure qsort(l,r:longint); var i,j,t,m:longint; begin i:=l; j:=r; m:=a[(i+j) ]; repeat while a ...

  2. 用AngularJS操作DOM

    在angular中使用第三方插件时最好都封装到指令(directives)中去,DOM操作也最好都解构到指令中. <!DOCTYPE html> <html lang="e ...

  3. P1650 田忌赛马

    题目描述 我国历史上有个著名的故事: 那是在2300年以前.齐国的大将军田忌喜欢赛马.他经常和齐王赛马.他和齐王都有三匹马:常规马,上级马,超级马.一共赛三局,每局的胜者可以从负者这里取得200银币. ...

  4. 国内各运营商(ISP)IP段表

    国内各运营商(ISP)IP段表 来源:http://bbs.hh010.com/forum.php?mod=viewthread&tid=490529&orderby=dateline ...

  5. BZOJ1293 [SCOI2009]生日礼物 【队列】

    题目 小西有一条很长的彩带,彩带上挂着各式各样的彩珠.已知彩珠有N个,分为K种.简单的说,可以将彩带考虑为x轴,每一个彩珠有一个对应的坐标(即位置).某些坐标上可以没有彩珠,但多个彩珠也可以出现在同一 ...

  6. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) B

    B. Little Artem and Grasshopper time limit per test 2 seconds memory limit per test 256 megabytes in ...

  7. android studio的弹出层

    <activity android:name=".SecondActivity" android:theme="@style/Theme.AppCompat.Dia ...

  8. CSS中的text-shadow。

    text-shadow(文字投影),box-shadow(容器投影),border-radius(圆角)这三个属性估计以后用的比较多,记录 一下.目前不支持IE系列(不过可以使用其他方法实现,下文有详 ...

  9. Spring - IoC(2): 属性注入 & 构造注入

    依赖注入是指程序运行过程中,如果需要另外的对象协作(访问它的属性或调用它的方法)时,无须在代码中创建被调用者,而是依赖于外部容器的注入. 属性注入(Setter Injection) 属性注入是指 I ...

  10. 【Foreign】阅读 [线段树][DP]

    阅读 Time Limit: 10 Sec  Memory Limit: 256 MB Description Input Output Sample Input 0 10 4 10 2 3 10 8 ...