Python PEP8 Indent
Plugin for Sublime Text 2 to properly indent Python code
Details
Installs
- Total 498
- Win 226
- Mac 162
- Linux 110
Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Python PEP 8 Indent
Sublime text 2 extension to add automatic python indentation, with compliance to PEP8.
Features
New lines are indented properly, depending on the previous line. Continuation lines are handled, as “end of block” keywords ('return', 'pass', …).
On new block keywords ('elif', 'else', 'except', …), the indent is aligned with the proper previous block.
The file 'example.py' were typed without pressing the tab
or backspace
key.
Caveat
PythonPEP8Indent works only with space indent, no tab indent.
Requirement
This plugin has no requirement beside sublime text 2. Sublime text 3 is currently not supported.
Install
Manual installation
Copy this directory into your sublime text package directory.
If you use the vintage mode, see “Settings”.
Settings
Use with vintage mode
Add the following lines to your keymap file, to remap the “new line” command:
{ "keys": ["o"], "command": "enter_insert_mode", "args":
{"insert_command": "new_python_line", "insert_args":{"full_line":true}},
"context": [{"key": "setting.command_mode", "match_all":true},
{"key":"selector", "operator":"equal",
"operand":"source.python", "match_all":true}]
},
{ "keys": ["O"], "command": "enter_insert_mode", "args":
{"insert_command": "new_python_line", "insert_args":{"full_line":true, "forward":false}},
"context": [{"key": "setting.command_mode"},
{"key":"selector", "operator":"equal", "operand":"source.python"}]
}
Testing
Requirement
The test script requires the python libraries pytest and mock.
They can be installed through pip
or easy_install
.
$ pip install -U pytest
$ pip install -U mock
$ easy_install -U pytest
$ easy_install -U mock
Execution
$ cd python_PEP8_indent
$ py.test
Bug reports & Contributions
Bug reports and contributions are welcome. PythonPEP8Indent is hosted on github.
License
Copyright © 2013 Bruno Perriot bperriot@gmail.com
This sublime text plugin is released under the terms of the MIT license.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.