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

Allow users to customize prompt layout #13

Open
satayev opened this issue Jan 20, 2021 · 3 comments
Open

Allow users to customize prompt layout #13

satayev opened this issue Jan 20, 2021 · 3 comments

Comments

@satayev
Copy link
Contributor

satayev commented Jan 20, 2021

At the moment PS1 is hard-coded env_functions.sh. Modifying it locally is obviously possible, but leads to infrequent merge conflicts.

Would it be possible to expose LAYOUT in base.conf of some sorts?

@dimo414
Copy link
Owner

dimo414 commented Jan 25, 2021

prompt.gem is intentionally prescriptive about how PS1 gets rendered. Originally the intended solution if someone prefers a different prompt would have been to create their own gem that configures the prompt how they'd like. However over time prompt.gem has become more and more powerful and it would definitely be a shame if someone had to reimplement or fork most of the gem just to tweak the layout.

The right solution long-term might be to split the gem in two, but I'm open to smaller improvements in the meantime. Can you elaborate on how you envision LAYOUT working?

@satayev
Copy link
Contributor Author

satayev commented Jan 25, 2021

Makes sense, I'd be okay either way to be honest (perhaps migrate some of the functions into util.gem?). Just to make sure I don't think this is a high priority issue by any means; just a minor inconvenience that results in merge conflicts once in a while.

We could expose available blocks for PS1 (e.g. machine, env, host, dir, etc.) and allow LAYOUT to use them; PS1 is then expanded and set to said layout. (I don't know bash enough, but this sounds doable?)

So, for example, my personal LAYOUT would be:
LAYOUT='\n[${exit_code_display}] [${env} ${short_pwd}]\n${prompt_string}'

@dimo414
Copy link
Owner

dimo414 commented Jan 25, 2021

One option would be to move the host/pwd rendering into an ENV_INFO function, then you could just rearrange that array. Would that work?

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

No branches or pull requests

2 participants