File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -34,22 +34,17 @@ git-ps1 # will output "master"
3434git-ps1 " [%s]" # will output " [master]"
3535```
3636
37- ### zsh
37+ ### zsh example
3838
3939Add the following to your ` ~/.zshrc ` file:
4040
4141```
42- setopt promptsubst
43- local gitps1='$(git-ps1 " [%s]")'
44- export PROMPT="~%C${gitps1}%# "
42+ setopt PROMPT_SUBST ; PS1='~%C$(git-ps1 " (%s)")%# '
4543```
4644
47- Besides the first two linces, the important part in the ` export `
48- statement is ` ${gitps1} ` which you can just add to your existing
49- ` PROMPT ` if you have already modified it. The above lines will modify
50- your prompt to show a tilde ` ~ ` followed by the current directory name
51- (` %C ` ), followed by ` [] ` optionally containing the git branch name and
52- emoji and terminated by ` % ` .
45+ The above commands will modify your prompt to show a tilde (` ~ ` )
46+ followed by the current directory name (` %C ` ) followed by the ouput of
47+ ` git-ps1 ` and terminated by ` % ` .
5348
5449## License
5550
You can’t perform that action at this time.
0 commit comments