diff --git a/README.md b/README.md index 00dc5eb..6a224ba 100644 --- a/README.md +++ b/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: -![Git_Prompt_Before](./img/tips/git_prompt_before.png) +![Git_Prompt_Origin](./img/tips/git_prompt_origin.png) into: -![Git_Prompt_After](./img/tips/git_prompt_after.png) +![Git_Prompt_Command](./img/tips/git_prompt_command.png) 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 - *$*, *\*, *\*, 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_after.png b/img/tips/git_prompt_command.png similarity index 100% rename from img/tips/git_prompt_after.png rename to img/tips/git_prompt_command.png 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_before.png b/img/tips/git_prompt_origin.png similarity index 100% rename from img/tips/git_prompt_before.png rename to img/tips/git_prompt_origin.png