tmux-powerline is displaying on multiple lines - zsh

I posted an issue found at on the github link below, but in short, I can't get zsh to work properly. I'm open to suggestions.
https://github.com/erikw/tmux-powerline/issues/125

Do you have UTF characters in your prompt? If so, make sure you have these settings in your .tmux.conf:
# use UTF8
set -g utf8
set-window-option -g utf8 on
Some UTF characters will take an extra space, causing some weird formatting of tmux-powerline.

Related

Turn off separator between windows names in tmux+powerline

Does anyone know how to hide this separator in byobu/tmux+powerline?
I found the solution. In tmux it is a window option called a window-status-separator. You can set it in the .tmux.config by adding it after the powerline is initialized:
set-window-option -g window-status-separator ""
It overwrites the default separator (" "). Luckily, it does not affect any styling of powerline. Maybe someone knows a powerline specific answer. Feel free to comment.

tmux status line width with unicode characters

I'm running tmux 3.1b on RHEL 7.9.
The following .tmux.conf leads to an expected status line:
$ cat .tmux.conf
set -g status-left "test"
However, if I put a full-with unicode character in the status line:
$ cat .tmux.conf
set -g status-left "👥 test"
The status line seems to be rendered with inappropriate width in the presence of full-width characters, resulting in an overflow onto the next line. Every time tmux refreshes the line, it adds another new line. Anyone have an idea why this might be happening or how to tell tmux to pad the status line less? I did some digging and there are some people complaining of the wrong width for unicode characters in tmux, but I'm not confident that's the problem here.
I'm using mintty 3.4.4 fwiw.
This is probably due to a disagreement between libc, terminal and font about character width. Try building tmux with utf8proc or try a different terminal or font.

tmux status-line: italicize zoomed window name?

I've customized my tmux statusline, and I'd like to add a visual indicator for when the current window is zoomed (resize-pane -Z).
I've seen several examples of how to apply a different foreground color,
setw -g window-status-current-format " #{?window_zoomed_flag,#[fg=red],#[fg=black]}#W#[fg=default]"
Since I have italics working in tmux, I want to apply them in this case. I tried:
setw -g window-status-current-format " #{?window_zoomed_flag,#[fg=red,italics],#[fg=black]}#W#[fg=default]"
but this doesn't work. When zoomed it just shows empty spaces, and when unzoomed it shows italics],bash ("bash" being the window_name).
It seems to be treating the , in #[fg=red,italics] as one of the separators for the overall conditional form,
#{?test,alternative1,alternative2}
It does correctly handle a comma embedded in alternative2, e.g.
setw -g window-status-current-format " #{?window_zoomed_flag,#[fg=red],#[fg=black,italics]}#W#[fg=default]"
so if I wanted to italicize the unzoomed window name, I'd be in luck, but since I don't have a way to turn the conditional around, I am SOL.
Does anyone know a way to get this working, or is this an issue I should bring to the tmux project?
I got it working and now I'm not sure I actually like it, but it's good to know that it can be done. It's not entirely clear from the documentation, but I noticed in this answer this answer that you can specify the text attribute in a separate #[] group instead of using a comma-separated list, so this works:
setw -g window-status-current-format " #{?window_zoomed_flag,#[fg=red]#[italics],#[fg=black]}#W#[fg=default]"
probably a bit outdated answer yet helpful for anyone out there that might need help!
I have managed to do that with the following code :)
I will post the whole status bar in case anyone finds it any helpfull
set -g status-left '#[fg=black,bg=green] #S#{prefix_highlight}#[fg=green,bg=black,nobold,nounderscore,noitalics]#[fg=green,bg=green]#{?mouse,#[fg=black] MOUSE#[bg=green]#[fg=green],#[bg=red]#[fg=green]#[fg=white]#[bg=red]MOUSE#[bg=green]#[fg=red]}#{?pane_synchronized,#[fg=black] SYNC#[bg=green]#[fg=green],#[bg=red]#[fg=green]#[fg=white]#[bg=red]SYNC#[bg=green]#[fg=red]}#{?window_zoomed_flag,#[fg=black] #[bg=green]#[fg=green],#[bg=red]#[fg=green]#[fg=white]#[bg=red]#[bg=green]#[fg=red]}#[fg=green,bg=black] #W #[fg=green,bg=black,nobold,nounderscore,noitalics]#[fg=green,bg=black] #(whoami) CPU: #{cpu_percentage}Online:#{online_status}#[fg=green,bg=black,nobold,nounderscore,noitalics]'
set -g status-right '#[fg=green,bg=black,nobold,nounderscore,noitalics]#[fg=green,bg=black]#[fg=green,bg=black,nobold,nounderscore,noitalics]#[fg=white,bg=black]Bat: #{battery_percentage}#[fg=green,bg=black,nobold,nounderscore,noitalics]#[fg=black,bg=green]#(rainbarf --battery --remaining )'
setw -g window-status-format '#[fg=green,bg=black,nobold,nounderscore,noitalics]#[default] #I  #W #[fg=green,bg=black,nobold,nounderscore,noitalics]'
setw -g window-status-current-format '#[fg=green,bg=black,nobold,nounderscore,noitalics]#[fg=green,bg=black] #I  #W  #F #[fg=green,bg=black,nobold,nounderscore,noitalics]'

why the split line of tmux within putty shows different(xxxxx, qqqqqq)in these tow cases?

Why the split line of tmux within PuTTY shows different(xxxxx, qqqqqq)in these tow cases?
If I do not set PuTTY any thing(the default "Use font encoding"), the split line of pane shows like following:
But it can't show Chinese word correctly, so I set PuTTY's Window -> Translation -> Remote character set to UTF-8. Then the split line of pane become to like that:
Using “xxx qqqq” seems very ugly.
BTW: echo $LANG shows “zh_CN.UTF-8”
So, in this case, How to show Chinese word correctly with the first split line?
I had the same problem with Putty with character set set to UTF-8.
Launching tmux with -u option did the trick (tmux -u)
I was having the same issue except I was not trying to display Chinese characters. For the ugly line break ( xxxx qqqq), take a look at Tmux borders displayed as x q instead of lines?. For me, there are two version of tmux installed and switching to the newer version solves the problem. You may want to upgrade your tmux. Hope it helps.

give a hint when press prefix key in tmux

When I press the prefix-key Ctrl-b tmux doesn't give me a hint that it has been pressed.
Sometimes I can not remember whether I have already pressed it or not.
Can I set up a hint like highlight/change color or show some special symbol in the status bar to show me when I have pressed the prefix-key?
The development version of tmux has support for this, so the next release (1.8?) should also support it.
There have been two changes that can be combined to indicate in your status line whether a prefix key has been pressed:
You can include the extended “format” replacements in the values of the “status” options. These replacements were first available in tmux 1.6, but they were not previously usable in the status options.
The client_prefix format replacement was added.
You could add a (conditional) highlighted <Prefix> string before the default status-right like this:
set -g status-right ' #{?client_prefix,#[reverse]<Prefix>#[noreverse] ,}"#{=21:pane_title}" %H:%M %d-%b-%y'
There's also a Tmux plugin called tmux-prefix-highlight that does this.
It adds a new keyword, #{prefix_highlight} to use in the string that defines your tmux status bar, like so:
set -g status-right '#{prefix_highlight} | %a %Y-%m-%d %H:%M'
I created plugin for this. It indicates copy mode as well, is easily customizable and has good out-of-the-box experience.
https://github.com/dominikduda/tmux_mode_indicator
As readme says:
Plugin indicating normal/insert/prefix/copy modes.
It adds a new keyword, #{tmux_mode_indicator} to use in the string that defines your tmux status bar. Like this:
set -g status-right "#{tmux_mode_indicator}"

Resources