zoukankan      html  css  js  c++  java
  • vim 代码片段:通过vundle插件管理器安装ultisnips |centos6.5|vim7.2

    背景:中午醒来,饭都没吃,突然想到要给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键,。。。。。
    
  • 相关阅读:
    QTreeWidgetItem清空子节点
    qt no doubments matching "ui..h" could be found
    Qt 调试信息、打印信息、输出到文本
    QLayout及其子类 清除添加的widget
    同一个电脑安装两个jdk版本
    hive javaapi 002
    ActiveMQ之spring集成消息转换器MessageConverter
    install Maven
    install apache-activemq
    MySQL 5.7.9版本sql_mode=only_full_group_by问题
  • 原文地址:https://www.cnblogs.com/bushe/p/4085935.html
Copyright © 2011-2022 走看看