据纪录片中,powerline
使用~/.config/powerline/config.json
的配置。由于我不太喜欢$PS1
默认的布局,因此我对关键字cwd
做了如下更改。但是,自定义未应用。我做错什么了吗?通常,如何在中自定义细分powerline
?
{
"powerline":{
"segments":{
"shell":{
"cwd":{
"dir_shorten_len": 4,
"dir_limit_depth": 3
}
}
}
}
}
您需要修改其中的一个主题配置文件config-directory/themes/
(大概~/.config/powerline/themes/
在您的系统上)
一种方法是将这样的东西放进去 config-directory/themes/shell/__main__.json
{
"segment_data": {
"cwd": {
"args": {
"dir_shorten_len": 4,
"dir_limit_depth": 3
}
}
}
}
cwd
当从shell
扩展名中调用时,这将设置函数的默认参数,但是您仍然可以在主题配置文件中使用其他参数覆盖。
例如config-directory/themes/shell/default.json
:
{
"segments": {
"left": [
...other-segments...
{
"function": "powerline.segments.shell.cwd",
"priority": 10,
"args": {
"dir_shorten_len": 1,
"dir_limit_depth": 5
}
}
],
"right": [
...right-segments...
]
}
}
此外,除此以外powerline.segments.shell.cwd
,还有更一般的内容powerline.segments.common.env.cwd
。对于该功能,您可以将默认的args放入config-directory/themes/powerline.json
其中,这不仅会影响shell
扩展名,还会影响使用的其他参数powerline.segments.common.env.cwd
。
请注意,调用powerline.segments.shell.cwd
仍然遵循powerline.segments.common.env.cwd
默认args,除非在更具体的地方进行了覆盖。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句