diff --git a/README.md b/README.md index a75961a..65abf95 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,45 @@ or don't want to see. All options must be overridden in your **.zshrc** file. |`BULLETTRAIN_EXEC_TIME_BG`|`yellow`|Background color |`BULLETTRAIN_EXEC_TIME_FG`|`black`|Foreground color +## Tips + +### BULLETTRAIN_GIT_PROMPT_CMD + +Allows you to specify custom git prompt command. This makes it possible to +change: + +![Git_Prompt_Origin](./img/tips/git_prompt_origin.png) + +into: + +![Git_Prompt_Command](./img/tips/git_prompt_command.png) + +with: + +``` bash +BULLETTRAIN_GIT_PROMPT_CMD=\${\$(git_prompt_info)//\\//\ \ } +``` + +Please note we need to delay variable expansion, so we have to escape all +**weird** character - *$*, *\*, *\*, 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: + +![Git_Prompt_Function](./img/tips/git_prompt_function.png) + ## Contributors That project was originally a fork from diff --git a/img/tips/git_prompt_command.png b/img/tips/git_prompt_command.png new file mode 100644 index 0000000..4861afe Binary files /dev/null and b/img/tips/git_prompt_command.png differ diff --git a/img/tips/git_prompt_function.png b/img/tips/git_prompt_function.png new file mode 100644 index 0000000..b84ea6f Binary files /dev/null and b/img/tips/git_prompt_function.png differ diff --git a/img/tips/git_prompt_origin.png b/img/tips/git_prompt_origin.png new file mode 100644 index 0000000..2db03e0 Binary files /dev/null and b/img/tips/git_prompt_origin.png differ