vim 代碼片斷:經過vundle插件管理器安裝ultisnips |centos6.5|vim7.2

背景:中午醒來,飯都沒吃,忽然想到要給vim增長個代碼片斷的功能,由於昨天使用了gedit的代碼片斷,感受不錯。爲何不直接使用gedit呢?由於我相信把時間投入到vim是不會錯的,精通vim就行了。。。。就這樣的一個想法,讓我搞到了快5點。 T_Thtml

1 安裝vundlegit

地址在:https://github.com/gmarik/Vundle.vim,不過不須要在這邊下載什麼,看看文檔就好github

git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
#沒有git的話  yum install git
#這樣就安裝好了,不騙你

 2 配置 .vimrc  在家目錄下,沒有就建立一個vim

    而後在.vimrc 的第一行加入以下代碼,無腦拷貝就行了app

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,  ui

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步,安裝插件了this

3 打開vim 執行 :PluginInstall (安裝插件的意思), 等完成了會提示 done!spa

4 使用插件

先建立文件,好比
 $ >test.html
而後打開
$ vim test.html
而後輸入
form  按下tab鍵,。。。。。
相關文章
相關標籤/搜索