erikw / tmux-powerline

⚡️ A tmux plugin giving you a hackable status bar consisting of dynamic & beautiful looking powerline segments, written purely in bash.
BSD 3-Clause "New" or "Revised" License
3.43k stars 515 forks source link

Powerline did not show when use ZSH. #21

Closed mattma closed 12 years ago

mattma commented 12 years ago

I am using Z-Shell and followed the README instruction to config the Tmux-powerline.

I changed config.sh => PLATFORM="mac", used Patched font to true.

Other files remain the same, it did not work.

I changed absolute path of cwd instead of variable in status-left.sh file, and it still did not work.

I installed the fontpatcher and patch font for my ternimal, and it stilll did not work.

Did I do anything wrong or miss any steps?

Tried google search and still no answers. Please, help. Thanks.

erikw commented 12 years ago

There should still be some output even if the font patch is installed or not. Can you try to execute the scripts status-left.sh or status-right.sh directly from the command line? The issue is probably that one or more default activated segments have unlisted requirements. Try to comment out the register_segment lines in the above scripts one by one to identify the faulting segments.

mattma commented 12 years ago

Thank you for your fast reply.

I tried to execute the scripts status.left.sh directly from CLI. Here is the error message:

./lib.sh: line 64: ./segments/tmux_session_info.shcolour234colour148⮀default: No such file or directory ./lib.sh: line 55: ./segments/tmux_session_info.shcolour234colour148⮀default: syntax error: operand expected (error token is "./segments/tmux_session_info.shcolour234colour148⮀default") ./lib.sh: line 56: ./segments/tmux_session_info.shcolour234colour148⮀default: syntax error: operand expected (error token is "./segments/tmux_session_info.shcolour234colour148⮀default") ./lib.sh: line 57: ./segments/tmux_session_info.shcolour234colour148⮀default: syntax error: operand expected (error token is "./segments/tmux_session_info.shcolour234colour148⮀default") ./lib.sh: line 58: ./segments/tmux_session_info.shcolour234colour148⮀default: syntax error: operand expected (error token is "./segments/tmux_session_info.shcolour234colour148⮀default") ./lib.sh: line 64: ./segments/lan_ip.shcolour255colour24⮀: No such file or directory ./lib.sh: line 55: ./segments/lan_ip.shcolour255colour24⮀: syntax error: operand expected (error token is "./segments/lan_ip.shcolour255colour24⮀") ./lib.sh: line 56: ./segments/lan_ip.shcolour255colour24⮀: syntax error: operand expected (error token is "./segments/lan_ip.shcolour255colour24⮀") ./lib.sh: line 57: ./segments/lan_ip.shcolour255colour24⮀: syntax error: operand expected (error token is "./segments/lan_ip.shcolour255colour24⮀") ./lib.sh: line 58: ./segments/lan_ip.shcolour255colour24⮀: syntax error: operand expected (error token is "./segments/lan_ip.shcolour255colour24⮀") ./lib.sh: line 64: ./segments/vcs_branch.shcolour88colour29⮀: No such file or directory

[bg=colour235] #[fg=colour148, bg=colour235]#[fg=red,bg=colour235]#[default]

It looks like something related color values. I checked my terminal setting, it is currently set to xterm-256color, and I also declare the rule in my .tmux.conf set -g default-terminal "screen-256color" .

I tried to comment out the register_segment line, it outputs the same error.

Do I need to add any additional setting?

tor-oscar commented 12 years ago

Hi, I've tried to reproduce your error but was not successful. Could you please post the following information:

I'm quite inexperienced with shell scripting but it seems to be a problem with the interpretation of the files. lib.sh: line 64 tries to evaluate './segments/...shcolour...' which happens to be a concatenation of all elements in the configuration structure.

mattma commented 12 years ago

I am currently using Z-SHELL, it is not a default bash terminal. Check this post out (http://www.mahdiyusuf.com/post/24784023641/beautiful-tools). In additional, if you look at the second video, it shows the powerline in Z-SHELL. So I know it will definitely works.

I tried to execute the status-left.sh directly from zsh, then that is what I got from error log.

I think it is something related with colour setting in terminal, at least that is what error log said. Is there any post or tutorial how to set it up?

erikagnvall commented 12 years ago

Hi, I've tried to reproduce the error and managed to do so when I was using the version of bash that ships with OS X. Did you install a newer version of bash (brew install bash) as described in the README?

The scripts rely on bash so even if you are using zsh you still need to install the newer bash version.

It's not related to color settings, the error message says that the scripts fail to execute and that should not happen regardless of which color settings you have.

suvash commented 12 years ago

you must install the new bash ( > 4.0 ) via brew possibly. even though you use zshell. as all the script are bash scripts.

I'm running it with zsh just fine.

mattma commented 12 years ago

My Bash version was 3.2.4. I never update the bash since I have my Mac. Well, that was the problem. I thought that I was using ZSH which is up-to-date so that I could skip the bash update.

I updated the Bash Shell, and the Powerline works the way it should be. Awesome. Thanks for all the helps.

mattma commented 12 years ago

Thank you all for the great help!

bendemaree commented 12 years ago

I know this is excessive and this issue is closed, so...apologies...but there's one other situation OS X users running ZSH and out-of-date bash might run into.

I have brew installed to my profile as I'm in an institution which does not allow root access. brew handles this gracefully, but after installing the new version of bash, I still was not able to load the new version, even after aliasing the command and adding its location to my PATH. This is surely because it's a shell and not a standard binary.

The workaround is to change the shebang of the status scripts, as such:

#!/Users/You/homebrew/bin/bash

Posted for posterity. Thanks for this awesome library!

erikagnvall commented 12 years ago

Hi,

You should be able to install bash anywhere as long as that directory is placed before the standard path for bash in your $PATH. The shebang #!/usr/bin/env bash will search through your $PATH and invoke the first bash it comes across. So as long the path to your new version of bash is before the default one, /usr/bin/env should invoke the new version.

Hope this helps :)

bendemaree commented 12 years ago

Thanks @Meldanya! I'll check it out tonight on another machine, but what you say makes sense.

suvash commented 12 years ago

@bendemaree Try checking the version of bash after the brew install. bash --version, and it should be the latest (i.e. > 4.0) More info on how to set it to use as your shell can be found by running brew info bash

bendemaree commented 12 years ago

@suvash @Meldanya Thanks for the help guys. It was a matter of putting my brew path before my other additions to the PATH.

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin for example.

But perhaps there's an edge case that someone will need to edit the shebang still! :-p

suvash commented 12 years ago

hopefully not ! exporting PATH is always a better idea, and works even if the permissions to change shell is restricted. Cheers that it works for you now.