@@ -8,46 +8,127 @@ xontrib-powerline fork by [santagada/xontrib-powerline](https://github.com/santa
88# Install
99
1010```
11- pip install git+https://github.com/6syun9/ xontrib-powerline2
11+ pip install xontrib-powerline2
1212```
1313
1414And them load it on your `` .xonshrc ``
1515
1616```
17- xontrib load powerline
17+ xontrib load powerline2
1818```
1919
2020
2121# Configuration
2222
23- There are two variables that can be set, `` PL_PROMPT `` for the right prompt and `` PL_TOOLBAR `` for the bottom toolbar.
23+ There are two variables that can be set, `` $PROMPT `` for main prompt, `` $ PL_PROMPT`` for the right prompt and `` $ PL_TOOLBAR`` for the bottom toolbar.
2424They contain a list of sections that can be used separated by `` > `` . The value `` ! `` means not to use that prompt.
2525
2626Examples:
2727
2828```
29+ $PL_PROMPT='cwd>branch'
30+ $PL_RPROMPT = '!' # for no toolbar
2931$PL_TOOLBAR = 'who>virtualenv>branch>cwd>full_proc'
30- $PL_TOOLBAR = '!' # for no toolbar
3132xontrib load powerline
3233```
3334
34- To see all available sections type `` pl_available_sections `` , and to commit changes to your prompt execute `` pl_build_prompt `` .
35+ ## Bulid prompt
3536
36- # Customize
37+ If you want to override the settings after ` xontrib load ` , so commit changes to your prompt execute `` pl_build_prompt `` command.
3738
38- - customize color: $PL_COLORS
39- - customize origin section: $PL_EXTRA_SEC
39+ ## Check config
4040
41- Examples:
41+ To see all available sections type `` pl_available_sections `` command.
42+
43+ <img src =" https://github.com/6syun9/xontrib-powerline2/raw/master/img/example_available.png " alt =" example " title =" example_available " >
44+
45+ ## Default sections
46+
47+ | section| description|
48+ | ---| ---|
49+ | who| {user}@{hostname} |
50+ | virtualenv| {env_name} |
51+ | branch| {curr_branch} |
52+ | cwd| $pwd using $pl_colors[ 'cwd', 'git_root', 'git_sub_dir'] and $pl_parts |
53+ | short_cwd| {short_cwd} |
54+ | full_proc| run time of the previous command from history |
55+ | timing| diff from previous command's executed time |
56+ | time| strftime(' %h:%m ') |
57+ | history| len(\_\_ xonsh\_\_ .history) |
58+ | rtns| '!' if \_\_ xonsh\_\_ .history.rtns else none |
59+ | full_rtns| rtns[ -1] if \_\_ xonsh\_\_ .history.rtns else none |
60+
61+
62+ If you want to know about ` {} ` sections, please look [ xonsh document] ( https://xon.sh/tutorial.html#customizing-the-prompt ) .
4263
64+
65+ ## Custom sections
66+
67+ We can add customize origin section by ` $PL_EXTRA_SEC ` .
4368```
44- $PL_COLORS = {"cwd": ("BLACK", "#a6e22e")}
45- $PL_EXTRA_SEC = {"user": lambda: [' {user} ', 'BLACK', '#fd971f']}
69+ # func return [format string, text color, background color]
70+ $PL_EXTRA_SEC = {"user": lambda: [' I'm {user} ', 'BLACK', '#fd971f']}
4671$PL_PROMPT='user>cwd>branch'
4772$PL_TOOLBAR='!'
4873$PL_RPROMPT='!'
4974xontrib load powerline
5075```
76+ <img src =" https://github.com/6syun9/xontrib-powerline2/raw/master/img/example_custom_sec.png " alt =" example " title =" custom_sec " >
77+
78+
79+ ## Section's color
80+
81+ We can change section color by ` $PL_COLORS ` .
82+
83+ ` $PL_COLORS ` is ` dict ` . Basically, the value is ` (text_color, background_color) ` .
84+ | key| default value| description|
85+ | ---| ---| ---|
86+ | who| ("BLACK", "#a6e22e") ||
87+ | venv| ("BLACK", "INTENSE_GREEN") ||
88+ | branch| ("#333 ") | background color from $PROMPT_FIELDS[ 'branch_bg_color'] |
89+ | cwd| ("WHITE", "#444 ") ||
90+ | git_root| ("BLACK", "#00adee") | used by cwd |
91+ | git_sub_dir| ("WHITE", "#00adee") | used by cwd |
92+ | short_cwd| ("WHITE", "#444 ") ||
93+ | full_proc| ("WHITE", "RED", "#444 ") | There are two types of background depending on the situation|
94+ | timing| ("WHITE", "#444 ") ||
95+ | time| ("BLACK", "#00adee") ||
96+ | history| ("WHITE", "#333333 ") ||
97+ | rtns| ("WHITE", "RED") ||
98+ | full_rtns| ("WHITE", "RED", "#444 ") | There are two types of background depending on the situation|
99+
100+
101+ ## Separate mode
102+
103+ We can change the way of separation mode by ` $PL_SEP_MODE ` .
104+
105+ | mode| separate char|
106+ | ---| ---|
107+ | powerline| , , , |
108+ | round| , , , |
109+ | down| , , , |
110+ | up| , , , |
111+ | flame| , , , |
112+ | squares| , , , |
113+ | ruiny| , , , |
114+ | lego| , |
115+
116+ For example
117+ ```
118+ # set $PL_SEP_MODE or using pl_set_mode alias
119+ $PL_SEP_MODE='round'
120+ pl_set_mode round
121+ ```
122+ <img src =" https://github.com/6syun9/xontrib-powerline2/raw/master/img/example_round.png " alt =" example " title =" round " >
123+
124+ If you want to use original separeter, you can use ` $PL_ORG_SEP ` , ` $PL_ORG_SEP_THIN ` , ` $PL_ORG_RSEP ` .
125+ ```
126+ $PL_ORG_SEP = '■'
127+ $PL_ORG_SEP_THIN = '□'
128+ $PL_ORG_RSEP = '■'
129+ xontrib load xontrib-powerline2
130+ ```
131+ <img src =" https://github.com/6syun9/xontrib-powerline2/raw/master/img/example_origin_sep.png " alt =" example " title =" origin_sep " >
51132
52133# Credits
53134
0 commit comments