Skip to content
dchurch315 edited this page Jan 30, 2022 · 5 revisions

Removing long username prompts

For example, if you don't want to include your context info (username@hostname) in the prompt string, you can comment out the prompt_context section in your theme file. The theme file will be located in ~/.oh-my-bash/themes/<theme-name>/<theme-name>.theme.sh but you should copy the chosen theme's folder into ~/.oh-my-bash/custom/themes/ and modify the copy in that folder as this will prevent issues during upgrades.

For example, for the agnoster theme, the theme file is ~/.oh-my-bash/themes/agnoster/agnoster.theme.sh and we can remove the context info from the build_prompt function like below:

## Main prompt

build_prompt() {
    [[ ! -z ${AG_EMACS_DIR+x} ]] && prompt_emacsdir
    prompt_status
    #[[ -z ${AG_NO_HIST+x} ]] && prompt_histdt
    #[[ -z ${AG_NO_CONTEXT+x} ]] && prompt_context
    prompt_virtualenv
    prompt_dir
    prompt_git
    prompt_end
}
Clone this wiki locally