Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I hide the “user@hostname” info #39

Open
elbrinke opened this issue Jun 6, 2017 · 6 comments

Comments

Projects
None yet
7 participants
@elbrinke
Copy link

commented Jun 6, 2017

It is said to do the following:
Optionally set DEFAULT_USER to your regular username followed by prompt_context(){} in ~/.zshrc to hide the “user@hostname” info when you’re logged in as yourself on your local machine.

What does that look like?

@itsmehemant123

This comment has been minimized.

Copy link

commented Jun 9, 2017

Open your .zshrc and paste this at the bottom:

prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
  fi
}

This makes only your username to appear. If you don't want that too, just comment out this line prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"

Picked this up from here

@MichaelAquilina

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2017

This PR will help: #40

@grmat

This comment has been minimized.

Copy link

commented Jan 31, 2018

May I ask why the DEFAULT_USER query is there at all?

Perhaps I miss something, but it seems like a double-check, when SSH_CLIENT is already being queried. It's an extra step required when working on different machines with different users, or when sharing or adapting dotfiles. It potentially also leads to disclosure of people's local usernames in their public dotfiles.

@BeastF5

This comment has been minimized.

Copy link

commented Apr 18, 2018

How to set agnoster theme in termux please tell me

@kud

This comment has been minimized.

Copy link

commented Nov 28, 2018

In my .zshrc I did:

# change prompt
prompt_context() {
  prompt_segment $PRIMARY_FG default  "  🌈  "
}

prompt_dir() {
  prompt_segment blue $PRIMARY_FG ' %c '
}

:)

@biigpongsatorn

This comment has been minimized.

Copy link

commented Mar 7, 2019

My config in ~/.oh-my-zsh/themes/agnoster.zsh-theme for random emoji.

prompt_context() {
  # Custom (Random emoji)
  emojis=("⚡️" "🔥" "💀" "👑" "😎" "🐸" "🐵" "🦄" "🌈" "🍻" "🚀" "💡" "🎉" "🔑" "🇹🇭" "🚦" "🌙")
  RAND_EMOJI_N=$(( $RANDOM % ${#emojis[@]} + 1))
  prompt_segment black default "${emojis[$RAND_EMOJI_N]} "
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.