mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 17:50:04 +08:00
Update python layer documentation
This commit is contained in:
parent
074728103e
commit
03afa28116
@ -9,6 +9,16 @@ description: "This layer is for Python development, provide autocompletion, synt
|
||||
|
||||
- [Description](#description)
|
||||
- [Features](#features)
|
||||
- [Install](#install)
|
||||
- [Layer](#layer)
|
||||
- [Syntax Checking](#syntax-checking)
|
||||
- [Buffer formatting](#buffer-formatting)
|
||||
- [Format imports](#format-imports)
|
||||
- [Key bindings](#key-bindings)
|
||||
- [Inferior REPL process](#inferior-repl-process)
|
||||
- [Running current script](#running-current-script)
|
||||
- [Testing](#testing)
|
||||
- [Refactoring](#refactoring)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
@ -20,3 +30,63 @@ This layer is for Python development.
|
||||
|
||||
- Aoto-completion using [deoplete-jedi](https://github.com/zchee/deoplete-jedi) or [jedi-vim](https://github.com/davidhalter/jedi-vim)
|
||||
- Documentation Lookup using [jedi-vim](https://github.com/davidhalter/jedi-vim)
|
||||
|
||||
## Install
|
||||
|
||||
### Layer
|
||||
|
||||
To use this configuration layer, add `SPLayer 'lang#python'` to your custom configuration file.
|
||||
|
||||
### Syntax Checking
|
||||
|
||||
`checker` layer provide syntax checking feature, and for python it uses `flake8` package:
|
||||
|
||||
```sh
|
||||
pip install --user flake8
|
||||
```
|
||||
|
||||
### Buffer formatting
|
||||
|
||||
The default key binding for formatting buffer is `SPC b f`, and you need to install `yapf`. To enable automatic buffer formatting on save, load this layer with setting `format-on-save` to `1`.
|
||||
|
||||
```sh
|
||||
pip install --user yapf
|
||||
```
|
||||
|
||||
### Format imports
|
||||
|
||||
To be able to suppress unused imports easily, install [autoflake](https://github.com/myint/autoflake):
|
||||
|
||||
```sh
|
||||
pip install --user autoflake
|
||||
```
|
||||
|
||||
To be able to sort your imports, install [isort](https://github.com/timothycrosley/isort)
|
||||
|
||||
```sh
|
||||
pip install --user isort
|
||||
```
|
||||
|
||||
## Key bindings
|
||||
|
||||
### Inferior REPL process
|
||||
|
||||
Start a Python or iPython inferior REPL process with `SPC l s i`. If ipython is available in system executable search paths, ipython will be used to launch python shell; otherwise, default python interpreter will be used. You may change your system executable search path by activating a virtual environment.
|
||||
|
||||
Send code to inferior process commands:
|
||||
|
||||
| Key Binding | Description |
|
||||
| ----------- | ----------- |
|
||||
|
||||
### Running current script
|
||||
|
||||
To running a python script, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer.
|
||||
|
||||
### Testing
|
||||
|
||||
### Refactoring
|
||||
|
||||
| Key Binding | Description |
|
||||
| ----------- | ------------------------------------ |
|
||||
| `SPC l r i` | remove unused imports with autoflake |
|
||||
| `SPC l r I` | sort imports with isort |
|
||||
|
Loading…
Reference in New Issue
Block a user