nvllsvm/base16-shell-preview

Does not work with the Fish shell.

theethernaut opened this issue · 12 comments

Error:

color21 ~/.config/base16-shell/scripts/base16-atelier-heath-light.sh (line 43): Unsupported use of '&&'. In fish, please use 'COMMAND; and COMMAND'.
put_template() { [ $1 -lt 16 ] && printf "\e]P%x%s" $1 $(echo $2 | sed 's////g'); }
^
fish: Error while reading file /home/bob/.config/base16-shell/scripts/base16-atelier-heath-light.sh

Quick fix for fish shell:

env SHELL=/bin/sh base16-shell-preview

Should be fixed in 0.4.0.

Not totally..
it seems bash use base16_ prefix while the fish one use the base16- prefix.
a little design flaw I think.
what we can do is code something like USER_SHELL.endswith('fish') or so?

There are some more issues with it it seems;
If I edit the code and 'fix' the base16_ to base16- the shell is being somehow replaced
so if I press enter the shell exists. Don't know why yet, however if I replace subprocess.Popen by subprocess.run it works flawlessly but you lose support for Python 2.7 afaik.

@combro2k I've replaced the alias execution in favor of symlinking theme directly in Python. Does it work in your fish setup?
8f389bc

Any additional logic one wishes to run upon theme change should be setup stored in the path of env var BASE16_SHELL_HOOKS. This is the existing behavior of the shell helper script, but no the fish helper.

0255633

Let me have a check, will come back to you :-)

I see...
Don't know yet how this hooks work, how is it exactly implemented?
I will fork the base16-shell repo and fix that behavior :-) it should be the same for both shells

The symlinking works, only miss the ~/.vim_background update.
But I guess I can fix that, the hooks has a small issue now cause the BASE16_THEME variable is not set now :-) so you don't have that variable available in the hook script.

Did a pull request to fix the issues with BASE16_THEME which was not set on the scripts anyway for fish ..
Fish a little different as 'normal' shell unfortunately and a lot of people aren't using it because of that.
But that being said, I hope Chris will merge my pull request, we will see if it does or not ;-)

chriskempson/base16-shell#175

I purposefully excluded the .vim_background logic as it's too opinionated. Just use a hook.


Be aware that BASE16_THEME is not consistent. The initial shell load of a theme results in the full theme name (ex.BASE16_THEME=base16-bright) while the aliases exclude the prefix (ex. BASE16_THEME=bright).

This doesn't matter too much since the hooks are only ever run from the alias.

chriskempson/base16-shell#147

Anyway - I've updated base16-shell-preview to set BASE16_THEME when executing the hooks. The value of the variable is consistent with the alias (BASE16_THEME=bright).
081d285

Released version 0.5.0

Thank you, clear enough ;-)
Thanks for fixing it