(1) install Python 2.7
Download and install python on the official website. My installation path is D: \ Program Files \ python. Edit Environment Variables after installationPath, Add; D: \ Program Files \ Python. (Note the semicolon above)
(2) install Vim
Download gvim from the official website and install it. My installation path is D: \ Program Files \ vim. Edit Environment Variables after installationPath, Add; D: \ Program Files \ Vim \ vim73.
(3) install exuberant ctags
Ctags is used to generate the tags file. Vim can use it to implement the jump function and can also be called by other plug-ins. The so-called jump is to be able to go to the desired function, type, struct, class and other definitions at any time. For example, when the cursor is at any position, it can be input in normal mode.
: Ta func_name
You can direct the cursor to the hot spot of func_name. Of course, other names can also be quickly located using this method. In addition, you can pressCTRL +], Jump to the definition of this function immediately. After you jump to the defined position, you can pressCTRL + OReturn the original editing location quickly. The difference between ctags and tags needs to be clarified: ctags is an EXE file used to generate the tags file. The tags file is the tag link file of all source files in the current directory. In Vim without ctags, a new tags file cannot be generated, but the existing tags file can still be used.
Generally, we do not use ctags separately. It is usually used with plug-ins such as taglist.
Download ctagsfrom the official website and place the ctags.exe in the folder to any folder, such as D: \ opensource \ vim( ctctctctctctctctctctctct ). Put it inD: \ Program Files \ Vim \ vim73In this way, no complicated settings are required later.
(4) install taglist
Download taglist from the official website, and put taglist. Vim in the in folder of the installation directory. my options are D: \ Program Files \ Vim \ vim73 \ plugin.
With ctags and taglist, you can easily view functions, classes, and variables contained in the file.
(5) install the Automatic completion tool pydiction
Download pydiction from the official website and put the python_pydiction.vim, complete_dict, and pydiction. py files to D: \ Program Files \ Vim \ vim73 \ ftplugin. The tab key can be used for automatic completion.
(6) configuration _ vimrc
Generally, this file is located at the upper layer of the installation directory, and my files are located at D: \ Program Files \ vim. You must change the taglistfile to ctags.exe and set it to open by default.
Set the complete-dict position of pydiction and set the default height to 20.
Add the following statements:
Let tlist_ctags_cmd = 'd: \ opensource \ Vim \ ctags.exe'
Let tlist_auto_open = 1
Let G: pydiction_location = 'd: \ Program Files \ Vim \ vim73 \ ftplugin \ complete-dict'
Let G: pydiction_menu_height = 20
If you put ctags.exeD: \ Program Files \ Vim \ vim73, You need to change the first sentence
Let tlist_ctags_{'ctags.exe'
(7) Add a python shortcut
Since gvim version 2.73 has integrated Python's syntax highlighting plug-in Python. Vim, we now have the python editor. Next we will set shortcuts to compile python. You can use the following statement:
Map <F12> :! Python.exe %
In this example, you can directly use python.exe to run the py script in vim. For a script, press F12 and press enter to run the program.
(8) Example
For the following program,
def run(name) print name, 'running'print run('your name')
Use Vim to open and run
Now, we can easily use Vim to edit and run py, enjoy it ready _^