Operating system: windows8.1 64-bit
vim:gvim7.4 1, Download tern for Vim, go to the official website direct download, connection seems to be on GitHub (https://github.com/marijnh/tern_for_vim.git). 2. Node. js and NPM are required, both of which should be installed Nodejs. (Note: Here to install git in advance, use NPM will use) 3, tern recommended with pathogen, a vim plug-in management tool. The get address is also GitHub (Https://github.com/tpope/vim-pathogen). The pathogen is installed directly as described in the documentation. For example, I'll copy the Pathogen.vim into the D:\soft\Vim\vim74\autoload directory, and then modify the Vim configuration (D:\SOFTL\VIM\_VIMRC) to add
" Managing Execute Pathogen#infect () using the pathogen plugin
, so that you can use pathogen to manage the Vim plug-in (the default is to put the plugin into the D:\soft\Vim\vimfiles\bundle folder (Bundle folder default, need to create manually)), here will get the Tern_for_ The Vim folder is placed in this directory.
4, open cmd, enter the D:\soft\Vim\vimfiles\bundle\tern_for_vim directory, run the command
NPM Install
Depending on the Package.json in the directory, the required dependencies will be taken. 5, installs the Python (Ya's also to install this, usually does not use). I now get the tern for VIM, the document has this sentence (Note:this plugin requires vim 7.3+ and builtin Python support to work), I use Vim is 7.4, so installing Python is Come on. I here Gvim is 32 bit, so download Python also need to be 32 bit, otherwise does not support, start when I download 64 bit of GVIM,TMD is not support, find a half day reason. Https://www.python.org/ftp/python/2.7.10/python-2.7.10.msitern.vim came up with one sentence: if!has (' python ') &&!has (' Python3 ') echo ' tern requires Python support ' finishendif should also be supported Python3, I see the python official online Download the latest version 2 and 3 side, downloaded 2, because I do not use it, at least not now. After installation, I verify that vim is supporting Python, using the method above
: Echo has ("python")
0 is returned before installation, and 1 is returned after installation. 6, the above installation is successful, try the effect, create d:\test\qianye.js, in addition Tern required to create a configuration file under the project, the file name is (. Tern-project), the contents are as follows: {"libs": ["Browser", "jquery"], " Loadeagerly ": [" Importantfile.js "]," plugins ": {" Requirejs ": {" BaseURL ":"./"," Paths ": {}}}} These configurations are examples , of course, can be modified as required, here Libs only wrote two, support more. Note: Windows does not allow you to create a. Start file that can be created with vim or copied directly from somewhere else. Like Linux, Vim's configuration file is. vimrc,windows can be replaced with _VIMRC, I tried the next _tern-project No. There are two files in the test directory: D:\test\qianye.jsd:\test\.tern-project open qianye.js, enter jquery., press ctrl+x and Ctrl+o, are there any hints?
Install tern for vim under windows