Plastic SCM
非官方测试版翻译
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
功能
当处于 Plastic 仓库中时显示 Plastic SCM 信息,在子文件夹中同样有效。
为确保最佳兼容性,请保持 cm 可执行文件为最新版本(例如当分支或状态信息不正确时)。
示例配置
- json
- yaml
- toml
{
"type": "plastic",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#ffeb3b",
"background_templates": [
"{{ if .MergePending }}#006060{{ end }}",
"{{ if .Changed }}#FF9248{{ end }}",
"{{ if and .Changed .Behind }}#ff4500{{ end }}",
"{{ if .Behind }}#B388FF{{ end }}"
],
"template": "{{ .Selector }}{{ if .Status.Changed }} {{ end }}{{ .Status.String }}",
"options": {
"fetch_status": true
}
}
type: plastic
style: powerline
powerline_symbol:
foreground: "#193549"
background: "#ffeb3b"
background_templates:
- "{{ if .MergePending }}#006060{{ end }}"
- "{{ if .Changed }}#FF9248{{ end }}"
- "{{ if and .Changed .Behind }}#ff4500{{ end }}"
- "{{ if .Behind }}#B388FF{{ end }}"
template: "{{ .Selector }}{{ if .Status.Changed }} {{ end }}{{ .Status.String }}"
options:
fetch_status: true
type = "plastic"
style = "powerline"
powerline_symbol = ""
foreground = "#193549"
background = "#ffeb3b"
background_templates = [ "{{ if .MergePending }}#006060{{ end }}", "{{ if .Changed }}#FF9248{{ end }}", "{{ if and .Changed .Behind }}#ff4500{{ end }}", "{{ if .Behind }}#B388FF{{ end }}" ]
template = "{{ .Selector }}{{ if .Status.Changed }} {{ end }}{{ .Status.String }}"
[options]
fetch_status = true
Plastic SCM 图标
若想在提示段中使用 Plastic SCM 图标,请帮忙在这个 issue 点赞推动!
选项
信息获取
为避免多次 cm 调用拖慢提示响应速度,默认不主动获取信息。
可将以下属性设为 true 启用额外信息获取(并填充模板)。
| Name | Type | Default | Description |
|---|---|---|---|
fetch_status | boolean | false | fetch the local changes |
native_fallback | boolean | false | when set to true and cm.exe is not available when inside a WSL2 shared Windows drive, we will fallback to the native cm executable to fetch data. Not all information can be displayed in this case |
status_formats | map[string]string | a key, value map allowing to override how individual status items are displayed. For example, "status_formats": { "Added": "Added: %d" } will display the added count as Added: 1 instead of +1. See the Status section for available overrides |
图标设置
分支图标
| Name | Type | Default | Description |
|---|---|---|---|
branch_icon | string | \uE0A0 | the icon to use in front of the git branch name |
mapped_branches | object | custom glyph/text for specific branches. You can use * at the end as a wildcard character for matching | |
branch_template | string | a template to format that branch name. You can use {{ .Branch }} as reference to the original branch name |
选择器
| Name | Type | Default | Description |
|---|---|---|---|
commit_icon | string | \uF417 | icon/text to display before the commit context (detached HEAD) |
tag_icon | string | \uF412 | icon/text to display before the tag context |
模板 (信息)
默认模板
{{ .Selector }}
属性
| Name | Type | Description |
|---|---|---|
.Selector | string | the current selector context (branch/changeset/label) |
.Behind | bool | the current workspace is behind and changes are incoming |
.Status | Status | changes in the workspace (see below) |
.MergePending | bool | if a merge is pending and needs to be committed (known issue: when no file is left after a Change/Delete conflict merge, the MergePending property is not set) |
状态标识
| Name | Type | Description |
|---|---|---|
.Unmerged | int | number of unmerged changes |
.Deleted | int | number of deleted changes |
.Added | int | number of added changes |
.Modified | int | number of modified changes |
.Moved | int | number of moved changes |
.Changed | boolean | if the status contains changes or not |
.String | string | a string representation of the changes above |
本地变更使用以下语法表示:
| Icon | Description |
|---|---|
x | Unmerged |
- | Deleted |
+ | Added |
~ | Modified |
v | Moved |