Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 0

killf/python-mode

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
develop
Branches (4)
Tags (81)
develop
last-py2-support
master
gh-pages
0.13.0
0.12.0
0.11.0
last-py2-support
0.10.0
0.9.2
0.9.1
0.9.0
0.8.1
0.8.0
0.7.8b
0.7.7b
0.7.6b
0.7.5b
0.7.4b
0.7.3b
0.7.2b
0.7.1b
0.7.0b
0.6.19
develop
Branches (4)
Tags (81)
develop
last-py2-support
master
gh-pages
0.13.0
0.12.0
0.11.0
last-py2-support
0.10.0
0.9.2
0.9.1
0.9.0
0.8.1
0.8.0
0.7.8b
0.7.7b
0.7.6b
0.7.5b
0.7.4b
0.7.3b
0.7.2b
0.7.1b
0.7.0b
0.6.19
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
develop
Branches (4)
Tags (81)
develop
last-py2-support
master
gh-pages
0.13.0
0.12.0
0.11.0
last-py2-support
0.10.0
0.9.2
0.9.1
0.9.0
0.8.1
0.8.0
0.7.8b
0.7.7b
0.7.6b
0.7.5b
0.7.4b
0.7.3b
0.7.2b
0.7.1b
0.7.0b
0.6.19
python-mode
/
doc
/
pymode.txt
python-mode
/
doc
/
pymode.txt
pymode.txt 32.39 KB
Copy Edit Raw Blame History
Diego Rabatone Oliveira authored 2020年10月09日 02:49 +08:00 . Bump version: 0.12.0 → 0.13.0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882
*pymode.txt* For Vim Version 8.0 Last change: 2019 March 08
____ _ _ ____ _ _ _____ _ _ __ __ _____ ____ ____ ~
( _ \( \/ )(_ _)( )_( )( _ )( \( )___( \/ )( _ )( _ \( ___) ~
)___/ \ / )( ) _ ( )(_)( ) ((___)) ( )(_)( )(_) ))__) ~
(__) (__) (__) (_) (_)(_____)(_)\_) (_/\/\_)(_____)(____/(____) ~
Version: 0.13.0
===============================================================================
CONTENTS *pymode-contents*
1. Intro...........................................................|pymode-intro|
2. Common functionality...........................................|pymode-common|
2.1 Python version....................................|pymode-python-version|
2.2 Python indentation........................................|pymode-indent|
2.3 Python folding...........................................|pymode-folding|
2.4 Vim motion................................................|pymode-motion|
2.5 Show documentation.................................|pymode-documentation|
2.6 Support virtualenv....................................|pymode-virtualenv|
2.7 Run code.....................................................|pymode-run|
2.8 Breakpoints..........................................|pymode-breakpoints|
3. Code checking....................................................|pymode-lint|
3.1 Code checkers options...............................|pymode-lint-options|
4. Rope support.....................................................|pymode-rope|
4.1 Code completion.......................................|pymode-completion|
4.2 Find definition......................................|pymode-rope-findit|
4.3 Refactoring.....................................|pymode-rope-refactoring|
4.4 Undo/Redo changes......................................|pymode-rope-undo|
5. Syntax.........................................................|pymode-syntax|
6. FAQ...............................................................|pymode-faq|
7. Development...............................................|pymode-development|
8. Credits.......................................................|pymode-credits|
9. License.......................................................|pymode-license|
===============================================================================
1. Intro ~
*pymode-intro*
XXX IMPORTANT: As of 2017年11月18日 python-mode is going through a major redesign.
Thus some of its functionality may not work as expected. Please be patient and
do report bugs or inconsistencies in its documentation. But remember to look
for already openned bug reports for the same issue before creating a new one.
Python-mode is a vim plugin that allows you to use the pylint, rope, and pydoc
libraries in vim to provide features like python code bug checking,
refactoring, and some other useful things.
This plugin allows you to create python code in vim very easily. There is no
need to install the pylint or rope libraries on your system.
Python-mode contains all you need to develop python applications in Vim.
Features: *pymode-features*
- Support Python version 2.6+ and 3.2+
- Syntax highlighting
- Virtualenv support
- Run python code (``<leader>r``)
- Add/remove breakpoints (``<leader>b``)
- Improved Python indentation
- Python folding
- Python motions and operators (``]]``, ``3[[``, ``]]M``, ``vaC``, ``viM``,
``daC``, ``ciM``, ...)
- Code checking (pylint_, pyflakes_, pylama_, ...) that can be run
simultaneously (``:PymodeLint``)
- Autofix PEP8 errors (``:PymodeLintAuto``)
- Search in python documentation (``K``)
- Code refactoring <rope refactoring library> (rope_)
- Strong code completion (rope_)
- Go to definition (``<C-c>g`` for `:RopeGotoDefinition`)
- And more, more ...
===============================================================================
2. Common functionality ~
*pymode-common*
This script provides the following options that can customizes the behavior of
python-mode. These options should be set in your |vimrc|.
Find below the default values:
Turn on the whole plugin. *'g:pymode'*
>
let g:pymode = 1
Turn off plugin's warnings. *'g:pymode_warnings'*
>
let g:pymode_warnings = 1
Add paths to `sys.path` *'g:pymode_paths'*
Value is list of path's strings.
>
let g:pymode_paths = []
Trim unused white spaces on save. *'g:pymode_trim_whitespaces'*
>
let g:pymode_trim_whitespaces = 1
Setup default python options. *'g:pymode_options'*
>
let g:pymode_options = 1
If this option is set to 1, pymode will enable the following options for
python buffers: >
setlocal complete+=t
setlocal formatoptions-=t
if v:version > 702 && !&relativenumber
setlocal number
endif
setlocal nowrap
setlocal textwidth=79
setlocal commentstring=#%s
setlocal define=^\s*\\(def\\\\|class\\)
Setup max line length *'g:pymode_options_max_line_length'*
>
let g:pymode_options_max_line_length = 79
Enable colorcolumn display at max_line_length. *'g:pymode_options_colorcolumn'*
>
let g:pymode_options_colorcolumn = 1
Setup pymode |quickfix| window.
*'g:pymode_quickfix_maxheight'* *'g:pymode_quickfix_minheight'*
>
let g:pymode_quickfix_minheight = 3
let g:pymode_quickfix_maxheight = 6
Set pymode |preview| window height. *'g:pymode_preview_height'*
Preview window is used to show documentation and ouput from |pymode-run|.
>
let g:pymode_preview_height = &previewheight
Set where pymode |preview| window will appear. *'g:pymode_preview_position'*
>
let g:pymode_preview_position = 'botright'
Value is command which can influcece where new window created by `:new` command
will appear, eg. `:botright`.
-------------------------------------------------------------------------------
2.1. Python version ~
*pymode-python-version*
By default pymode will attempt to use Python 3, if available. However, you can
also disable all Python features of pymode.
*'g:pymode_python'*
>
let g:pymode_python = 'python3'
Values are `python3`, `disable`. If value set to `disable` most
python-features of **pymode** will be disabled.
Set value to `python3` if you are working with python3 projects. You could use
|exrc|
-------------------------------------------------------------------------------
2.2 Python indentation ~
*pymode-indent*
Pymode supports PEP8-compatible python indent.
Enable pymode indentation *'g:pymode_indent'*
>
let g:pymode_indent = 1
-------------------------------------------------------------------------------
2.3 Python folding ~
*pymode-folding*
Enable pymode folding *'g:pymode_folding'*
>
let g:pymode_folding = 0
Currently folding is considered experimental. There are several issues with
its implementation.
-------------------------------------------------------------------------------
2.4 Vim motion ~
*pymode-motion*
Support Vim motion (See |operator|) for python objects (such as functions,
class and methods).
`C` — means class
`M` — means method or function
*pymode-motion-keys*
==== ============================
Key Command
==== ============================
[[ Jump to previous class or function (normal, visual, operator modes)
]] Jump to next class or function (normal, visual, operator modes)
[M Jump to previous class or method (normal, visual, operator modes)
]M Jump to next class or method (normal, visual, operator modes)
aC Select a class. Ex: vaC, daC, yaC, caC (normal, operator modes)
iC Select inner class. Ex: viC, diC, yiC, ciC (normal, operator modes)
aM Select a function or method. Ex: vaM, daM, yaM, caM (normal, operator modes)
iM Select inner function or method. Ex: viM, diM, yiM, ciM (normal, operator modes)
==== ============================
Enable pymode-motion *'g:pymode_motion'*
>
let g:pymode_motion = 1
-------------------------------------------------------------------------------
2.5 Show documentation ~
*pymode-documentation*
Pymode could show documentation for current word by `pydoc`.
Commands:
*:PymodeDoc* <args> — show documentation
Turns on the documentation script *'g:pymode_doc'*
>
let g:pymode_doc = 1
Bind keys to show documentation for current word (selection)
*'g:pymode_doc_bind'*
>
let g:pymode_doc_bind = 'K'
-------------------------------------------------------------------------------
2.6 Support virtualenv ~
*pymode-virtualenv*
Commands:
*:PymodeVirtualenv* <path> -- Activate virtualenv (path can be absolute or
relative to current working directory)
Enable automatic virtualenv detection *'g:pymode_virtualenv'*
>
let g:pymode_virtualenv = 1
Set path to virtualenv manually *'g:pymode_virtualenv_path'*
>
let g:pymode_virtualenv_path = $VIRTUAL_ENV
-------------------------------------------------------------------------------
2.7 Run code ~
*pymode-run*
Commands:
*:PymodeRun* -- Run current buffer or selection
Turn on the run code script *'g:pymode_run'*
>
let g:pymode_run = 1
Binds keys to run python code *'g:pymode_run_bind'*
>
let g:pymode_run_bind = '<leader>r'
-------------------------------------------------------------------------------
2.8 Breakpoints ~
*pymode-breakpoints*
Pymode automatically detects available debugger (like pdb, ipdb, pudb) and user
can set/unset breakpoint with one key and without code checking and etc.
Enable functionality *'g:pymode_breakpoint'*
>
let g:pymode_breakpoint = 1
Bind keys
>
let g:pymode_breakpoint_bind = '<leader>b'
Manually set breakpoint command (leave empty for automatic detection)
>
let g:pymode_breakpoint_cmd = ''
===============================================================================
3. Code checking ~
*pymode-lint*
Pymode supports `pylint`, `pep257`, `pep8`, `pyflakes`, `mccabe` code
checkers. You could run several similar checkers.
Pymode uses Pylama library for code checking. Many options like skip
files, errors and etc could be defined in `pylama.ini` file or modelines.
Check Pylama documentation for details.
Pylint options (ex. disable messages) may be defined in `$HOME/pylint.rc`
See pylint documentation.
Commands:
*:PymodeLint* -- Check code in current buffer
*:PymodeLintToggle* -- Toggle code checking
*:PymodeLintAuto* -- Fix PEP8 errors in current buffer automatically
Turn on code checking *'g:pymode_lint'*
>
let g:pymode_lint = 1
Check code on every save (if file has been modified) *'g:pymode_lint_on_write'*
>
let g:pymode_lint_on_write = 1
Check code on every save (every) *'g:pymode_lint_unmodified'*
>
let g:pymode_lint_unmodified = 0
Check code when editing (on the fly) *'g:pymode_lint_on_fly'*
>
let g:pymode_lint_on_fly = 0
Show error message if cursor placed at the error line *'g:pymode_lint_message'*
>
let g:pymode_lint_message = 1
Default code checkers (you could set several) *'g:pymode_lint_checkers'*
>
let g:pymode_lint_checkers = ['pyflakes', 'pep8', 'mccabe']
Values may be chosen from: `pylint`, `pep8`, `mccabe`, `pep257`, `pyflakes`.
Skip errors and warnings *'g:pymode_lint_ignore'*
E.g. ["W", "E2"] (Skip all Warnings and the Errors starting with E2) etc.
>
let g:pymode_lint_ignore = ["E501", "W",]
Select some error or warnings. *'g:pymode_lint_select'*
By example you disable all warnings starting from 'W', but want to see warning
'W0011' and warning 'W430'
>
let g:pymode_lint_select = ["E501", "W0011", "W430"]
Sort errors by relevance *'g:pymode_lint_sort'*
If not empty, errors will be sort by defined relevance
E.g. let g:pymode_lint_sort = ['E', 'C', 'I'] " Errors first 'E',
after them 'C' and ...
>
let g:pymode_lint_sort = []
Auto open cwindow (quickfix) if any errors have been found
*'g:pymode_lint_cwindow'*
>
let g:pymode_lint_cwindow = 1
Place error |signs| *'g:pymode_signs'*
>
let g:pymode_lint_signs = 1
Definitions for |signs|
>
let g:pymode_lint_todo_symbol = 'WW'
let g:pymode_lint_comment_symbol = 'CC'
let g:pymode_lint_visual_symbol = 'RR'
let g:pymode_lint_error_symbol = 'EE'
let g:pymode_lint_info_symbol = 'II'
let g:pymode_lint_pyflakes_symbol = 'FF'
-------------------------------------------------------------------------------
3.1 Set code checkers options ~
*pymode-lint-options*
Pymode has the ability to set code checkers options from pymode variables:
Set PEP8 options *'g:pymode_lint_options_pep8'*
>
let g:pymode_lint_options_pep8 =
\ {'max_line_length': g:pymode_options_max_line_length}
See https://pep8.readthedocs.org/en/1.4.6/intro.html#configuration for more
info.
Set Pyflakes options *'g:pymode_lint_options_pyflakes'*
>
let g:pymode_lint_options_pyflakes = { 'builtins': '_' }
Set mccabe options *'g:pymode_lint_options_mccabe'*
>
let g:pymode_lint_options_mccabe = { 'complexity': 12 }
Set pep257 options *'g:pymode_lint_options_pep257'*
>
let g:pymode_lint_options_pep257 = {}
Set pylint options *'g:pymode_lint_options_pylint'*
>
let g:pymode_lint_options_pylint =
\ {'max-line-length': g:pymode_options_max_line_length}
See http://docs.pylint.org/features.html#options for more info.
===============================================================================
4. Rope support ~
*pymode-rope*
Pymode supports Rope refactoring operations, code completion and code assists.
Commands:
|:PymodeRopeAutoImport| -- Resolve import for element under cursor
|:PymodeRopeModuleToPackage| -- Convert current module to package
|:PymodeRopeNewProject| -- Open new Rope project in current working directory
|:PymodeRopeRedo| -- Redo changes from last refactoring
|:PymodeRopeRegenerate| -- Regenerate the project cache
|:PymodeRopeRenameModule| -- Rename current module
|:PymodeRopeUndo| -- Undo changes from last refactoring
Turn on the rope script *'g:pymode_rope'*
>
let g:pymode_rope = 1
.ropeproject Folder ~
*.ropeproject*
*:PymodeRopeNewProject* [<path>] -- Open new Rope project in the given path
*:PymodeRopeRegenerate* -- Regenerate the project cache
Rope uses a folder inside projects for holding project configuration and data.
Its default name is `.ropeproject`. It is recommended that you do not add the
.ropeproject folder to version control system.
Currently it is used for things such as:
* The config.py file in this folder contains project configuration. Have
a look at the default config.py file (which is created when it
does not exist) for more information.
* It can be used for saving project history, so that the next time you open the
project you can undo past changes.
* It can be used to save information about object inferences.
* It can be used to save a global name cache, which is used for auto-import.
By default, if `.ropeproject` is not found in the current directory, rope will
look recursively for it in parent folders.
Warning: If rope finds `.ropeproject` in a parent dir, it will use it with
all its child directories, which may slow scanning down (because of many,
possibly unrelated, files)
Enable searching for |.ropeproject| in parent directories
*'g:pymode_rope_lookup_project'*
>
let g:pymode_rope_lookup_project = 0
You can also manually set the rope project directory. If not specified rope will
use the current directory.
*'g:pymode_rope_project_root'*
>
let g:pymode_rope_project_root = ""
The location of the `.ropeproject` folder may also be overridden if you wish to
keep it outside of your project root. The rope library treats this folder as a
project resource, so the path will always be relative to your project root (a
leading '/' will be ignored). You may use `'..'` path segments to place the
folder outside of your project root.
*'g:pymode_rope_ropefolder'*
>
let g:pymode_rope_ropefolder='.ropeproject'
Show documentation for element under cursor ~
Show documentation for object under cursor. *'g:pymode_rope_show_doc_bind'*
Leave empty to disable the key binding.
>
let g:pymode_rope_show_doc_bind = '<C-c>d'
Regenerate project cache on every save (if file has been modified)
>
let g:pymode_rope_regenerate_on_write = 1
-------------------------------------------------------------------------------
4.1 Completion ~
*pymode-completion*
By default you can use <Ctrl-Space> for autocompletion. The first entry will
be automatically selected and you can press <Return> to insert the entry in
your code. <C-X><C-O> and <C-P>/<C-N> works too.
Autocompletion is also called by typing a period in |Insert| mode by default.
If there's only one complete item, vim may be inserting it automatically
instead of using a popup menu. If the complete item which inserted is not
your wanted, you can roll it back use '<c-w>' in |Insert| mode or setup
'completeopt' with `menuone` and `noinsert` in your vimrc. .e.g.
>
set completeopt=menuone,noinsert
Turn on code completion support in the plugin *'g:pymode_rope_completion'*
>
let g:pymode_rope_completion = 1
Turn on autocompletion when typing a period
*'g:pymode_rope_complete_on_dot'*
>
let g:pymode_rope_complete_on_dot = 1
Keymap for autocomplete *'g:pymode_rope_completion_bind'*
>
let g:pymode_rope_completion_bind = '<C-Space>'
Extended autocompletion (rope could complete objects which have not been
imported) from project *'g:pymode_rope_autoimport'*
>
let g:pymode_rope_autoimport = 0
Load modules to autoimport by default *'g:pymode_rope_autoimport_modules'*
>
let g:pymode_rope_autoimport_modules = ['os', 'shutil', 'datetime']
Offer to unresolved import object after completion.
>
let g:pymode_rope_autoimport_import_after_complete = 0
-------------------------------------------------------------------------------
4.2 Find definition ~
*pymode-rope-findit*
By default when you press *<C-C>g* on any object in your code you will be moved
to definition.
Leave empty for disable key binding. *'g:pymode_rope_goto_definition_bind'*
>
let g:pymode_rope_goto_definition_bind = '<C-c>g'
Command for open window when definition has been found
Values are (`e`, `new`, `vnew`) *'g:pymode_rope_goto_definition_cmd'*
>
let g:pymode_rope_goto_definition_cmd = 'new'
-------------------------------------------------------------------------------
4.3 Refactoring ~
*pymode-rope-refactoring*
Rename method/function/class/variable in the project ~
Pymode can rename everything: classes, functions, modules, packages, methods,
variables and keyword arguments.
Keymap for rename method/function/class/variables under cursor
*'g:pymode_rope_rename_bind'*
>
let g:pymode_rope_rename_bind = '<C-c>rr'
Rename a current module/package ~
*:PymodeRopeRenameModule* -- Rename current module
Keymap for rename current module *'g:pymode_rope_rename_module_bind'*
>
let g:pymode_rope_rename_module_bind = '<C-c>r1r'
Imports ~
*:PymodeRopeAutoImport* -- Resolve import for element under cursor
Organize imports sorts imports, too. It does that according to PEP8. Unused
imports will be dropped.
Keymap *'g:pymode_rope_organize_imports_bind'*
>
let g:pymode_rope_organize_imports_bind = '<C-c>ro'
Insert import for current word under cursor *'g:pymode_rope_autoimport_bind'*
Should be enabled |'g:pymode_rope_autoimport'|
>
let g:pymode_rope_autoimport_bind = '<C-c>ra'
Convert module to package ~
*'g:pymode_rope_module_to_package_bind'*
*:PymodeRopeModuleToPackage* -- convert current module to package
Keybinding:
>
let g:pymode_rope_module_to_package_bind = '<C-c>r1p'
Extract method/variable ~
*pymode-rope-extract*
Extract method/variable from selected lines.
*'g:pymode_rope_extract_method_bind'*
*'g:pymode_rope_extract_variable_bind'*
>
let g:pymode_rope_extract_method_bind = '<C-c>rm'
let g:pymode_rope_extract_variable_bind = '<C-c>rl'
Use function ~
*pymode-rope-use*
It tries to find the places in which a function can be used and changes the
code to call it instead.
>
let g:pymode_rope_use_function_bind = '<C-c>ru'
Move method/fields ~
*pymode-rope-move*
It happens when you perform move refactoring on a method of a class. In this
refactoring, a method of a class is moved to the class of one of its
attributes. The old method will call the new method. If you want to change all
of the occurrences of the old method to use the new method you can inline it
afterwards.
>
let g:pymode_rope_move_bind = '<C-c>rv'
Change function signature ~
>
let g:pymode_rope_change_signature_bind = '<C-c>rs'
-------------------------------------------------------------------------------
4.4 Undo/Redo changes ~
*pymode-rope-undo*
*pymode-rope-redo*
Commands:
*:PymodeRopeUndo* -- Undo last changes in the project
*:PymodeRopeRedo* -- Redo last changes in the project
===============================================================================
5. Syntax ~
*pymode-syntax*
Turn on pymode syntax *'g:pymode_syntax'*
>
let g:pymode_syntax = 1
Slower syntax synchronization that is better at handling code blocks in
docstrings. Consider disabling this on slower hardware.
*'g:pymode_syntax_slow_sync'*
>
let g:pymode_syntax_slow_sync = 1
Enable all python highlights *'g:pymode_syntax_all'*
>
let g:pymode_syntax_all = 1
Highlight "print" as a function *'g:pymode_syntax_print_as_function'*
>
let g:pymode_syntax_print_as_function = 0
Highlight "async/await" keywords *'g:pymode_syntax_highlight_async_await'*
>
let g:pymode_syntax_highlight_async_await = g:pymode_syntax_all
Highlight '=' operator *'g:pymode_syntax_highlight_equal_operator'*
>
let g:pymode_syntax_highlight_equal_operator = g:pymode_syntax_all
Highlight '*' operator *'g:pymode_syntax_highlight_stars_operator'*
>
let g:pymode_syntax_highlight_stars_operator = g:pymode_syntax_all
Highlight 'self' keyword *'g:pymode_syntax_highlight_self'*
>
let g:pymode_syntax_highlight_self = g:pymode_syntax_all
Highlight indent's errors *'g:pymode_syntax_indent_errors'*
>
let g:pymode_syntax_indent_errors = g:pymode_syntax_all
Highlight space's errors *'g:pymode_syntax_space_errors'*
>
let g:pymode_syntax_space_errors = g:pymode_syntax_all
Highlight string formatting *'g:pymode_syntax_string_formatting'*
*'g:pymode_syntax_string_format'*
*'g:pymode_syntax_string_templates'*
*'g:pymode_syntax_doctests'*
>
let g:pymode_syntax_string_formatting = g:pymode_syntax_all
let g:pymode_syntax_string_format = g:pymode_syntax_all
let g:pymode_syntax_string_templates = g:pymode_syntax_all
let g:pymode_syntax_doctests = g:pymode_syntax_all
Highlight builtin objects (True, False, ...) *'g:pymode_syntax_builtin_objs'*
>
let g:pymode_syntax_builtin_objs = g:pymode_syntax_all
Highlight builtin types (str, list, ...) *'g:pymode_syntax_builtin_types'*
>
let g:pymode_syntax_builtin_types = g:pymode_syntax_all
Highlight exceptions (TypeError, ValueError, ...)
*'g:pymode_syntax_highlight_exceptions'*
>
let g:pymode_syntax_highlight_exceptions = g:pymode_syntax_all
Highlight docstrings as pythonDocstring (otherwise as pythonString)
*'g:pymode_syntax_docstrings'*
>
let g:pymode_syntax_docstrings = g:pymode_syntax_all
===============================================================================
6. FAQ ~
*pymode-faq*
1. Python-mode doesn't work
---------------------------
First remember to get the latest and updated version of the project source
code and also update the project submodules.
Clear all python cache/compiled files (`*.pyc` files and `__pycache__`
directory and everything under it). In Linux/Unix/MacOS you can run:
`find . -type f -name '*.pyc' -delete && find . -type d -name '__pycache__' -delete`
Then start python mode with:
`vim -i NONE -u <path_to_pymode>/debugvimrc.vim`
Reproduce the error and submit your python mode debug file. You can check its
location with `:messages` for something like:
`pymode debug msg 1: Starting debug on: 2017年11月18日 16:44:13 with file /tmp/pymode_debug_file.txt`
Please submit the entire content of the file along with a reasoning of why the
plugin seems broken.
*Underlined do check for sensitive information in the file before
*Underlined submitting!
2. Rope completion is very slow *pymode-rope-slow*
-------------------------------
Rope creates a project-level service directory in |.ropeproject|
If ``.ropeproject`` is not found in the current directory, rope will walk
upwards looking for a ``.ropeproject`` in every dir of the parent path. If
rope finds ``.ropeproject`` in a parent dir, it sets the project for all child
dirs and the scan may be slow for so many dirs and files.
Solutions:
- Delete `.ropeproject` from the parent dir to make rope create `.ropeproject`
in the current dir.
- Run ``:PymodeRopeNewProject`` to make rope create ``.ropeproject`` in the
current dir.
- Set |'g:pymode_rope_lookup_project'| to 0 for prevent searching in parent
dirs.
You may also set |'g:pymode_rope_project_root'| to manually specify the project
root path.
3. Pylint check is very slow
----------------------------
In some projects pylint may check slowly, because it also scans imported
modules if possible. Try using another code checker: see
|'g:pymode_lint_checkers'|.
You may set |exrc| and |secure| in your |vimrc| to auto-set custom settings
from `.vimrc` from your projects directories.
4. OSX cannot import urandom
----------------------------
See: https://groups.google.com/forum/?fromgroups=#!topic/vim_dev/2NXKF6kDONo
The sequence of commands that fixed this:
>
brew unlink python
brew unlink macvim
brew remove macvim
brew install -v --force macvim
brew link macvim
brew link python
5. Folding is slow
------------------
Python mode adds folding for definitions and multi line docstrings. These may
be costly to compute on large files. To disable them one simple has to to add:
let g:pymode_folding = 1
to their vimrc file.
Beware that when editing python files in multiple windows vim computes the
folding for every typed character. Thus it may be useful to define:
augroup unset_folding_in_insert_mode
autocmd!
autocmd InsertEnter *.py setlocal foldmethod=marker
autocmd InsertLeave *.py setlocal foldmethod=expr
augroup END
===============================================================================
7. Development~
*pymode-development*
This section briefly defines development guidelines for python-mode.
1. This help file uses vim's conventions defined at |help-writing|.
2. The name of the plugin shall be referred to as 'python-mode' throughout
documentation (except as a first word in a sentence in which case is
'Python-mode').
3. All defined functions should use vim's conventions and start with 'Pymode'.
4. Special marks for project development are `XXX` and `TODO`. They provide a
easy way for developers to check pending issues.
5. If submitting a pull request then a test should be added which smartly
covers the found bug/new feature. Check out the `tests/test.sh` (1) file and
other executed files.
A suggested structure is the following: add your test to
`tests/test_bash` (2) and a vim script to be sourced at
`tests/test_procedures_vimscript` (3). Try to make use of the already existing
files at `tests/test_python_sample_code` (4). File (1) should be trigger the
newly added file (2). This latter file should invoke vim which in turn sources
file (3). File (3) may then read (4) as a first part of its assertion
structure and then execute the remaning of the instructions/assertions.
===============================================================================
8. Credits ~
*pymode-credits*
Kirill Klenov
http://klen.github.com/
http://github.com/klen/
Rope
Copyright (C) 2006-2010 Ali Gholami Rudi
Copyright (C) 2009-2010 Anton Gritsay
Pylint
Copyright (C) 2003-2011 LOGILAB S.A. (Paris, FRANCE).
http://www.logilab.fr/
Pyflakes:
Copyright (c) 2005-2011 Divmod, Inc.
Copyright (c) 2013-2014 Florent Xicluna
https://github.com/PyCQA/pyflakes
PEP8:
Copyright (c) 2006 Johann C. Rocholl <johann@rocholl.net>
http://github.com/jcrocholl/pep8
autopep8:
Copyright (c) 2012 hhatto <hhatto.jp@gmail.com>
https://github.com/hhatto/autopep8
Python syntax for vim:
Copyright (c) 2010 Dmitry Vasiliev
http://www.hlabs.spb.ru/vim/python.vim
PEP8 VIM indentation
Copyright (c) 2012 Hynek Schlawack <hs@ox.cx>
http://github.com/hynek/vim-python-pep8-indent
===============================================================================
9. License ~
*pymode-license*
Python-mode is released under the GNU lesser general public license.
See: http://www.gnu.org/copyleft/lesser.html
If you like this plugin, I would very appreciated if you kindly send me a
postcard :)
My address is: "Russia, 143500, MO, Istra, pos. Severny 8-3" to "Kirill
Klenov". Thanks for your support!
-------------------------------------------------------------------------------
vim:tw=79:ts=8:ft=help:norl:
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/killf/python-mode.git
git@gitee.com:killf/python-mode.git
killf
python-mode
python-mode
develop
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /