Background: Wake up at noon, Rice did not eat, suddenly thought to give vim add a code snippet function, because yesterday used the Gedit code snippet, feel good. Why not use Gedit directly? Because I believe that the time to devote to vim is not wrong, proficient in vim is good .... That's the idea that I got to get to the 5 point. t_t
1 Installing Vundle
Address: Https://github.com/gmarik/Vundle.vim, but don't need to download anything here, just look at the documentation.
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/vundle.vim# no git, yum install git# so it's installed, don't cheat you
2 configuration. VIMRC in the home directory, without creating a
Then add the following code to the first line of the. VIMRC, without a brain copy.
Set nocompatible ' be improved, requiredfiletype off ' required ' set the runtime Path to Inc Lude Vundle and Initializeset rtp+=~/.vim/bundle/vundle.vimcall vundle#begin () "Alternatively, pass a path where Vundle sh Ould Install plugins "Call Vundle#begin (' ~/some/path/here ')" Let Vundle manage Vundle, Requiredplugin ' Gmarik/vundle.vim ' The following is examples of different formats supported. ' Keep Plugin commands between vundle#begin/end. "Plugin on GitHub repoplugin ' tpope/vim-fugitive '" Plugin from Http://vim-s Cripts.org/vim/scripts.htmlplugin ' L9 ' Git plugin not hosted on Githubplugin ' 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 Spa Rkup 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 L9plugin ' User/l9 ', {' name ': ' NewL9 '} "all of your Plugins must is added before the following Linecall Vundle#end ()" Requiredfiletype plugin in Dent on ' required ' to ignore plugin indent changes, instead use: ' FileType plugin on ' "Brief help":P luginlist- Lists configured plugins ":P Lugininstall-installs plugins; Append '! ' to update or just:P luginupdate ":P luginsearch foo-searches for foo; Append '! ' to refresh local cache ':P luginclean-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
To install plug-ins, add a plug-in name between call Vundle#begin () and call Vundle#end () , such as installing Ultisnips,
Plugin ' sirver/ultisnips ' #这个是没有现成的代码片段的, how to configure their own have not studied, but can use others, see the next line Plugin ' Honza/vim-snippets ' #这个就应有就有了, are in. Vim /vundle/vim-snippets/snippets/below # Then configure the following 3 lines, no words can not use the code snippet function. This is the trigger setting let g:ultisnipsexpandtrigger= "<tab>" Let g:ultisnipsjumpforwardtrigger= "<c-b>" #可以自行配置, Like my <c-l> the function is to jump to the next placeholder let g:ultisnipsjumpbackwardtrigger= "<c-z>" #我的 <c-h> the previous placeholder
This really has everything, only the 3rd step, install the plug-in
3 Open Vim Execution:P lugininstall (install plug-in meaning), and so on, will prompt done!
4 Use
First create the file, such as $ >test.html then open the Vim test.html then enter form press TAB, ...
Vim Code snippet: Install ultisnips through the Vundle plugin manager |centos6.5|vim7.2