Spaceship-prompt: $SPACESHIP_DIR_PREFIX not used

Created on 15 Aug 2017  Â·  5Comments  Â·  Source: denysdovhan/spaceship-prompt

Issue

I don't know this is a bug or I understand it wrong

I wanna do something like this:

screenshot

So I have this in .zshrc

ZSH_THEME="spaceship"
SPACESHIP_DIR_SHOW="true"
SPACESHIP_DIR_PREFIX="at "

But I dont see its affect

screenshot

So, I don't know I get it wrong (I read a little in source code) or why It can't run?

Environment

Operating system: Linux
Terminal emulator: terminator
ZSH version: zsh 5.4.1

question

Most helpful comment

It was intentional to hide _PREFIX before the first section. Here is the relevant section of source code

https://github.com/denysdovhan/spaceship-zsh-theme/blob/522987a502ac3283c29efc6f01e20e55c5c042ec/spaceship.zsh#L325-L327

All 5 comments

I only see SPACESHIP_DIR_PREFIX if I have something before the directory. In my normal usage, my prompt does not display a user, so I don't see the dir prefix. If I ssh into localhost, then my hostname and username get printed, so I also see the dir prefix:

~
➜ ssh 127.0.0.1

user at mymachine in ~
➜ SPACESHIP_DIR_PREFIX="hi there "

user at mymachine hi there ~
➜

The maintainers can comment on if this is intended behavior or not, this is just what I observe.

It was intentional to hide _PREFIX before the first section. Here is the relevant section of source code

https://github.com/denysdovhan/spaceship-zsh-theme/blob/522987a502ac3283c29efc6f01e20e55c5c042ec/spaceship.zsh#L325-L327

It was intentional to hide _PREFIX before the first section. Here is the relevant section of source code

Thank you. So the workaround if I wanna force display prefix is having this in .zshrc

SPACESHIP_OPENED=true

Seem abuse the code when the source code write:

SPACESHIP_OPENED=false # Internal variable for checking if prompt is opened

But it meet my need.

SPACESHIP_OPENED=true would do the trick.

But, You should also expect _PREFIX for time,user and host sections, which appear before dir section. Or, you could define custom prompt order.

@BeyondTheBoundary I have to aware you that SPACESHIP_OPENED is an internal variable, so we can remove this without any deprecation warning.

Probably it will be exposed with the next major version (please, open a request-feature issue, if you want that). However, I'm going to almost completely rewrite sections rendering in the next major release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tbekaert picture tbekaert  Â·  3Comments

martincartledge picture martincartledge  Â·  4Comments

maccius picture maccius  Â·  3Comments

salmanulfarzy picture salmanulfarzy  Â·  3Comments

conradwt picture conradwt  Â·  3Comments