This article describes how to use the plug-in management tool Vundle to build a vim development environment in an UBUNTU environment to improve the efficiency of using VIM for programming under Linux. Install Vim
Installing Vim on Ubuntu is simple, typing the following command at the terminal:
$ sudo apt-get install vim
The Vim installed on the above commands in Ubuntu version 14.04 is a 7.4+ version, but if you use Ubuntu 12.04 like me, you are not so lucky. Because the Vim installed on Ubuntu 12.04 with Apt-get is version 7.3, this version is relatively old, and some plugins are not supported, such as Youcompleteme. So we need to upgrade to more than 7.4 version, see a netizen said add PPA source can be upgraded, as follows:
$ sudo add-apt-repository ppa:fcwu-tw/ppa
$ sudo apt-get update
$ sudo apt-get install vim
But I tried not to, so I still download Vim's source code for installation. I directly install the latest version 8.0, the relevant source code can be found at the following Web site: GitHub Warehouse: Https://github.com/vim/vim VIM official website: http://www.vim.org/
Download, compile, and install the following commands:
$ git clone https://github.com/vim/vim.git
$ cd vim/src
$/configure--enable-pythoninterp=yes $
Make
$ sudo make Installvim
Typing VIM command can see the following screen:
Note that the./configure--enable-pythoninterp=yes configuration is necessary to open Vim's Python2 support. If you want to turn on PYTHON3 support, the parameter should be--enable-python3interp=yes.
Vim's default installation path is/usr/local/bin/vim, the original vim is/usr/bin/vim, so vim 8.0 and vim 7.3 can be shared. So why did you enter VIM to perform the 8.0 version instead of the 7.3 version? Look at the environment variable path, because/usr/local/bin's path is ahead.
$ echo $PATH
/sbin:/usr/sbin:/usr/lib/lightdm/lightdm:/usr/local/bin:/usr/bin:/bin
So now VIM executes the 8.0 version, and VI executes the 7.3 version.
In addition, we can check if Vim already supports Python with the following command. Not executed./configure--enable-pythoninterp=yes compiled words like this:
$ VIM--version | grep python
+cryptv +linebreak +python +viminfo
+cscope +lispindent + Vreplace
After the execution of the./configure--enable-pythoninterp=yes, this is the case:
$ VIM--version | grep python
+cryptv +linebreak +python +viminfo
+cscope +lispindent + Vreplace
linking:gcc -l/usr/local/lib-wl,--as-needed-o vim -lgtk-x11-2.0-lgdk-x11-2.0-latk-1.0- lgio-2.0-lpangoft2-1.0-lpangocairo-1.0-lgdk_pixbuf-2.0-lcairo-lpango-1.0-lfreetype-lfontconfig-lgobject-2.0- lglib-2.0 -lsm-lice-lxt-lx11-lxdmcp-lsm-lice -lm-ltinfo-lnsl -ldl -l/usr/lib/python2.7/ Config-lpython2.7-lpthread-ldl-lutil-lm-xlinker-export-dynamic-wl,-o1-wl,-bsymbolic-functions
Install Vundle
Because vim lacks the default plugin manager, all plug-in files are scattered in several folders under the ~/.vim, which causes all kinds of plug-ins to install, update, delete all need their own manual processing, both troublesome and possible errors. So we need the help of the plugin manager, the common plugins manager has vundle, pathogen and so on, we use vundle here.
Vundle is hosted on Github, so use git to download the Vundle and store it in ~/.vim/bundle/vundle. Check out the source code directly to the directory using the following command:
$ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
After downloading the Vundle, you also need to configure the. vimrc file.
In order not to let. VIMRC looks too bloated, I created a new ~/.vimrc.bundles file to save all of the plugin's configuration. First, include the following in the ~/.vimrc.bundles file:
FileType off
set rtp+=~/.vim/bundle/vundle/call
VUNDLE#RC ()
Then add the content to the ~/.vimrc file:
If Filereadable (expand ("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
So the Vundle is ready. Installing Plug-ins
We need to know that Bundle is divided into three categories: repos under the Github vim-scripts user, only need to write repos name in Github other users repos, need to write "username/repos name" is not on the Github plug-in, need To write a git full path
More commonly used is the second, that is, the "User name/repos name" approach. Here we will put the configuration information of the plug-in in ~/.vimrc.bundles, as follows:
"Define bundles via Github repos Bundle ' christoomey/vim-run-interactive ' Bundle ' valloric/youcompleteme ' Bundle '" croak " Y/vim-colors-github ' Bundle ' danro/rename.vim ' Bundle ' majutsushi/tagbar ' Bundle ' kchmck/vim-coffee-script ' ' Bundle ' Kien/ctrlp.vim ' Bundle ' pbrisbin/vim-mkdir ' Bundle ' scrooloose/syntastic ' Bundle ' slim-template/vim-slim ' ' Bundle ' Thoughtbot/vim-rspec ' Bundle ' tpope/vim-bundler ' Bundle ' tpope/vim-endwise ' Bundle ' tpope/vim-fugitive ' ' Bundle ' Vim-rails ' Bundle ' tpope/vim-surround ' Bundle ' Vim-ruby/vim-ruby ' Bundle ' vim-scripts/ctags.vim ' ' Bundle ' Matchit.zip ' Bundle ' vim-scripts/tcomment ' Bundle ' mattn/emmet-vim ' Bundle ' scrooloose/nerdtree ' ' Bundle ' Vim-powerline ' Bundle ' godlygeek/tabular ' Bundle ' msanders/snipmate.vim ' Bundle ' jelera/vim-javascript-syntax ' ' altercation/vim-colors-solarized ' Bundle ' othree/html5.vim ' Bundle ' xsbeats/vim-blade ' Bundle ' raimondi/ Delimitmate ' Bundle ' groenewege/vim-less ' Bundle ' Evanmiller/nginx-vim-syntaX ' Bundle ' lokaltog/vim-easymotion ' Bundle ' Tomasr/molokai ' Bundle ' Klen/python-mode '
Then, open vim, enter: Bundleinstall or directly in the terminal input vim +bundleinstall +qall install Plug-ins.
Some plug-ins are relatively large, need to wait a period of time to download, installation completed. Vim Help documentation
Vimtutor is a good getting started document, which can be opened in the terminal direct input vimtutor, this document may find the Chinese version on the net.
In addition, enter in VIM: Help can also see the assistance document, if you really do not like English, you can switch to Chinese.
First execute the following command to download vimcdoc-1.8.0.tar.gz:
$ wget http://nchc.dl.sourceforge.net/sourceforge/vimcdoc/vimcdoc-1.8.0.tar.gz
Then unpack the vimcdoc-1.8.0.tar.gz, enter the vimcdoc-1.8.0 directory to find the doc directory, and copy all files in doc to the ~/.vim/doc/directory.
Re-enter VIM, input: Help can see helping documents become Chinese.
If you cannot display Chinese, add in ~/.VIMRC:
Set HELPLANG=CN
Set Encoding=utf-8
Error Prompt
If you start vim after installing the plugin, your VIM needs to be upgraded.
Youcompleteme unavailable:requires Vim 7.4.1578+.
If you start vim after installing the plugin, your vim needs to be recompiled to support Python.
Youcompleteme unavailable:requires Vim compiled with Python (2.6+ or 3.3+) support