1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:00:04 +08:00

Update python doc (#4154)

This commit is contained in:
Wang Shidong 2021-03-31 21:35:26 +08:00 committed by GitHub
parent 4407b7c8af
commit 50c7c3bebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 14 deletions

View File

@ -20,7 +20,7 @@ if exists('s:enabled_linters')
finish
endif
let s:enabled_linters = ['python', 'flake8']
let s:enabled_linters = ['python']
let s:format_on_save = 0
let s:python_file_head = [
\ '#!/usr/bin/env python',

View File

@ -108,19 +108,21 @@ pip install --user coverage
## 模块设置
默认情况下,当新建一个空白 python 文件时,会自动添加文件头,如果需要修改默认的文件头样式,
可以通过设置 `python_file_head` 选项:
- `python_file_head`: 设置默认的 Python 文件头信息模板。
```toml
[[layers]]
name = "lang#python"
python_file_head = [
'#!/usr/bin/env python',
'# -*- coding: utf-8 -*-',
'',
''
]
```
默认情况下,当新建一个空白 python 文件时,会自动添加文件头,如果需要修改默认的文件头样式,
可以通过设置 `python_file_head` 选项:
```toml
[[layers]]
name = "lang#python"
python_file_head = [
'#!/usr/bin/env python',
'# -*- coding: utf-8 -*-',
'',
''
]
```
默认自动补全是不显示类型信息,因为这会让补全变得比较慢,如果需要显示,可以启用 `enable_typeinfo` 选项:
@ -130,6 +132,30 @@ pip install --user coverage
enable_typeinfo = true
```
- `format_on_save`: 启用或者禁用文件保存时的自动格式化,默认为禁用状态,
若想启用这一功能,可以使用如下配置:
```toml
[[layers]]
name = 'lang#python'
format_on_save = true
```
- `python_interpreter`: 设置 python 的可执行命令路劲,默认值为 `python3`,该选项的值将被应用于
`g:neomake_python_python_exe` 和代码快速运行器。
```toml
[[layers]]
name = 'lang#python'
python_interpreter = 'D:\scoop\shims\python.exe'
```
- `python_linters`: 设置 python 语言默认的语法检查工具,默认是 `['python']`,你也可以修改该选项为
`['python', 'pylint']`
```toml
[[layers]]
name = 'lang#python'
enabled_linters = ['python', 'pylint']
```
## 快捷键
### 跳至定义处

View File

@ -134,7 +134,7 @@ you need to add following snippet into your spacevim configuration file.
format_on_save = true
```
* `python_interpreter`: Set the python interpreter, by default, it is `python3`. The value of this option will
- `python_interpreter`: Set the python interpreter, by default, it is `python3`. The value of this option will
be apply to `g:neomake_python_python_exe` and code runner.
```toml
[[layers]]
@ -142,6 +142,14 @@ you need to add following snippet into your spacevim configuration file.
python_interpreter = 'D:\scoop\shims\python.exe'
```
- `python_linters`: Set the default linters for python language, by default it is `['python']`. You can change
it to `['python', 'pylint']`.
```toml
[[layers]]
name = 'lang#python'
enabled_linters = ['python', 'pylint']
```
## Key bindings
### Jump to definition