Code Monkey home page Code Monkey logo

Comments (21)

itsmehemant123 avatar itsmehemant123 commented on September 26, 2024 507

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

from agnoster-zsh-theme.

biigpongsatorn avatar biigpongsatorn commented on September 26, 2024 363

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

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

image

from agnoster-zsh-theme.

MuhaddiMu avatar MuhaddiMu commented on September 26, 2024 56

Simply add DEFAULT_USER=$USER in .zshrc

from agnoster-zsh-theme.

 avatar commented on September 26, 2024 43

How to set agnoster theme in termux please tell me

from agnoster-zsh-theme.

kud avatar kud commented on September 26, 2024 10

In my .zshrc I did:

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

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

:)

from agnoster-zsh-theme.

TheLandolorien avatar TheLandolorien commented on September 26, 2024 9

Similar to @kud, but modified my prompt to work in agnoster.

I updated the prompt_context in ~/.oh-my-zsh/themes/agnoster.zsh-theme (because it was being overwritten) and used the agnoster background variable (CURRENT_BG):

prompt_context() {
  prompt_segment $CURRENT_BG default  "  🌈  "
}

from agnoster-zsh-theme.

LukaszBielsko avatar LukaszBielsko commented on September 26, 2024 4

In my .zshrc I did:

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

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

:)

thanks for that!

from agnoster-zsh-theme.

awshumway avatar awshumway commented on September 26, 2024 4

@itsmehemant123 's solution didn't quite work for me.
I want to recommend changing this in your theme, rather than your .zshrc
like @TheLandoCal , I updated the prompt_context in ~/.oh-my-zsh/themes/agnoster.zsh-theme.

For me, I just wanted to show my username, without my '@ hostname'.

Original agnoster.zsh-theme:

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

I just removed @%m from line 92.

Updated agnoster.zsh-theme:

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

from agnoster-zsh-theme.

mauriciabad avatar mauriciabad commented on September 26, 2024 4

In ~/.oh-my-zsh/themes/agnoster.zsh-theme change the prompt_context function to not do anything. Like this:

prompt_context() {}

from agnoster-zsh-theme.

MichaelAquilina avatar MichaelAquilina commented on September 26, 2024 3

This PR will help: #40

from agnoster-zsh-theme.

carloza avatar carloza commented on September 26, 2024 1

@itsmehemant123 ty so much

from agnoster-zsh-theme.

jangandibantingg avatar jangandibantingg commented on September 26, 2024 1

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

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

image

woooo tankyou bro

from agnoster-zsh-theme.

grmat avatar grmat commented on September 26, 2024

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.

from agnoster-zsh-theme.

apjanke avatar apjanke commented on September 26, 2024

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

I think this is in case you're su-ing or logging in as an unusual user on your local machine, or you have a typical "regular" account you use on multiple machines.

from agnoster-zsh-theme.

zeeshankhan avatar zeeshankhan commented on September 26, 2024

wow, nothing helped. I'm using bira theme.

from agnoster-zsh-theme.

asterisk-ragavan avatar asterisk-ragavan commented on September 26, 2024

Iam using oh my zsh and ur theme is listed there how can I install ur theme, pls tell me

from agnoster-zsh-theme.

iruslanalexan avatar iruslanalexan commented on September 26, 2024

On MacOS 10.15 Catalina in 2021 year

Open the file /private/etc/zshrc in a text editor
Locate the comment: # Default prompt
Modify the line that looks like this: PS1="%n@%m~ %& # "
Save the file. You will be prompted to enter a password to save it.
Load a new Terminal window.

For example, you can:

Remove "%n@%m" to get rid of both the username and computer name
Remove "%n" to get rid of the user name
Remove "%m" to get rid of the machine name

Source https://stackoverflow.com/a/59944342/10991361

from agnoster-zsh-theme.

AtomicNess123 avatar AtomicNess123 commented on September 26, 2024

How to hide the owner and group names when doing listings (ls -la) for instance?

from agnoster-zsh-theme.

renatojobal avatar renatojobal commented on September 26, 2024

Make sure you add this line to the ~/.zshrc file:

export DEFAULT_USER="$(whoami)"

from agnoster-zsh-theme.

AtomicNess123 avatar AtomicNess123 commented on September 26, 2024

Thanks! The last thing would be how to hide or change the user name on the top of the Terminal window?

from agnoster-zsh-theme.

Mr-Vipi avatar Mr-Vipi commented on September 26, 2024

Thanks! The last thing would be how to hide or change the user name on the top of the Terminal window?

In order to achieve what you want, in the ~/.zshrc file:

First uncomment DISABLE_AUTO_TITLE="true" and after

add this line precmd () { print -Pn "\e]2; %~\a" } # title bar prompt at the end of the file:

Source https://superuser.com/questions/79972/set-the-title-of-the-terminal-window-to-the-current-directory

from agnoster-zsh-theme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.