zsh custom command line prompt

environment:oh-my-zsh 插件

Effect:

The original appearance: I feel that there are many elements, and the space is relatively crowded

insert image description here

The current look: a lot simpler

insert image description here


step:

  1. Open your theme's config file (my theme is agnoster )

    open /Users/你的家目录/.oh-my-zsh/themes/agnoster.zsh-theme
    
  2. Find build_promptthe function and modify its configuration

    build_prompt() {
          
          
     RETVAL=$?
     prompt_status
     prompt_virtualenv
     prompt_aws
     # prompt_context
     prompt_dir
     prompt_git
     prompt_bzr
     prompt_hg
     prompt_end
    }
    

    For example, I commented the prompt_context attribute here, indicating that I don't want to display the current user and host name, or other context information on the command line. For other configurations, please GPT by yourself.

Guess you like

Origin blog.csdn.net/qq_35760825/article/details/131710346