Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/en/chunk.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ local default_conf = {
textobject = "",
max_file_size = 1024 * 1024,
error_sign = true,
straight = false,
-- animation related
duration = 200,
delay = 300,
}
```

The unique configuration options are `use_treesitter`, `chars`, `textobject`, `max_file_size`, `error_sign`, `duration` and `delay`
The unique configuration options are `use_treesitter`, `chars`, `textobject`, `max_file_size`, `error_sign`, `duration`, `delay` and `straight`

- `use_treesitter` is used to control whether to use treesitter to highlight code blocks. The default is true.
If this field is set to true, it finds the matching node type by searching the tree nodes from bottom to top to obtain the corresponding chunk range. If set to false, it will use Vim's `searchpair` to find the nearest braces to infer the position (which is why it cannot be used normally in scripting languages like Python). And after `v1.2.1`, it's no longer recommended to use `treesitter` to get indent.
Expand Down Expand Up @@ -62,6 +63,8 @@ The unique configuration options are `use_treesitter`, `chars`, `textobject`, `m

- `delay` is a number, with a default of `300` ms. It is used to control the delay of the animation. If set to `0`, animation will be removed.

- `straight` is a boolean value, which is false by default. When set to true, the chunk is rendered as a straight vertical line aligned to the block's indentation level, without the curved top (`╭─`) and bottom (`╰─>`) connectors. This gives a simpler, indent-guide-like appearance.

For the general configurations (mentioned in the [README](../../README.md)), only a few need special attention:

- `style` is a string or a Lua table. If it is a string, it must be a hexadecimal RGB string. If it is a table, it accepts one or two strings representing hexadecimal colors. If table only contain one item, only one color will be used to render the chunk. If there are two, the first color will be used to render the normal chunk, and the second color will be used to render the erroneous chunk.
Expand Down
5 changes: 4 additions & 1 deletion docs/zh_CN/chunk.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ local default_conf = {
textobject = "",
max_file_size = 1024 * 1024,
error_sign = true,
straight = false,
-- 动画相关
duration = 200,
delay = 300,
}
```

独有的配置项为 `use_treesitter`,`chars`,`textobject`,`max_file_size`,`error_sign`,`duration`,`delay`
独有的配置项为 `use_treesitter`,`chars`,`textobject`,`max_file_size`,`error_sign`,`duration`,`delay`,`straight`

- `use_treesitter` 是用来控制是否使用 treesitter 来高亮代码块,默认为 true。
如果该项被设置为 true,他是通过自底向上的查找树的节点,直至找到匹配的节点类型,以此获取相应的 chunk 范围的。而如果设置为 false,将使用 vim 的 `searchpair` 来查找最近的相邻大括号来推断位置(也因此导致 Python 等脚本语言无法正常使用该 mod)
Expand Down Expand Up @@ -62,6 +63,8 @@ local default_conf = {

- `delay` 从移动光标到动画开始间隔的时间,以毫秒为单位,默认 300 ms,设置为 0 可以取消动画效果

- `straight` 是一个布尔值,默认为 false。当设置为 true 时,chunk 将以对齐到代码块缩进层级的垂直直线渲染,省去顶部(`╭─`)和底部(`╰─>`)的弯折连接符,呈现出类似缩进参考线的简洁样式。

对于通用的配置(在 [README](../../README.zh-CN.md) 中有提到),仅有部分需要特别注意:

- `style` 是一个字符串或者 Lua 表。如果是字符串,必须是一个 RGB 十六进制字符串。如果是一个表,接收一到两个表示十六进制颜色的字符串,如果只有一个颜色,那么只会使用一个颜色来渲染 chunk,如果有两个颜色,那么会使用两个颜色来渲染 chunk,第一个颜色用来渲染正常的 chunk,第二个颜色用来渲染错误的 chunk。
Expand Down
2 changes: 1 addition & 1 deletion lua/hlchunk/mods/chunk/chunk_conf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ local ChunkConf = class(BaseConf, function(self, conf)
textobject = "",
max_file_size = 1024 * 1024,
error_sign = true,
straight = false,
duration = 200,
delay = 300,
straight = false,
}
conf = vim.tbl_deep_extend("force", default_conf, conf or {}) --[[@as HlChunk.ChunkConf]]
BaseConf.init(self, conf)
Expand Down
Loading