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

Feat: Add option to disable @hostname in prompt #614

Open
acantepie opened this issue Oct 11, 2021 · 11 comments
Open

Feat: Add option to disable @hostname in prompt #614

acantepie opened this issue Oct 11, 2021 · 11 comments

Comments

@acantepie
Copy link

I want to change user@hostname on prompt , is it possible to doing that ?

@acantepie acantepie changed the title Option to chanhe user@hostname in prompt Option to change user@hostname in prompt Oct 11, 2021
@sindresorhus
Copy link
Owner

Change it how exactly?

@acantepie
Copy link
Author

acantepie commented Oct 12, 2021

I have installed pure theme on my docker image, i got this prompt :

docker@58862c73050e ~
❯ 

I want hide the hostname part to display only "docker ~"

@sindresorhus
Copy link
Owner

Per #564 (comment), we are open to adding an option for this.

@acantepie
Copy link
Author

@sindresorhus Can't you just hide hostname if we are on container ?

Replace line on file : https://github.com/sindresorhus/pure/blob/main/pure.zsh

# Show `username@host` if inside a container and not in GitHub Codespaces.
	[[ -z "${CODESPACES}" ]] && prompt_pure_is_inside_container && username='%F{$prompt_pure_colors[user]}%n%f'"$hostname"

By

# Show `username@host` if inside a container and not in GitHub Codespaces.
	[[ -z "${CODESPACES}" ]] && prompt_pure_is_inside_container && username='%F{$prompt_pure_colors[user]}%n%f'

@mafredri
Copy link
Collaborator

@acantepie while I can appreciate the (somewhat) aesthetic improvement, how would you differentiate between two open containers? We'd also have to adjust the logic for the root user which, without changes, would display the hostname. Removing the hostname there would IMO also create a color-imbalance (only the white username).

@acantepie
Copy link
Author

Indeed, I have finally define a custom hostname on my docker-compose.

@poetaman
Copy link

poetaman commented Dec 14, 2021

@sindresorhus Is it possible to always show username@hostname, even when I have not ssh'ed into a machine?

@sindresorhus
Copy link
Owner

@reportaman Anything is possible by modifying the prompt yourself, but it's not something we plan to support built-in.

@mafredri
Copy link
Collaborator

mafredri commented Jun 5, 2022

@sindresorhus what's the action-point for this issue? I'm not entirely sure if it's adding an option for disabling the showing of @hostname, or to detect hostname == hostname between host and container (as per #564 (comment))?

Of the two, I think only the former is possible.

@sindresorhus
Copy link
Owner

@mafredri The former.

@mafredri mafredri changed the title Option to change user@hostname in prompt Feat: Add option to disable @hostname in prompt Jun 5, 2022
@Tr0nJ4volta
Copy link

Tr0nJ4volta commented Jan 5, 2023

@sindresorhus I would second @poetaman's ask for an option to always show the user@host in the prompt (where it normally would be). In a hasty look, I don't see a way other than to rewrite the function (i.e., prompt_pure_state_setup).

I am happy to open up a new issue and/or submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants