Pure: Single line prompt?

Created on 31 Aug 2016  路  4Comments  路  Source: sindresorhus/pure

Thanks for pure prompt, I'm loving it! I am curious however, if there is a way to have the prompt be a single line prompt.

Basically, instead of current directory etc... being above if it could be on the same line as the arrow? Wouldn't even know where to start with customizing...

Cheers.

question

Most helpful comment

@To1ne indeed, single-line pure became much simpler with 4cdd0cf4f48d0c2064700c4fc60083bc0b3f6693. I don't think that your suggestion works quite as intended, though, at least in my terminal it's not represented as zero-width (shows space before path), furthermore, you could tell the terminal that it takes no space with prompt_newline=$'%{\u200B%}' but also this is insufficient.

One example of how to make it work properly would be:

prompt pure
prompt_newline='%666v'
PROMPT=" $PROMPT"

Why does this work? %666v expands to the contents of $psvar[666] (not like you will have it defined, right 馃槄?) thus creating a unique identifier (for removing preprompt during update).

Then we're adding an extra space to the $PROMPT initialised by pure, to make it more spacious.

screenshot 2017-05-05 12 48 27

Do you consider adding this to the README?

Not to the README, since this is not supported or as-intended, but maybe to the Wiki? There are a few hacks / tweaks there already.

All 4 comments

We do not support single-line prompts in pure (and we probably never will), but if you're still interested, you should check out https://github.com/sindresorhus/pure/issues/109#issuecomment-148991334.

@tyrollins @CrazyPython I've found a quick workaround to make Pure give a single line prompt.

Just add this to your ~/.zshrc

prompt_newline=$(echo -n "\u200B")

The unicode character \u200B is a zero-width space.

I haven't tested it thoroughly yet, but it seems to work.

@mafredri Do you consider adding this to the README?

@To1ne indeed, single-line pure became much simpler with 4cdd0cf4f48d0c2064700c4fc60083bc0b3f6693. I don't think that your suggestion works quite as intended, though, at least in my terminal it's not represented as zero-width (shows space before path), furthermore, you could tell the terminal that it takes no space with prompt_newline=$'%{\u200B%}' but also this is insufficient.

One example of how to make it work properly would be:

prompt pure
prompt_newline='%666v'
PROMPT=" $PROMPT"

Why does this work? %666v expands to the contents of $psvar[666] (not like you will have it defined, right 馃槄?) thus creating a unique identifier (for removing preprompt during update).

Then we're adding an extra space to the $PROMPT initialised by pure, to make it more spacious.

screenshot 2017-05-05 12 48 27

Do you consider adding this to the README?

Not to the README, since this is not supported or as-intended, but maybe to the Wiki? There are a few hacks / tweaks there already.

Added it to the wiki: https://github.com/sindresorhus/pure/wiki#single-line-prompt

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sudo-nice picture sudo-nice  路  6Comments

julenpardo picture julenpardo  路  5Comments

victorronnow picture victorronnow  路  7Comments

bigH picture bigH  路  8Comments

jpresley23 picture jpresley23  路  8Comments