mirror of
https://github.com/Cornelicorn/bullet-train.zsh.git
synced 2025-12-06 11:50:38 +01:00
Merge pull request #125 from dawikur/allow_segment_reordering
Allow to specify custom prompt order Closes #115
This commit is contained in:
35
README.md
35
README.md
@@ -97,6 +97,23 @@ zgen load caiogondim/bullet-train-oh-my-zsh-theme bullet-train
|
||||
Bullet Train is configurable. You can change colors and which segments you want
|
||||
or don't want to see. All options must be overridden in your **.zshrc** file.
|
||||
|
||||
### Order
|
||||
`BULLETTRAIN_PROMPT_ORDER` defines order of prompt segments. Use zsh array
|
||||
syntax to specify your own order, e.g:
|
||||
|
||||
```bash
|
||||
BULLETTRAIN_PROMPT_ORDER=(
|
||||
git
|
||||
context
|
||||
dir
|
||||
time
|
||||
)
|
||||
```
|
||||
|
||||
NOTE: You do not need to specify *end* segment - it will be added automatically.
|
||||
With this you can also specify custom segments, please see [Tips](#tips) for
|
||||
more details.
|
||||
|
||||
### Prompt
|
||||
|
||||
|Variable|Default|Meaning
|
||||
@@ -242,6 +259,24 @@ or don't want to see. All options must be overridden in your **.zshrc** file.
|
||||
|
||||
## Tips
|
||||
|
||||
### BULLETTRAIN_PROMPT_ORDER
|
||||
|
||||
This gives ability to customize order and put user-defined segment on prompt.
|
||||
|
||||
```bash
|
||||
prompt_say_hello() {
|
||||
prompt_segment yellow blue "hello"
|
||||
}
|
||||
|
||||
BULLETTRAIN_PROMPT_ORDER=(
|
||||
git
|
||||
dir
|
||||
say_hello
|
||||
)
|
||||
```
|
||||
|
||||

|
||||
|
||||
### BULLETTRAIN_GIT_PROMPT_CMD
|
||||
|
||||
Allows you to specify custom git prompt command. This makes it possible to
|
||||
|
||||
@@ -15,6 +15,25 @@
|
||||
|
||||
VIRTUAL_ENV_DISABLE_PROMPT=true
|
||||
|
||||
# Define order and content of prompt
|
||||
if [ ! -n "${BULLETTRAIN_PROMPT_ORDER+1}" ]; then
|
||||
BULLETTRAIN_PROMPT_ORDER=(
|
||||
time
|
||||
status
|
||||
custom
|
||||
context
|
||||
dir
|
||||
perl
|
||||
ruby
|
||||
virtualenv
|
||||
nvm
|
||||
go
|
||||
git
|
||||
hg
|
||||
cmd_exec_time
|
||||
)
|
||||
fi
|
||||
|
||||
# PROMPT
|
||||
if [ ! -n "${BULLETTRAIN_PROMPT_CHAR+1}" ]; then
|
||||
BULLETTRAIN_PROMPT_CHAR="\$"
|
||||
@@ -592,19 +611,10 @@ prompt_line_sep() {
|
||||
|
||||
build_prompt() {
|
||||
RETVAL=$?
|
||||
prompt_time
|
||||
prompt_status
|
||||
prompt_custom
|
||||
prompt_context
|
||||
prompt_dir
|
||||
prompt_perl
|
||||
prompt_ruby
|
||||
prompt_virtualenv
|
||||
prompt_nvm
|
||||
prompt_go
|
||||
prompt_git
|
||||
prompt_hg
|
||||
prompt_cmd_exec_time
|
||||
for segment in $BULLETTRAIN_PROMPT_ORDER
|
||||
do
|
||||
prompt_$segment
|
||||
done
|
||||
prompt_end
|
||||
}
|
||||
|
||||
|
||||
BIN
img/tips/prompt_order.png
Normal file
BIN
img/tips/prompt_order.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
Reference in New Issue
Block a user