agkozak / agkozak-zsh-prompt

A fast, asynchronous Zsh prompt with color ASCII indicators of Git, exit, SSH, virtual environment, and vi mode status. Framework-agnostic and customizable.
MIT License
292 stars 26 forks source link

Add variable AGKOZAK_PROMPT_DIRTRIM_CHAR (default: '...') #32

Closed AndydeCleyre closed 3 years ago

AndydeCleyre commented 3 years ago

_agkozak_prompt_dirtrim now takes this value as argument 3 (second mandatory argument)

Add variable with default value to the environment (if unset)

Update docs in comments accordingly

Functions using the new global variable now include an annotation saying as much

NOTE: The default can be overridden with an empty string value; default value '...' is only used when the variable is unset

README:

agkozak commented 3 years ago

This looks like a fine idea. I'm sorry that it has taken me so long to review it. Give me a few days to play around with it.

agkozak commented 3 years ago

We might ultimately want to call the variable AGKOZAK_PROMPT_DIRTRIM_STR or something like that, since it can be as long as the user wants. Let me think about that.

Out of curiosity, what symbols do you like to use instead of ...? Thanks!

agkozak commented 3 years ago

We might ultimately want to call the variable AGKOZAK_PROMPT_DIRTRIM_STR or something like that, since it can be as long as the

Maybe AGKOZAK_PROMPT_DIRTRIM_CHARS, even. I think we've already got options like that. I'll keep thinking about this.

agkozak commented 3 years ago

OK. I've merged your new feature to my own branch feature/ellipsis-dirtrim, but I've made a few changes.

The most important one is that I've named the variable AGKOZAK_PROMPT_DIRTRIM_STRING, but it works the same.

I prefer to keep changes to _agkozak_prompt_dirtrim minimal -- no new mandatory parameter. Some people may be invoking that function in their custom prompts, and I don't want their code to break.

Give my branch a pull and test it to make sure I haven't missed anything.

AndydeCleyre commented 3 years ago

Thanks! It's working great.

Yeah, I only used CHAR in the name in an attempt to mimic AGKOZAK_PROMPT_CHAR, even though that's an array.

For now I'm using the ellipsis character () instead of three periods. I may change it, but my primary goal is to keep that to a single character.

agkozak commented 3 years ago

For now I'm using the ellipsis character (…) instead of three periods. I may change it, but my primary goal is to keep that to a single character.

Ah, that makes sense. It takes up less space on the screen, doesn't it?

Give me a few days and I'll let you know when I merge this feature to master. Thanks so much for your contribution.

AndydeCleyre commented 3 years ago

Yeah, just saves two character spots for me. It doesn't look amazing with my font setup, so I might play with alternative characters if I can find any that make sense and look better.

image

Thanks for your continued, excellent Zsh work.

agkozak commented 3 years ago

I'll add your example:

AGKOZAK_PROMPT_DIRTRIM_STRING=$'\u2026'

(Unicode ellipsis) to the documentation. I think people will like that.

agkozak commented 3 years ago

All right -- your feature is now on master and is part of release v3.9.0. Thanks again for your contribution.