-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
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 to enable username and hostname in the default theme? #5686
Comments
You'll have to modify the theme settings. Go and open the theme(s) directory and select the theme you want to use. Open it in any of the text editors available. And make the necessary changes. |
@sounak98 I would like to stick to the default theme because I expect is the most mature one and least likely to have bugs. The only thing that I don't like about it is the missing username and hostname. I find quite overwhelming the number of themes and the fact that there is no matrix like comparison between them makes any decision even harder. I guess that less-is-more concept does not apply to oh-my-zsh themes ;) |
Sorry for the late reply. Did you get it already? If not I'll tell you the way to do it. @ssbarnea |
|
Change the value of PROMPT to this in the file /themes/robbyrussell.zsh-theme |
Copy the More info about customization. |
Am I wrong or all these solutions to break the ability to get updates of oh-my-zsh? If I clone it means that I am stuck on that specific version. Maybe unrelated to this ticket but I found quite weird not to be able to compare themes by their features like:
My impression is that could be achieved by creating a google spreadsheet with main features as columns and themes as rows, allowing us to filter the themes with an auto-filter. |
@sounak98 it seems that your example alternative prompt value contains at least one important bug: the prompt arrow is always red but on original default theme the colour is based on the result of the last command (green = success, red means != 0 return code). Ideally the user/hostname should be just a parameter to configure on |
In fact I finally found the solution for the problem, quite surprise how easy it was: Edit
This will add a The only thing I was not able to do was to find out how to produce the |
Yeah @ssbarnea it's true that you won't be able to update after this. Yours is a better method in that sense. Cheers. 😄 |
@sounak98 It seems that this bug should be reopened because I found a serious bug related to the workaround.
If you add this to
|
I still don't consider this issue as resolved as long we do not have an option to deploy/install oh-my-zsh using a one-liner and end-up with the hostname in prompt. No further changes. Not having the hostname as part of the prompt is recipe for disasters. Did anyone create a way to compare themes based on features? |
Hi. You can create under the Copy the base theme you want to add the Then add the Finally edit the It works fine in this way and you can update without problems since the custom folder is in the |
It would be nice if this could be a configurable in the default theme. Copying the theme and modifying it seems like an awkward work around |
When you copy the theme to your custom folder you are creating your own theme, but instead of making it from scratch you started with a base. For me is a good solution. What I do is put all my custom settings in the custom folder, doesn't matter if it is a change to the theme, to the PATH variable, an alias, etc.. In this way I sync my custom folder to my own git repository and when I change machines I only need to pull my custom settings and everything is with the same configuration. For example my personal laptop with Xubuntu and my work Mac Book have the same custom settings and when I need to add any new settings it will be synced on both machines. Of course you can also have some settings only in one of the machines it is all a question of your personal custom configuration. |
Hello, i came across the same auto-complete problem when i tried the solution proposed by @ssbarnea. But it appears to me that this behavior is due to a missing opening-bracket in the line that was added to
This gives me the |
Would´nt it be possible to use |
Can we please reopen this? I want to deploy ohmyzsh to all hosts for root account too and I am pretty people will scream only because of this: where is my hostname/username, nothing else. If we need to customize things to enable these it means that we degrade the user experience (UX) because the best user experience is that that does just-works and that does not require "investigation". Especially for system where management is shared this matters. |
I just took a look at this and added this in my .zshrc
It's been working for the passed hour or so. |
|
Hi Guys, cp local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT='${ret_status} %{$fg_bold[magenta]%}%n %{$fg[cyan]%}%~%{$reset_color%} $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" this adds the username@servername , and also shows full path or relative path to ~ |
this works for me |
It missing '@' and hostname. To anyone who need also hostname please use this:
|
I also wanted the username and machine in my prompt. So my prompt looks like this - |
I'd rather also like auto-updates, yet the ability to display user & machine based on config. |
There's another useful condition |
Just comment out the prompt_context section the .oh-my-zsh/themes/<your_theme>.zsh-theme file
|
Thank you it works for me |
A quick copy & paste solution if anyone needs it. Adds "user@hostname" at the beginning.
|
can someone help me to also display the device name and not only my name in this custom theme as well? |
Fixing the tab completion offset issue as mentioned here: https://stackoverflow.com/questions/11916064/zsh-tab-completion-duplicating-command-name local ret_status="%(?:%{$fg_bold[green]%}%{%G➜%} :%{$fg_bold[red]%}%{%G➜%} )"
PROMPT='${ret_status} %{$fg_bold[magenta]%}%n%{$reset_color%}%{$FG[146]%}@%{$reset_color%}%{$fg_bold[green]%}%m%{$reset_color%} %{$fg_bold[cyan]%}%~%{$reset_color%} $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}%{%G✗%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
Yeah, I just found when using SSH to connect the remote machine, the |
I do want to stick with the default theme but I want to just be able to see username and hostname in order to avoid running commands on the wrong host.
How can I do this?
The text was updated successfully, but these errors were encountered: