geometry-zsh/geometry

possibility to deactivate `hostname`

myyc opened this issue · 12 comments

myyc commented

hey. not sure if this is me being clumsy or it's an actual issue. i want to be able to get rid of the hostname plugin over ssh sessions. the behaviour is a bit inconsistent when sudoing (the root session won't be a ssh session so the @hostname bit will disappear).

i noticed it's hardcoded so i tried to set GEOMETRY_PROMPT_PLUGINS_PRIMARY='path' and that doesn't really work because it messes with the rest of the prompt (git, for instance).

any clue?

I would advise migrating to the mnml branch of geometry, and seeing if this issue persists. If it does let's figure out how to get the behaviour you'd prefer.

I think I would prefer it to be consistent (within sudo) and always show @hostname over remote. If that is not possible, we can come up with more creative solutions.

myyc commented

now the hostname seems gone but weirdly it isn't as it appears on the line above as i press enter (and enter doesn't insert a double newline)

image

alxbl commented

That means geometry_hostname is in your GEOMETRY_INFO prompt, That's a default IIRC, If you don't want to use the INFO prompt (when you press enter without submitting a command) You can set GEOMETRY_INFO=() in your zshrc.

myyc commented

it seems like a bug? it only appears above and there is no double newline? compare here
image

alxbl commented

That is how GEOMETRY_INFO works as far as I know.

This prompt didn't exist in the 1.x release, you can remove the default functions by explicitly setting GEOMETRY_INFO=() in your zshrc. This will prevent having anything print when you submit an empty command line.

I suppose we could modify the behavior so that GEOMETRY_INFO runs on a ZSH hook like precmd to have it display on its own line, but my understanding is that it was designed this way. I'll let @jedahan have the final word on this.

Its not a bug, but I am open to changing the design. I can see arguments for and against the current design, and even different behaviours. I personally like that there is no 'second line output' as it shows this is not just running a regular command, but can see how that might be confusing or weird.

myyc commented

i think it's a matter of preference and being accustomed (or not) to shell "themes" that have the option to insert a new line. if that is a thing then you open pandora's box of "when to do that" and "what happens if you do / don't", which personally i find a source of inconsistency but others might disagree. i'll try this later and come back with an answer. sorry for the delay :)

alxbl commented

I think the newline feature could be implemented as an additional function which just adds a precmd hook. This would allow people who want newlines to have them without changing the default behavior.

For the GEOMETRY_INFO prompt itself, I don't think we should change the behavior, but we could probably make it configurable. I admit I don't use the INFO prompt much, and I was initially surprised by the default functions because I tend to hit enter to "scroll up".

myyc commented

That is how GEOMETRY_INFO works as far as I know.

This prompt didn't exist in the 1.x release, you can remove the default functions by explicitly setting GEOMETRY_INFO=() in your zshrc. This will prevent having anything print when you submit an empty command line.

trying this removes the hostname, but no double newline. how is this not inconsistent with not being logged in to any machine and having a double newline instead?

I think it’s a good idea to check if the array is empty or null and skip our custom logic if so.

Is this still an issue? I tried GEOMETRY_INFO=() and works as intended, I believe.

@jedahan Worked for me with GEOMETRY_INFO, but found the behavior confusing as well.