mirror of
https://github.com/Cornelicorn/bullet-train.zsh.git
synced 2025-12-06 11:50:38 +01:00
Add function example to Tips.git_cmd
This commit is contained in:
21
README.md
21
README.md
@@ -236,11 +236,11 @@ or don't want to see. All options must be overridden in your **.zshrc** file.
|
||||
Allows you to specify custom git prompt command. This makes it possible to
|
||||
change:
|
||||
|
||||

|
||||

|
||||
|
||||
into:
|
||||
|
||||

|
||||

|
||||
|
||||
with:
|
||||
|
||||
@@ -251,6 +251,23 @@ BULLETTRAIN_GIT_PROMPT_CMD=\${\$(git_prompt_info)//\\//\ \ }
|
||||
Please note we need to delay variable expansion, so we have to escape all
|
||||
**weird** character - *$*, *\*, *\<space>*, etc.
|
||||
|
||||
You can also use function to get more complex commands:
|
||||
|
||||
``` bash
|
||||
BULLETTRAIN_GIT_PROMPT_CMD="\$(custom_git_prompt)"
|
||||
|
||||
custom_git_prompt() {
|
||||
prompt=$(git_prompt_info)
|
||||
prompt=${prompt//\//\ \ }
|
||||
prompt=${prompt//_/\ }
|
||||
echo ${prompt}
|
||||
}
|
||||
```
|
||||
|
||||
which gives:
|
||||
|
||||

|
||||
|
||||
## Contributors
|
||||
|
||||
That project was originally a fork from
|
||||
|
||||
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
BIN
img/tips/git_prompt_function.png
Normal file
BIN
img/tips/git_prompt_function.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Reference in New Issue
Block a user