In the previous article on the VIM Foundation plug-in plus a special for reading and writing Python program plug-in-python-mode. As the name implies, let vim run in Python mode. This section describes the features of this plugin and how to use it.
This article mainly extracts Python-mode's help document that individuals feel to use more and more meaningful content.
Introduction
Python-mode:includes libraries such as pylint, rope, Pydoc, Pyflakes, Pep8, and McCabe. Python-mode provides powerful functionality by integrating a variety of plugins.
Install
Use Neobundle to add the following code to the VIMRC, or download the extract directly. Vim/plugin directory
Bundle ' Klen/python-mode '
Function
Python-mode has a lot of features and configurations, but most of them only need to use the default configuration. Summarizing the Help Pymode, you can learn about its features by introducing his configuration items:
1. Turn on the Plugin:
Let G:pymode = 1 "Close and open the Python-mode plugin
2. Choose python version:
Let G:pymode_python = ' python ' "or Python3, disable." Choose the version of Python
3. Pep8-compatible python indent:
Let g:pymode_indent = 1 "Use indent style for PEP8
4. Enable Pymode Folding:
Let g:pymode_folding = 1 "Enable folding function
5. Show Document:
Let G:pymode_doc = 1 "via command: Pymodedoc ARG lookup document
Let G:pymode_doc_bind = ' K ' cursor moves to the parameter by pressing the shortcut key K
6. Run Code:
Let G:pymode_run = 1
Let G:pymode_run_bind = ' <leader>r ' "running in vim
7. Add Breakpoint
Let G:pymode_breakpoint_bind = ' <leader>b ' "Automatically joins the breakpoint statement
8. Code Checking:
Let G:pymode_lint_on_write = 1 "post-modification check
Let g:pymode_lint_checkers = [' Pyflakes ', ' pep8 ', ' McCabe '] "Choose from Pylint, Pep8, McCabe, pep257, Pyflakes
9. Rope Support (Build database of project files to index objects):
Let g:pymode_rope_ropefolder= '. Ropeproject ' "project file in the directory
Let G:pymode_rope_show_doc_bind = ' <c-c>d ' "Lookup help documentation
Ten. Completion
Grammar Completion Command:<c-p>/<c-n>
Others.
Let g:pymode_trim_whitespaces = 1 "trim unused white spaces on save
Let g:pymode_options = 1 "Setup Default python options
Let G:pymode_options_max_line_length = + "Setup Max line length
There are also features for code re-casting and the configuration of the virtual environment, because it is not used, so it is not introduced. Although there are many configurations, there are a few things that need to be used in VIMRC:
423 "for python-mode424 let G:pymode_rope_goto_definition_bind =" <C-]> "425 let G:pymode_python = ' python '" or Pyth On3, disable426 "Let G:pymode_virtualenv_path = $VIRTUAL _env427 to G:pymode_lint_on_write = 1428" Let G:pymode_rope_goto _definition_cmd = ' new ' or vnew
Finally summarize the command using
1). K: Consult the object document
2). <leader>r: Run Python script
3). <leader>b: Automatically add breakpoints
4). <c-p>/<c-n>: auto-complete
5). <c-]>: Jump to function definition
Create a Python editor under vim