推荐修改方式
vim ~/.zshrc # 重写 prompt_context prompt_context () {} # 也可使用自定义提示符 prompt_context () { prompt_segment black default "hoo"; }
不推荐直接修改主题,更新或者更换主题须要从新修改
以 agnoster
为例,能够注释 prompt_context 或者也能够修改内容。git
注释中也有提示,不须要显示的能够隐藏,不会影响别的组件的展现
vim ~/.oh-my-zsh/themes/agnoster.zsh-theme # Each component will draw itself, and hide itself if no information needs to be shown # Context: user@hostname (who am I and where am I) prompt_context() { if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m" fi } ## Main prompt build_prompt() { RETVAL=$? prompt_status prompt_virtualenv prompt_context prompt_dir prompt_git prompt_bzr prompt_hg prompt_end }