How can I change the prompt of my zsh shell while still retaining the cool coloring that agnoster provides? For people who don't know, it looks like this I want to add some things like ! and \u before the working directories. I've tried the usual PS1="! \u \w" but it just gives this:
EDIT: I found the right escaped characters for inserting information, but it cancels out the styling How can I change the prompt while maintaining the styling?
Configure Agnoster theme For this, you first need to download a font that supports the unique characters and icons used by the theme. After installing the font, you can enable the Agnoster theme by changing the ZSH_THEME variable inside the ~/. zshrc configuration file.
To customize the ZSH prompt, we need to modify the prompt= variable inside the . zshrc file. We can populate the prompt variable with various placeholders, which will alter how the ZSH prompt appears.
To change the Theme, simply change the ZSH_THEME value in ~/. zshrc file from robbyrussell to Avit. Run the following command to update the config. Open ITerm2 > Preferences > Profiles > Colors and change the background black color to use 20% gray as shown below.
You'd have to customise the theme, i.e. .oh-my-zsh/themes/agnoster.zsh-theme
, add your own function to the build_prompt function and add whatever you need to the prompt:
## Main prompt
build_prompt() {
RETVAL=$?
prompt_status
prompt_virtualenv
prompt_context
prompt_dir
prompt_git
prompt_hg
prompt_end
}
I personally added a prompt_custom
stub, which I then replace with the real prompt function in my .zshrc
, so I only have to maintain that small customisation (probabaly worthty of a pull request at some stage...)
prompt_custom() {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With