edkolev / promptline.vim

Generate a fast shell prompt with powerline symbols and airline colors
MIT License
623 stars 54 forks source link

Fix "hostname needed" detection #44

Closed nekonyuu closed 7 years ago

nekonyuu commented 9 years ago

Hello !

This PR fixes #33 at least for zsh, seems to work in bash too but dunno in fish.

If someone could test it in fish to ensure compatibility...

MorphBonehunter commented 7 years ago

@nekonyuu: The script does generaly not work with an fish shell:

Expected end of the statement, but instead found a string
.shell_prompt (line 8):     if [[ -n ${ZSH_VERSION-} ]]; then print %m; elif [[ -n ${FISH_VERSION-} ]]; then hostname -s; else printf "%s" \\h; fi
                                                                                                                               ^

But this is not the problem of your change, it is in my eyes that "fish" doesn't understand the "elif" statement, it is "else if" in "fish" i think. I've done another quick check:

if [ $blub ]; then print a; elif [ $blah ]; then print b; else print test; fi
Expected end of the statement, but instead found a string
fish: if [ $blub ]; then print a; elif [ $blah ]; then print b; else print test; fi
                                                                     ^

So the change should be merged and maybe if this is realy an bug with fish handling a new issue should opened.

MorphBonehunter commented 7 years ago

BTW, the PR works in BASH (daily use).

edkolev commented 7 years ago

Thank you for the PR!