spacevim/docs/cn/layers/checkers.md
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

83 lines
3.1 KiB
Markdown

---
title: "SpaceVim checkers 模块"
description: "这一模块为 SpaceVim 提供了代码语法检查的特性,同时提供代码实时检查,并列出语法错误的位置。"
lang: zh
---
# [可用模块](../) >> checkers
<!-- vim-markdown-toc GFM -->
- [模块描述](#模块描述)
- [启用模块](#启用模块)
- [模块配置](#模块配置)
- [快捷键](#快捷键)
<!-- vim-markdown-toc -->
## 模块描述
这一模块为 SpaceVim 提供了自动语法检查的特性,并且可设置为输入时实时检查。默认情况
下已经支持多种语言工具。
## 启用模块
可通过在配置文件内加入如下配置来启用该模块:
```toml
[[layers]]
name = "checkers"
```
## 模块配置
`checkers` 模块默认已经加载了,与该模块相关的选项有两种,一个是全局选项,一个是模块选项:
**全局选项:**
所有的 SpaceVim 全局选项需要写在`[options]`下方:
| 选项名称 | 默认值 | 功能描述 |
| ------------- | --------- | ---------------------- |
| `lint_engine` | `neomake` | 设置默认的语法检查插件 |
默认的语法检查插件是 `neomake`,你也可以设置成 `ale` 或者 `syntastic`
如果需要设置 neomake 选项,需要使用启动函数。在启动函数里面可以使用 vim 脚本。具体如何配置 neomake 可以阅读`:h neomake`。
**模块选项:**
默认情况下,语法错误将在当前行下方展示,如果需要禁用这个功能,可以将`show_cursor_error`模块选项设置成`false`。
| 选项名称 | 默认值 | 功能描述 |
| ----------------------- | ------- | ---------------------------------------- |
| `lint_on_the_fly` | `false` | 设置语法实时检查,默认已禁用 |
| `lint_on_save` | `true` | 设置保存文件时进行语法检查,默认已启用 |
| `show_cursor_error` | `true` | 设置在当前行下方展示语法错误,默认已启用 |
| `lint_exclude_filetype` | `[]` | 设置禁用语法检查的文件类型列表 |
| `open_error_list` | `1/2/0` | 设置语法检查结果窗口打开方式,默认为 2 |
```toml
[[layers]]
name = "checkers"
show_cursor_error = false
```
## 快捷键
| 快捷键 | 功能描述 |
| --------- | ------------------------------- |
| `SPC e .` | 打开错误临时快捷键菜单 |
| `SPC e c` | 清除错误列表 |
| `SPC e h` | 描述当前检查工具 |
| `SPC e n` | 跳至下一个语法错误位置 |
| `SPC e N` | 跳至上一个语法错误位置 |
| `SPC e p` | 跳至上一个语法错误位置 |
| `SPC e l` | 列出错误列表窗口 |
| `SPC e L` | 列出错误列表窗口并跳至该窗口 |
| `SPC e e` | 解释光标处的语法错误 |
| `SPC e s` | 设置语法检查工具 (TODO) |
| `SPC e S` | 设置语法检查工具执行命令 (TODO) |
| `SPC e v` | 确认语法检查工具启动状态 |
| `SPC t s` | 临时启用/禁用语法检查 |