Search code examples
zshtmuxpowerline

zsh tmux powerline multiple lines, normal operation


This is my .tmux.conf

set-option -g default-shell /bin/zsh
set -g mode-mouse on

# use UTF8
set -g utf8
set-window-option -g utf8 on

shell "powerline-daemon -q"
source "/Users/lighter/Library/Python/2.7/lib/python/site-packages/powerline/bindings/tmux/powerline.conf"

 ~ > python --version
Python 2.7.10
 ~ > pip --version
pip 7.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7)
 ~ > vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 16 2015 15:31:56)

And When I type tmux, I can't normal operation, and jump multiple lines powerline. How can I fix it. I have search a lot, but not work for me. Thanks your help.

enter image description here


Solution

  • First, add LANG setting in your zshrc like export LANG=en_US.UTF-8.

    Next, If you use iTerm2, try below.

    iTerm > Preferences > Profiles > Text
    Uncheck "Treat ambiguous-width characters as double width" at "Double-Width Characters".

    Or Terminal.app, try this.

    Terminal > Preferences > Profiles > Advanced
    Uncheck "Unicode East Asian Ambiguous characters are wide" at "International".

    I think that will resolve problem, but may cause another problem if you use CJK language.

    For example, vim in tmux, non-ascii characters ("☆", "※", "♪" ...) would be treat as ascii.
    To avoid this, you have to patch tmux with these gist.
    After that, Check these above unchecked options, it will work fine :)