1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-14 15:19:12 +08:00

Add doc for code indentation (#3799)

This commit is contained in:
Wang Shidong 2020-09-10 22:23:54 +08:00 committed by GitHub
parent d9bc5a3dae
commit 8008b8389e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View File

@ -38,6 +38,7 @@ lang: zh
- [快捷键导航](#快捷键导航)
- [基本编辑操作](#基本编辑操作)
- [移动文本块](#移动文本块)
- [代码缩进](#代码缩进)
- [文本操作命令](#文本操作命令)
- [文本插入命令](#文本插入命令)
- [增加或减小数字](#增加或减小数字)
@ -877,6 +878,26 @@ call SpaceVim#custom#SPC('nnoremap', ['f', 't'], 'echom "hello world"', 'test cu
| `Ctrl-Shift-Up` | 向上移动选中行 |
| `Ctrl-Shift-Down` | 向下移动选中行 |
#### 代码缩进
默认的代码缩进值是 2缩进的大小由选项 `default_indent` 设置,
如果希望使用 4 个空格作为缩进,只需要在 SpaceVim 配置文件中加入如下内容:
```toml
[options]
default_indent = 4
```
`default_indent` 这一选项的值,将被赋值到 Vim 的选项:`&tabstop``&softtabstop`
`&shiftwidth`。默认情况下,输入的 `<Tab>` 会被自动展开成对应缩进数量的空格,
可通过设置选项 `expand_tab` 的值为 `false` 来禁用这一特性:
```toml
[options]
default_indent = 4
expand_tab = true
```
#### 文本操作命令
文本相关的命令 (以 `x` 开头)

View File

@ -36,6 +36,7 @@ description: "General documentation about how to using SpaceVim, including the q
- [Mappings guide](#mappings-guide)
- [Editing](#editing)
- [Moving text](#moving-text)
- [Code indentation](#code-indentation)
- [Text manipulation commands](#text-manipulation-commands)
- [Text insertion commands](#text-insertion-commands)
- [Increase/Decrease numbers](#increasedecrease-numbers)
@ -932,6 +933,27 @@ Then use `<Tab>` or `<Up>` and `<Down>` to select the mapping, press `<Enter>` t
| `Ctrl-Shift-Up` | move lines up |
| `Ctrl-Shift-Down` | move lines down |
#### Code indentation
The default indentation of code is 2, which is controlled by option `default_indent`.
If you prefer to use 4 as code indentation. Just add following snippet into SpaceVim
configuration file:
```toml
[options]
default_indent = 4
```
The `default_indent` option will be applied to vim's `&tabstop`, `&softtabstop` and
`&shiftwidth` options. By default, when user insert a `<Tab>`, it will be expanded
to spaces. This feature can be disabled by `expand_tab` option.
```toml
[options]
default_indent = 4
expand_tab = true
```
#### Text manipulation commands
Text related commands (start with `x`):